1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-03 17:54:06 +00:00
OpenMW/apps/opencs/view/render/lighting.cpp

39 lines
779 B
C++
Raw Normal View History

2014-03-23 15:14:26 +01:00
#include "lighting.hpp"
2015-03-28 21:26:16 +01:00
#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;
};
2015-03-28 21:26:16 +01:00
2015-03-11 10:54:45 -04:00
CSVRender::Lighting::~Lighting() {}
void CSVRender::Lighting::updateDayNightMode(int index)
{
if (mRootNode == nullptr)
return;
DayNightSwitchVisitor visitor(index);
mRootNode->accept(visitor);
}