Bug fix for bug 1920

In pt_lights.cxx in SGLightFactory::getOdal, at segment "centerline lights",
the decrement loop index i is initialized with lights.getNumLights(), then is used at lights.getLight. (ERROR)
The function getNumLights is set to the size of the vector which is one more than the max index refernce.

This restores the behavior that was in place before commit 8ddb99f62f
This commit is contained in:
Ron Haertel
2016-12-24 14:00:37 -05:00
committed by Ron Haertel
parent 45ac758cc9
commit f3e066cce0

View File

@@ -403,7 +403,7 @@ SGLightFactory::getOdal(const SGLightBin& lights, const SGReaderWriterOptions* o
Effect* effect = getLightEffect(10.0f, osg::Vec3(1.0, 0.0001, 0.00000001),
6.0, 10.0, false, options);
// centerline lights
for (int i = lights.getNumLights(); i > 1; --i) {
for (int i = lights.getNumLights() - 1; i >= 2; i--) {
EffectGeode* egeode = new EffectGeode;
egeode->setEffect(effect);
egeode->addDrawable(getLightDrawable(lights.getLight(i)));