2 #include "Cloud2DState.h"
3 #include "ObjectModel.h"
6 #include "PostProcess.h"
7 #include "AtmosphereMie.h"
8 #include "AtmosphereHimmel.h"
9 #include "TerrainMIE.h"
10 #include "TerrainHimmel.h"
11 #include "TerrainGeometry.h"
12 #include "ReflectionCamera.h"
13 #include "CloudCreator.h"
14 #include "Atmosphereprecompute.h"
16 #include <osg/PolygonMode>
17 #include <osg/ShapeDrawable>
19 #include <osg/Program>
21 #include <osg/Uniform>
23 namespace osgCloudyDay
42 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
44 osgUtil::CullVisitor* cv =
dynamic_cast<osgUtil::CullVisitor*
>(nv);
45 osg::ref_ptr<osg::Geode> geometry =
dynamic_cast<osg::Geode*
> (node);
49 osg::RefMatrixd* m = cv->getModelViewMatrix();
50 osg::Matrixd
viewMatrix = cv->getCurrentCamera()->getViewMatrix();
51 osg::Matrixd invViewMatrix = osg::Matrixd::inverse(viewMatrix);
52 osg::Matrixd worldmat = invViewMatrix * (*m);
53 osg::Matrixd invWorldMatrix = osg::Matrixd::inverse(worldmat);
55 geometry->getOrCreateStateSet()->getUniform(
"ProjectionMatrix")->set(cv->getCurrentCamera()->getProjectionMatrix());
56 geometry->getOrCreateStateSet()->getUniform(
"ViewMatrix")->set(cv->getCurrentCamera()->getViewMatrix());
57 geometry->getOrCreateStateSet()->getUniform(
"ModelMatrix")->set(worldmat);
58 geometry->getOrCreateStateSet()->getUniform(
"NormalMatrix")->set(invWorldMatrix);
59 geometry->getOrCreateStateSet()->getUniform(
"LightMatrix")->set(
Scene::GetLightCamera()->getViewMatrix());
84 void Initialize(std::vector<Cloud2DState> cloud2dstates);
103 std::vector<osg::ref_ptr<osg::Geode>> m_geodes;
104 std::vector<osg::ref_ptr<osg::Geode>> m_light_geodes;
106 osg::Group* m_node_scene;
107 osg::Group* m_node_light;
108 osg::Group** m_reflection;