4 #include <osg/Geometry>
6 #include <osg/ArrayDispatchers>
7 #include <osg/PrimitiveSet>
11 #include <osg/ClearNode>
12 #include <osgViewer/Viewer>
14 #include <osgUtil/RenderStage>
15 #include <osg/PolygonOffset>
16 #include <osg/BlendFunc>
17 #include <osg/BlendEquation>
23 #define SHADOW_MAPPING
24 namespace osgCloudyDay
37 osg::ref_ptr<osg::Texture2D> _fbo_light_texture,
38 osg::ref_ptr<osg::Texture2D> _fbo_light_depth,
39 osg::ref_ptr<osg::Texture2D> _fbo_blur_texture,
40 osg::ref_ptr<osg::FrameBufferObject> _fbo_shadow,
41 osg::ref_ptr<osg::FrameBufferObject> _fbo_vert_linear_blur,
42 osg::ref_ptr<osg::FrameBufferObject> _fbo_hori_linear_blur,
43 osg::ref_ptr<osg::FrameBufferObject> _fbo_hori_blur,
44 osg::ref_ptr<osg::FrameBufferObject> _fbo_vert_blur,
45 osg::ref_ptr<osg::FrameBufferObject> _fbo_cloud_viewer,
46 osg::ref_ptr<osg::FrameBufferObject> _fbo_hori_blur2,
47 osg::ref_ptr<osg::Program> viewer,
48 osg::ref_ptr<osg::Program> light,
49 osg::ref_ptr<osg::Program> blur_vert,
50 osg::ref_ptr<osg::Program> blur_hori,
51 osg::ref_ptr<osg::Program> blur_linear_vert,
52 osg::ref_ptr<osg::Program> blur_linear_hori,
53 osg::ref_ptr<osg::Program> shadow_map);
56 void AddLayer(
int type);
57 void AddPrimitive(
int type);
58 void SetActiveLayer(
int layer);
59 void DeletePrimitives();
61 osg::ref_ptr<osg::FrameBufferObject> fbo_cloud_viewer;
63 osg::ref_ptr<osg::Program> sh_viewer;
64 osg::ref_ptr<osg::Program> sh_light;
65 osg::ref_ptr<osg::Program> sh_blur_vert;
66 osg::ref_ptr<osg::Program> sh_blur_hori;
67 osg::ref_ptr<osg::Program> sh_blur_linear_vert;
68 osg::ref_ptr<osg::Program> sh_blur_linear_hori;
69 osg::ref_ptr<osg::Program> sh_shadow_map;
71 osg::ref_ptr<osg::Texture2D> tex_clouds;
72 osg::ref_ptr<osg::Texture2D> fbo_light_texture;
73 osg::ref_ptr<osg::Texture2D> fbo_light_depth;
74 osg::ref_ptr<osg::Texture2D> fbo_blur_texture;
75 osg::ref_ptr<osg::FrameBufferObject> fbo_shadow;
76 osg::ref_ptr<osg::FrameBufferObject> fbo_vert_linear_blur;
77 osg::ref_ptr<osg::FrameBufferObject> fbo_hori_linear_blur;
78 osg::ref_ptr<osg::FrameBufferObject> fbo_hori_blur;
79 osg::ref_ptr<osg::FrameBufferObject> fbo_vert_blur;
80 osg::ref_ptr<osg::FrameBufferObject> fbo_hori_blur2;
82 osg::ref_ptr<osg::Uniform> projectuniform;
83 osg::ref_ptr<osg::Uniform> modelViewMatrixuniform;
84 osg::ref_ptr<osg::Uniform> viewMatrixuniform;
85 osg::ref_ptr<osg::Uniform> viewMatrixInvuniform;
87 osg::ref_ptr<osg::Uniform> project_lightuniform;
88 osg::ref_ptr<osg::Uniform> modelViewMatrix_lightuniform;
89 osg::ref_ptr<osg::Uniform> viewMatrix_lightuniform;
90 osg::ref_ptr<osg::Uniform> viewMatrixInv_lightuniform;
92 void Active(
bool type);
94 std::vector<int> m_layers;
96 bool m_slicingViewVectorTransformed;
98 unsigned int m_active_layer;
100 osg::ref_ptr<osg::UIntArray> m_primitive2Layer;
102 osg::ref_ptr<osg::IntArray> m_numPrimitiveArrays;
103 osg::ref_ptr<osg::IntArray> m_CloudsIterArrays;
105 virtual void CloudGeometry::drawImplementation(osg::RenderInfo& renderInfo)
const;