- Fixes for two spelling mistakes
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
/* ParallelSplitShadowMap written by Adrian Egli
|
||||
/* ParallelSplitShadowMap written by Adrian Egli
|
||||
*
|
||||
* this version has still a bug in mutli-thread application (flickering problem)
|
||||
* to avoid the flickering problem try osgShadow --pssm --SingleThreaded your_scene.ive
|
||||
*
|
||||
* The Parallel Split Shadow Map only supports directional light for simulating the shadow.
|
||||
* It's one of the most robust algorithm for huge terrain sun light's shadow simulation, if
|
||||
* you need to shadow a terrain, or another huge scene, you should use Parallel Split Shadow Map
|
||||
* or at least test it against your scene. Have fun.
|
||||
* The Parallel Split Shadow Map only supports directional light for simulating the shadow.
|
||||
* It's one of the most robust algorithm for huge terrain sun light's shadow simulation, if
|
||||
* you need to shadow a terrain, or another huge scene, you should use Parallel Split Shadow Map
|
||||
* or at least test it against your scene. Have fun.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OSGSHADOW_ParallelSplitShadowMap
|
||||
#ifndef OSGSHADOW_ParallelSplitShadowMap
|
||||
#define OSGSHADOW_ParallelSplitShadowMap 1
|
||||
|
||||
#include <osg/Camera>
|
||||
@@ -35,16 +35,16 @@
|
||||
|
||||
namespace osgShadow {
|
||||
|
||||
class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
{
|
||||
public:
|
||||
ParallelSplitShadowMap(osg::Geode** debugGroup=NULL, int icountplanes=3);
|
||||
|
||||
ParallelSplitShadowMap(const ParallelSplitShadowMap& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
|
||||
META_Object(osgShadow, ParallelSplitShadowMap);
|
||||
|
||||
|
||||
|
||||
/** Initialize the ShadowedScene and local cached data structures.*/
|
||||
virtual void init();
|
||||
|
||||
@@ -69,21 +69,21 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
/** Set the texture resolution */
|
||||
inline void setTextureResolution(unsigned int resolution) { _resolution = resolution; }
|
||||
|
||||
/** Set the max far distance */
|
||||
/** Set the max far distance */
|
||||
inline void setMaxFarDistance(double farDist) { _setMaxFarDistance = farDist; _isSetMaxFarDistance = true; }
|
||||
|
||||
/** Set the factor for moving the virtual camera behind the real camera*/
|
||||
inline void setMoveVCamBehindRCamFactor(double distFactor ) { _move_vcam_behind_rcam_factor = distFactor; }
|
||||
|
||||
/** Set min near distance for splits */
|
||||
/** Set min near distance for splits */
|
||||
inline void setMinNearDistanceForSplits(double nd){ _split_min_near_dist=nd; }
|
||||
|
||||
/** set a user defined light for shadow simulation (sun light, ... )
|
||||
* when this light get passed to pssm, the scene's light are no longer collected
|
||||
* and simulated. just this user passed light, it needs to be a directional light.
|
||||
/** set a user defined light for shadow simulation (sun light, ... )
|
||||
* when this light get passed to pssm, the scene's light are no longer collected
|
||||
* and simulated. just this user passed light, it needs to be a directional light.
|
||||
*/
|
||||
inline void setUserLight(osg::Light* light) { _userLight = light; }
|
||||
|
||||
|
||||
/** Set the values for the ambient bias the shader will use.*/
|
||||
void setAmbientBias(const osg::Vec2& ambientBias );
|
||||
|
||||
@@ -92,32 +92,32 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
*/
|
||||
class OSGSHADOW_EXPORT FragmentShaderGenerator : public osg::Referenced {
|
||||
public:
|
||||
/**
|
||||
* generate the GLSL fragement shader
|
||||
/**
|
||||
* generate the GLSL fragement shader
|
||||
*/
|
||||
virtual std::string generateGLSL_FragmentShader_BaseTex(bool debug, unsigned int splitCount,double textureRes, bool filtered, unsigned int nbrSplits,unsigned int textureOffset);
|
||||
};
|
||||
|
||||
|
||||
/** set fragment shader generator */
|
||||
inline void setFragmentShaderGenerator(FragmentShaderGenerator* fsw) { _FragmentShaderGenerator = fsw;}
|
||||
|
||||
|
||||
/** enable / disable shadow filtering */
|
||||
inline void enableShadowGLSLFiltering(bool filtering = true) { _GLSL_shadow_filtered = filtering; }
|
||||
|
||||
|
||||
enum SplitCalcMode {
|
||||
SPLIT_LINEAR,
|
||||
SPLIT_EXP
|
||||
};
|
||||
|
||||
|
||||
/** set split calculation mode */
|
||||
inline void setSplitCalculationMode(SplitCalcMode scm=SPLIT_EXP) { _SplitCalcMode = scm; }
|
||||
|
||||
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~ParallelSplitShadowMap() {}
|
||||
|
||||
|
||||
|
||||
struct PSSMShadowSplitTexture {
|
||||
// RTT
|
||||
osg::ref_ptr<osg::Camera> _camera;
|
||||
@@ -157,7 +157,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
|
||||
private:
|
||||
void calculateFrustumCorners(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners);
|
||||
void calculateLightInitalPosition(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners);
|
||||
void calculateLightInitialPosition(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners);
|
||||
void calculateLightNearFarFormFrustum(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners);
|
||||
void calculateLightViewProjectionFormFrustum(PSSMShadowSplitTexture &pssmShadowSplitTexture,osg::Vec3d *frustumCorners);
|
||||
|
||||
@@ -180,13 +180,13 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
double _split_min_near_dist;
|
||||
|
||||
double _move_vcam_behind_rcam_factor;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Light> _userLight;
|
||||
osg::ref_ptr<FragmentShaderGenerator> _FragmentShaderGenerator;
|
||||
|
||||
bool _GLSL_shadow_filtered;
|
||||
SplitCalcMode _SplitCalcMode;
|
||||
|
||||
|
||||
osg::Uniform* _ambientBiasUniform;
|
||||
osg::Vec2d _ambientBias;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user