5 #include <osg/Geometry>
7 #include <osg/CullFace>
10 namespace osgCloudyDay
23 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
25 osgUtil::CullVisitor* cv =
dynamic_cast<osgUtil::CullVisitor*
>(nv);
26 osg::ref_ptr<osg::Geode> geometry =
dynamic_cast<osg::Geode*
> (node);
30 osg::Matrixd view(cv->getCurrentCamera()->getViewMatrix());
31 osg::Matrixd invViewMatrix = osg::Matrixd::inverse(view);
32 osg::Matrixd modelview(*cv->getModelViewMatrix());
33 osg::Matrixd model = modelview*invViewMatrix;
34 osg::Matrixd proj(cv->getCurrentCamera()->getProjectionMatrix());
36 geometry->getOrCreateStateSet()->getUniform(
"ModelMatrix")->set(model);
37 geometry->getOrCreateStateSet()->getUniform(
"ViewMatrix")->set(view);
38 geometry->getOrCreateStateSet()->getUniform(
"ProjectionMatrix")->set(proj);
55 osg::Geode* GetGeode();
56 void SetUniforms(osg::ref_ptr<osg::StateSet> nodess4);
59 osg::ref_ptr<osg::Geode> geode;
60 osg::ref_ptr<osg::Geometry> geometry;
61 osg::ref_ptr<osg::Vec3Array> m_vertices;
62 osg::ref_ptr<osg::UIntArray> m_indices;
63 osg::ref_ptr<osg::Program> m_forestProg;