OgreShadowCameraSetupLiSPSM.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004 (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2006 Torus Knot Software Ltd
00008 Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>                             
00009 Also see acknowledgements in Readme.html
00010 
00011 This program is free software; you can redistribute it and/or modify it under
00012 the terms of the GNU Lesser General Public License as published by the Free Software
00013 Foundation; either version 2 of the License, or (at your option) any later
00014 version.
00015 
00016 This program is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00019 
00020 You should have received a copy of the GNU Lesser General Public License along with
00021 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00022 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00023 http://www.gnu.org/copyleft/lesser.txt.
00024 
00025 You may alternatively use this source under the terms of a specific version of
00026 the OGRE Unrestricted License provided you have obtained such a license from
00027 Torus Knot Software Ltd.
00028 -----------------------------------------------------------------------------
00029 */
00030 #ifndef __ShadowCameraSetupLiSPSM_H__
00031 #define __ShadowCameraSetupLiSPSM_H__
00032 
00033 #include "OgrePrerequisites.h"
00034 #include "OgreShadowCameraSetupFocused.h"
00035 
00036 
00037 namespace Ogre 
00038 {
00039 
00093     class _OgreExport LiSPSMShadowCameraSetup : public FocusedShadowCameraSetup
00094     {
00095     protected:
00097         Real mOptAdjustFactor;
00099         bool mUseSimpleNOpt;
00101         mutable Real mOptAdjustFactorTweak;
00102 
00118         Matrix4 calculateLiSPSM(const Matrix4& lightSpace, const PointListBody& bodyB, 
00119             const PointListBody& bodyLVS, const SceneManager& sm, 
00120             const Camera& cam, const Light& light) const;
00121 
00146         Real calculateNOpt(const Matrix4& lightSpace, const AxisAlignedBox& bodyBABB_ls, 
00147             const PointListBody& bodyLVS, const Camera& cam) const;
00148 
00151         Real calculateNOptSimple(const PointListBody& bodyLVS, 
00152             const Camera& cam) const;
00153 
00164         Vector3 calculateZ0_ls(const Matrix4& lightSpace, const Vector3& e, Real bodyB_zMax_ls, 
00165             const Camera& cam) const;
00166 
00172         Matrix4 buildFrustumProjection(Real left, Real right, Real bottom, 
00173             Real top, Real near, Real far) const;
00174 
00175     public:
00180         LiSPSMShadowCameraSetup(void);
00181 
00186         virtual ~LiSPSMShadowCameraSetup(void);
00187 
00194         virtual void getShadowCamera(const SceneManager *sm, const Camera *cam, 
00195             const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
00196 
00209         virtual void setOptimalAdjustFactor(Real n) { mOptAdjustFactor = n; }
00213         virtual Real getOptimalAdjustFactor() const { return mOptAdjustFactor; }
00217         virtual void setUseSimpleOptimalAdjust(bool s) { mUseSimpleNOpt = s; }
00221         virtual bool getUseSimpleOptimalAdjust() const { return mUseSimpleNOpt; }
00222 
00223     };
00224 
00225 }
00226 
00227 #endif
00228 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Tue Nov 4 11:02:34 2008