From 1aa0592878e1b138eb67205f2d6b7818667f8f8f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Mar 2004 20:34:23 +0000 Subject: [PATCH] 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." --- src/osgPlugins/flt/flt2osg.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 9ce762a98..9a4051950 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -2207,13 +2207,13 @@ void ConvertFromFLT::visitLightPoint(osg::Group& osgParent, LightPointRecord* re { azimAngle = acos( pNormal.y() ); 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); @@ -2330,13 +2330,13 @@ void ConvertFromFLT::visitLightPointIndex(osg::Group& osgParent, LightPointIndex azimAngle = acos( pNormal.y() ); if (pNormal.x() < 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);