Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgreShadowCameraSetup.h @ 5

Last change on this file since 5 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 3.8 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __ShadowCameraSetup_H__
30#define __ShadowCameraSetup_H__
31
32#include "OgrePrerequisites.h"
33#include "OgreMovablePlane.h"
34#include "OgreSharedPtr.h"
35
36
37namespace Ogre {
38
39    /** This class allows you to plug in new ways to define the camera setup when
40                rendering and projecting shadow textures.
41        @remarks
42                The default projection used when rendering shadow textures is a uniform
43                frustum. This is pretty straight forward but doesn't make the best use of
44                the space in the shadow map since texels closer to the camera will be larger,
45                resulting in 'jaggies'. There are several ways to distribute the texels
46                in the shadow texture differently, and this class allows you to override
47                that.
48        @par
49                Ogre is provided with several alternative shadow camera setups, including
50                LiSPSM (LiSPSMShadowCameraSetup) and Plane Optimal (PlaneOptimalShadowCameraSetup).
51                Others can of course be written to incorporate other algorithms. All you
52                have to do is instantiate one of these classes and enable it using
53                SceneManager::setShadowCameraSetup (global) or Light::setCustomShadowCameraSetup
54                (per light). In both cases the instance is wrapped in a SharedPtr which means
55                it will  be deleted automatically when no more references to it exist.
56        @note
57        Shadow map matrices, being projective matrices, have 15 degrees of freedom.
58                3 of these degrees of freedom are fixed by the light's position.  4 are used to
59                affinely affect z values.  6 affinely affect u,v sampling.  2 are projective
60                degrees of freedom.  This class is meant to allow custom methods for
61                handling optimization.
62    */
63        class _OgreExport ShadowCameraSetup
64        {
65        public:
66                /// Function to implement -- must set the shadow camera properties
67                virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
68                                                                          const Viewport *vp, const Light *light, Camera *texCam) const = 0;
69                /// Need virtual destructor in case subclasses use it
70                virtual ~ShadowCameraSetup() {}
71
72        };
73
74
75
76        /** Implements default shadow camera setup
77        @remarks
78            This implements the default shadow camera setup algorithm.  This is what might
79                        be referred to as "normal" shadow mapping. 
80    */
81        class _OgreExport DefaultShadowCameraSetup : public ShadowCameraSetup
82        {
83        public:
84                /// Default constructor
85                DefaultShadowCameraSetup();
86                /// Destructor
87                virtual ~DefaultShadowCameraSetup();
88
89                /// Default shadow camera setup
90                virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
91                                                                          const Viewport *vp, const Light *light, Camera *texCam) const;
92        };
93
94
95
96        typedef SharedPtr<ShadowCameraSetup> ShadowCameraSetupPtr;
97
98}
99
100#endif
Note: See TracBrowser for help on using the repository browser.