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 __ShadowCameraSetupPSSM_H__ 00031 #define __ShadowCameraSetupPSSM_H__ 00032 00033 #include "OgrePrerequisites.h" 00034 #include "OgreShadowCameraSetupLiSPSM.h" 00035 00036 namespace Ogre 00037 { 00038 00050 class _OgreExport PSSMShadowCameraSetup : public Ogre::LiSPSMShadowCameraSetup 00051 { 00052 public: 00053 typedef std::vector<Real> SplitPointList; 00054 typedef std::vector<Real> OptimalAdjustFactorList; 00055 00056 protected: 00057 size_t mSplitCount; 00058 SplitPointList mSplitPoints; 00059 OptimalAdjustFactorList mOptimalAdjustFactors; 00060 Real mSplitPadding; 00061 00062 mutable size_t mCurrentIteration; 00063 00064 public: 00066 PSSMShadowCameraSetup(); 00067 ~PSSMShadowCameraSetup(); 00068 00075 void calculateSplitPoints(size_t splitCount, Real nearDist, Real farDist, Real lambda = 0.95); 00076 00083 void setSplitPoints(const SplitPointList& newSplitPoints); 00084 00088 void setOptimalAdjustFactor(size_t splitIndex, Real factor); 00089 00093 void setSplitPadding(Real pad) { mSplitPadding = pad; } 00094 00098 Real getSplitPadding() const { return mSplitPadding; } 00100 size_t getSplitCount() const { return mSplitCount; } 00101 00103 virtual void getShadowCamera(const Ogre::SceneManager *sm, const Ogre::Camera *cam, 00104 const Ogre::Viewport *vp, const Ogre::Light *light, Ogre::Camera *texCam, size_t iteration) const; 00105 00107 inline const SplitPointList& getSplitPoints() const 00108 { return mSplitPoints; } 00109 00111 inline Real getOptimalAdjustFactor(size_t splitIndex) const 00112 { return mOptimalAdjustFactors[splitIndex]; } 00113 00115 Real getOptimalAdjustFactor() const; 00116 00117 }; 00118 } 00119 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:26 2009