1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
13 * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski
14 * Thanks to to my company http://www.ai.com.pl for allowing me free this work.
18#ifndef OSGSHADOW_LIGHTSPACEPERSPECTIVESHADOWMAP
19#define OSGSHADOW_LIGHTSPACEPERSPECTIVESHADOWMAP 1
21#include <osgShadow/MinimalCullBoundsShadowMap>
22#include <osgShadow/MinimalDrawBoundsShadowMap>
23#include <osgShadow/ProjectionShadowMap>
28// "Light Space Perspective Shadow Maps" algorithm by
29// Michael Wimmer, Daniel Scherzer, Werner Purgathofer
30// http://www.cg.tuwien.ac.at/research/vr/lispsm/
34class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapAlgorithm
37 LightSpacePerspectiveShadowMapAlgorithm();
38 ~LightSpacePerspectiveShadowMapAlgorithm();
41 const osgShadow::ConvexPolyhedron* hullShadowedView,
42 const osg::Camera* cameraMain,
43 osg::Camera* cameraShadow ) const;
49// Optimized for draw traversal shadow bounds
50class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadowMap< MinimalDrawBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
53 /** Convenient typedef used in definition of ViewData struct and methods */
54 typedef ProjectionShadowMap< MinimalDrawBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
56 /** Classic OSG constructor */
57 LightSpacePerspectiveShadowMapDB()
61 /** Classic OSG cloning constructor */
62 LightSpacePerspectiveShadowMapDB(
63 const LightSpacePerspectiveShadowMapDB& copy,
64 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
68 /** Declaration of standard OSG object methods */
69 META_Object( osgShadow, LightSpacePerspectiveShadowMapDB );
72// Optimized for cull traversal shadow bounds
73class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapCB: public ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
76 /** Convenient typedef used in definition of ViewData struct and methods */
77 typedef ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
79 /** Classic OSG constructor */
80 LightSpacePerspectiveShadowMapCB()
84 /** Classic OSG cloning constructor */
85 LightSpacePerspectiveShadowMapCB(
86 const LightSpacePerspectiveShadowMapCB& copy,
87 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
91 /** Declaration of standard OSG object methods */
92 META_Object( osgShadow, LightSpacePerspectiveShadowMapCB );
95// Optimized for view frustum bounds
96class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapVB: public ProjectionShadowMap< MinimalShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
99 /** Convenient typedef used in definition of ViewData struct and methods */
100 typedef ProjectionShadowMap< MinimalShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
102 /** Classic OSG constructor */
103 LightSpacePerspectiveShadowMapVB()
107 /** Classic OSG cloning constructor */
108 LightSpacePerspectiveShadowMapVB(
109 const LightSpacePerspectiveShadowMapVB& copy,
110 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
114 /** Declaration of standard OSG object methods */
115 META_Object( osgShadow, LightSpacePerspectiveShadowMapVB );
118typedef LightSpacePerspectiveShadowMapDB LightSpacePerspectiveShadowMap;
120} // namespace osgShadow