Game Development Community

Are lights on MountedImages inadventently registered twice

by Jeff White · in Torque Game Engine · 06/27/2006 (1:47 pm) · 0 replies

(moved from Torque SDK Private Forums >> Engine )

In \game\shapeImage.cc

bool ShapeBase::mountImage(ShapeBaseImageData* imageData,U32 imageSlot,bool loaded,StringHandle &skinNameHandle)
...
	//see if the image has a light source
   if (imageData->lightType != ShapeBaseImageData::NoLight)
	   Sim::getLightSet()->addObject(this);
...

and in \game\shapeBase.cc

bool ShapeBase::onAdd()
...
      for (S32 i = 0; i < MaxMountedImages; i++)
      {
         ShapeBaseImageData* imageData = getMountedImage(i);
         if (imageData != NULL && imageData->lightType != ShapeBaseImageData::NoLight)
         {
            Sim::getLightSet()->addObject(this);
            break;
         }
      }
...

I am getting two lights registered for the same light emitting object and I have tracked it down to the above two code segments. Commenting out either one gets the expected results, but I am not sure of the global ramifications.

I believe it only happens because I have an 'Image' mounted before the player is added, so both segments get called. (ShapeBase would have an empty mount list, otherwise.)

I am commenting out the second block above as it appears to not properly remove itself from the light list in ShapeBase::OnRemove().

Has anyone encountered this issue before? (guess not)

About the author

Recent Threads

  • 3D Volume Textures