12 #ifndef VTOSG_SIMPLEINTERIMSHADOWTECHNIQUEH
13 #define VTOSG_SIMPLEINTERIMSHADOWTECHNIQUEH
16 #include <osg/Material>
17 #include <osgShadow/ShadowTechnique>
20 #include "vtlib/core/GeomUtil.h"
33 void SetLightNumber(
const uint Light);
34 void SetShadowTextureUnit(
const uint Unit);
35 void SetShadowTextureResolution(
const uint ShadowTextureResolution) { m_ShadowTextureResolution = ShadowTextureResolution; }
36 uint GetShadowTextureResolution() {
return m_ShadowTextureResolution; }
37 void SetRecalculateEveryFrame(
const bool RecalculateEveryFrame) { m_RecalculateEveryFrame = RecalculateEveryFrame; }
38 bool GetRecalculateEveryFrame()
const {
return m_RecalculateEveryFrame; }
39 void SetShadowDarkness(
const float Darkness);
40 float GetShadowDarkness() {
return m_ShadowDarkness; }
41 void SetShadowSphereRadius(
const float ShadowSphereRadius) { m_ShadowSphereRadius = ShadowSphereRadius; }
42 float GetShadowSphereRadius() {
return m_ShadowSphereRadius; }
43 void SetHeightField3d(
vtHeightField3d *pHeightField3d) { m_pHeightField3d = pHeightField3d; }
44 void AddMainSceneTextureUnit(
const uint Unit,
const uint Mode);
45 void RemoveMainSceneTextureUnit(
const uint Unit);
46 void ForceShadowUpdate();
47 void AddLodGridToIgnore(
vtLodGrid* pLodGrid) { m_LodGridsToIgnore.push_back(pLodGrid); }
50 virtual void update(osg::NodeVisitor& nv);
51 virtual void cull(osgUtil::CullVisitor& cv);
52 virtual void cleanSceneGraph();
54 osg::ref_ptr<osg::Camera> makeDebugHUD();
58 osg::Group *m_pParent;
66 std::string GenerateFragmentShaderSource();
68 osg::ref_ptr<osg::Camera> m_pCamera;
69 osg::ref_ptr<osg::TexGen> m_pTexgen;
70 osg::ref_ptr<osg::Texture2D> m_pTexture;
71 osg::ref_ptr<osg::StateSet> m_pStateset;
72 osg::ref_ptr<osg::Material> m_pMaterial;
74 uint m_ShadowTextureUnit;
75 uint m_ShadowTextureResolution;
76 bool m_RecalculateEveryFrame;
77 float m_PolygonOffsetFactor;
78 float m_PolygonOffsetUnits;
79 float m_ShadowDarkness;
80 float m_ShadowSphereRadius;
81 std::vector<vtLodGrid*> m_LodGridsToIgnore;
82 std::map<uint, uint> m_MainSceneTextureUnits;
84 osg::Vec3 m_OldBoundingSphereCentre;
85 osg::Vec3 m_OldSunPos;
86 bool m_UsingFrameBuffer;
89 #endif // VTOSG_SIMPLEINTERIMSHADOWTECHNIQUEH