From Paul Martz, "The attached code change causes the flt plugin to leave _sector unset if the

direction normal has a zero length. The net effect is that unidirectional
light points with zero length direction vectors are now treated as
omnidirectional light points."
This commit is contained in:
Robert Osfield 2004-03-17 20:34:23 +00:00
parent 3fea25a0a1
commit 1aa0592878

View File

@ -2207,13 +2207,13 @@ void ConvertFromFLT::visitLightPoint(osg::Group& osgParent, LightPointRecord* re
{ {
azimAngle = acos( pNormal.y() ); azimAngle = acos( pNormal.y() );
if( pNormal.y() > 0.0f ) azimAngle = - azimAngle; if( pNormal.y() > 0.0f ) azimAngle = - azimAngle;
float minAzimuth = azimAngle - lobeHorz/2.0f;
float maxAzimuth = azimAngle + lobeHorz/2.0f;
float fadeRange = 0.0f;
lp._sector = new osgSim::AzimElevationSector( minAzimuth, maxAzimuth, minElevation, maxElevation, fadeRange);
} }
float minAzimuth = azimAngle - lobeHorz/2.0f;
float maxAzimuth = azimAngle + lobeHorz/2.0f;
float fadeRange = 0.0f;
lp._sector = new osgSim::AzimElevationSector( minAzimuth, maxAzimuth, minElevation, maxElevation, fadeRange);
} }
lpNode->addLightPoint( lp); lpNode->addLightPoint( lp);
@ -2330,13 +2330,13 @@ void ConvertFromFLT::visitLightPointIndex(osg::Group& osgParent, LightPointIndex
azimAngle = acos( pNormal.y() ); azimAngle = acos( pNormal.y() );
if (pNormal.x() < 0.0f) if (pNormal.x() < 0.0f)
azimAngle = -azimAngle; azimAngle = -azimAngle;
float minAzimuth = azimAngle - lobeHorz/2.0f;
float maxAzimuth = azimAngle + lobeHorz/2.0f;
float fadeRange = 0.0f;
lp._sector = new osgSim::AzimElevationSector( minAzimuth, maxAzimuth, minElevation, maxElevation, fadeRange);
} }
float minAzimuth = azimAngle - lobeHorz/2.0f;
float maxAzimuth = azimAngle + lobeHorz/2.0f;
float fadeRange = 0.0f;
lp._sector = new osgSim::AzimElevationSector( minAzimuth, maxAzimuth, minElevation, maxElevation, fadeRange);
} }
lpNode->addLightPoint(lp); lpNode->addLightPoint(lp);