3 #include <simgear/scene/util/RenderConstants.hxx>
4 #include "GroundLightManager.hxx"
12 StateSet* makeLightSS()
14 StateSet* ss = new StateSet;
16 fog->setMode(Fog::EXP2);
17 ss->setAttribute(fog);
18 ss->setDataVariance(Object::DYNAMIC);
25 GroundLightManager::GroundLightManager()
27 runwayLightSS = makeLightSS();
28 taxiLightSS = makeLightSS();
29 groundLightSS = makeLightSS();
32 void GroundLightManager::update(const SGUpdateVisitor* updateVisitor)
35 SGVec4f fogColor = updateVisitor->getFogColor();
36 fog = static_cast<osg::Fog*>(runwayLightSS
37 ->getAttribute(StateAttribute::FOG));
38 fog->setColor(toOsg(fogColor));
39 fog->setDensity(updateVisitor->getRunwayFogExp2Density());
40 fog = static_cast<osg::Fog*>(taxiLightSS
41 ->getAttribute(StateAttribute::FOG));
42 fog->setColor(toOsg(fogColor));
43 fog->setDensity(updateVisitor->getTaxiFogExp2Density());
44 fog = static_cast<osg::Fog*>(groundLightSS
45 ->getAttribute(StateAttribute::FOG));
46 fog->setColor(toOsg(fogColor));
47 fog->setDensity(updateVisitor->getGroundLightsFogExp2Density());
50 unsigned GroundLightManager::getLightNodeMask(const SGUpdateVisitor* updateVisitor)
53 // The current sun angle in degree
54 float sun_angle = updateVisitor->getSunAngleDeg();
55 if (sun_angle > 85 || updateVisitor->getVisibility() < 5000)
56 mask |= RUNWAYLIGHTS_BIT;
59 mask |= GROUNDLIGHTS2_BIT;
61 mask |= GROUNDLIGHTS1_BIT;
63 mask |= GROUNDLIGHTS0_BIT;