OgreAutoParamDataSource.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) 2000-2012 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028 #ifndef __AutoParamDataSource_H_
    00029 #define __AutoParamDataSource_H_
    00030
    00031 #include "OgrePrerequisites.h"
    00032 #include "OgreCommon.h"
    00033 #include "OgreMatrix4.h"
    00034 #include "OgreVector4.h"
    00035 #include "OgreLight.h"
    00036 #include "OgreColourValue.h"
    00037
    00038 namespace Ogre {
    00039
    00040     // forward decls
    00041     struct VisibleObjectsBoundsInfo;
    00060     class _OgreExport AutoParamDataSource : public SceneMgtAlloc
    00061     {
    00062     protected:
    00063         const Light& getLight(size_t index) const;
    00064         mutable Matrix4 mWorldMatrix[256];
    00065         mutable size_t mWorldMatrixCount;
    00066         mutable const Matrix4* mWorldMatrixArray;
    00067         mutable Matrix4 mWorldViewMatrix;
    00068         mutable Matrix4 mViewProjMatrix;
    00069         mutable Matrix4 mWorldViewProjMatrix;
    00070         mutable Matrix4 mInverseWorldMatrix;
    00071         mutable Matrix4 mInverseWorldViewMatrix;
    00072         mutable Matrix4 mInverseViewMatrix;
    00073         mutable Matrix4 mInverseTransposeWorldMatrix;
    00074         mutable Matrix4 mInverseTransposeWorldViewMatrix;
    00075         mutable Vector4 mCameraPosition;
    00076         mutable Vector4 mCameraPositionObjectSpace;
    00077         mutable Matrix4 mTextureViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00078         mutable Matrix4 mTextureWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00079         mutable Matrix4 mSpotlightViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00080         mutable Matrix4 mSpotlightWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00081         mutable Vector4 mShadowCamDepthRanges[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00082         mutable Matrix4 mViewMatrix;
    00083         mutable Matrix4 mProjectionMatrix;
    00084         mutable Real mDirLightExtrusionDistance;
    00085         mutable Vector4 mLodCameraPosition;
    00086         mutable Vector4 mLodCameraPositionObjectSpace;
    00087
    00088         mutable bool mWorldMatrixDirty;
    00089         mutable bool mViewMatrixDirty;
    00090         mutable bool mProjMatrixDirty;
    00091         mutable bool mWorldViewMatrixDirty;
    00092         mutable bool mViewProjMatrixDirty;
    00093         mutable bool mWorldViewProjMatrixDirty;
    00094         mutable bool mInverseWorldMatrixDirty;
    00095         mutable bool mInverseWorldViewMatrixDirty;
    00096         mutable bool mInverseViewMatrixDirty;
    00097         mutable bool mInverseTransposeWorldMatrixDirty;
    00098         mutable bool mInverseTransposeWorldViewMatrixDirty;
    00099         mutable bool mCameraPositionDirty;
    00100         mutable bool mCameraPositionObjectSpaceDirty;
    00101         mutable bool mTextureViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00102         mutable bool mTextureWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00103         mutable bool mSpotlightViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00104         mutable bool mSpotlightWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00105         mutable bool mShadowCamDepthRangesDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00106         mutable ColourValue mAmbientLight;
    00107         mutable ColourValue mFogColour;
    00108         mutable Vector4 mFogParams;
    00109         mutable int mPassNumber;
    00110         mutable Vector4 mSceneDepthRange;
    00111         mutable bool mSceneDepthRangeDirty;
    00112         mutable bool mLodCameraPositionDirty;
    00113         mutable bool mLodCameraPositionObjectSpaceDirty;
    00114
    00115         const Renderable* mCurrentRenderable;
    00116         const Camera* mCurrentCamera;
    00117         bool mCameraRelativeRendering;
    00118         Vector3 mCameraRelativePosition;
    00119         const LightList* mCurrentLightList;
    00120         const Frustum* mCurrentTextureProjector[OGRE_MAX_SIMULTANEOUS_LIGHTS];
    00121         const RenderTarget* mCurrentRenderTarget;
    00122         const Viewport* mCurrentViewport;
    00123         const SceneManager* mCurrentSceneManager;
    00124         const VisibleObjectsBoundsInfo* mMainCamBoundsInfo;
    00125         const Pass* mCurrentPass;
    00126
    00127         Light mBlankLight;
    00128     public:
    00129         AutoParamDataSource();
    00130         virtual ~AutoParamDataSource();
    00132         virtual void setCurrentRenderable(const Renderable* rend);
    00134         virtual void setWorldMatrices(const Matrix4* m, size_t count);
    00136         virtual void setCurrentCamera(const Camera* cam, bool useCameraRelative);
    00138         virtual void setCurrentLightList(const LightList* ll);
    00140         virtual void setTextureProjector(const Frustum* frust, size_t index);
    00142         virtual void setCurrentRenderTarget(const RenderTarget* target);
    00144         virtual void setCurrentViewport(const Viewport* viewport);
    00146         virtual void setShadowDirLightExtrusionDistance(Real dist);
    00148         virtual void setMainCamBoundsInfo(VisibleObjectsBoundsInfo* info);
    00150         virtual void setCurrentSceneManager(const SceneManager* sm);
    00152         virtual void setCurrentPass(const Pass* pass);
    00153
    00154
    00155
    00156         virtual const Matrix4& getWorldMatrix(void) const;
    00157         virtual const Matrix4* getWorldMatrixArray(void) const;
    00158         virtual size_t getWorldMatrixCount(void) const;
    00159         virtual const Matrix4& getViewMatrix(void) const;
    00160         virtual const Matrix4& getViewProjectionMatrix(void) const;
    00161         virtual const Matrix4& getProjectionMatrix(void) const;
    00162         virtual const Matrix4& getWorldViewProjMatrix(void) const;
    00163         virtual const Matrix4& getWorldViewMatrix(void) const;
    00164         virtual const Matrix4& getInverseWorldMatrix(void) const;
    00165         virtual const Matrix4& getInverseWorldViewMatrix(void) const;
    00166         virtual const Matrix4& getInverseViewMatrix(void) const;
    00167         virtual const Matrix4& getInverseTransposeWorldMatrix(void) const;
    00168         virtual const Matrix4& getInverseTransposeWorldViewMatrix(void) const;
    00169         virtual const Vector4& getCameraPosition(void) const;
    00170         virtual const Vector4& getCameraPositionObjectSpace(void) const;
    00171         virtual const Vector4& getLodCameraPosition(void) const;
    00172         virtual const Vector4& getLodCameraPositionObjectSpace(void) const;
    00173         virtual bool hasLightList() const { return mCurrentLightList != 0; }
    00175         virtual float getLightNumber(size_t index) const;
    00176         virtual float getLightCount() const;
    00177         virtual float getLightCastsShadows(size_t index) const;
    00178         virtual const ColourValue& getLightDiffuseColour(size_t index) const;
    00179         virtual const ColourValue& getLightSpecularColour(size_t index) const;
    00180         virtual const ColourValue getLightDiffuseColourWithPower(size_t index) const;
    00181         virtual const ColourValue getLightSpecularColourWithPower(size_t index) const;
    00182         virtual const Vector3& getLightPosition(size_t index) const;
    00183         virtual Vector4 getLightAs4DVector(size_t index) const;
    00184         virtual const Vector3& getLightDirection(size_t index) const;
    00185         virtual Real getLightPowerScale(size_t index) const;
    00186         virtual Vector4 getLightAttenuation(size_t index) const;
    00187         virtual Vector4 getSpotlightParams(size_t index) const;
    00188         virtual void setAmbientLightColour(const ColourValue& ambient);
    00189         virtual const ColourValue& getAmbientLightColour(void) const;
    00190         virtual const ColourValue& getSurfaceAmbientColour(void) const;
    00191         virtual const ColourValue& getSurfaceDiffuseColour(void) const;
    00192         virtual const ColourValue& getSurfaceSpecularColour(void) const;
    00193         virtual const ColourValue& getSurfaceEmissiveColour(void) const;
    00194         virtual Real getSurfaceShininess(void) const;
    00195         virtual ColourValue getDerivedAmbientLightColour(void) const;
    00196         virtual ColourValue getDerivedSceneColour(void) const;
    00197         virtual void setFog(FogMode mode, const ColourValue& colour, Real expDensity, Real linearStart, Real linearEnd);
    00198         virtual const ColourValue& getFogColour(void) const;
    00199         virtual const Vector4& getFogParams(void) const;
    00200         virtual const Matrix4& getTextureViewProjMatrix(size_t index) const;
    00201         virtual const Matrix4& getTextureWorldViewProjMatrix(size_t index) const;
    00202         virtual const Matrix4& getSpotlightViewProjMatrix(size_t index) const;
    00203         virtual const Matrix4& getSpotlightWorldViewProjMatrix(size_t index) const;
    00204         virtual const Matrix4& getTextureTransformMatrix(size_t index) const;
    00205         virtual const RenderTarget* getCurrentRenderTarget(void) const;
    00206         virtual const Renderable* getCurrentRenderable(void) const;
    00207         virtual const Pass* getCurrentPass(void) const;
    00208         virtual Vector4 getTextureSize(size_t index) const;
    00209         virtual Vector4 getInverseTextureSize(size_t index) const;
    00210         virtual Vector4 getPackedTextureSize(size_t index) const;
    00211         virtual Real getShadowExtrusionDistance(void) const;
    00212         virtual const Vector4& getSceneDepthRange() const;
    00213         virtual const Vector4& getShadowSceneDepthRange(size_t index) const;
    00214         virtual const ColourValue& getShadowColour() const;
    00215         virtual Matrix4 getInverseViewProjMatrix(void) const;
    00216         virtual Matrix4 getInverseTransposeViewProjMatrix() const;
    00217         virtual Matrix4 getTransposeViewProjMatrix() const;
    00218         virtual Matrix4 getTransposeViewMatrix() const;
    00219         virtual Matrix4 getInverseTransposeViewMatrix() const;
    00220         virtual Matrix4 getTransposeProjectionMatrix() const;
    00221         virtual Matrix4 getInverseProjectionMatrix() const;
    00222         virtual Matrix4 getInverseTransposeProjectionMatrix() const;
    00223         virtual Matrix4 getTransposeWorldViewProjMatrix() const;
    00224         virtual Matrix4 getInverseWorldViewProjMatrix() const;
    00225         virtual Matrix4 getInverseTransposeWorldViewProjMatrix() const;
    00226         virtual Matrix4 getTransposeWorldViewMatrix() const;
    00227         virtual Matrix4 getTransposeWorldMatrix() const;
    00228         virtual Real getTime(void) const;
    00229         virtual Real getTime_0_X(Real x) const;
    00230         virtual Real getCosTime_0_X(Real x) const;
    00231         virtual Real getSinTime_0_X(Real x) const;
    00232         virtual Real getTanTime_0_X(Real x) const;
    00233         virtual Vector4 getTime_0_X_packed(Real x) const;
    00234         virtual Real getTime_0_1(Real x) const;
    00235         virtual Real getCosTime_0_1(Real x) const;
    00236         virtual Real getSinTime_0_1(Real x) const;
    00237         virtual Real getTanTime_0_1(Real x) const;
    00238         virtual Vector4 getTime_0_1_packed(Real x) const;
    00239         virtual Real getTime_0_2Pi(Real x) const;
    00240         virtual Real getCosTime_0_2Pi(Real x) const;
    00241         virtual Real getSinTime_0_2Pi(Real x) const;
    00242         virtual Real getTanTime_0_2Pi(Real x) const;
    00243         virtual Vector4 getTime_0_2Pi_packed(Real x) const;
    00244         virtual Real getFrameTime(void) const;
    00245         virtual Real getFPS() const;
    00246         virtual Real getViewportWidth() const;
    00247         virtual Real getViewportHeight() const;
    00248         virtual Real getInverseViewportWidth() const;
    00249         virtual Real getInverseViewportHeight() const;
    00250         virtual Vector3 getViewDirection() const;
    00251         virtual Vector3 getViewSideVector() const;
    00252         virtual Vector3 getViewUpVector() const;
    00253         virtual Real getFOV() const;
    00254         virtual Real getNearClipDistance() const;
    00255         virtual Real getFarClipDistance() const;
    00256         virtual int getPassNumber(void) const;
    00257         virtual void setPassNumber(const int passNumber);
    00258         virtual void incPassNumber(void);
    00259         virtual void updateLightCustomGpuParameter(const GpuProgramParameters::AutoConstantEntry& constantEntry, GpuProgramParameters *params) const;
    00260     };
    00263 }
    00264
    00265 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:20