1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 04:15:31 +00:00
openmw-tes3mp/apps/opencs/view/render/lightingday.cpp

34 lines
827 B
C++
Raw Normal View History

2014-03-26 16:47:56 +00:00
#include "lightingday.hpp"
#include <osgViewer/View>
2014-03-26 16:47:56 +00:00
CSVRender::LightingDay::LightingDay() : mView(NULL) {}
2014-03-26 16:47:56 +00:00
void CSVRender::LightingDay::activate (osgViewer::View* view,
const osg::Vec4f *defaultAmbient)
2014-03-26 16:47:56 +00:00
{
mView = view;
osg::ref_ptr<osg::Light> light (new osg::Light);
light->setDirection(osg::Vec3f(0.f, 0.f, -1.f));
light->setDiffuse(osg::Vec4f(1.f, 1.f, 1.f, 1.f));
light->setConstantAttenuation(1.f);
2014-03-26 16:47:56 +00:00
if (defaultAmbient)
light->setAmbient(*defaultAmbient);
2014-03-26 16:47:56 +00:00
else
light->setAmbient(osg::Vec4f(0.7f, 0.7f, 0.7f, 1.f));
2014-03-26 16:47:56 +00:00
mView->setLight(light);
2014-03-26 16:47:56 +00:00
}
void CSVRender::LightingDay::deactivate()
{
}
void CSVRender::LightingDay::setDefaultAmbient (const osg::Vec4f& colour)
2014-03-26 16:47:56 +00:00
{
if (mView)
mView->getLight()->setAmbient(colour);
2015-03-11 14:54:45 +00:00
}