openscenegraph
LightSpacePerspectiveShadowMap
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 * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski
14 * Thanks to to my company http://www.ai.com.pl for allowing me free this work.
15*/
16
17
18#ifndef OSGSHADOW_LIGHTSPACEPERSPECTIVESHADOWMAP
19#define OSGSHADOW_LIGHTSPACEPERSPECTIVESHADOWMAP 1
20
21#include <osgShadow/MinimalCullBoundsShadowMap>
22#include <osgShadow/MinimalDrawBoundsShadowMap>
23#include <osgShadow/ProjectionShadowMap>
24
25namespace osgShadow {
26
27// Class implements
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/
31
32class LispSM;
33
34class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapAlgorithm
35{
36 public:
37 LightSpacePerspectiveShadowMapAlgorithm();
38 ~LightSpacePerspectiveShadowMapAlgorithm();
39
40 void operator() (
41 const osgShadow::ConvexPolyhedron* hullShadowedView,
42 const osg::Camera* cameraMain,
43 osg::Camera* cameraShadow ) const;
44
45 protected:
46 LispSM * lispsm;
47};
48
49// Optimized for draw traversal shadow bounds
50class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadowMap< MinimalDrawBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
51{
52 public:
53 /** Convenient typedef used in definition of ViewData struct and methods */
54 typedef ProjectionShadowMap< MinimalDrawBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
55
56 /** Classic OSG constructor */
57 LightSpacePerspectiveShadowMapDB()
58 {
59 }
60
61 /** Classic OSG cloning constructor */
62 LightSpacePerspectiveShadowMapDB(
63 const LightSpacePerspectiveShadowMapDB& copy,
64 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
65 {
66 }
67
68 /** Declaration of standard OSG object methods */
69 META_Object( osgShadow, LightSpacePerspectiveShadowMapDB );
70};
71
72// Optimized for cull traversal shadow bounds
73class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapCB: public ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
74{
75 public:
76 /** Convenient typedef used in definition of ViewData struct and methods */
77 typedef ProjectionShadowMap< MinimalCullBoundsShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
78
79 /** Classic OSG constructor */
80 LightSpacePerspectiveShadowMapCB()
81 {
82 }
83
84 /** Classic OSG cloning constructor */
85 LightSpacePerspectiveShadowMapCB(
86 const LightSpacePerspectiveShadowMapCB& copy,
87 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
88 {
89 }
90
91 /** Declaration of standard OSG object methods */
92 META_Object( osgShadow, LightSpacePerspectiveShadowMapCB );
93};
94
95// Optimized for view frustum bounds
96class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapVB: public ProjectionShadowMap< MinimalShadowMap, LightSpacePerspectiveShadowMapAlgorithm >
97{
98 public:
99 /** Convenient typedef used in definition of ViewData struct and methods */
100 typedef ProjectionShadowMap< MinimalShadowMap, LightSpacePerspectiveShadowMapAlgorithm > BaseClass;
101
102 /** Classic OSG constructor */
103 LightSpacePerspectiveShadowMapVB()
104 {
105 }
106
107 /** Classic OSG cloning constructor */
108 LightSpacePerspectiveShadowMapVB(
109 const LightSpacePerspectiveShadowMapVB& copy,
110 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : BaseClass(copy,copyop)
111 {
112 }
113
114 /** Declaration of standard OSG object methods */
115 META_Object( osgShadow, LightSpacePerspectiveShadowMapVB );
116};
117
118typedef LightSpacePerspectiveShadowMapDB LightSpacePerspectiveShadowMap;
119
120} // namespace osgShadow
121
122#endif