OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreShadowCameraSetupLiSPSM.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>
9 
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16 
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 THE SOFTWARE.
27 -----------------------------------------------------------------------------
28 */
29 #ifndef __ShadowCameraSetupLiSPSM_H__
30 #define __ShadowCameraSetupLiSPSM_H__
31 
32 #include "OgrePrerequisites.h"
34 
35 
36 namespace Ogre
37 {
38 
99  {
100  protected:
109 
125  Matrix4 calculateLiSPSM(const Matrix4& lightSpace, const PointListBody& bodyB,
126  const PointListBody& bodyLVS, const SceneManager& sm,
127  const Camera& cam, const Light& light) const;
128 
153  Real calculateNOpt(const Matrix4& lightSpace, const AxisAlignedBox& bodyBABB_ls,
154  const PointListBody& bodyLVS, const Camera& cam) const;
155 
158  Real calculateNOptSimple(const PointListBody& bodyLVS,
159  const Camera& cam) const;
160 
171  Vector3 calculateZ0_ls(const Matrix4& lightSpace, const Vector3& e, Real bodyB_zMax_ls,
172  const Camera& cam) const;
173 
179  Matrix4 buildFrustumProjection(Real left, Real right, Real bottom,
180  Real top, Real near, Real far) const;
181 
182  public:
188 
193  virtual ~LiSPSMShadowCameraSetup(void);
194 
201  virtual void getShadowCamera(const SceneManager *sm, const Camera *cam,
202  const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
203 
216  virtual void setOptimalAdjustFactor(Real n) { mOptAdjustFactor = n; }
220  virtual Real getOptimalAdjustFactor() const { return mOptAdjustFactor; }
224  virtual void setUseSimpleOptimalAdjust(bool s) { mUseSimpleNOpt = s; }
228  virtual bool getUseSimpleOptimalAdjust() const { return mUseSimpleNOpt; }
229 
238  virtual void setCameraLightDirectionThreshold(Degree angle);
239 
244  virtual Degree getCameraLightDirectionThreshold() const;
245 
246 
247  };
251 }
252 
253 #endif
254 
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:233
virtual Real getOptimalAdjustFactor() const
Get the parameter n used to produce optimal shadows.
Manages the organisation and rendering of a 'scene' i.e.
Real mOptAdjustFactor
Warp factor adjustment.
virtual void setUseSimpleOptimalAdjust(bool s)
Sets whether or not to use a slightly simpler version of the camera near point derivation (default is...
virtual void setOptimalAdjustFactor(Real n)
Adjusts the parameter n to produce optimal shadows.
A 3D box aligned with the x/y/z axes.
Representation of a dynamic light source in the scene.
Definition: OgreLight.h:73
Wrapper class which indicates a given angle value is in Degrees.
Definition: OgreMath.h:97
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Real mCosCamLightDirThreshold
Threshold (cos angle) within which to start increasing the opt adjust as camera direction approaches ...
Internal class holding a point list representation of a convex body.
bool mUseSimpleNOpt
Use simple nopt derivation?
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:56
Real mOptAdjustFactorTweak
Extra calculated warp factor.
virtual bool getUseSimpleOptimalAdjust() const
Gets whether or not to use a slightly simpler version of the camera near point derivation (default is...
Implements the Light Space Perspective Shadow Mapping Algorithm.
Implements the uniform shadow mapping algorithm in focused mode.