You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
779 B
C++
39 lines
779 B
C++
#include "lighting.hpp"
|
|
|
|
#include <osg/LightSource>
|
|
#include <osg/NodeVisitor>
|
|
#include <osg/Switch>
|
|
|
|
#include <components/misc/constants.hpp>
|
|
|
|
class DayNightSwitchVisitor : public osg::NodeVisitor
|
|
{
|
|
public:
|
|
DayNightSwitchVisitor(int index)
|
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
|
, mIndex(index)
|
|
{ }
|
|
|
|
void apply(osg::Switch &switchNode) override
|
|
{
|
|
if (switchNode.getName() == Constants::NightDayLabel)
|
|
switchNode.setSingleChildOn(mIndex);
|
|
|
|
traverse(switchNode);
|
|
}
|
|
|
|
private:
|
|
int mIndex;
|
|
};
|
|
|
|
CSVRender::Lighting::~Lighting() {}
|
|
|
|
void CSVRender::Lighting::updateDayNightMode(int index)
|
|
{
|
|
if (mRootNode == nullptr)
|
|
return;
|
|
|
|
DayNightSwitchVisitor visitor(index);
|
|
mRootNode->accept(visitor);
|
|
}
|