From 258f7a2b42c6b2083aabe196eaa43e7c5d9854d5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 5 Dec 2015 00:38:06 +0100 Subject: [PATCH] LightController fixes --- components/sceneutil/lightcontroller.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/sceneutil/lightcontroller.cpp b/components/sceneutil/lightcontroller.cpp index d44a1a94ae..511937a282 100644 --- a/components/sceneutil/lightcontroller.cpp +++ b/components/sceneutil/lightcontroller.cpp @@ -61,8 +61,10 @@ namespace SceneUtil void LightController::operator ()(osg::Node* node, osg::NodeVisitor* nv) { double time = nv->getFrameStamp()->getSimulationTime(); - if (time == mLastTime) - return; + + // disabled early out, light state needs to be set every frame regardless of change, due to the double buffering + //if (time == mLastTime) + // return; float dt = static_cast(time - mLastTime); mLastTime = time; @@ -119,6 +121,8 @@ namespace SceneUtil brightness = 0.7f + pulseAmplitude(mDeltaCount*slow)*0.3f; static_cast(node)->getLight(nv->getTraversalNumber())->setDiffuse(mDiffuseColor * brightness); + + traverse(node, nv); } void LightController::setDiffuse(osg::Vec4f color)