I am using Irrlicht 1.8.0-alpha, SVN 4306. While playing with the bounding box of directional lights, which are actually lines from the position of the light in the direction of the light, I noticed that they were pointing in the wrong direction. This is caused by the fact that the direction is taken from the rotation of the LightSceneNode, and that rotation is also used to calculate the AbsoluteTransformation, so basically the rotation is applied twice. Below is the proposed fix to line 69 of CLightSceneNode.cpp:
Code: Select all
//! render
void CLightSceneNode::render()
{
video::IVideoDriver* driver = SceneManager->getVideoDriver();
if (!driver)
return;
if ( DebugDataVisible & scene::EDS_BBOX )
{
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
video::SMaterial m;
m.Lighting = false;
driver->setMaterial(m);
switch ( LightData.Type )
{
case video::ELT_POINT:
case video::ELT_SPOT:
driver->draw3DBox(BBox, LightData.DiffuseColor.toSColor());
break;
case video::ELT_DIRECTIONAL:
driver->draw3DLine(core::vector3df(0.f, 0.f, 0.f),
// LightData.Direction * LightData.Radius, // this line should be removed
core::vector3df(0.f, 0.f, LightData.Radius), // this line should be inserted
LightData.DiffuseColor.toSColor());
break;
}
}
DriverLightIndex = driver->addDynamicLight(LightData);
setVisible(LightIsOn);
}
Cheers