OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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-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 __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 "OgreAny.h"
38 #include "OgreHeaderPrefix.h"
39 
40 namespace Ogre {
41 
50  {
51  BCT_FLOAT = 1,
52  BCT_INT = 2,
54  BCT_UINT = 4,
55  BCT_BOOL = 5,
59  };
60 
67  {
89  GCT_INT1 = 22,
90  GCT_INT2 = 23,
91  GCT_INT3 = 24,
92  GCT_INT4 = 25,
107  GCT_UINT1 = 40,
108  GCT_UINT2 = 41,
109  GCT_UINT3 = 42,
110  GCT_UINT4 = 43,
111  GCT_BOOL1 = 44,
112  GCT_BOOL2 = 45,
113  GCT_BOOL3 = 46,
114  GCT_BOOL4 = 47,
119  GCT_SAMPLER_STATE = 52, //only for hlsl 4.0
121  };
122 
127  {
136 
137 
139  GPV_ALL = 0xFFFF
140  };
141 
147  {
153  size_t logicalIndex;
156  size_t elementSize;
158  size_t arraySize;
161 
162  //TODO Should offset be added to list?
163  // For instance, for GLSL atomic counters:
164  // layout(binding = 1, offset = 10) atomic_uint atom_counter;
165  // Binding goes in logicalIndex, but where does offset go?
166  //size_t offset;
167 
168  bool isFloat() const
169  {
170  return isFloat(constType);
171  }
172 
173  static bool isFloat(GpuConstantType c)
174  {
175  switch(c)
176  {
177  case GCT_FLOAT1:
178  case GCT_FLOAT2:
179  case GCT_FLOAT3:
180  case GCT_FLOAT4:
181  case GCT_MATRIX_2X2:
182  case GCT_MATRIX_2X3:
183  case GCT_MATRIX_2X4:
184  case GCT_MATRIX_3X2:
185  case GCT_MATRIX_3X3:
186  case GCT_MATRIX_3X4:
187  case GCT_MATRIX_4X2:
188  case GCT_MATRIX_4X3:
189  case GCT_MATRIX_4X4:
190  return true;
191  default:
192  return false;
193  };
194  }
195 
196  bool isDouble() const
197  {
198  return isDouble(constType);
199  }
200 
201  static bool isDouble(GpuConstantType c)
202  {
203  switch(c)
204  {
205  case GCT_DOUBLE1:
206  case GCT_DOUBLE2:
207  case GCT_DOUBLE3:
208  case GCT_DOUBLE4:
218  return true;
219  default:
220  return false;
221  };
222  }
223 
224  bool isInt() const
225  {
226  return isInt(constType);
227  }
228 
229  static bool isInt(GpuConstantType c)
230  {
231  switch(c)
232  {
233  case GCT_INT1:
234  case GCT_INT2:
235  case GCT_INT3:
236  case GCT_INT4:
237  return true;
238  default:
239  return false;
240  };
241  }
242 
243  bool isUnsignedInt() const
244  {
245  return isUnsignedInt(constType);
246  }
247 
249  {
250  switch(c)
251  {
252  case GCT_UINT1:
253  case GCT_UINT2:
254  case GCT_UINT3:
255  case GCT_UINT4:
256  return true;
257  default:
258  return false;
259  };
260  }
261 
262  bool isBool() const
263  {
264  return isBool(constType);
265  }
266 
267  static bool isBool(GpuConstantType c)
268  {
269  switch(c)
270  {
271  case GCT_BOOL1:
272  case GCT_BOOL2:
273  case GCT_BOOL3:
274  case GCT_BOOL4:
275  return true;
276  default:
277  return false;
278  };
279  }
280 
281  bool isSampler() const
282  {
283  return isSampler(constType);
284  }
285 
286  static bool isSampler(GpuConstantType c)
287  {
288  switch(c)
289  {
290  case GCT_SAMPLER1D:
291  case GCT_SAMPLER2D:
292  case GCT_SAMPLER2DARRAY:
293  case GCT_SAMPLER3D:
294  case GCT_SAMPLERCUBE:
295  case GCT_SAMPLER1DSHADOW:
296  case GCT_SAMPLER2DSHADOW:
297  return true;
298  default:
299  return false;
300  };
301 
302  }
303 
304  bool isSubroutine() const
305  {
306  return isSubroutine(constType);
307  }
308 
310  {
311  return c == GCT_SUBROUTINE;
312  }
313 
315  {
316  if (isFloat(ctype))
317  return BCT_FLOAT;
318  else if (isDouble(ctype))
319  return BCT_DOUBLE;
320  else if (isInt(ctype))
321  return BCT_INT;
322  else if (isUnsignedInt(ctype))
323  return BCT_UINT;
324  else if (isBool(ctype))
325  return BCT_BOOL;
326  else if (isSampler(ctype))
327  return BCT_SAMPLER;
328  else if (isSubroutine(ctype))
329  return BCT_SUBROUTINE;
330  else
331  return BCT_UNKNOWN;
332  }
333 
337  static size_t getElementSize(GpuConstantType ctype, bool padToMultiplesOf4)
338  {
339  if (padToMultiplesOf4)
340  {
341  switch(ctype)
342  {
343  case GCT_FLOAT1:
344  case GCT_INT1:
345  case GCT_UINT1:
346  case GCT_BOOL1:
347  case GCT_SAMPLER1D:
348  case GCT_SAMPLER2D:
349  case GCT_SAMPLER2DARRAY:
350  case GCT_SAMPLER3D:
351  case GCT_SAMPLERCUBE:
352  case GCT_SAMPLER1DSHADOW:
353  case GCT_SAMPLER2DSHADOW:
354  case GCT_FLOAT2:
355  case GCT_INT2:
356  case GCT_UINT2:
357  case GCT_BOOL2:
358  case GCT_FLOAT3:
359  case GCT_INT3:
360  case GCT_UINT3:
361  case GCT_BOOL3:
362  case GCT_FLOAT4:
363  case GCT_INT4:
364  case GCT_UINT4:
365  case GCT_BOOL4:
366  return 4;
367  case GCT_MATRIX_2X2:
368  case GCT_MATRIX_2X3:
369  case GCT_MATRIX_2X4:
370  case GCT_DOUBLE1:
371  case GCT_DOUBLE2:
372  case GCT_DOUBLE3:
373  case GCT_DOUBLE4:
374  return 8; // 2 float4s
375  case GCT_MATRIX_3X2:
376  case GCT_MATRIX_3X3:
377  case GCT_MATRIX_3X4:
378  return 12; // 3 float4s
379  case GCT_MATRIX_4X2:
380  case GCT_MATRIX_4X3:
381  case GCT_MATRIX_4X4:
385  return 16; // 4 float4s
389  return 24;
393  return 32;
394  default:
395  return 4;
396  };
397  }
398  else
399  {
400  switch(ctype)
401  {
402  case GCT_INT1:
403  case GCT_FLOAT1:
404  case GCT_DOUBLE1:
405  case GCT_UINT1:
406  case GCT_BOOL1:
407  case GCT_SAMPLER1D:
408  case GCT_SAMPLER2D:
409  case GCT_SAMPLER2DARRAY:
410  case GCT_SAMPLER3D:
411  case GCT_SAMPLERCUBE:
412  case GCT_SAMPLER1DSHADOW:
413  case GCT_SAMPLER2DSHADOW:
414  return 1;
415  case GCT_FLOAT2:
416  case GCT_INT2:
417  case GCT_DOUBLE2:
418  case GCT_UINT2:
419  case GCT_BOOL2:
420  return 2;
421  case GCT_FLOAT3:
422  case GCT_INT3:
423  case GCT_DOUBLE3:
424  case GCT_UINT3:
425  case GCT_BOOL3:
426  return 3;
427  case GCT_FLOAT4:
428  case GCT_INT4:
429  case GCT_DOUBLE4:
430  case GCT_UINT4:
431  case GCT_BOOL4:
432  return 4;
433  case GCT_MATRIX_2X2:
435  return 4;
436  case GCT_MATRIX_2X3:
437  case GCT_MATRIX_3X2:
440  return 6;
441  case GCT_MATRIX_2X4:
442  case GCT_MATRIX_4X2:
445  return 8;
446  case GCT_MATRIX_3X3:
448  return 9;
449  case GCT_MATRIX_3X4:
450  case GCT_MATRIX_4X3:
453  return 12;
454  case GCT_MATRIX_4X4:
456  return 16;
457  default:
458  return 4;
459  };
460 
461  }
462  }
463 
465  : constType(GCT_UNKNOWN)
466  , physicalIndex((std::numeric_limits<size_t>::max)())
467  , logicalIndex(0)
468  , elementSize(0)
469  , arraySize(1)
470  , variability(GPV_GLOBAL) {}
471  };
474 
477  {
487  // size_t boolBufferSize;
490 
491  GpuNamedConstants() : floatBufferSize(0), doubleBufferSize(0),
492  intBufferSize(0), uintBufferSize(0) { } //boolBufferSize(0) {}
493 
505  void generateConstantDefinitionArrayEntries(const String& paramName,
506  const GpuConstantDefinition& baseDef);
507 
509  static bool getGenerateAllConstantDefinitionArrayEntries();
510 
517  static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll);
518 
522  void save(const String& filename) const;
526  void load(DataStreamPtr& stream);
527 
528  size_t calculateSize(void) const;
529 
530  protected:
538  };
539 
542  {
543  public:
545  virtual ~GpuNamedConstantsSerializer();
546  void exportNamedConstants(const GpuNamedConstants* pConsts, const String& filename,
547  Endian endianMode = ENDIAN_NATIVE);
548  void exportNamedConstants(const GpuNamedConstants* pConsts, DataStreamPtr stream,
549  Endian endianMode = ENDIAN_NATIVE);
550  void importNamedConstants(DataStreamPtr& stream, GpuNamedConstants* pDest);
551  };
552 
557  {
561  size_t currentSize;
564 
566  : physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
567  GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
568  : physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
569  };
573  {
574  OGRE_MUTEX(mutex);
575 
579  size_t bufferSize;
580  GpuLogicalBufferStruct() : bufferSize(0) {}
581  };
582 
607  //FIXME What is best container for bool in C++? Apparently not vector,
608  // since it stores bool as bitfield which is slow and awkward.
609  // typedef vector<bool>::type BoolConstantList;
610  // typedef deque<bool>::type BoolConstantList;
611 
628  {
629  protected:
632 
635 
644  // BoolConstantList mBoolConstants;
645 
648 
651 
653  unsigned long mVersion;
654 
655  bool mDirty;
656 
657  public:
658  GpuSharedParameters(const String& name);
659  virtual ~GpuSharedParameters();
660 
662  const String& getName() { return mName; }
663 
671  void addConstantDefinition(const String& name, GpuConstantType constType, size_t arraySize = 1);
672 
675  void removeConstantDefinition(const String& name);
676 
679  void removeAllConstantDefinitions();
680 
684  unsigned long getVersion() const { return mVersion; }
685 
689  size_t calculateSize(void) const;
690 
694  bool isDirty() const { return mDirty; }
695 
702  void _markClean();
703 
711  void _markDirty();
712 
714  size_t getFrameLastUpdated() const { return mFrameLastUpdated; }
715 
719  GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
720 
723  const GpuConstantDefinition& getConstantDefinition(const String& name) const;
724 
727  const GpuNamedConstants& getConstantDefinitions() const;
728 
730  void setNamedConstant(const String& name, Real val);
732  void setNamedConstant(const String& name, int val);
734  void setNamedConstant(const String& name, uint val);
735  // /** @copydoc GpuProgramParameters::setNamedConstant(const String& name, bool val) */
736  // void setNamedConstant(const String& name, bool val);
738  void setNamedConstant(const String& name, const Vector4& vec);
740  void setNamedConstant(const String& name, const Vector3& vec);
742  void setNamedConstant(const String& name, const Vector2& vec);
744  void setNamedConstant(const String& name, const Matrix4& m);
746  void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
748  void setNamedConstant(const String& name, const float *val, size_t count);
750  void setNamedConstant(const String& name, const double *val, size_t count);
752  void setNamedConstant(const String& name, const ColourValue& colour);
754  void setNamedConstant(const String& name, const int *val, size_t count);
756  void setNamedConstant(const String& name, const uint *val, size_t count);
757  // /** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const bool *val, size_t count) */
758  // void setNamedConstant(const String& name, const bool *val, size_t count);
759 
761  float* getFloatPointer(size_t pos) { _markDirty(); return &mFloatConstants[pos]; }
763  const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
765  double* getDoublePointer(size_t pos) { _markDirty(); return &mDoubleConstants[pos]; }
767  const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
769  int* getIntPointer(size_t pos) { _markDirty(); return &mIntConstants[pos]; }
771  const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
773  uint* getUnsignedIntPointer(size_t pos) { _markDirty(); return &mUnsignedIntConstants[pos]; }
775  const uint* getUnsignedIntPointer(size_t pos) const { return &mUnsignedIntConstants[pos]; }
776  // /// Get a pointer to the 'nth' item in the bool buffer
777  // bool* getBoolPointer(size_t pos) { _markDirty(); return &mBoolConstants[pos]; }
778  // /// Get a pointer to the 'nth' item in the bool buffer
779  // const bool* getBoolPointer(size_t pos) const { return &mBoolConstants[pos]; }
780 
782  const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
784  const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
786  const IntConstantList& getIntConstantList() const { return mIntConstants; }
788  const UnsignedIntConstantList& getUnsignedIntConstantList() const { return mUnsignedIntConstants; }
789  // /// Get a reference to the list of bool constants
790  // const BoolConstantList& getBoolConstantList() const { return mBoolConstants; }
791 
793  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
795  const Any& _getRenderSystemData() const { return mRenderSystemData; }
796 
797  };
798 
799  class GpuProgramParameters;
800 
805  {
806  protected:
808  // Not a shared pointer since this is also parent
810  // list of physical mappings that we are going to bring in
812  {
815  };
817 
819 
820  // Optional data the rendersystem might want to store
822 
824  unsigned long mCopyDataVersion;
825 
826  void initCopyData();
827 
828 
829  public:
832  GpuProgramParameters* params);
833 
841  void _copySharedParamsToTargetParams();
842 
844  const String& getName() const { return mSharedParams->getName(); }
845 
846  GpuSharedParametersPtr getSharedParams() const { return mSharedParams; }
847  GpuProgramParameters* getTargetParams() const { return mParams; }
848 
850  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
852  const Any& _getRenderSystemData() const { return mRenderSystemData; }
853 
854 
855  };
856 
888  {
889  public:
894  {
905 
914 
927 
928 
943 
944 
959 
960 
972 
973 
988 
989 
991 
995 
999 
1004 
1005 
1018 
1019 
1022 
1023 
1026 
1100 
1111 
1124 
1133 
1134 
1219 
1239 
1241 
1265 
1270 
1276 
1277 
1282 
1289 
1295 
1302 
1309 
1326 
1331 
1346 
1351 
1352  ACT_UNKNOWN = 999
1353  };
1354 
1358  enum ACDataType {
1364  ACDT_REAL
1365  // /// the auto constant requires data of type unsigned int
1366  // ACDT_UINT,
1367  // /// the auto constant requires data of type bool
1368  // ACDT_BOOL
1369  };
1370 
1375  // float or double, depending on 64-bit compiler flag
1376  ET_REAL
1377  // ET_UINT,
1378  // ET_BOOL
1379  };
1380 
1385  {
1393 
1395  size_t _elementCount, ElementType _elementType,
1396  ACDataType _dataType)
1397  :acType(_acType), name(_name), elementCount(_elementCount),
1398  elementType(_elementType), dataType(_dataType)
1399  {
1400 
1401  }
1402  };
1403 
1406  {
1407  public:
1417  union{
1418  size_t data;
1420  };
1423 
1424  AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData,
1425  uint16 theVariability, size_t theElemCount = 4)
1426  : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1427  data(theData), variability(theVariability) {}
1428 
1429  AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData,
1430  uint16 theVariability, size_t theElemCount = 4)
1431  : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1432  fData(theData), variability(theVariability) {}
1433 
1434  };
1435  // Auto parameter storage
1437 
1439 
1440  // Map that store subroutines associated with slots
1441  typedef HashMap<unsigned int, String> SubroutineMap;
1442  typedef HashMap<unsigned int, String>::const_iterator SubroutineIterator;
1443 
1444  protected:
1446 
1447  static AutoConstantDefinition AutoConstantDictionary[];
1448 
1457  // /// Packed list of boolean constants (physical indexing)
1458  // BoolConstantList mBoolConstants;
1476  GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1479  GpuLogicalIndexUse* _getDoubleConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1482  GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1485  GpuLogicalIndexUse* _getUnsignedIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1488  // GpuLogicalIndexUse* _getBoolConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1489 
1502 
1504  uint16 deriveVariability(AutoConstantType act);
1505 
1506  void copySharedParamSetUsage(const GpuSharedParamUsageList& srcList);
1507 
1509 
1510  // Optional data the rendersystem might want to store
1512 
1513 
1514  public:
1517 
1521  GpuProgramParameters& operator=(const GpuProgramParameters& oth);
1522 
1524  void _setNamedConstants(const GpuNamedConstantsPtr& constantmap);
1525 
1527  void _setLogicalIndexes(const GpuLogicalBufferStructPtr& floatIndexMap, const GpuLogicalBufferStructPtr& doubleIndexMap,
1528  const GpuLogicalBufferStructPtr& intIndexMap, const GpuLogicalBufferStructPtr& uintIndexMap,
1529  const GpuLogicalBufferStructPtr& boolIndexMap);
1530 
1531 
1533  bool hasNamedParameters() const { return !mNamedConstants.isNull(); }
1539  bool hasLogicalIndexedParameters() const { return !mFloatLogicalToPhysical.isNull(); }
1540 
1546  void setConstant(size_t index, const Vector4& vec);
1554  void setConstant(size_t index, Real val);
1562  void setConstant(size_t index, const Vector3& vec);
1570  void setConstant(size_t index, const Vector2& vec);
1577  void setConstant(size_t index, const Matrix4& m);
1585  void setConstant(size_t index, const Matrix4* m, size_t numEntries);
1591  void setConstant(size_t index, const ColourValue& colour);
1598  void setConstant(size_t index, const float *val, size_t count);
1605  void setConstant(size_t index, const double *val, size_t count);
1620  void setConstant(size_t index, const int *val, size_t count);
1635  void setConstant(size_t index, const uint *val, size_t count);
1650  void setConstant(size_t index, const bool *val, size_t count);
1651 
1658  void _writeRawConstants(size_t physicalIndex, const float* val, size_t count);
1665  void _writeRawConstants(size_t physicalIndex, const double* val, size_t count);
1672  void _writeRawConstants(size_t physicalIndex, const int* val, size_t count);
1679  void _writeRawConstants(size_t physicalIndex, const uint* val, size_t count);
1680  // /** Write a series of boolean values into the underlying integer
1681  // constant buffer at the given physical index.
1682  // @param physicalIndex The buffer position to start writing
1683  // @param val Pointer to a list of values to write
1684  // @param count The number of ints to write
1685  // */
1686  // void _writeRawConstants(size_t physicalIndex, const bool* val, size_t count);
1693  void _readRawConstants(size_t physicalIndex, size_t count, float* dest);
1700  void _readRawConstants(size_t physicalIndex, size_t count, int* dest);
1701 
1712  void _writeRawConstant(size_t physicalIndex, const Vector4& vec,
1713  size_t count = 4);
1721  void _writeRawConstant(size_t physicalIndex, Real val);
1729  void _writeRawConstant(size_t physicalIndex, Real val, size_t count);
1737  void _writeRawConstant(size_t physicalIndex, int val);
1745  void _writeRawConstant(size_t physicalIndex, uint val);
1753  void _writeRawConstant(size_t physicalIndex, bool val);
1761  void _writeRawConstant(size_t physicalIndex, const Vector3& vec);
1769  void _writeRawConstant(size_t physicalIndex, const Vector2& vec);
1778  void _writeRawConstant(size_t physicalIndex, const Matrix4& m, size_t elementCount);
1786  void _writeRawConstant(size_t physicalIndex, const Matrix4* m, size_t numEntries);
1796  void _writeRawConstant(size_t physicalIndex, const ColourValue& colour,
1797  size_t count = 4);
1798 
1799 
1805  GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
1806 
1811  const GpuConstantDefinition& getConstantDefinition(const String& name) const;
1812 
1817  const GpuNamedConstants& getConstantDefinitions() const;
1818 
1824  const GpuLogicalBufferStructPtr& getFloatLogicalBufferStruct() const { return mFloatLogicalToPhysical; }
1830  const GpuLogicalBufferStructPtr& getDoubleLogicalBufferStruct() const { return mDoubleLogicalToPhysical; }
1836  const GpuLogicalBufferStructPtr& getIntLogicalBufferStruct() const { return mIntLogicalToPhysical; }
1842  const GpuLogicalBufferStructPtr& getUnsignedIntLogicalBufferStruct() const { return mUnsignedIntLogicalToPhysical; }
1848  const GpuLogicalBufferStructPtr& getBoolLogicalBufferStruct() const { return mBoolLogicalToPhysical; }
1849 
1855  size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex);
1861  size_t getDoubleLogicalIndexForPhysicalIndex(size_t physicalIndex);
1867  size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex);
1873  size_t getUnsignedIntLogicalIndexForPhysicalIndex(size_t physicalIndex);
1879  size_t getBoolLogicalIndexForPhysicalIndex(size_t physicalIndex);
1880 
1881 
1883  const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
1885  float* getFloatPointer(size_t pos) { return &mFloatConstants[pos]; }
1887  const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
1889  const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
1891  double* getDoublePointer(size_t pos) { return &mDoubleConstants[pos]; }
1893  const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
1895  const IntConstantList& getIntConstantList() const { return mIntConstants; }
1897  int* getIntPointer(size_t pos) { return &mIntConstants[pos]; }
1899  const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
1901  const UnsignedIntConstantList& getUnsignedIntConstantList() const { return mUnsignedIntConstants; }
1903  uint* getUnsignedIntPointer(size_t pos) { return &mUnsignedIntConstants[pos]; }
1905  const uint* getUnsignedIntPointer(size_t pos) const { return &mUnsignedIntConstants[pos]; }
1906  // /// Get a reference to the list of bool constants
1907  // const BoolConstantList& getBoolConstantList() const { return mBoolConstants; }
1908  // /// Get a pointer to the 'nth' item in the bool buffer
1909  // bool* getBoolPointer(size_t pos) { return &mBoolConstants[pos]; }
1910  // /// Get a pointer to the 'nth' item in the bool buffer
1911  // const bool* getBoolPointer(size_t pos) const { return &mBoolConstants[pos]; }
1912 
1914  const AutoConstantList& getAutoConstantList() const { return mAutoConstants; }
1915 
1929  void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
1930  void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData);
1931 
1946  void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
1947 
1951  void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo,
1952  uint16 variability, size_t elementSize = 4);
1956  void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData,
1957  uint16 variability, size_t elementSize = 4);
1958 
1959 
1961  void clearAutoConstant(size_t index);
1962 
1967  void setConstantFromTime(size_t index, Real factor);
1968 
1970  void clearAutoConstants(void);
1973  AutoConstantIterator getAutoConstantIterator(void) const;
1975  size_t getAutoConstantCount(void) const { return mAutoConstants.size(); }
1980  AutoConstantEntry* getAutoConstantEntry(const size_t index);
1982  bool hasAutoConstants(void) const { return !(mAutoConstants.empty()); }
1987  const AutoConstantEntry* findFloatAutoConstantEntry(size_t logicalIndex);
1992  const AutoConstantEntry* findDoubleAutoConstantEntry(size_t logicalIndex);
1997  const AutoConstantEntry* findIntAutoConstantEntry(size_t logicalIndex);
2002  const AutoConstantEntry* findUnsignedIntAutoConstantEntry(size_t logicalIndex);
2003  // /** Finds an auto constant that's affecting a given logical parameter
2004  // index for boolean values.
2005  // @note Only applicable for low-level programs.
2006  // */
2007  // const AutoConstantEntry* findBoolAutoConstantEntry(size_t logicalIndex);
2011  const AutoConstantEntry* findAutoConstantEntry(const String& paramName);
2015  const AutoConstantEntry* _findRawAutoConstantEntryFloat(size_t physicalIndex);
2019  const AutoConstantEntry* _findRawAutoConstantEntryDouble(size_t physicalIndex);
2023  const AutoConstantEntry* _findRawAutoConstantEntryInt(size_t physicalIndex);
2027  const AutoConstantEntry* _findRawAutoConstantEntryUnsignedInt(size_t physicalIndex);
2031  const AutoConstantEntry* _findRawAutoConstantEntryBool(size_t physicalIndex);
2032 
2037  void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask);
2038 
2041  void setIgnoreMissingParams(bool state) { mIgnoreMissingParams = state; }
2042 
2062  void setNamedConstant(const String& name, Real val);
2082  void setNamedConstant(const String& name, int val);
2102  void setNamedConstant(const String& name, uint val);
2103  // /** Sets a single value constant boolean parameter to the program.
2104  // @remarks
2105  // Different types of GPU programs support different types of constant parameters.
2106  // For example, it's relatively common to find that vertex programs only support
2107  // floating point constants, and that fragment programs only support integer (fixed point)
2108  // parameters. This can vary depending on the program version supported by the
2109  // graphics card being used. You should consult the documentation for the type of
2110  // low level program you are using, or alternatively use the methods
2111  // provided on RenderSystemCapabilities to determine the options.
2112  // @par
2113  // Another possible limitation is that some systems only allow constants to be set
2114  // on certain boundaries, e.g. in sets of 4 values for example. Again, see
2115  // RenderSystemCapabilities for full details.
2116  // @note
2117  // This named option will only work if you are using a parameters object created
2118  // from a high-level program (HighLevelGpuProgram).
2119  // @param name The name of the parameter
2120  // @param val The value to set
2121  // */
2122  // void setNamedConstant(const String& name, bool val);
2127  void setNamedConstant(const String& name, const Vector4& vec);
2140  void setNamedConstant(const String& name, const Vector3& vec);
2145  void setNamedConstant(const String& name, const Vector2& vec);
2150  void setNamedConstant(const String& name, const Matrix4& m);
2158  void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
2163  void setNamedConstant(const String& name, const ColourValue& colour);
2180  void setNamedConstant(const String& name, const float *val, size_t count,
2181  size_t multiple = 4);
2198  void setNamedConstant(const String& name, const double *val, size_t count,
2199  size_t multiple = 4);
2216  void setNamedConstant(const String& name, const int *val, size_t count,
2217  size_t multiple = 4);
2234  void setNamedConstant(const String& name, const uint *val, size_t count,
2235  size_t multiple = 4);
2236  // /** Sets a multiple value constant boolean parameter to the program.
2237  // @par
2238  // Some systems only allow constants to be set on certain boundaries,
2239  // e.g. in sets of 4 values for example. The 'multiple' parameter allows
2240  // you to control that although you should only change it if you know
2241  // your chosen language supports that (at the time of writing, only
2242  // GLSL allows constants which are not a multiple of 4).
2243  // @note
2244  // This named option will only work if you are using a parameters object created
2245  // from a high-level program (HighLevelGpuProgram).
2246  // @param name The name of the parameter
2247  // @param val Pointer to the values to write
2248  // @param count The number of 'multiples' of floats to write
2249  // @param multiple The number of raw entries in each element to write,
2250  // the default is 4 so count = 1 would write 4 floats.
2251  // */
2252  // void setNamedConstant(const String& name, const bool *val, size_t count,
2253  // size_t multiple = 4);
2268  void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
2269  void setNamedAutoConstantReal(const String& name, AutoConstantType acType, Real rData);
2270 
2286  void setNamedAutoConstant(const String& name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
2287 
2295  void setNamedConstantFromTime(const String& name, Real factor);
2296 
2298  void clearNamedAutoConstant(const String& name);
2299 
2309  const GpuConstantDefinition* _findNamedConstantDefinition(
2310  const String& name, bool throwExceptionIfMissing = false) const;
2317  size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
2324  size_t _getDoubleConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
2331  size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
2338  size_t _getUnsignedIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
2345  //size_t _getBoolConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
2346 
2354  void setTransposeMatrices(bool val) { mTransposeMatrices = val; }
2356  bool getTransposeMatrices(void) const { return mTransposeMatrices; }
2357 
2364  void copyConstantsFrom(const GpuProgramParameters& source);
2365 
2374  void copyMatchingNamedConstantsFrom(const GpuProgramParameters& source);
2375 
2379  static const AutoConstantDefinition* getAutoConstantDefinition(const String& name);
2384  static const AutoConstantDefinition* getAutoConstantDefinition(const size_t idx);
2387  static size_t getNumAutoConstantDefinitions(void);
2388 
2389 
2392  void incPassIterationNumber(void);
2395  { return mActivePassIterationIndex != (std::numeric_limits<size_t>::max)(); }
2398  { return mActivePassIterationIndex; }
2399 
2400 
2406  void addSharedParameters(GpuSharedParametersPtr sharedParams);
2407 
2415  void addSharedParameters(const String& sharedParamsName);
2416 
2418  bool isUsingSharedParameters(const String& sharedParamsName) const;
2419 
2421  void removeSharedParameters(const String& sharedParamsName);
2422 
2424  void removeAllSharedParameters();
2425 
2427  const GpuSharedParamUsageList& getSharedParameters() const;
2428 
2430  void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
2432  const Any& _getRenderSystemData() const { return mRenderSystemData; }
2433 
2441  void _copySharedParams();
2442 
2443  size_t calculateSize(void) const;
2444 
2447  void setNamedSubroutine(const String& subroutineSlot, const String& subroutine);
2448 
2451  void setSubroutine(size_t index, const String& subroutine);
2452 
2455  const SubroutineMap& getSubroutineMap() const { return mSubroutineMap; }
2456  };
2457 
2460 }
2461 
2462 #include "OgreHeaderSuffix.h"
2463 
2464 #endif
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".
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
static bool isFloat(GpuConstantType c)
const double * getDoublePointer(size_t pos) const
Get a pointer to the 'nth' item in the double buffer.
size_t intBufferSize
Total size of the int buffer required.
An array of the view/projection matrix of a given spotlight projection frustum, combined with the cur...
uint16 mCombinedVariability
The combined variability masks of all parameters.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
GpuConstantDefinitionMap map
Total size of the bool buffer required.
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;
HashMap< unsigned int, String >::const_iterator SubroutineIterator
float Real
Software floating point type.
This variable provides the view side vector (world space).
const GpuLogicalBufferStructPtr & getUnsignedIntLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
Array of light attenuation parameters, Vector4(range, constant, linear, quadric) (count set by extra ...
#define _OgreExport
Definition: OgrePlatform.h:255
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:54
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.
HashMap< unsigned int, String > SubroutineMap
Provides transpose of concatenated view and projection matrices.
const GpuLogicalBufferStructPtr & getBoolLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
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.
#define OGRE_MUTEX(name)
const float & max(const float &a, const float &b)
Definition: OgreCommon.h:851
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...
const UnsignedIntConstantList & getUnsignedIntConstantList() const
Get a reference to the list of uint constants.
Surface alpha rejection value, not as set in Pass::setAlphaRejectionValue, but a floating number betw...
The distance of the light from the center of the object a useful approximation as an alternative to p...
float * getFloatPointer(size_t pos)
GpuParamVariability
The variability of a GPU parameter, as derived from auto-params targeting it.
Array of derived light specular colours (count set by extra param)
Any mRenderSystemData
Optional data the rendersystem might want to store.
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 SubroutineMap & getSubroutineMap() const
Get map with.
uint * getUnsignedIntPointer(size_t pos)
Get a pointer to the 'nth' item in the uint buffer.
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...
GpuLogicalIndexUseMap map
Map from logical index to physical buffer location.
vector< GpuSharedParametersUsage >::type GpuSharedParamUsageList
void setTransposeMatrices(bool val)
Gets the physical buffer index associated with a logical bool constant index.
AutoConstantType paramType
The type of parameter.
Array of light directions in world space (count set by extra param)
const GpuConstantDefinition * srcDefinition
Surface specular colour, as set in Pass::setSpecular.
Single float value, which repeats itself based on given as parameter "cycle time".
DoubleConstantList mDoubleConstants
List of double constants values.
Surface shininess, as set in Pass::setShininess.
Provides inverse of concatenated view and projection matrices.
Definition of container that holds the current bool constants.
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, double, int, or uint 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.
static bool isSubroutine(GpuConstantType c)
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)
GpuLogicalBufferStructPtr mUnsignedIntLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
GpuSharedParametersPtr mSharedParams
vector< uint >::type UnsignedIntConstantList
Definition of container that holds the current uint constants.
GpuConstantType constType
Data type.
const uint * getUnsignedIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the uint buffer.
Provides an array of information about the depth range of the scene as viewed from a given shadow cam...
Surface ambient colour, as set in Pass::setAmbient.
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
uint * getUnsignedIntPointer(size_t pos)
Get a pointer to the 'nth' item in the uint buffer.
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?
String mName
Name of the shared parameter set.
Sine of "Time0_2PI". Equivalent to RenderMonkey's "SinTime0_2PI".
The current array of world matrices, used for blending.
Array of PSSM split points (pixel depth must be lower) in projection space.
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.
bool isDirty() const
True if this parameter set is dirty (values have been modified, but the render system has not updated...
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...
static bool isUnsignedInt(GpuConstantType c)
Binds custom per-light constants to the shaders.
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?
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
Array of light power levels, a single scalar as set in Light::setPowerScale (count set by extra param...
const UnsignedIntConstantList & getUnsignedIntConstantList() const
Get a reference to the list of uint constants.
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...
size_t bufferSize
Shortcut to know the buffer size needs.
size_t doubleBufferSize
Total size of the double buffer required.
ConstVectorIterator< AutoConstantList > AutoConstantIterator
static bool isSampler(GpuConstantType c)
static BaseConstantType getBaseType(GpuConstantType ctype)
bool hasLogicalIndexedParameters() const
Does this parameter set include logically indexed parameters?
vector< CopyDataEntry >::type CopyDataList
static bool isBool(GpuConstantType c)
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.
UnsignedIntConstantList mUnsignedIntConstants
List of unsigned int constant values.
Concrete IteratorWrapper for const access to the underlying container.
static bool isDouble(GpuConstantType c)
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".
Standard 2-dimensional vector.
Definition: OgreVector2.h:51
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)
const uint * getUnsignedIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the uint buffer.
This variable represents 1.0/ViewportWidth.
const GpuLogicalBufferStructPtr & getDoubleLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
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 array of world matrices transformed to an array of dual quaternions, represented as a 2x4...
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)
The scale and shear components of the current array of world matrices.
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:50
GpuLogicalBufferStructPtr mBoolLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
DoubleConstantList mDoubleConstants
Packed list of double-point constants (physical indexing)
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.
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
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.
UnsignedIntConstantList mUnsignedIntConstants
Packed list of unsigned integer constants (physical indexing)
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.
FloatConstantList mFloatConstants
List of float constant values.
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 int constants.
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param) ...
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
Gets the physical buffer index associated with a logical bool constant index.
Information about predefined program constants.
Vector of "Time0_1", "SinTime0_1", "CosTime0_1", "TanTime0_1".
_StringBase String
Definition: OgreCommon.h:53
size_t uintBufferSize
Total size of the uint buffer required.
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.
GpuNamedConstants mNamedConstants
Shared parameter definitions and related data.
unsigned short uint16
Definition: OgrePlatform.h:421
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...
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
vector< double >::type DoubleConstantList
Definition of container that holds the current double constants.
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)
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
GpuLogicalBufferStructPtr mDoubleLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
Tangent of "Time0_X". Equivalent to RenderMonkey's "TanTime0_X".
ElementType elementType
The type of the constant in the program.
const double * getDoublePointer(size_t pos) const
Get a pointer to the 'nth' item in the double buffer.
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.
static bool isInt(GpuConstantType c)
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)
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.
unsigned int uint
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.
IntConstantList mIntConstants
List of int constant values.
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.