From b466bfee40068dba7c26c2d466d8e3236b07ab46 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 21 Mar 2019 10:27:50 +0400 Subject: [PATCH] Enable light sources directly to avoid virtual calls --- components/sceneutil/lightmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index f0fd0ef9f3..c657e66fd7 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -245,7 +245,8 @@ namespace SceneUtil osg::ref_ptr attr = new LightStateAttribute(mStartLight, lights); // don't use setAttributeAndModes, that does not support light indices! stateset->setAttribute(attr, osg::StateAttribute::ON); - stateset->setAssociatedModes(attr, osg::StateAttribute::ON); + for (unsigned int i=0; isetMode(GL_LIGHT0 + mStartLight + i, osg::StateAttribute::ON); // need to push some dummy attributes to ensure proper state tracking // lights need to reset to their default when the StateSet is popped