Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetup.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 4.1 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) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __ShadowCameraSetup_H__
29#define __ShadowCameraSetup_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreMovablePlane.h"
33#include "OgreSharedPtr.h"
34#include "OgreHeaderPrefix.h"
35
36namespace Ogre {
37
38        /** \addtogroup Core
39        *  @{
40        */
41        /** \addtogroup Scene
42        *  @{
43        */
44        /** This class allows you to plug in new ways to define the camera setup when
45                rendering and projecting shadow textures.
46        @remarks
47                The default projection used when rendering shadow textures is a uniform
48                frustum. This is pretty straight forward but doesn't make the best use of
49                the space in the shadow map since texels closer to the camera will be larger,
50                resulting in 'jaggies'. There are several ways to distribute the texels
51                in the shadow texture differently, and this class allows you to override
52                that.
53        @par
54                Ogre is provided with several alternative shadow camera setups, including
55                LiSPSM (LiSPSMShadowCameraSetup) and Plane Optimal (PlaneOptimalShadowCameraSetup).
56                Others can of course be written to incorporate other algorithms. All you
57                have to do is instantiate one of these classes and enable it using
58                SceneManager::setShadowCameraSetup (global) or Light::setCustomShadowCameraSetup
59                (per light). In both cases the instance is wrapped in a SharedPtr which means
60                it will  be deleted automatically when no more references to it exist.
61        @note
62        Shadow map matrices, being projective matrices, have 15 degrees of freedom.
63                3 of these degrees of freedom are fixed by the light's position.  4 are used to
64                affinely affect z values.  6 affinely affect u,v sampling.  2 are projective
65                degrees of freedom.  This class is meant to allow custom methods for
66                handling optimization.
67    */
68        class _OgreExport ShadowCameraSetup : public ShadowDataAlloc
69        {
70        public:
71                /// Function to implement -- must set the shadow camera properties
72                virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
73                                                                          const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const = 0;
74                /// Need virtual destructor in case subclasses use it
75                virtual ~ShadowCameraSetup() {}
76
77        };
78
79
80
81        /** Implements default shadow camera setup
82        @remarks
83            This implements the default shadow camera setup algorithm.  This is what might
84                        be referred to as "normal" shadow mapping. 
85    */
86        class _OgreExport DefaultShadowCameraSetup : public ShadowCameraSetup
87        {
88        public:
89                /// Default constructor
90                DefaultShadowCameraSetup();
91                /// Destructor
92                virtual ~DefaultShadowCameraSetup();
93
94                /// Default shadow camera setup
95                virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
96                                                                          const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
97        };
98
99
100
101        typedef SharedPtr<ShadowCameraSetup> ShadowCameraSetupPtr;
102        /** @} */
103        /** @} */
104
105}
106
107#include "OgreHeaderSuffix.h"
108
109#endif
Note: See TracBrowser for help on using the repository browser.