OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreGpuProgramParams.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-2011 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 __GpuProgramParams_H_
29 #define __GpuProgramParams_H_
30 
31 // Precompiler options
32 #include "OgrePrerequisites.h"
33 #include "OgreSharedPtr.h"
34 #include "OgreIteratorWrappers.h"
35 #include "OgreSerializer.h"
36 #include "OgreRenderOperation.h"
37 #include "OgreAny.h"
38 
39 namespace Ogre {
40 
53  {
73  GCT_INT1 = 20,
74  GCT_INT2 = 21,
75  GCT_INT3 = 22,
76  GCT_INT4 = 23,
78  };
79 
84  {
86  GPV_GLOBAL = 1,
90  GPV_LIGHTS = 4,
93 
94 
96  GPV_ALL = 0xFFFF
97 
98  };
99 
105  {
111  size_t logicalIndex;
114  size_t elementSize;
116  size_t arraySize;
119 
120  bool isFloat() const
121  {
122  return isFloat(constType);
123  }
124 
125  static bool isFloat(GpuConstantType c)
126  {
127  switch(c)
128  {
129  case GCT_INT1:
130  case GCT_INT2:
131  case GCT_INT3:
132  case GCT_INT4:
133  case GCT_SAMPLER1D:
134  case GCT_SAMPLER2D:
135  case GCT_SAMPLER3D:
136  case GCT_SAMPLERCUBE:
137  case GCT_SAMPLER1DSHADOW:
138  case GCT_SAMPLER2DSHADOW:
139  return false;
140  default:
141  return true;
142  };
143 
144  }
145 
146  bool isSampler() const
147  {
148  return isSampler(constType);
149  }
150 
151  static bool isSampler(GpuConstantType c)
152  {
153  switch(c)
154  {
155  case GCT_SAMPLER1D:
156  case GCT_SAMPLER2D:
157  case GCT_SAMPLER3D:
158  case GCT_SAMPLERCUBE:
159  case GCT_SAMPLER1DSHADOW:
160  case GCT_SAMPLER2DSHADOW:
161  return true;
162  default:
163  return false;
164  };
165 
166  }
167 
168 
172  static size_t getElementSize(GpuConstantType ctype, bool padToMultiplesOf4)
173  {
174  if (padToMultiplesOf4)
175  {
176  switch(ctype)
177  {
178  case GCT_FLOAT1:
179  case GCT_INT1:
180  case GCT_SAMPLER1D:
181  case GCT_SAMPLER2D:
182  case GCT_SAMPLER3D:
183  case GCT_SAMPLERCUBE:
184  case GCT_SAMPLER1DSHADOW:
185  case GCT_SAMPLER2DSHADOW:
186  case GCT_FLOAT2:
187  case GCT_INT2:
188  case GCT_FLOAT3:
189  case GCT_INT3:
190  case GCT_FLOAT4:
191  case GCT_INT4:
192  return 4;
193  case GCT_MATRIX_2X2:
194  case GCT_MATRIX_2X3:
195  case GCT_MATRIX_2X4:
196  return 8; // 2 float4s
197  case GCT_MATRIX_3X2:
198  case GCT_MATRIX_3X3:
199  case GCT_MATRIX_3X4:
200  return 12; // 3 float4s
201  case GCT_MATRIX_4X2:
202  case GCT_MATRIX_4X3:
203  case GCT_MATRIX_4X4:
204  return 16; // 4 float4s
205  default:
206  return 4;
207  };
208  }
209  else
210  {
211  switch(ctype)
212  {
213  case GCT_FLOAT1:
214  case GCT_INT1:
215  case GCT_SAMPLER1D:
216  case GCT_SAMPLER2D:
217  case GCT_SAMPLER3D:
218  case GCT_SAMPLERCUBE:
219  case GCT_SAMPLER1DSHADOW:
220  case GCT_SAMPLER2DSHADOW:
221  return 1;
222  case GCT_FLOAT2:
223  case GCT_INT2:
224  return 2;
225  case GCT_FLOAT3:
226  case GCT_INT3:
227  return 3;
228  case GCT_FLOAT4:
229  case GCT_INT4:
230  return 4;
231  case GCT_MATRIX_2X2:
232  return 4;
233  case GCT_MATRIX_2X3:
234  case GCT_MATRIX_3X2:
235  return 6;
236  case GCT_MATRIX_2X4:
237  case GCT_MATRIX_4X2:
238  return 8;
239  case GCT_MATRIX_3X3:
240  return 9;
241  case GCT_MATRIX_3X4:
242  case GCT_MATRIX_4X3:
243  return 12;
244  case GCT_MATRIX_4X4:
245  return 16;
246  default:
247  return 4;
248  };
249 
250  }
251  }
252 
254  : constType(GCT_UNKNOWN)
255  , physicalIndex((std::numeric_limits<size_t>::max)())
256  , elementSize(0)
257  , arraySize(1)
258  , variability(GPV_GLOBAL) {}
259  };
262 
265  {
272 
273  GpuNamedConstants() : floatBufferSize(0), intBufferSize(0) {}
274 
286  void generateConstantDefinitionArrayEntries(const String& paramName,
287  const GpuConstantDefinition& baseDef);
288 
290  static bool getGenerateAllConstantDefinitionArrayEntries();
291 
298  static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll);
299 
303  void save(const String& filename) const;
307  void load(DataStreamPtr& stream);
308 
309  protected:
317  };
319 
322  {
323  public:
325  virtual ~GpuNamedConstantsSerializer();
326  void exportNamedConstants(const GpuNamedConstants* pConsts, const String& filename,
327  Endian endianMode = ENDIAN_NATIVE);
328  void importNamedConstants(DataStreamPtr& stream, GpuNamedConstants* pDest);
329  };
330 
335  {
339  size_t currentSize;
342 
344  : physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
345  GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
346  : physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
347  };
351  {
352  OGRE_MUTEX(mutex)
356  size_t bufferSize;
357  GpuLogicalBufferStruct() : bufferSize(0) {}
358  };
360 
371 
388  {
389  protected:
394 
395  // Optional data the rendersystem might want to store
397 
400 
402  unsigned long mVersion;
403 
404  public:
405  GpuSharedParameters(const String& name);
406  virtual ~GpuSharedParameters();
407 
409  const String& getName() { return mName; }
410 
418  void addConstantDefinition(const String& name, GpuConstantType constType, size_t arraySize = 1);
419 
422  void removeConstantDefinition(const String& name);
423 
426  void removeAllConstantDefinitions();
427 
431  unsigned long getVersion() const { return mVersion; }
432 
438  void _markDirty();
440  size_t getFrameLastUpdated() const { return mFrameLastUpdated; }
441 
445  GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
446 
449  const GpuConstantDefinition& getConstantDefinition(const String& name) const;
450 
453  const GpuNamedConstants& getConstantDefinitions() const;
454 
456  void setNamedConstant(const String& name, Real val);
458  void setNamedConstant(const String& name, int val);
460  void setNamedConstant(const String& name, const Vector4& vec);
462  void setNamedConstant(const String& name, const Vector3& vec);
464  void setNamedConstant(const String& name, const Matrix4& m);
466  void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
468  void setNamedConstant(const String& name, const float *val, size_t count);
470  void setNamedConstant(const String& name, const double *val, size_t count);
472  void setNamedConstant(const String& name, const ColourValue& colour);
474  void setNamedConstant(const String& name, const int *val, size_t count);
475 
477  float* getFloatPointer(size_t pos) { _markDirty(); return &mFloatConstants[pos]; }
479  const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
481  int* getIntPointer(size_t pos) { _markDirty(); return &mIntConstants[pos]; }
483  const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
484 
485 
487  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
489  const Any& _getRenderSystemData() const { return mRenderSystemData; }
490 
491  };
492 
495 
496  class GpuProgramParameters;
497 
502  {
503  protected:
505  // Not a shared pointer since this is also parent
507  // list of physical mappings that we are going to bring in
509  {
512  };
514 
516 
517  // Optional data the rendersystem might want to store
519 
521  unsigned long mCopyDataVersion;
522 
523  void initCopyData();
524 
525 
526  public:
529  GpuProgramParameters* params);
530 
538  void _copySharedParamsToTargetParams();
539 
541  const String& getName() const { return mSharedParams->getName(); }
542 
543  GpuSharedParametersPtr getSharedParams() const { return mSharedParams; }
544  GpuProgramParameters* getTargetParams() const { return mParams; }
545 
547  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
549  const Any& _getRenderSystemData() const { return mRenderSystemData; }
550 
551 
552  };
553 
585  {
586  public:
591  {
602 
603 
608 
621 
622 
637 
638 
653 
654 
666 
667 
682 
683 
685 
689 
693 
698 
699 
710 
711 
714 
715 
718 
792 
803 
816 
830 
831 
912 
932 
934 
958 
963 
969 
970 
975 
982 
988 
995 
1012 
1017 
1031  ACT_LIGHT_CUSTOM
1032  };
1033 
1037  enum ACDataType {
1043  ACDT_REAL
1044  };
1045 
1050  ET_REAL
1051  };
1052 
1057  {
1065 
1067  size_t _elementCount, ElementType _elementType,
1068  ACDataType _dataType)
1069  :acType(_acType), name(_name), elementCount(_elementCount),
1070  elementType(_elementType), dataType(_dataType)
1071  {
1072 
1073  }
1074  };
1075 
1078  {
1079  public:
1089  union{
1090  size_t data;
1092  };
1095 
1096  AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData,
1097  uint16 theVariability, size_t theElemCount = 4)
1098  : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1099  data(theData), variability(theVariability) {}
1100 
1101  AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData,
1102  uint16 theVariability, size_t theElemCount = 4)
1103  : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1104  fData(theData), variability(theVariability) {}
1105 
1106  };
1107  // Auto parameter storage
1109 
1111 
1112  protected:
1113  static AutoConstantDefinition AutoConstantDictionary[];
1136 
1139  GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1142  GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1143 
1145  uint16 deriveVariability(AutoConstantType act);
1146 
1147  void copySharedParamSetUsage(const GpuSharedParamUsageList& srcList);
1148 
1150 
1151  // Optional data the rendersystem might want to store
1153 
1154 
1155 
1156  public:
1159 
1163  GpuProgramParameters& operator=(const GpuProgramParameters& oth);
1164 
1166  void _setNamedConstants(const GpuNamedConstantsPtr& constantmap);
1167 
1169  void _setLogicalIndexes(const GpuLogicalBufferStructPtr& floatIndexMap,
1170  const GpuLogicalBufferStructPtr& intIndexMap);
1171 
1172 
1174  bool hasNamedParameters() const { return !mNamedConstants.isNull(); }
1180  bool hasLogicalIndexedParameters() const { return !mFloatLogicalToPhysical.isNull(); }
1181 
1187  void setConstant(size_t index, const Vector4& vec);
1195  void setConstant(size_t index, Real val);
1203  void setConstant(size_t index, const Vector3& vec);
1210  void setConstant(size_t index, const Matrix4& m);
1218  void setConstant(size_t index, const Matrix4* m, size_t numEntries);
1225  void setConstant(size_t index, const float *val, size_t count);
1232  void setConstant(size_t index, const double *val, size_t count);
1238  void setConstant(size_t index, const ColourValue& colour);
1239 
1254  void setConstant(size_t index, const int *val, size_t count);
1255 
1262  void _writeRawConstants(size_t physicalIndex, const float* val, size_t count);
1269  void _writeRawConstants(size_t physicalIndex, const double* val, size_t count);
1276  void _writeRawConstants(size_t physicalIndex, const int* val, size_t count);
1283  void _readRawConstants(size_t physicalIndex, size_t count, float* dest);
1290  void _readRawConstants(size_t physicalIndex, size_t count, int* dest);
1291 
1302  void _writeRawConstant(size_t physicalIndex, const Vector4& vec,
1303  size_t count = 4);
1311  void _writeRawConstant(size_t physicalIndex, Real val);
1319  void _writeRawConstant(size_t physicalIndex, int val);
1327  void _writeRawConstant(size_t physicalIndex, const Vector3& vec);
1336  void _writeRawConstant(size_t physicalIndex, const Matrix4& m, size_t elementCount);
1344  void _writeRawConstant(size_t physicalIndex, const Matrix4* m, size_t numEntries);
1354  void _writeRawConstant(size_t physicalIndex, const ColourValue& colour,
1355  size_t count = 4);
1356 
1357 
1363  GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
1364 
1369  const GpuConstantDefinition& getConstantDefinition(const String& name) const;
1370 
1375  const GpuNamedConstants& getConstantDefinitions() const;
1376 
1382  const GpuLogicalBufferStructPtr& getFloatLogicalBufferStruct() const { return mFloatLogicalToPhysical; }
1383 
1389  size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex);
1395  size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex);
1396 
1402  const GpuLogicalBufferStructPtr& getIntLogicalBufferStruct() const { return mIntLogicalToPhysical; }
1404  const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
1406  float* getFloatPointer(size_t pos) { return &mFloatConstants[pos]; }
1408  const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
1410  const IntConstantList& getIntConstantList() const { return mIntConstants; }
1412  int* getIntPointer(size_t pos) { return &mIntConstants[pos]; }
1414  const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
1416  const AutoConstantList& getAutoConstantList() const { return mAutoConstants; }
1417 
1431  void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
1432  void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData);
1433 
1448  void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
1449 
1453  void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo,
1454  uint16 variability, size_t elementSize = 4);
1458  void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData,
1459  uint16 variability, size_t elementSize = 4);
1460 
1461 
1463  void clearAutoConstant(size_t index);
1464 
1469  void setConstantFromTime(size_t index, Real factor);
1470 
1472  void clearAutoConstants(void);
1475  AutoConstantIterator getAutoConstantIterator(void) const;
1477  size_t getAutoConstantCount(void) const { return mAutoConstants.size(); }
1482  AutoConstantEntry* getAutoConstantEntry(const size_t index);
1484  bool hasAutoConstants(void) const { return !(mAutoConstants.empty()); }
1489  const AutoConstantEntry* findFloatAutoConstantEntry(size_t logicalIndex);
1494  const AutoConstantEntry* findIntAutoConstantEntry(size_t logicalIndex);
1498  const AutoConstantEntry* findAutoConstantEntry(const String& paramName);
1502  const AutoConstantEntry* _findRawAutoConstantEntryFloat(size_t physicalIndex);
1506  const AutoConstantEntry* _findRawAutoConstantEntryInt(size_t physicalIndex);
1507 
1512  void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask);
1513 
1516  void setIgnoreMissingParams(bool state) { mIgnoreMissingParams = state; }
1517 
1537  void setNamedConstant(const String& name, Real val);
1557  void setNamedConstant(const String& name, int val);
1562  void setNamedConstant(const String& name, const Vector4& vec);
1575  void setNamedConstant(const String& name, const Vector3& vec);
1580  void setNamedConstant(const String& name, const Matrix4& m);
1588  void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
1605  void setNamedConstant(const String& name, const float *val, size_t count,
1606  size_t multiple = 4);
1623  void setNamedConstant(const String& name, const double *val, size_t count,
1624  size_t multiple = 4);
1629  void setNamedConstant(const String& name, const ColourValue& colour);
1630 
1647  void setNamedConstant(const String& name, const int *val, size_t count,
1648  size_t multiple = 4);
1649 
1664  void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
1665  void setNamedAutoConstantReal(const String& name, AutoConstantType acType, Real rData);
1666 
1682  void setNamedAutoConstant(const String& name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
1683 
1691  void setNamedConstantFromTime(const String& name, Real factor);
1692 
1694  void clearNamedAutoConstant(const String& name);
1695 
1705  const GpuConstantDefinition* _findNamedConstantDefinition(
1706  const String& name, bool throwExceptionIfMissing = false) const;
1713  size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
1720  size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
1721 
1729  void setTransposeMatrices(bool val) { mTransposeMatrices = val; }
1731  bool getTransposeMatrices(void) const { return mTransposeMatrices; }
1732 
1739  void copyConstantsFrom(const GpuProgramParameters& source);
1740 
1749  void copyMatchingNamedConstantsFrom(const GpuProgramParameters& source);
1750 
1754  static const AutoConstantDefinition* getAutoConstantDefinition(const String& name);
1759  static const AutoConstantDefinition* getAutoConstantDefinition(const size_t idx);
1762  static size_t getNumAutoConstantDefinitions(void);
1763 
1764 
1767  void incPassIterationNumber(void);
1770  { return mActivePassIterationIndex != (std::numeric_limits<size_t>::max)(); }
1773  { return mActivePassIterationIndex; }
1774 
1775 
1781  void addSharedParameters(GpuSharedParametersPtr sharedParams);
1782 
1790  void addSharedParameters(const String& sharedParamsName);
1791 
1793  bool isUsingSharedParameters(const String& sharedParamsName) const;
1794 
1796  void removeSharedParameters(const String& sharedParamsName);
1797 
1799  void removeAllSharedParameters();
1800 
1802  const GpuSharedParamUsageList& getSharedParameters() const;
1803 
1805  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
1807  const Any& _getRenderSystemData() const { return mRenderSystemData; }
1808 
1816  void _copySharedParams();
1817 
1818 
1819 
1820  };
1821 
1824 
1827 }
1828 #endif
1829 
Array of light diffuse colours scaled by light power (count set by extra param)
The derived scene colour, with 'r', 'g' and 'b' components filled with sum of derived ambient light c...
The current view & projection matrices concatenated.
Sine of "Time0_1". Equivalent to RenderMonkey's "SinTime0_1".
static bool isFloat(GpuConstantType c)
size_t intBufferSize
Total size of the int buffer required.
uint16 mCombinedVariability
The combined variability masks of all parameters.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
GpuConstantDefinitionMap map
Map of parameter names to GpuConstantDefinition.
bool mIgnoreMissingParams
flag to indicate if names not found will be ignored
The ambient light colour set in the scene.
The current world matrix, inverted & transposed.
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
unsigned long getVersion() const
Get the version number of this shared parameter set, can be used to identify when changes have occurr...
size_t elementSize
Number of raw buffer slots per element (some programs pack each array element to float4, some do not)
static size_t getElementSize(GpuConstantType ctype, bool padToMultiplesOf4)
Get the element size of a given type, including whether to pad the elements into multiples of 4 (e...
GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
size_t mFrameLastUpdated
Not used when copying data, but might be useful to RS using shared buffers.
Structure recording the use of a physical buffer by a logical parameter index.
size_t mActivePassIterationIndex
physical index for active pass iteration parameter real constant entry;
float Real
Software floating point type.
This variable provides the view side vector (world space).
Array of light attenuation parameters, Vector4(range, constant, linear, quadric) (count set by extra ...
#define _OgreExport
Definition: OgrePlatform.h:203
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
size_t elementCount
The number of elements per individual entry in this constant Used in case people used packed elements...
This variable represents 1.0/ViewportHeight.
Provides information about the depth range of the scene as viewed from the current camera...
Single float value, which represents scaled time value [0..1], which repeats itself based on given as...
Variant type that can hold Any other type.
Definition: OgreAny.h:56
Cosine of "Time0_1". Equivalent to RenderMonkey's "CosTime0_1".
size_t logicalIndex
Logical index - used to communicate this constant to the rendersystem.
A light position in object space (index determined by setAutoConstant call)
Array of view/projection matrices of the first n texture projection frustums.
Provides transpose of concatenated view and projection matrices.
This variable provides the far clip distance as a floating point value.
size_t getAutoConstantCount(void) const
Gets the number of int constants that have been set.
Generic class for serialising data to / from binary stream-based files.
The current world & view matrices concatenated, then inverted & transposed.
Fog params: density, linear start, linear end, 1/(end-start)
Array of distances of the lights from the center of the object a useful approximation as an alternati...
The distance of the light from the center of the object a useful approximation as an alternative to p...
float * getFloatPointer(size_t pos)
Get a pointer to the 'nth' item in the float buffer.
GpuParamVariability
The variability of a GPU parameter, as derived from auto-params targetting it.
Array of derived light specular colours (count set by extra param)
Class representing colour.
A custom parameter which will come from the renderable, using 'data' as the identifier.
size_t floatBufferSize
Total size of the float buffer required.
IntConstantList mIntConstants
Packed list of integer constants (physical indexing)
Provides the fixed shadow colour as configured via SceneManager::setShadowColour; useful for integrat...
The view/projection matrix of the assigned texture projection frustum, combined with the current worl...
A light position in view space (index determined by setAutoConstant call)
The current camera's position in object space.
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
Provides the position of the LOD camera in world space, allowing you to perform separate LOD calculat...
vector< GpuSharedParametersUsage >::type GpuSharedParamUsageList
void setTransposeMatrices(bool val)
Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
AutoConstantType paramType
The type of parameter.
Array of light directions in world space (count set by extra param)
const GpuConstantDefinition * srcDefinition
SharedPtr< GpuProgramParameters > GpuProgramParametersSharedPtr
Shared pointer used to hold references to GpuProgramParameters instances.
Surface specular colour, as set in Pass::setSpecular.
Single float value, which repeats itself based on given as parameter "cycle time".
#define OGRE_MUTEX(name)
Surface shininess, as set in Pass::setShininess.
Provides inverse of concatenated view and projection matrices.
A group of manually updated parameters that are shared between many parameter sets.
GpuSharedParametersPtr getSharedParams() const
The view/projection matrix of a given spotlight projection frustum, combined with the current world m...
static bool msGenerateAllConstantDefinitionArrayEntries
Indicates whether all array entries will be generated and added to the definitions map...
size_t physicalIndex
Physical start index in buffer (either float or int buffer)
AutoConstantList mAutoConstants
List of automatically updated parameters.
const GpuConstantDefinition * dstDefinition
bool getTransposeMatrices(void) const
Gets whether or not matrices are to be transposed when set.
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
This variable provides the view up vector (world space).
The distance a shadow volume should be extruded when using finite extrusion programs.
ACDataType
Defines the type of the extra data item used by the auto constant.
Provides texture size of the texture unit (index determined by setAutoConstant call).
A light position in world space (index determined by setAutoConstant call)
GpuSharedParametersPtr mSharedParams
GpuConstantType constType
Data type.
Surface ambient colour, as set in Pass::setAmbient.
uint16 variability
The variability of this parameter (see GpuParamVariability)
The derived light specular colour (index determined by setAutoConstant call), with 'r'...
Array of light specular colours scaled by light power (count set by extra param)
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param) ...
bool mTransposeMatrices
Do we need to transpose matrices?
Sine of "Time0_2PI". Equivalent to RenderMonkey's "SinTime0_2PI".
The current array of world matrices, used for blending.
A light direction in object space (index determined by setAutoConstant call)
Provides inverse of concatenated world, view and projection matrices.
Structure recording the use of an automatic parameter.
Array of view/projection matrix of a given spotlight.
This variable provides the near clip distance as a floating point value.
GpuSharedParamUsageList mSharedParamSets
Provides the texel offsets required by this rendersystem to map texels to pixels. ...
provides the calculated frames per second, returned as a floating point value.
The view/projection matrix of the assigned texture projection frustum.
AutoConstantType
Defines the types of automatically updated values that may be bound to GpuProgram parameters...
vector< AutoConstantEntry >::type AutoConstantList
The derived light diffuse colour (index determined by setAutoConstant call), with 'r'...
Array of light specular colours (count set by extra param)
bool hasNamedParameters() const
Does this parameter set include named parameters?
Array of light power levels, a single scalar as set in Light::setPowerScale (count set by extra param...
Cosine of "Time0_X". Equivalent to RenderMonkey's "CosTime0_X".
map< size_t, GpuLogicalIndexUse >::type GpuLogicalIndexUseMap
Vector of "Time0_X", "SinTime0_X", "CosTime0_X", "TanTime0_X".
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
provides the current iteration number of the pass.
size_t currentSize
Current physical size allocation.
Light power level, a single scalar as set in Light::setPowerScale (index determined by setAutoConstan...
ConstVectorIterator< AutoConstantList > AutoConstantIterator
static bool isSampler(GpuConstantType c)
bool hasLogicalIndexedParameters() const
Does this parameter set include logically indexed parameters?
vector< CopyDataEntry >::type CopyDataList
size_t physicalIndex
Physical buffer index.
const AutoConstantList & getAutoConstantList() const
Get a reference to the list of auto constant bindings.
Structure defining an auto constant that's available for use in a parameters object.
GpuLogicalBufferStructPtr mIntLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
Container struct to allow params to safely & update shared list of logical buffer assignments...
Struct collecting together the information for named constants.
Endian
The endianness of written files.
Concrete IteratorWrapper for const access to the underlying container.
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.
Tangent of "Time0_1". Equivalent to RenderMonkey's "TanTime0_1".
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, uint16 theVariability, size_t theElemCount=4)
SharedPtr< GpuNamedConstants > GpuNamedConstantsPtr
This variable represents 1.0/ViewportWidth.
float * getFloatPointer(size_t pos)
Get a pointer to the 'nth' item in the float buffer.
uint16 variability
How this parameter varies (bitwise combination of GpuProgramVariability)
Surface emissive colour, as set in Pass::setSelfIllumination.
the auto constant requires data of type int
Full mask (16-bit)
Array of light diffuse colours (count set by extra param)
Provides transpose of concatenated world and view matrices.
The current world & view matrices concatenated, then inverted.
const String & getName()
Get the name of this shared parameter set.
The derived ambient light colour, with 'r', 'g', 'b' components filled with product of surface ambien...
The view/projection matrix of a given spotlight.
GpuProgramParameters * getTargetParams() const
uint16 variability
How the contents of this slot vary.
void setIgnoreMissingParams(bool state)
Tells the program whether to ignore missing parameters or not.
Array of light positions in world space (count set by extra param)
Light specular colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call) ...
Light diffuse colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call) ...
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Provides information about the depth range of the scene as viewed from a given shadow camera...
bool hasAutoConstants(void) const
Returns true if this instance has any automatic constants.
Varies per object (based on an auto param usually), but not per light setup.
Light specular colour (index determined by setAutoConstant call)
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
Varies with pass iteration number.
-1 if the winding has been inverted (e.g.
This variable provides the field of view as a floating point value.
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
Surface diffuse colour, as set in Pass::setDiffuse.
Array of world/view/projection matrices of the first n texture projection frustums.
Light attenuation parameters, Vector4(range, constant, linear, quadric)
const GpuLogicalBufferStructPtr & getFloatLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
Cosine of "Time0_2PI". Equivalent to RenderMonkey's "CosTime0_2PI".
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
Sine of "Time0_X". Equivalent to RenderMonkey's "SinTime0_X".
No variation except by manual setting - the default.
SharedPtr< GpuLogicalBufferStruct > GpuLogicalBufferStructPtr
Array of light directions in view space (count set by extra param)
const String & getName() const
Get the name of the shared parameter set.
unsigned long mCopyDataVersion
Version of shared params we based the copydata on.
Packed of "ViewportWidth", "ViewportHeight", "ViewportWidthInverse", "ViewportHeightInverse".
AutoConstantDefinition(AutoConstantType _acType, const String &_name, size_t _elementCount, ElementType _elementType, ACDataType _dataType)
map< String, GpuConstantDefinition >::type GpuConstantDefinitionMap
provides current elapsed time
Array of light positions in object space (count set by extra param)
size_t data
Concrete IteratorWrapper for const access to the underlying key-value container.
size_t arraySize
Length of array.
Single float value, which represents scaled time value [0..2*Pi], which repeats itself based on given...
A light direction in world space (index determined by setAutoConstant call)
provides the pass index number within the technique of the active materil.
Provides the position of the LOD camera in object space, allowing you to perform separate LOD calcula...
Provides the current transform matrix of the texture unit (index determined by setAutoConstant call)...
vector< int >::type IntConstantList
Definition of container that holds the current float constants.
size_t getFrameLastUpdated() const
Get the frame in which this shared parameter set was last updated.
The current array of world matrices, as a 3x4 matrix, used for blending.
The number of active light sources (better than gl_MaxLights)
AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData, uint16 theVariability, size_t theElemCount=4)
GpuNamedConstantsPtr mNamedConstants
Mapping from parameter names to def - high-level programs are expected to populate this...
Information about predefined program constants.
Vector of "Time0_1", "SinTime0_1", "CosTime0_1", "TanTime0_1".
_StringBase String
SharedPtr< GpuSharedParameters > GpuSharedParametersPtr
Shared pointer used to hold references to GpuProgramParameters instances.
Provides packed texture size of the texture unit (index determined by setAutoConstant call)...
size_t getPassIterationNumberIndex() const
Get the physical buffer index of the pass iteration number constant.
vector< float >::type FloatConstantList
Definition of container that holds the current float constants.
unsigned long mVersion
Version number of the definitions in this buffer.
ConstMapIterator< GpuConstantDefinitionMap > GpuConstantDefinitionIterator
ACDataType dataType
The type of any extra data.
unsigned short uint16
Definition: OgrePlatform.h:247
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45
ElementType
Defines the base element type of the auto constant.
provides the scaled frame time, returned as a floating point value.
Provides a parametric animation value [0..1], only available where the renderable specifically implem...
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
GpuLogicalBufferStructPtr mFloatLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
bool hasPassIterationNumber() const
Does this parameters object have a pass iteration number constant?
Provides transpose of concatenated world, view and projection matrices.
Tangent of "Time0_2PI". Equivalent to RenderMonkey's "TanTime0_2PI".
Real fData
Array of light directions in object space (count set by extra param)
Tangent of "Time0_X". Equivalent to RenderMonkey's "TanTime0_X".
ElementType elementType
The type of the constant in the program.
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
Array of light positions in view space (count set by extra param)
Light diffuse colour (index determined by setAutoConstant call)
size_t physicalIndex
The target (physical) constant index.
Spotlight parameters, Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and outerFactor ...
Varies with light setup.
Provides inverse texture size of the texture unit (index determined by setAutoConstant call)...
This class records the usage of a set of shared parameters in a concrete set of GpuProgramParameters...
Provides inverse transpose of concatenated world, view and projection matrices.
A light direction in view space (index determined by setAutoConstant call)
The absolute light number of a local light index.
const int * getIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the int buffer.
The current camera's position in world space.
The current world & view matrices concatenated.
Array of derived light diffuse colours (count set by extra param)
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
This utility class is used to hold the information used to generate the matrices and other informatio...
Simple class for loading / saving GpuNamedConstants.
const int * getIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the int buffer.
FloatConstantList mFloatConstants
Packed list of floating-point constants (physical indexing)
const GpuLogicalBufferStructPtr & getIntLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
Spotlight parameters array of Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and oute...
Vector of "Time0_2PI", "SinTime0_2PI", "CosTime0_2PI", "TanTime0_2PI".
Current viewport height (in pixels) as floating point value.
Provides inverse transpose of concatenated view and projection matrices.