/usr/include/osgShadow/SoftShadowMap is in libopenscenegraph-dev 3.0.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /* -*-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
* (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
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSHADOW_SOFTSHADOWMAP
#define OSGSHADOW_SOFTSHADOWMAP 1
#include <osg/Camera>
#include <osg/Material>
#include <osg/MatrixTransform>
#include <osg/LightSource>
#include <osgShadow/ShadowMap>
namespace osgShadow {
/** SoftShadowMap provides an implementation of soft shadows with shadow maps.*/
class OSGSHADOW_EXPORT SoftShadowMap : public ShadowMap
{
public :
SoftShadowMap();
SoftShadowMap(const SoftShadowMap& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgShadow, SoftShadowMap);
/** Set the values for width of the soft penumbra the shader will use.
* Zero is for hard shadow (no penumbra). 0.01 is already very soft penumbra.
* Default is 0.005.*/
void setSoftnessWidth(float softnessWidth);
/** Get the value used for width of the soft penumbra in the shader.*/
float getSoftnessWidth() const { return _softnessWidth; }
/** Set the values for jittering scale the shader will use.
* Zero is no jittering (i.e. see the banding in penumbra)
* High values (>64) cause 'pixelization' of the penumbra.
* Usually but not necessarily power of two number.
* Default is 32. */
void setJitteringScale(float jitteringScale);
/** Get the value used for jittering scale in the shader.*/
float getJitteringScale() const { return _jitteringScale; }
/** Set the texture unit that the jitter texture will be applied on.*/
void setJitterTextureUnit(unsigned int jitterTextureUnit);
/** Get the texture unit that the jitter texture will be applied on.*/
unsigned int getJitterTextureUnit() const { return _jitterTextureUnit; }
/** Add a small bias to the z-value, this can reduce
* shadow acne problem.
* This is the same as calling setPolygonOffset(osg::Vec2(bias,0));
* Suitable values are 0-0.005
* Default is 0. */
void setBias(float bias) { setPolygonOffset(osg::Vec2(bias,0)); }
/** Return the bias value */
float getBias() const { return getPolygonOffset().x(); }
protected:
virtual ~SoftShadowMap(void) {};
/** Create the managed Uniforms */
void createUniforms();
void createShaders();
void initJittering(osg::StateSet *ss);
osg::ref_ptr<osg::Uniform> _softnessWidthUniform;
osg::ref_ptr<osg::Uniform> _jitteringScaleUniform;
float _softnessWidth;
float _jitteringScale;
unsigned int _jitterTextureUnit;
};
}
#endif
|