Talk:Displaying LensFlare        

Errors in Code

This is a very useful class and I thank you for posting it. I'm not sure if it was developed under an older version of Ogre, but I had to make a few changes to get it to compile. I also had to make a few changes to get the proper results. Maybe I don't fully understand how the lens flare should look, but it wasn't moving around with the view as I looked around the light source. I won't make the changes to the actual code, because that would drive me nuts if someone else did that to me, so I'll just list them here.

  • In Destructor: renamed removeBillboardSet() to destroyBillboardSet()

  • In createLensFlare: VOIDOBJECT was not a valid QueryFlag. Changed to 0

  • In update(): LightDistance was just the length of the position vector for the light. Changed to be the distance from the camera to the light.

 Vector3 camPos = mCamera->getPosition();
 Real LightDistance  = (camPos - mLightPosition).length();
  • In update(): The CameraVec didn't take into account the camera's position, so it was always relative to the scene's origin, not the camera. Added the camera's position.

 CameraVect = mCamera->getPosition() + (LightDistance * CameraVect);

Moohasha 21:20, 8 April 2008 (BST)