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) 2000-2006 Torus Knot Software Ltd 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 00024 You may alternatively use this source under the terms of a specific version of 00025 the OGRE Unrestricted License provided you have obtained such a license from 00026 Torus Knot Software Ltd. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 #ifndef __AutoParamDataSource_H_ 00030 #define __AutoParamDataSource_H_ 00031 00032 #include "OgrePrerequisites.h" 00033 #include "OgreCommon.h" 00034 #include "OgreMatrix4.h" 00035 #include "OgreVector4.h" 00036 #include "OgreLight.h" 00037 #include "OgreColourValue.h" 00038 00039 namespace Ogre { 00040 00041 // forward decls 00042 struct VisibleObjectsBoundsInfo; 00043 00044 00055 class _OgreExport AutoParamDataSource 00056 { 00057 protected: 00058 mutable Matrix4 mWorldMatrix[256]; 00059 mutable size_t mWorldMatrixCount; 00060 mutable const Matrix4* mWorldMatrixArray; 00061 mutable Matrix4 mWorldViewMatrix; 00062 mutable Matrix4 mViewProjMatrix; 00063 mutable Matrix4 mWorldViewProjMatrix; 00064 mutable Matrix4 mInverseWorldMatrix; 00065 mutable Matrix4 mInverseWorldViewMatrix; 00066 mutable Matrix4 mInverseViewMatrix; 00067 mutable Matrix4 mInverseTransposeWorldMatrix; 00068 mutable Matrix4 mInverseTransposeWorldViewMatrix; 00069 mutable Vector4 mCameraPositionObjectSpace; 00070 mutable Matrix4 mTextureViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS]; 00071 mutable Matrix4 mViewMatrix; 00072 mutable Matrix4 mProjectionMatrix; 00073 mutable Real mDirLightExtrusionDistance; 00074 mutable Vector4 mCameraPosition; 00075 00076 mutable bool mWorldMatrixDirty; 00077 mutable bool mViewMatrixDirty; 00078 mutable bool mProjMatrixDirty; 00079 mutable bool mWorldViewMatrixDirty; 00080 mutable bool mViewProjMatrixDirty; 00081 mutable bool mWorldViewProjMatrixDirty; 00082 mutable bool mInverseWorldMatrixDirty; 00083 mutable bool mInverseWorldViewMatrixDirty; 00084 mutable bool mInverseViewMatrixDirty; 00085 mutable bool mInverseTransposeWorldMatrixDirty; 00086 mutable bool mInverseTransposeWorldViewMatrixDirty; 00087 mutable bool mCameraPositionObjectSpaceDirty; 00088 mutable bool mCameraPositionDirty; 00089 mutable bool mTextureViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS]; 00090 mutable ColourValue mAmbientLight; 00091 mutable ColourValue mFogColour; 00092 mutable Vector4 mFogParams; 00093 mutable int mPassNumber; 00094 mutable Vector4 mSceneDepthRange; 00095 mutable bool mSceneDepthRangeDirty; 00096 // Ordered by light, populated on demand, dirtied when lights change 00097 mutable std::vector<Vector4> mShadowCamDepthRanges; 00098 mutable bool mShadowCamDepthRangesDirty; 00099 00100 const Renderable* mCurrentRenderable; 00101 const Camera* mCurrentCamera; 00102 const LightList* mCurrentLightList; 00103 const Frustum* mCurrentTextureProjector[OGRE_MAX_SIMULTANEOUS_LIGHTS]; 00104 const RenderTarget* mCurrentRenderTarget; 00105 const Viewport* mCurrentViewport; 00106 const SceneManager* mCurrentSceneManager; 00107 const VisibleObjectsBoundsInfo* mMainCamBoundsInfo; 00108 const Pass* mCurrentPass; 00109 00110 Light mBlankLight; 00111 public: 00112 AutoParamDataSource(); 00113 ~AutoParamDataSource(); 00115 void setCurrentRenderable(const Renderable* rend); 00117 void setWorldMatrices(const Matrix4* m, size_t count); 00119 void setCurrentCamera(const Camera* cam); 00121 void setCurrentLightList(const LightList* ll); 00123 void setTextureProjector(const Frustum* frust, size_t index); 00125 void setCurrentRenderTarget(const RenderTarget* target); 00127 void setCurrentViewport(const Viewport* viewport); 00129 void setShadowDirLightExtrusionDistance(Real dist); 00131 void setMainCamBoundsInfo(VisibleObjectsBoundsInfo* info); 00133 void setCurrentSceneManager(const SceneManager* sm); 00135 void setCurrentPass(const Pass* pass); 00136 00137 00138 00139 const Matrix4& getWorldMatrix(void) const; 00140 const Matrix4* getWorldMatrixArray(void) const; 00141 size_t getWorldMatrixCount(void) const; 00142 const Matrix4& getViewMatrix(void) const; 00143 const Matrix4& getViewProjectionMatrix(void) const; 00144 const Matrix4& getProjectionMatrix(void) const; 00145 const Matrix4& getWorldViewProjMatrix(void) const; 00146 const Matrix4& getWorldViewMatrix(void) const; 00147 const Matrix4& getInverseWorldMatrix(void) const; 00148 const Matrix4& getInverseWorldViewMatrix(void) const; 00149 const Matrix4& getInverseViewMatrix(void) const; 00150 const Matrix4& getInverseTransposeWorldMatrix(void) const; 00151 const Matrix4& getInverseTransposeWorldViewMatrix(void) const; 00152 const Vector4& getCameraPosition(void) const; 00153 const Vector4& getCameraPositionObjectSpace(void) const; 00155 const Light& getLight(size_t index) const; 00156 void setAmbientLightColour(const ColourValue& ambient); 00157 const ColourValue& getAmbientLightColour(void) const; 00158 const ColourValue& getSurfaceAmbientColour(void) const; 00159 const ColourValue& getSurfaceDiffuseColour(void) const; 00160 const ColourValue& getSurfaceSpecularColour(void) const; 00161 const ColourValue& getSurfaceEmissiveColour(void) const; 00162 Real getSurfaceShininess(void) const; 00163 ColourValue getDerivedAmbientLightColour(void) const; 00164 ColourValue getDerivedSceneColour(void) const; 00165 void setFog(FogMode mode, const ColourValue& colour, Real expDensity, Real linearStart, Real linearEnd); 00166 const ColourValue& getFogColour(void) const; 00167 const Vector4& getFogParams(void) const; 00168 const Matrix4& getTextureViewProjMatrix(size_t index) const; 00169 const RenderTarget* getCurrentRenderTarget(void) const; 00170 const Renderable* getCurrentRenderable(void) const; 00171 const Pass* getCurrentPass(void) const; 00172 Vector4 getTextureSize(size_t index) const; 00173 Vector4 getInverseTextureSize(size_t index) const; 00174 Vector4 getPackedTextureSize(size_t index) const; 00175 Real getShadowExtrusionDistance(void) const; 00176 const Vector4& getSceneDepthRange() const; 00177 const Vector4& getShadowSceneDepthRange(size_t lightIndex) const; 00178 Matrix4 getInverseViewProjMatrix(void) const; 00179 Matrix4 getInverseTransposeViewProjMatrix() const; 00180 Matrix4 getTransposeViewProjMatrix() const; 00181 Matrix4 getTransposeViewMatrix() const; 00182 Matrix4 getInverseTransposeViewMatrix() const; 00183 Matrix4 getTransposeProjectionMatrix() const; 00184 Matrix4 getInverseProjectionMatrix() const; 00185 Matrix4 getInverseTransposeProjectionMatrix() const; 00186 Matrix4 getTransposeWorldViewProjMatrix() const; 00187 Matrix4 getInverseWorldViewProjMatrix() const; 00188 Matrix4 getInverseTransposeWorldViewProjMatrix() const; 00189 Matrix4 getTransposeWorldViewMatrix() const; 00190 Matrix4 getTransposeWorldMatrix() const; 00191 Real getTime(void) const; 00192 Real getTime_0_X(Real x) const; 00193 Real getCosTime_0_X(Real x) const; 00194 Real getSinTime_0_X(Real x) const; 00195 Real getTanTime_0_X(Real x) const; 00196 Vector4 getTime_0_X_packed(Real x) const; 00197 Real getTime_0_1(Real x) const; 00198 Real getCosTime_0_1(Real x) const; 00199 Real getSinTime_0_1(Real x) const; 00200 Real getTanTime_0_1(Real x) const; 00201 Vector4 getTime_0_1_packed(Real x) const; 00202 Real getTime_0_2Pi(Real x) const; 00203 Real getCosTime_0_2Pi(Real x) const; 00204 Real getSinTime_0_2Pi(Real x) const; 00205 Real getTanTime_0_2Pi(Real x) const; 00206 Vector4 getTime_0_2Pi_packed(Real x) const; 00207 Real getFrameTime(void) const; 00208 Real getFPS() const; 00209 Real getViewportWidth() const; 00210 Real getViewportHeight() const; 00211 Real getInverseViewportWidth() const; 00212 Real getInverseViewportHeight() const; 00213 Vector3 getViewDirection() const; 00214 Vector3 getViewSideVector() const; 00215 Vector3 getViewUpVector() const; 00216 Real getFOV() const; 00217 Real getNearClipDistance() const; 00218 Real getFarClipDistance() const; 00219 int getPassNumber(void) const; 00220 void setPassNumber(const int passNumber); 00221 void incPassNumber(void); 00222 }; 00223 } 00224 00225 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Dec 27 15:19:15 2007