![]() |
VR-Forces Developer's Guide
|
The DtOsgShadowTechnique class implements a robust shadow mapping system.

Classes | |
| struct | CameraDescription |
Public Member Functions | |
| DtOsgShadowTechnique (DtDe &de) | |
| DtOsgShadowTechnique (const DtOsgShadowTechnique &es, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
| virtual osg::Object * | cloneType () const |
| virtual osg::Object * | clone (const osg::CopyOp ©op) const |
| virtual bool | isSameKindAs (const osg::Object *obj) const |
| virtual const char * | libraryName () const |
| virtual const char * | className () const |
| virtual void | init () |
| virtual void | postConstructionInit () |
| virtual void | update (osg::NodeVisitor &nv) |
| virtual void | cull (osgUtil::CullVisitor &cv) |
| virtual void | cleanSceneGraph () |
| void | setChannelShadowState (DtOsgChannel *osgChannel, bool enable) |
| bool | getChannelShadowSettings (DtOsgChannel *osgChannel, DtShadowSettingsObject **shadowSettingObject, bool *isPlanView) |
| void | setGlobalLight (osg::LightSource *light) |
| const osg::LightSource * | getGlobalLight () const |
| const osg::StateSet * | mapCameraToStateSet (const osg::Camera *camera) const |
| virtual void | resizeGLObjectBuffers (unsigned int maxSize) override |
| virtual void | releaseGLObjects (osg::State *=0) const override |
Static Public Member Functions | |
| static const std::string & | shadowCameraPrefixString (void) |
Public Attributes | |
| class DtShadowTweakables * | myShadowUI |
Static Public Attributes | |
| static const int | MAX_NUM_CASCADES = 6 |
Protected Types | |
| typedef std::map< const osg::Camera *, osg::ref_ptr < DtPerChannelData > > | PerChannelDataMap |
| typedef std::vector < osg::ref_ptr < DtPerChannelData > > | PerChannelDataVector |
Protected Member Functions | |
| virtual void | reInitialize (unsigned int quality) |
| virtual void | cleanupOldPerChannelData () |
| virtual bool | configureShadowTraversalNodeMask (bool traverseEntities, bool traverseProps, bool traverseTerrain) |
| virtual void | slot_refresh_maps () |
| virtual std::string | generateVertexShader (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| virtual std::string | generateFragmentShader (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| unsigned int | getFilterCount (DtShadowSettingsObject *shadowSettingObject) |
| bool | getReceiveShadows (const DtShadowSettingsObject *shadowSettings) const |
| virtual void | computeFrustumPoints (const osg::Matrix &projectionMat, bool reverseZ, const osg::Matrix &inverseViewMat, double nearPlane, double farPlane, osg::Vec3d *outFrustumPoints) |
| virtual void | chooseComputeShadowFunction (std::stringstream &sstr, DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettings) |
| virtual | ~DtOsgShadowTechnique () |
Static Protected Attributes | |
| static const std::string | myShadowCameraPrefixString |
Private Member Functions | |
| std::string | generateFragmentComputeShadowFunction (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| std::string | generateFragmentComputeShadowFunctionEsm (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| std::string | generateFragmentComputeShadowFunctionVsm (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| std::string | generateFragmentUniformAndVariables (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| std::string | generateFragmentMain (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| bool | getCameraSettings (osg::Camera *viewCamera, DtPerChannelData **perChannelData, DtShadowSettingsObject **shadowSettingObject, bool *isPlanView) |
| void | initPerChannelData (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| void | installReceiverVPandSharedStateSet (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| void | triggerExternalModuleShaderRefresh () |
| void | updateCascadeImportance (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject) |
| osg::Program * | getProgramFromFile (const std::string &szVertexShader, const std::string &szFragmentShader) |
| void | installPreFilter (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject, osg::Camera *depthCamera, osg::Camera *xBlurCamera, osg::Camera *yBlurCamera, osg::Texture2DArray *texture, osg::StateSet *stateSet, unsigned int textureUnit) |
| void | installPreFilter (DtPerChannelData *perChannelData, DtShadowSettingsObject *shadowSettingObject, osg::Camera *depthCamera, osg::Camera *xBlurCamera, osg::Camera *yBlurCamera, unsigned int textureLayer, osg::Texture2DArray *texture2DArray, osg::Texture2DArray *preFilterTexture2DArray1, osg::Texture2DArray *preFilterTexture2DArray2) |
| void | setupReverseZBuffer (osg::Camera *depthCamera, osg::Camera *xBlurCamera, osg::Camera *yBlurCamera) |
| void | setupBlurCamera (osg::Camera *camera, osg::ref_ptr< osg::Program > &blurProgram, const osg::Vec2 &direction) |
| osg::Texture2D * | createTexture2D (int width, int height, GLenum internalFormat, GLenum sourceFormat, GLenum sourceType, bool shadowComparisonMode, osg::Texture2D::FilterMode minFilter=osg::Texture2D::NEAREST, osg::Texture2D::FilterMode magFilter=osg::Texture2D::NEAREST) |
| osg::Texture2DArray * | createTexture2DArray (int width, int height, int depth, GLenum internalFormat, GLenum sourceFormat, GLenum sourceType, bool shadowComparisonMode, osg::Texture2DArray::FilterMode minFilter=osg::Texture2DArray::NEAREST, osg::Texture2DArray::FilterMode magFilter=osg::Texture2DArray::NEAREST) |
| osg::Camera * | createCamera (int width, int height, GLbitfield clearMask) |
| osg::Geode * | createFullScreenQuad (const osg::Vec2 &size, const osg::Vec2 &uvStart, const osg::Vec2 &uvStop) |
| osg::Camera * | createHudCamera (int width, int height, GLbitfield clearMask, const char *name=NULL) |
| double | computeUniformSplit (double nearDistance, double farDistance, unsigned int splitIndex, unsigned int numSplits) |
| double | computeLogarithmicSplit (double nearDistance, double farDistance, unsigned int splitIndex, unsigned int numSplits) |
| CameraDescription | constructSplitLightCamera (const DtCurrentPassData &d, int split_index, bool farCascade=false) |
| void | updateCameras (const DtCurrentPassData &d) |
| void | getSplitCameraDistances (const DtCurrentPassData &d, int split_index, double &splitCamNear, double &splitCamFar) |
| void | setDirty (bool dirty) |
| void | frustumBoundingBoxLightViewSpace (const DtCurrentPassData &d, int split_index, const osg::Matrix &lightViewMatrix, double nearPlane, double farPlane, osg::Vec3d &minFrustum, osg::Vec3d &maxFrustum) |
Friends | |
| struct | DtCurrentPassData |
|
protected |
|
protected |
| makVrv::DtOsgShadowTechnique::DtOsgShadowTechnique | ( | DtDe & | de | ) |
CTOR.
| makVrv::DtOsgShadowTechnique::DtOsgShadowTechnique | ( | const DtOsgShadowTechnique & | es, |
| const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY |
||
| ) |
DTOR.
|
protectedvirtual |
DTOR.
|
inlinevirtual |
Creates a new object of Type DtOsgShadowTechnique.
|
inlinevirtual |
Creates a new copy of DtOsgShadowTechnique object.
|
inlinevirtual |
Returns true if object is of the DtOsgShadowTechnique class. Otherwise, returns false.
|
inlinevirtual |
Returns the namespace string.
|
inlinevirtual |
Returns the class name string.
|
virtual |
Overrides the osgShadow::ShadowTechnique::init method.
|
virtual |
another init function
|
virtual |
Overrides the osgShadow::ShadowTechnique::update method.
|
virtual |
Overrides the osgShadow::ShadowTechnique::cull method.
|
virtual |
Overrides the osgShadow::ShadowTechnique::cleanSceneGraph method.
| void makVrv::DtOsgShadowTechnique::setChannelShadowState | ( | DtOsgChannel * | osgChannel, |
| bool | enable | ||
| ) |
Set the shadow mode for channels.
| bool makVrv::DtOsgShadowTechnique::getChannelShadowSettings | ( | DtOsgChannel * | osgChannel, |
| DtShadowSettingsObject ** | shadowSettingObject, | ||
| bool * | isPlanView | ||
| ) |
Gets the shadow settings for this channel.
|
inline |
Sets global light source.
|
inline |
Gets global light source.
|
static |
| const osg::StateSet* makVrv::DtOsgShadowTechnique::mapCameraToStateSet | ( | const osg::Camera * | camera | ) | const |
returns shared state set uniform infor for this camera, may be null
|
overridevirtual |
override from osg::ShadowTechnique
|
overridevirtual |
override from osg::ShadowTechnique
Re-initialize perChannelData using the specified quality setting.
|
protectedvirtual |
Since the perChannelData can hold graphics objects we need to clear them in the main render thread. only call this from the main render thread.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Generates an optimized vertex shader given the shadow settings.
|
protectedvirtual |
Generates an optimized fragment shader given the shadow settings.
|
protected |
Gets the number of taps for percentage closer filtering(PCF)
|
protected |
True if scene receives shadows from any light casting source. This is used to bypass some shadow work otherwise.
|
protectedvirtual |
Computes 8 world space frustum points: (near bl, br, tl, tr), (far bl, br, tl, tr). The frustum is computed from the given projection and view matrix. The points will be located in world space at the given near and far frustum plane distances.
| projectionMat | The projection matrix |
| reverseZ | Set to true if the projection matrix is using reverse Z |
| inverseViewMat | The inverse view matrix |
| nearPlane | the desired near plane distance to project the near points to |
| farPlane | the desired far plane distance to project the far points to |
| outFrustumPoints | should be an array of 8 osg::Vec3d to accept the computed points |
|
protectedvirtual |
Uses internal logic to choose how to generate the fragment compute shadow function.
|
private |
Generates an optimized fragment compute shadow function given the shadow settings.
|
private |
Generates an optimized fragment compute shadow function given the shadow settings exponetial shadow mapping (ESM)
|
private |
Generates an optimized fragment compute shadow function given the shadow settings exponetial shadow mapping (VSM)
|
private |
Generates an optimized fragment uniforms and variables given the shadow settings.
|
private |
Generates an optimized fragment main given the shadow settings.
|
private |
Gets camera shadow settings.
|
private |
Initializes per channel data.
|
private |
Initializes the virtual program and shared stateset for perChannelData.
|
private |
|
private |
Updates Cascade Importance.
|
private |
Creates a Program with a vertex and fragment shader.
|
private |
Installs PreFilter for texture 2d.
|
private |
Installs PreFilter for texture 2d Array.
|
private |
|
private |
|
private |
Creates 2d texture.
|
private |
Creates 2d texture array.
|
private |
Creates a simple camera.
|
private |
Creates a full screen quad.
|
private |
Creates a hud camera with a full screen quad.
|
private |
Compute uniform split distance for specified cascade.
|
private |
Compute logarithm split distance for specified cascade.
|
private |
Compute logarithm split distance for specified cascade.
|
private |
|
private |
|
inlineprivate |
Sets dirty for shadow technique's to true or false.
|
private |
|
friend |
| class DtShadowTweakables* makVrv::DtOsgShadowTechnique::myShadowUI |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |