26#ifndef OSGSHADOW_ParallelSplitShadowMap
27#define OSGSHADOW_ParallelSplitShadowMap 1
76 inline void setMaxFarDistance(
double farDist) { _setMaxFarDistance = farDist; _isSetMaxFarDistance =
true; }
199 unsigned int _textureUnitOffset;
201 unsigned int _number_of_splits;
203 bool _debug_color_in_GLSL;
206 bool _user_polgyonOffset_set;
208 unsigned int _resolution;
210 double _setMaxFarDistance;
211 bool _isSetMaxFarDistance;
213 double _split_min_near_dist;
215 double _move_vcam_behind_rcam_factor;
220 bool _GLSL_shadow_filtered;
Vec2f Vec2
Definition Vec2:21
Matrixd Matrix
Definition Matrix:27
The osgShadow library is a NodeKit that extends the core scene graph to add support for a range of sh...
Definition ConvexPolyhedron:33
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
A Geode is a "geometry node", that is, a leaf node on the scene graph that can have "renderable thing...
Definition Geode:29
Light state class which encapsulates OpenGL glLight() functionality.
Definition Light:40
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Uniform encapsulates glUniform values.
Definition Uniform:414
General purpose float pair.
Definition Vec2f:29
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
void setPolygonOffset(const osg::Vec2f &p)
Set the polygon offset osg::Vec2f(factor,unit)
Definition ParallelSplitShadowMap:64
virtual void cull(osgUtil::CullVisitor &cv)
Run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.
ParallelSplitShadowMap(const ParallelSplitShadowMap &es, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
virtual void init()
Initialize the ShadowedScene and local cached data structures.
void setFragmentShaderGenerator(FragmentShaderGenerator *fsw)
set fragment shader generator
Definition ParallelSplitShadowMap:120
ParallelSplitShadowMap(osg::Geode **debugGroup=NULL, int icountplanes=3)
SplitCalcMode
Definition ParallelSplitShadowMap:125
@ SPLIT_EXP
Definition ParallelSplitShadowMap:127
@ SPLIT_LINEAR
Definition ParallelSplitShadowMap:126
PSSMShadowSplitTextureMap _PSSMShadowSplitTextureMap
Definition ParallelSplitShadowMap:188
void setMoveVCamBehindRCamFactor(double distFactor)
Set the factor for moving the virtual camera behind the real camera.
Definition ParallelSplitShadowMap:82
void setSplitCalculationMode(SplitCalcMode scm=SPLIT_EXP)
set split calculation mode
Definition ParallelSplitShadowMap:131
void setDebugColorOn()
Switch on the debug coloring in GLSL (only the first 3 texture/splits showed for visualisation.
Definition ParallelSplitShadowMap:61
META_Object(osgShadow, ParallelSplitShadowMap)
std::map< unsigned int, PSSMShadowSplitTexture > PSSMShadowSplitTextureMap
Definition ParallelSplitShadowMap:187
double getMaxFarDistance() const
Get the max far distance.
Definition ParallelSplitShadowMap:79
virtual ~ParallelSplitShadowMap()
Definition ParallelSplitShadowMap:147
void setMaxFarDistance(double farDist)
Set the max far distance.
Definition ParallelSplitShadowMap:76
double getMinNearDistanceForSplits() const
Get min near distance for splits.
Definition ParallelSplitShadowMap:91
void setTextureResolution(unsigned int resolution)
Set the texture resolution.
Definition ParallelSplitShadowMap:70
void setMinNearDistanceForSplits(double nd)
Set min near distance for splits.
Definition ParallelSplitShadowMap:88
const osg::Light * getUserLight() const
get the user defined light for shadow simulation
Definition ParallelSplitShadowMap:100
void enableShadowGLSLFiltering(bool filtering=true)
enable / disable shadow filtering
Definition ParallelSplitShadowMap:123
void setAmbientBias(const osg::Vec2 &ambientBias)
Set the values for the ambient bias the shader will use.
double getMoveVCamBehindRCamFactor() const
Get the factor for moving the virtual camera behind the real camera.
Definition ParallelSplitShadowMap:85
unsigned int getTextureResolution() const
Get the texture resolution.
Definition ParallelSplitShadowMap:73
virtual void update(osg::NodeVisitor &nv)
Run the update traversal of the ShadowedScene and update any loca chached data structures.
const osg::Vec2f & getPolygonOffset() const
Get the polygon offset osg::Vec2f(factor,unit)
Definition ParallelSplitShadowMap:67
const osg::Vec2 & getAmbientBias() const
Get the values for the ambient bias the shader will use.
Definition ParallelSplitShadowMap:106
virtual void cleanSceneGraph()
Clean scene graph from any shadow technique specific nodes, state and drawables.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
void setUserLight(osg::Light *light)
set a user defined light for shadow simulation (sun light, ... ) when this light get passed to pssm,...
Definition ParallelSplitShadowMap:97
SplitCalcMode getSplitCalculationMode() const
get split calculation mode
Definition ParallelSplitShadowMap:134
you can overwrite the fragment shader if you like to modify it yourself, own fragment shader can be u...
Definition ParallelSplitShadowMap:111
virtual std::string generateGLSL_FragmentShader_BaseTex(bool debug, unsigned int splitCount, double textureRes, bool filtered, unsigned int nbrSplits, unsigned int textureOffset)
generate the GLSL fragment shader
Definition ParallelSplitShadowMap:150
double _lightFar
Definition ParallelSplitShadowMap:172
double _lightNear
Definition ParallelSplitShadowMap:171
osg::Vec3d _frustumSplitCenter
Definition ParallelSplitShadowMap:169
void releaseGLObjects(osg::State *=0) const
unsigned int _splitID
Definition ParallelSplitShadowMap:177
osg::ref_ptr< osg::TexGen > _texgen
Definition ParallelSplitShadowMap:153
osg::ref_ptr< osg::Texture2D > _texture
Definition ParallelSplitShadowMap:154
osg::Vec3d _lightCameraTarget
Definition ParallelSplitShadowMap:168
osg::ref_ptr< osg::Texture2D > _debug_texture
Definition ParallelSplitShadowMap:162
double _split_far
Definition ParallelSplitShadowMap:159
osg::Vec3d _lightDirection
Definition ParallelSplitShadowMap:170
osg::ref_ptr< osg::StateSet > _debug_stateset
Definition ParallelSplitShadowMap:163
unsigned int _resolution
Definition ParallelSplitShadowMap:178
osg::Matrix _cameraView
Definition ParallelSplitShadowMap:174
osg::ref_ptr< osg::Camera > _camera
Definition ParallelSplitShadowMap:152
osg::ref_ptr< osg::StateSet > _stateset
Definition ParallelSplitShadowMap:155
osg::ref_ptr< osg::Uniform > _farDistanceSplit
Definition ParallelSplitShadowMap:180
void resizeGLObjectBuffers(unsigned int maxSize)
osg::Matrix _cameraProj
Definition ParallelSplitShadowMap:175
unsigned int _textureUnit
Definition ParallelSplitShadowMap:156
osg::ref_ptr< osg::Camera > _debug_camera
Definition ParallelSplitShadowMap:161
unsigned int _debug_textureUnit
Definition ParallelSplitShadowMap:164
osg::Vec3d _lightCameraSource
Definition ParallelSplitShadowMap:167
Basic NodeVisitor implementation for rendering a scene.
Definition CullVisitor:49
#define NULL
Definition Export:55
#define OSGSHADOW_EXPORT
Definition Export:39