OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SoftShadowMap.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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_SOFTSHADOWMAP
15 #define OSGSHADOW_SOFTSHADOWMAP 1
16 
17 #include <osg/Camera>
18 #include <osg/Material>
19 #include <osg/MatrixTransform>
20 #include <osg/LightSource>
21 
22 #include <osgShadow/ShadowMap>
23 
24 namespace osgShadow {
25 
28 {
29  public :
30  SoftShadowMap();
31 
33 
35 
39  void setSoftnessWidth(float softnessWidth);
40 
42  float getSoftnessWidth() const { return _softnessWidth; }
43 
49  void setJitteringScale(float jitteringScale);
50 
52  float getJitteringScale() const { return _jitteringScale; }
53 
55  void setJitterTextureUnit(unsigned int jitterTextureUnit);
56 
58  unsigned int getJitterTextureUnit() const { return _jitterTextureUnit; }
59 
60 
66  void setBias(float bias) { setPolygonOffset(osg::Vec2(bias,0)); }
67 
69  float getBias() const { return getPolygonOffset().x(); }
70 
71 
72  protected:
73  virtual ~SoftShadowMap(void) {};
74 
76  void createUniforms();
77  void createShaders();
78  void initJittering(osg::StateSet *ss);
79 
84  unsigned int _jitterTextureUnit;
85 
86 
87 
88 };
89 
90 }
91 
92 #endif
float getBias() const
Definition: SoftShadowMap.h:69
float getSoftnessWidth() const
Definition: SoftShadowMap.h:42
unsigned int getJitterTextureUnit() const
Definition: SoftShadowMap.h:58
void setBias(float bias)
Definition: SoftShadowMap.h:66
#define OSGSHADOW_EXPORT
Definition: Export.h:39
#define META_Object(library, name)
Definition: Object.h:42
unsigned int _jitterTextureUnit
Definition: SoftShadowMap.h:84
float getJitteringScale() const
Definition: SoftShadowMap.h:52
virtual ~SoftShadowMap(void)
Definition: SoftShadowMap.h:73
osg::ref_ptr< osg::Uniform > _jitteringScaleUniform
Definition: SoftShadowMap.h:81
osg::ref_ptr< osg::Uniform > _softnessWidthUniform
Definition: SoftShadowMap.h:80