OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ShadowSettings.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-20 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSGSHADOW_SHADOWSETTINGS
15 #define OSGSHADOW_SHADOWSETTINGS 1
16 
17 #include <osg/Uniform>
18 #include <osg/CullSettings>
19 #include <osgShadow/Export>
20 
21 namespace osgShadow {
22 
25 {
26  public:
29 
31 
32  void setReceivesShadowTraversalMask(unsigned int mask) { _receivesShadowTraversalMask = mask; }
33  unsigned int getReceivesShadowTraversalMask() const { return _receivesShadowTraversalMask; }
34 
35  void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; }
36  unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; }
37 
38  void setComputeNearFarModeOverride(osg::CullSettings::ComputeNearFarMode cnfn) { _computeNearFearModeOverride = cnfn; }
39  osg::CullSettings::ComputeNearFarMode getComputeNearFarModeOverride() const { return _computeNearFearModeOverride; }
40 
41 
45  void setLightNum(int lightNum) { _lightNum = lightNum; }
46  int getLightNum() const { return _lightNum; }
47 
48  void setBaseShadowTextureUnit(unsigned int unit) { _baseShadowTextureUnit = unit; }
49  unsigned int getBaseShadowTextureUnit() const { return _baseShadowTextureUnit; }
50 
53  void setUseOverrideForShadowMapTexture(bool useOverride) { _useShadowMapTextureOverride = useOverride; }
54 
56  bool getUseOverrideForShadowMapTexture() const { return _useShadowMapTextureOverride; }
57 
58 
60  void setTextureSize(const osg::Vec2s& textureSize) { _textureSize = textureSize; }
61 
63  const osg::Vec2s& getTextureSize() const { return _textureSize; }
64 
65  void setMinimumShadowMapNearFarRatio(double ratio) { _minimumShadowMapNearFarRatio = ratio; }
66  double getMinimumShadowMapNearFarRatio() const { return _minimumShadowMapNearFarRatio; }
67 
68  void setMaximumShadowMapDistance(double distance) { _maximumShadowMapDistance = distance; }
69  double getMaximumShadowMapDistance() const { return _maximumShadowMapDistance; }
70 
71 
73  {
75  PERSPECTIVE_SHADOW_MAP
76  };
77 
78  void setShadowMapProjectionHint(ShadowMapProjectionHint hint) { _shadowMapProjectionHint = hint; }
79  ShadowMapProjectionHint getShadowMapProjectionHint() const { return _shadowMapProjectionHint; }
80 
87  void setPerspectiveShadowMapCutOffAngle(double angle) { _perspectiveShadowMapCutOffAngle = angle; }
88  double getPerspectiveShadowMapCutOffAngle() const { return _perspectiveShadowMapCutOffAngle; }
89 
90 
91  void setNumShadowMapsPerLight(unsigned int numShadowMaps) { _numShadowMapsPerLight = numShadowMaps; }
92  unsigned int getNumShadowMapsPerLight() const { return _numShadowMapsPerLight; }
93 
95  {
97  CASCADED
98  };
99 
100  void setMultipleShadowMapHint(MultipleShadowMapHint hint) { _multipleShadowMapHint = hint; }
101  MultipleShadowMapHint getMultipleShadowMapHint() const { return _multipleShadowMapHint; }
102 
103 
105  {
108  PROVIDE_VERTEX_AND_FRAGMENT_SHADER
109  };
110 
111  void setShaderHint(ShaderHint shaderHint) { _shaderHint = shaderHint; }
112  ShaderHint getShaderHint() const { return _shaderHint; }
113 
114  void setDebugDraw(bool debugDraw) { _debugDraw = debugDraw; }
115  bool getDebugDraw() const { return _debugDraw; }
116 
117  protected:
118 
119  virtual ~ShadowSettings();
120 
121 
124 
126 
131 
136 
139 
142 
143 };
144 
145 }
146 
147 #endif
unsigned int _numShadowMapsPerLight
void setComputeNearFarModeOverride(osg::CullSettings::ComputeNearFarMode cnfn)
unsigned int _castsShadowTraversalMask
ShadowMapProjectionHint getShadowMapProjectionHint() const
MultipleShadowMapHint getMultipleShadowMapHint() const
void setReceivesShadowTraversalMask(unsigned int mask)
void setLightNum(int lightNum)
unsigned int _baseShadowTextureUnit
unsigned int getCastsShadowTraversalMask() const
void setPerspectiveShadowMapCutOffAngle(double angle)
MultipleShadowMapHint _multipleShadowMapHint
void setUseOverrideForShadowMapTexture(bool useOverride)
ShadowMapProjectionHint _shadowMapProjectionHint
double getPerspectiveShadowMapCutOffAngle() const
osg::CullSettings::ComputeNearFarMode getComputeNearFarModeOverride() const
void setNumShadowMapsPerLight(unsigned int numShadowMaps)
void setMinimumShadowMapNearFarRatio(double ratio)
void setBaseShadowTextureUnit(unsigned int unit)
void setShadowMapProjectionHint(ShadowMapProjectionHint hint)
#define OSGSHADOW_EXPORT
Definition: Export.h:39
#define META_Object(library, name)
Definition: Object.h:42
unsigned int _receivesShadowTraversalMask
void setShaderHint(ShaderHint shaderHint)
unsigned int getBaseShadowTextureUnit() const
osg::CullSettings::ComputeNearFarMode _computeNearFearModeOverride
const osg::Vec2s & getTextureSize() const
double getMaximumShadowMapDistance() const
void setCastsShadowTraversalMask(unsigned int mask)
unsigned int getReceivesShadowTraversalMask() const
void setTextureSize(const osg::Vec2s &textureSize)
ShaderHint getShaderHint() const
void setDebugDraw(bool debugDraw)
bool getUseOverrideForShadowMapTexture() const
unsigned int getNumShadowMapsPerLight() const
double getMinimumShadowMapNearFarRatio() const
void setMaximumShadowMapDistance(double distance)
void setMultipleShadowMapHint(MultipleShadowMapHint hint)