18 #include <osgEarth/VirtualProgram>
20 #include <osgShadow/ShadowTechnique>
22 #include <osg/StateSet>
24 #include <osg/PolygonOffset>
25 #include <osg/FrameBufferObject>
26 #include <osg/Uniform>
27 #include <osg/LightSource>
28 #include <osg/RenderInfo>
32 #include <osg/MatrixTransform>
33 #include <osg/Program>
34 #include <osg/Texture2D>
35 #include <osg/Texture2DArray>
37 #include <osg/Geometry>
44 #include <tbb/mutex.h>
49 class DtShadowTweakables;
52 class DtShadowSettingsObject;
53 class TextureApplyAttribute;
54 class DtOsgShadowTechnique;
55 struct DtCurrentPassData;
56 struct DtPerChannelData;
57 class DtSkyObjectManager;
84 virtual const char*
className()
const {
return "DtOsgShadowTechnique"; }
90 virtual void postConstructionInit();
93 virtual void update(osg::NodeVisitor& nv);
96 virtual void cull(osgUtil::CullVisitor& cv);
99 virtual void cleanSceneGraph();
102 void setChannelShadowState(
DtOsgChannel* osgChannel,
bool enable);
113 static const std::string& shadowCameraPrefixString(
void);
116 const osg::StateSet * mapCameraToStateSet(
const osg::Camera* camera)
const;
121 virtual void resizeGLObjectBuffers(
unsigned int maxSize)
override;
124 virtual void releaseGLObjects(osg::State* = 0)
const override;
127 virtual void reInitialize(
unsigned int quality);
131 virtual void cleanupOldPerChannelData();
133 virtual bool configureShadowTraversalNodeMask(
bool traverseEntities,
bool traverseProps,
bool traverseTerrain);
135 virtual void slot_refresh_maps();
176 void triggerExternalModuleShaderRefresh();
182 osg::Program* getProgramFromFile(
const std::string& szVertexShader,
const std::string& szFragmentShader);
186 osg::Camera* xBlurCamera, osg::Camera* yBlurCamera, osg::Texture2DArray* texture, osg::StateSet* stateSet,
unsigned int textureUnit);
190 osg::Camera* xBlurCamera, osg::Camera* yBlurCamera,
unsigned int textureLayer, osg::Texture2DArray* texture2DArray,
191 osg::Texture2DArray* preFilterTexture2DArray1, osg::Texture2DArray* preFilterTexture2DArray2);
193 void setupReverseZBuffer(osg::Camera* depthCamera, osg::Camera* xBlurCamera, osg::Camera* yBlurCamera);
197 osg::Texture2D* createTexture2D(
int width,
int height,
GLenum internalFormat,
GLenum sourceFormat,
GLenum sourceType,
bool shadowComparisonMode,
198 osg::Texture2D::FilterMode minFilter = osg::Texture2D::NEAREST, osg::Texture2D::FilterMode magFilter = osg::Texture2D::NEAREST);
201 osg::Texture2DArray* createTexture2DArray(
int width,
int height,
int depth,
GLenum internalFormat,
GLenum sourceFormat,
GLenum sourceType,
202 bool shadowComparisonMode, osg::Texture2DArray::FilterMode minFilter = osg::Texture2DArray::NEAREST, osg::Texture2DArray::FilterMode magFilter = osg::Texture2DArray::NEAREST);
205 osg::Camera* createCamera(
int width,
int height, GLbitfield clearMask);
208 osg::Geode* createFullScreenQuad(
const osg::Vec2&
size,
const osg::Vec2& uvStart,
const osg::Vec2& uvStop);
211 osg::Camera* createHudCamera(
int width,
int height, GLbitfield clearMask,
const char * name = NULL);
214 double computeUniformSplit(
double nearDistance,
double farDistance,
unsigned int splitIndex,
unsigned int numSplits);
217 double computeLogarithmicSplit(
double nearDistance,
double farDistance,
unsigned int splitIndex,
unsigned int numSplits);
230 void getSplitCameraDistances(
const DtCurrentPassData & d,
int split_index,
double &splitCamNear,
double &splitCamFar);
236 void frustumBoundingBoxLightViewSpace(
const DtCurrentPassData & d,
int split_index,
const osg::Matrix & lightViewMatrix,
237 double nearPlane,
double farPlane, osg::Vec3d& minFrustum, osg::Vec3d& maxFrustum);
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
static const std::string myShadowCameraPrefixString
Definition: DtOsgShadowTechnique.h:258
void setDirty(bool dirty)
Sets dirty for shadow technique's to true or false.
Definition: DtOsgShadowTechnique.h:233
void setGlobalLight(osg::LightSource *light)
Sets global light source.
Definition: DtOsgShadowTechnique.h:108
Definition: DtShadowSettingsObject.h:24
osg::ref_ptr< osg::Program > myVsmBlurTextureProgram
Definition: DtOsgShadowTechnique.h:260
Definition: DtOsgShadowTechnique.h:219
osg::ref_ptr< osg::Program > myVsmPassthroughArrayProgram
Definition: DtOsgShadowTechnique.h:263
osg::ref_ptr< osg::Program > myVsmPassthroughProgram
Definition: DtOsgShadowTechnique.h:264
osg::ref_ptr< osg::Program > myEsmBlurTexArrayProgram
Definition: DtOsgShadowTechnique.h:267
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
PerChannelDataMap myPerChannelDataMap
Definition: DtOsgShadowTechnique.h:249
boost::signalslib::connection myTerrainPatchAddedConnection
Definition: DtOsgShadowTechnique.h:283
voidpf void uLong size
Definition: ioapi.h:39
osg::ref_ptr< osg::Program > myVsmBlurTexArrayProgram
Definition: DtOsgShadowTechnique.h:261
static const int MAX_NUM_CASCADES
Definition: DtPerChannelData.h:47
Definition: DtSkyObjectManager.h:30
Contains the DtOsgTextureApplyAttribute class.
DtDe & myDe
Definition: DtOsgShadowTechnique.h:256
osg::ref_ptr< osg::Program > myEVsmBlurTextureProgram
Definition: DtOsgShadowTechnique.h:269
osg::Matrix myProjectionMatrix
Definition: DtOsgShadowTechnique.h:222
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:55
osg::ref_ptr< osg::Uniform > myReceiveShadowsUniform
Definition: DtOsgShadowTechnique.h:254
virtual const char * libraryName() const
Returns the namespace string.
Definition: DtOsgShadowTechnique.h:81
bool myMulticastIsSupported
Definition: DtOsgShadowTechnique.h:278
std::vector< osg::ref_ptr< DtPerChannelData > > PerChannelDataVector
Definition: DtOsgShadowTechnique.h:247
virtual osg::Object * cloneType() const
Creates a new object of Type DtOsgShadowTechnique.
Definition: DtOsgShadowTechnique.h:72
class DtShadowTweakables * myShadowUI
Definition: DtOsgShadowTechnique.h:118
Definition: DtCurrentPassData.h:29
Definition: DtPerChannelData.h:49
osg::ref_ptr< osg::Program > myEsmBlurTextureProgram
Definition: DtOsgShadowTechnique.h:266
osg::Matrix myViewMatrix
Definition: DtOsgShadowTechnique.h:221
Definition: DtShadowTweakables.h:21
std::vector< osg::ref_ptr< osg::Camera > > myDeferredDeleteCamera
Definition: DtOsgShadowTechnique.h:273
PerChannelDataVector myPerChannelDataDeleteList
Definition: DtOsgShadowTechnique.h:250
The DtOsgShadowTechnique class implements a robust shadow mapping system.
Definition: DtOsgShadowTechnique.h:61
DtSkyObjectManager & mySkyObjectManager
Definition: DtOsgShadowTechnique.h:281
osg::ref_ptr< osg::Program > myEVsmBlurTexArrayProgram
Definition: DtOsgShadowTechnique.h:270
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:19
const osg::LightSource * getGlobalLight() const
Gets global light source.
Definition: DtOsgShadowTechnique.h:111
virtual bool isSameKindAs(const osg::Object *obj) const
Returns true if object is of the DtOsgShadowTechnique class. Otherwise, returns false.
Definition: DtOsgShadowTechnique.h:78
std::map< const osg::Camera *, osg::ref_ptr< DtPerChannelData > > PerChannelDataMap
Definition: DtOsgShadowTechnique.h:246
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
osg::Matrix myTextureViewProjectionMatrix
Definition: DtOsgShadowTechnique.h:223
bool myShadingRateIsSupported
Definition: DtOsgShadowTechnique.h:279
osg::ref_ptr< osg::LightSource > myGlobalLight
Definition: DtOsgShadowTechnique.h:252
osg::ref_ptr< osg::Uniform > myLightDirectionUniform
Definition: DtOsgShadowTechnique.h:253
tbb::mutex myDeferredCameraDeletionMutex
Definition: DtOsgShadowTechnique.h:276
boost::signalslib::connection myTerrainPatchDeletedConnection
Definition: DtOsgShadowTechnique.h:284
virtual osg::Object * clone(const osg::CopyOp ©op) const
Creates a new copy of DtOsgShadowTechnique object.
Definition: DtOsgShadowTechnique.h:75
virtual const char * className() const
Returns the class name string.
Definition: DtOsgShadowTechnique.h:84