Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPlaneOptimal.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: 3.7 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 __ShadowCameraSetupPlaneOptimal_H__
29#define __ShadowCameraSetupPlaneOptimal_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreShadowCameraSetup.h"
33#include "OgreHeaderPrefix.h"
34
35namespace Ogre {
36
37
38        /** \addtogroup Core
39        *  @{
40        */
41        /** \addtogroup Scene
42        *  @{
43        */
44        /** Implements the plane optimal shadow camera algorithm.
45        @remarks
46            Given a plane of interest, it is possible to set up the shadow camera
47                        matrix such that the mapping between screen and shadow map is the identity
48                        (when restricted to pixels that view the plane of interest).  Therefore,
49                        if the shadow map resolution matches the screen space resolution (of the
50                        seen planar receiver), we can get pixel perfect shadowing on the plane.
51                        Off the plane, the shadowing is not guaranteed to be perfect and will
52                        likely exhibit the usual sampling artifacts associated with shadow mapping.
53                @note Important: this routine requires double-precision calculations. When you
54                        are running under Direct3D, you must ensure that you set the floating
55                        point mode to 'Consistent' rather than 'Fastest' to ensure this precision.
56                        This does allegedly come with some performance cost but when measuring
57                        it appears to be negligible in modern systems for normal usage.
58                @note Second important note: this projection also only works for lights with
59                        a finite position. Therefore you cannot use it for directional lights
60                        at this time.
61    */
62        class _OgreExport PlaneOptimalShadowCameraSetup : public ShadowCameraSetup
63        {
64        private:
65                MovablePlane* mPlane;   ///< pointer to plane of interest
66        private:
67                PlaneOptimalShadowCameraSetup() {}      ///< Default constructor is private
68
69                /// helper function computing projection matrix given constraints
70                Matrix4 computeConstrainedProjection( const Vector4& pinhole, 
71                                                                                          const vector<Vector4>::type& fpoint, 
72                                                                                          const vector<Vector2>::type& constraint) const;
73
74        public:
75                /// Constructor -- requires a plane of interest
76                PlaneOptimalShadowCameraSetup(MovablePlane *plane);
77                /// Destructor
78                virtual ~PlaneOptimalShadowCameraSetup();
79
80                /// Returns shadow camera configured to get 1-1 homography between screen and shadow map when restricted to plane
81                virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
82                                                                          const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
83        };
84        /** @} */
85        /** @} */
86
87}
88
89#include "OgreHeaderSuffix.h"
90
91#endif
Note: See TracBrowser for help on using the repository browser.