OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreAutoParamDataSource.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __AutoParamDataSource_H_
29 #define __AutoParamDataSource_H_
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreCommon.h"
33 #include "OgreLight.h"
34 
36 
37 namespace Ogre {
38 
39  // forward decls
40  class CompositorShadowNode;
60  {
61  protected:
62  const Light& getLight(size_t index) const;
63  OGRE_SIMD_ALIGNED_DECL( mutable Matrix4, mWorldMatrix[256] );
64  mutable size_t mWorldMatrixCount;
65  mutable const Matrix4* mWorldMatrixArray;
76  mutable Matrix4 mTextureViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
77  mutable Matrix4 mTextureWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
78  mutable Matrix4 mSpotlightViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
79  mutable Matrix4 mSpotlightWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
80  mutable Vector4 mShadowCamDepthRanges[OGRE_MAX_SIMULTANEOUS_LIGHTS];
86 
87  mutable bool mWorldMatrixDirty;
88  mutable bool mViewMatrixDirty;
89  mutable bool mProjMatrixDirty;
90  mutable bool mWorldViewMatrixDirty;
91  mutable bool mViewProjMatrixDirty;
98  mutable bool mCameraPositionDirty;
100  mutable bool mTextureViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
101  mutable bool mTextureWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
102  mutable bool mSpotlightViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
103  mutable bool mSpotlightWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
104  mutable bool mShadowCamDepthRangesDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
108  mutable int mPassNumber;
110  mutable bool mSceneDepthRangeDirty;
113 
117  const Frustum* mCurrentTextureProjector[OGRE_MAX_SIMULTANEOUS_LIGHTS];
124 
129  public:
131  virtual ~AutoParamDataSource();
133  void setCurrentRenderable(const Renderable* rend);
135  void setWorldMatrices(const Matrix4* m, size_t count);
137  void setCurrentCamera(const Camera* cam);
139  void setCurrentLightList(const LightList* ll);
141  void setTextureProjector(const Frustum* frust, size_t index);
143  void setCurrentViewport(const Viewport* viewport);
145  void setShadowDirLightExtrusionDistance(Real dist);
147  void setCurrentSceneManager(const SceneManager* sm);
149  void setCurrentPass(const Pass* pass);
150  void setCurrentShadowNode(const CompositorShadowNode *sn);
151 
152 
153  const Matrix4& getWorldMatrix(void) const;
154  const Matrix4* getWorldMatrixArray(void) const;
155  size_t getWorldMatrixCount(void) const;
156  const Matrix4& getViewMatrix(void) const;
157  const Matrix4& getViewProjectionMatrix(void) const;
158  const Matrix4& getProjectionMatrix(void) const;
159  const Matrix4& getWorldViewProjMatrix(void) const;
160  const Matrix4& getWorldViewMatrix(void) const;
161  const Matrix4& getInverseWorldMatrix(void) const;
162  const Matrix4& getInverseWorldViewMatrix(void) const;
163  const Matrix4& getInverseViewMatrix(void) const;
164  const Matrix4& getInverseTransposeWorldMatrix(void) const;
165  const Matrix4& getInverseTransposeWorldViewMatrix(void) const;
166  const Vector4& getCameraPosition(void) const;
167  const Vector4& getCameraPositionObjectSpace(void) const;
168  const Vector4& getLodCameraPosition(void) const;
169  const Vector4& getLodCameraPositionObjectSpace(void) const;
170  bool hasLightList() const { return mCurrentLightList != 0; }
171  float getLightCount() const;
172  float getLightCastsShadows(size_t index) const;
173  const ColourValue& getLightDiffuseColour(size_t index) const;
174  const ColourValue& getLightSpecularColour(size_t index) const;
175  const ColourValue getLightDiffuseColourWithPower(size_t index) const;
176  const ColourValue getLightSpecularColourWithPower(size_t index) const;
177  Vector3 getLightPosition(size_t index) const;
178  Vector4 getLightAs4DVector(size_t index) const;
179  Vector3 getLightDirection(size_t index) const;
180  Real getLightPowerScale(size_t index) const;
181  Vector4 getLightAttenuation(size_t index) const;
182  Vector4 getSpotlightParams(size_t index) const;
183  void setAmbientLightColour(const ColourValue& ambient);
184  const ColourValue& getAmbientLightColour(void) const;
185  const ColourValue& getSurfaceAmbientColour(void) const;
186  const ColourValue& getSurfaceDiffuseColour(void) const;
187  const ColourValue& getSurfaceSpecularColour(void) const;
188  const ColourValue& getSurfaceEmissiveColour(void) const;
189  Real getSurfaceShininess(void) const;
190  Real getSurfaceAlphaRejectionValue(void) const;
191  ColourValue getDerivedAmbientLightColour(void) const;
192  ColourValue getDerivedSceneColour(void) const;
193  void setFog(FogMode mode, const ColourValue& colour, Real expDensity, Real linearStart, Real linearEnd);
194  const ColourValue& getFogColour(void) const;
195  const Vector4& getFogParams(void) const;
196  const Matrix4& getTextureViewProjMatrix(size_t index) const;
197  const Matrix4& getTextureWorldViewProjMatrix(size_t index) const;
198  const Matrix4& getSpotlightViewProjMatrix(size_t index) const;
199  const Matrix4& getSpotlightWorldViewProjMatrix(size_t index) const;
200  const Matrix4& getTextureTransformMatrix(size_t index) const;
201  const vector<Real>::type& getPssmSplits( size_t shadowMapIdx ) const;
202  const RenderTarget* getCurrentRenderTarget(void) const;
203  const Renderable* getCurrentRenderable(void) const;
204  const Pass* getCurrentPass(void) const;
205  Vector4 getTextureSize(size_t index) const;
206  Vector4 getInverseTextureSize(size_t index) const;
207  Vector4 getPackedTextureSize(size_t index) const;
208  Real getShadowExtrusionDistance(void) const;
209  const Vector4& getSceneDepthRange() const;
210  const Vector4& getShadowSceneDepthRange(size_t index) const;
211  const ColourValue& getShadowColour() const;
212  Matrix4 getInverseViewProjMatrix(void) const;
213  Matrix4 getInverseTransposeViewProjMatrix() const;
214  Matrix4 getTransposeViewProjMatrix() const;
215  Matrix4 getTransposeViewMatrix() const;
216  Matrix4 getInverseTransposeViewMatrix() const;
217  Matrix4 getTransposeProjectionMatrix() const;
218  Matrix4 getInverseProjectionMatrix() const;
219  Matrix4 getInverseTransposeProjectionMatrix() const;
220  Matrix4 getTransposeWorldViewProjMatrix() const;
221  Matrix4 getInverseWorldViewProjMatrix() const;
222  Matrix4 getInverseTransposeWorldViewProjMatrix() const;
223  Matrix4 getTransposeWorldViewMatrix() const;
224  Matrix4 getTransposeWorldMatrix() const;
225  Real getTime(void) const;
226  Real getTime_0_X(Real x) const;
227  Real getCosTime_0_X(Real x) const;
228  Real getSinTime_0_X(Real x) const;
229  Real getTanTime_0_X(Real x) const;
230  Vector4 getTime_0_X_packed(Real x) const;
231  Real getTime_0_1(Real x) const;
232  Real getCosTime_0_1(Real x) const;
233  Real getSinTime_0_1(Real x) const;
234  Real getTanTime_0_1(Real x) const;
235  Vector4 getTime_0_1_packed(Real x) const;
236  Real getTime_0_2Pi(Real x) const;
237  Real getCosTime_0_2Pi(Real x) const;
238  Real getSinTime_0_2Pi(Real x) const;
239  Real getTanTime_0_2Pi(Real x) const;
240  Vector4 getTime_0_2Pi_packed(Real x) const;
241  Real getFrameTime(void) const;
242  Real getFPS() const;
243  Real getViewportWidth() const;
244  Real getViewportHeight() const;
245  Real getInverseViewportWidth() const;
246  Real getInverseViewportHeight() const;
247  Vector3 getViewDirection() const;
248  Vector3 getViewSideVector() const;
249  Vector3 getViewUpVector() const;
250  Real getFOV() const;
251  Real getNearClipDistance() const;
252  Real getFarClipDistance() const;
253  int getPassNumber(void) const;
254  void setPassNumber(const int passNumber);
255  void incPassNumber(void);
256  void updateLightCustomGpuParameter(const GpuProgramParameters::AutoConstantEntry& constantEntry, GpuProgramParameters *params) const;
257 
258  const Light& _getBlankLight(void) const { return mBlankLight; }
259  };
262 }
263 
264 #endif
NodeMemoryManager * mNodeMemoryManager
A 'canvas' which can receive the results of a rendering operation.
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:82
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
FogMode
Fog modes.
Definition: OgreCommon.h:152
const SceneManager * mCurrentSceneManager
Class representing colour.
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
Definition: OgreFrustum.h:84
Manages the organisation and rendering of a 'scene' i.e.
#define OGRE_SIMD_ALIGNED_DECL(type, var)
const CompositorShadowNode * mCurrentShadowNode
Wrap-around class that contains multiple ArrayMemoryManager, one per render queue.
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:53
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:78
Abstract class defining the interface all renderable objects must implement.
#define OGRE_MAX_SIMULTANEOUS_LIGHTS
Define max number of lights allowed per pass.
Definition: OgreConfig.h:76
Representation of a dynamic light source in the scene.
Definition: OgreLight.h:70
Structure recording the use of an automatic parameter.
const Light & _getBlankLight(void) const
ObjectMemoryManager mObjectMemoryManager
vector< Real >::type mNullPssmSplitPoint
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Collects together the program parameters used for a GpuProgram.
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:56
const RenderTarget * mCurrentRenderTarget
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45
Shadow Nodes are special nodes (not to be confused with.
Wrap-around class that contains multiple ArrayMemoryManager, one per hierarchy depth.
This utility class is used to hold the information used to generate the matrices and other informatio...