3 #include <osg/Geometry>
5 #include <osg/ArrayDispatchers>
6 #include <osg/PrimitiveSet>
10 #include <osg/ClearNode>
11 #include <osgViewer/Viewer>
13 #include <osgUtil/RenderStage>
14 #include <osg/PolygonOffset>
15 #include <osg/BlendFunc>
16 #include <osg/BlendEquation>
23 namespace osgCloudyDay
36 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
38 osgUtil::CullVisitor* cv =
dynamic_cast<osgUtil::CullVisitor*
>(nv);
39 osg::ref_ptr<osg::Geode> geometry =
dynamic_cast<osg::Geode*
> (node);
44 osg::Matrixd view(cv->getCurrentCamera()->getViewMatrix());
45 osg::Matrixd invViewMatrix = osg::Matrixd::inverse(view);
46 osg::Matrixd modelview(*cv->getModelViewMatrix());
47 osg::Matrixd model = modelview*invViewMatrix;
48 osg::Matrixd proj(cv->getCurrentCamera()->getProjectionMatrix());
50 geometry->getOrCreateStateSet()->getUniform(
"ModelMatrix")->set(model);
51 geometry->getOrCreateStateSet()->getUniform(
"ViewMatrix")->set(view);
52 geometry->getOrCreateStateSet()->getUniform(
"ProjectionMatrix")->set(proj);
77 static void CreateShader();
78 void SetUniforms(osg::ref_ptr<osg::StateSet> nodess4);
80 static void CreateTexture();
82 static osg::ref_ptr<osg::Program> m_cloudProg;
83 static osg::ref_ptr<osg::Texture2D> tex_tree;
85 osg::Geode* GetGeode();
88 osg::ref_ptr<osg::Geode> geode;
89 osg::ref_ptr<osg::Geometry> geometry;
90 osg::ref_ptr<osg::Vec3Array> m_vertices;
91 osg::ref_ptr<osg::Vec4Array> m_information;
92 osg::ref_ptr<osg::UIntArray> m_indices;