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;
00103         Real mCosCamLightDirThreshold;
00104 
00120         Matrix4 calculateLiSPSM(const Matrix4& lightSpace, const PointListBody& bodyB, 
00121             const PointListBody& bodyLVS, const SceneManager& sm, 
00122             const Camera& cam, const Light& light) const;
00123 
00148         Real calculateNOpt(const Matrix4& lightSpace, const AxisAlignedBox& bodyBABB_ls, 
00149             const PointListBody& bodyLVS, const Camera& cam) const;
00150 
00153         Real calculateNOptSimple(const PointListBody& bodyLVS, 
00154             const Camera& cam) const;
00155 
00166         Vector3 calculateZ0_ls(const Matrix4& lightSpace, const Vector3& e, Real bodyB_zMax_ls, 
00167             const Camera& cam) const;
00168 
00174         Matrix4 buildFrustumProjection(Real left, Real right, Real bottom, 
00175             Real top, Real near, Real far) const;
00176 
00177     public:
00182         LiSPSMShadowCameraSetup(void);
00183 
00188         virtual ~LiSPSMShadowCameraSetup(void);
00189 
00196         virtual void getShadowCamera(const SceneManager *sm, const Camera *cam, 
00197             const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
00198 
00211         virtual void setOptimalAdjustFactor(Real n) { mOptAdjustFactor = n; }
00215         virtual Real getOptimalAdjustFactor() const { return mOptAdjustFactor; }
00219         virtual void setUseSimpleOptimalAdjust(bool s) { mUseSimpleNOpt = s; }
00223         virtual bool getUseSimpleOptimalAdjust() const { return mUseSimpleNOpt; }
00224 
00233         virtual void setCameraLightDirectionThreshold(Degree angle);
00234 
00239         virtual Degree getCameraLightDirectionThreshold() const;
00240 
00241 
00242     };
00243 
00244 }
00245 
00246 #endif
00247 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:26 2009