OGRE  1.9.0
OgreGpuProgramParams.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __GpuProgramParams_H_
29#define __GpuProgramParams_H_
30
31// Precompiler options
32#include "OgrePrerequisites.h"
33#include "OgreSharedPtr.h"
35#include "OgreSerializer.h"
36#include "OgreRenderOperation.h"
37#include "OgreAny.h"
39#include "OgreHeaderPrefix.h"
40
41namespace Ogre {
42
97
117
123 {
134 size_t arraySize;
137
138 bool isFloat() const
139 {
140 return isFloat(constType);
141 }
142
144 {
145 switch(c)
146 {
147 case GCT_INT1:
148 case GCT_INT2:
149 case GCT_INT3:
150 case GCT_INT4:
151 case GCT_SAMPLER1D:
152 case GCT_SAMPLER2D:
154 case GCT_SAMPLER3D:
155 case GCT_SAMPLERCUBE:
158 return false;
159 default:
160 return true;
161 };
162
163 }
164
165 bool isDouble() const
166 {
167 return isDouble(constType);
168 }
169
171 {
172 switch(c)
173 {
174 case GCT_INT1:
175 case GCT_INT2:
176 case GCT_INT3:
177 case GCT_INT4:
178 case GCT_FLOAT1:
179 case GCT_FLOAT2:
180 case GCT_FLOAT3:
181 case GCT_FLOAT4:
182 case GCT_SAMPLER1D:
183 case GCT_SAMPLER2D:
185 case GCT_SAMPLER3D:
186 case GCT_SAMPLERCUBE:
189 return false;
190 default:
191 return true;
192 };
193
194 }
195
196 bool isSampler() const
197 {
198 return isSampler(constType);
199 }
200
202 {
203 switch(c)
204 {
205 case GCT_SAMPLER1D:
206 case GCT_SAMPLER2D:
208 case GCT_SAMPLER3D:
209 case GCT_SAMPLERCUBE:
212 return true;
213 default:
214 return false;
215 };
216
217 }
218
219 bool isSubroutine() const
220 {
221 return isSubroutine(constType);
222 }
223
225 {
226 return c == GCT_SUBROUTINE;
227 }
228
232 static size_t getElementSize(GpuConstantType ctype, bool padToMultiplesOf4)
233 {
234 if (padToMultiplesOf4)
235 {
236 switch(ctype)
237 {
238 case GCT_FLOAT1:
239 case GCT_INT1:
240 case GCT_SAMPLER1D:
241 case GCT_SAMPLER2D:
243 case GCT_SAMPLER3D:
244 case GCT_SAMPLERCUBE:
247 case GCT_FLOAT2:
248 case GCT_INT2:
249 case GCT_FLOAT3:
250 case GCT_INT3:
251 case GCT_FLOAT4:
252 case GCT_INT4:
253 return 4;
254 case GCT_MATRIX_2X2:
255 case GCT_MATRIX_2X3:
256 case GCT_MATRIX_2X4:
257 case GCT_DOUBLE1:
258 case GCT_DOUBLE2:
259 case GCT_DOUBLE3:
260 case GCT_DOUBLE4:
261 return 8; // 2 float4s
262 case GCT_MATRIX_3X2:
263 case GCT_MATRIX_3X3:
264 case GCT_MATRIX_3X4:
265 return 12; // 3 float4s
266 case GCT_MATRIX_4X2:
267 case GCT_MATRIX_4X3:
268 case GCT_MATRIX_4X4:
272 return 16; // 4 float4s
276 return 24;
280 return 32;
281 default:
282 return 4;
283 };
284 }
285 else
286 {
287 switch(ctype)
288 {
289 case GCT_FLOAT1:
290 case GCT_DOUBLE1:
291 case GCT_INT1:
292 case GCT_SAMPLER1D:
293 case GCT_SAMPLER2D:
295 case GCT_SAMPLER3D:
296 case GCT_SAMPLERCUBE:
299 return 1;
300 case GCT_FLOAT2:
301 case GCT_INT2:
302 case GCT_DOUBLE2:
303 return 2;
304 case GCT_FLOAT3:
305 case GCT_INT3:
306 case GCT_DOUBLE3:
307 return 3;
308 case GCT_FLOAT4:
309 case GCT_INT4:
310 case GCT_DOUBLE4:
311 return 4;
312 case GCT_MATRIX_2X2:
314 return 4;
315 case GCT_MATRIX_2X3:
316 case GCT_MATRIX_3X2:
319 return 6;
320 case GCT_MATRIX_2X4:
321 case GCT_MATRIX_4X2:
324 return 8;
325 case GCT_MATRIX_3X3:
327 return 9;
328 case GCT_MATRIX_3X4:
329 case GCT_MATRIX_4X3:
332 return 12;
333 case GCT_MATRIX_4X4:
335 return 16;
336 default:
337 return 4;
338 };
339
340 }
341 }
342
344 : constType(GCT_UNKNOWN)
345 , physicalIndex((std::numeric_limits<size_t>::max)())
346 , logicalIndex(0)
347 , elementSize(0)
348 , arraySize(1)
349 , variability(GPV_GLOBAL) {}
350 };
353
356 {
365
366 GpuNamedConstants() : floatBufferSize(0), doubleBufferSize(0), intBufferSize(0) {}
367
380 const GpuConstantDefinition& baseDef);
381
384
391 static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll);
392
396 void save(const String& filename) const;
400 void load(DataStreamPtr& stream);
401
402 size_t calculateSize(void) const;
403
404 protected:
412 };
414
417 {
418 public:
421 void exportNamedConstants(const GpuNamedConstants* pConsts, const String& filename,
422 Endian endianMode = ENDIAN_NATIVE);
424 Endian endianMode = ENDIAN_NATIVE);
426 };
427
432 {
439
441 : physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
442 GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
443 : physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
444 };
458
474
491 {
492 protected:
498
499 // Optional data the rendersystem might want to store
501
504
506 unsigned long mVersion;
507
508 public:
511
513 const String& getName() { return mName; }
514
522 void addConstantDefinition(const String& name, GpuConstantType constType, size_t arraySize = 1);
523
527
531
535 unsigned long getVersion() const { return mVersion; }
536
537 size_t calculateSize(void) const;
538
546 size_t getFrameLastUpdated() const { return mFrameLastUpdated; }
547
552
556
560
562 void setNamedConstant(const String& name, Real val);
564 void setNamedConstant(const String& name, int val);
566 void setNamedConstant(const String& name, const Vector4& vec);
568 void setNamedConstant(const String& name, const Vector3& vec);
570 void setNamedConstant(const String& name, const Vector2& vec);
572 void setNamedConstant(const String& name, const Matrix4& m);
574 void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
576 void setNamedConstant(const String& name, const float *val, size_t count);
578 void setNamedConstant(const String& name, const double *val, size_t count);
580 void setNamedConstant(const String& name, const ColourValue& colour);
582 void setNamedConstant(const String& name, const int *val, size_t count);
583
585 float* getFloatPointer(size_t pos) { _markDirty(); return &mFloatConstants[pos]; }
587 const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
589 double* getDoublePointer(size_t pos) { _markDirty(); return &mDoubleConstants[pos]; }
591 const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
593 int* getIntPointer(size_t pos) { _markDirty(); return &mIntConstants[pos]; }
595 const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
596
598 const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
600 const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
602 const IntConstantList& getIntConstantList() const { return mIntConstants; }
603
605 void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
607 const Any& _getRenderSystemData() const { return mRenderSystemData; }
608
609 };
610
613
615
620 {
621 protected:
623 // Not a shared pointer since this is also parent
625 // list of physical mappings that we are going to bring in
632
634
635 // Optional data the rendersystem might want to store
637
639 unsigned long mCopyDataVersion;
640
642
643
644 public:
647 GpuProgramParameters* params);
648
657
659 const String& getName() const { return mSharedParams->getName(); }
660
661 GpuSharedParametersPtr getSharedParams() const { return mSharedParams; }
662 GpuProgramParameters* getTargetParams() const { return mParams; }
663
665 void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
667 const Any& _getRenderSystemData() const { return mRenderSystemData; }
668
669
670 };
671
703 {
704 public:
709 {
720
729
742
743
758
759
774
775
787
788
803
804
806
810
814
819
820
833
834
837
838
841
915
926
939
955
956
1041
1061
1063
1087
1092
1098
1099
1104
1111
1117
1124
1131
1148
1153
1168
1169 ACT_UNKNOWN = 999
1171
1183
1188 ET_REAL
1190
1195 {
1203
1205 size_t _elementCount, ElementType _elementType,
1206 ACDataType _dataType)
1207 :acType(_acType), name(_name), elementCount(_elementCount),
1208 elementType(_elementType), dataType(_dataType)
1209 {
1210
1211 }
1212 };
1213
1216 {
1217 public:
1227 union{
1228 size_t data;
1230 };
1233
1234 AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData,
1235 uint16 theVariability, size_t theElemCount = 4)
1236 : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1237 data(theData), variability(theVariability) {}
1238
1239 AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData,
1240 uint16 theVariability, size_t theElemCount = 4)
1241 : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1242 fData(theData), variability(theVariability) {}
1243
1244 };
1245 // Auto parameter storage
1247
1249
1250 // Map that store subroutines associated with slots
1252 typedef HashMap<unsigned int, String>::const_iterator SubroutineIterator;
1253
1254 protected:
1256
1257 static AutoConstantDefinition AutoConstantDictionary[];
1285
1288 GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1291 GpuLogicalIndexUse* _getDoubleConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1294 GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
1295
1298
1300
1302
1303 // Optional data the rendersystem might want to store
1305
1306
1307
1308 public:
1311
1316
1319
1321 void _setLogicalIndexes(const GpuLogicalBufferStructPtr& floatIndexMap, const GpuLogicalBufferStructPtr& doubleIndexMap,
1322 const GpuLogicalBufferStructPtr& intIndexMap);
1323
1324
1326 bool hasNamedParameters() const { return !mNamedConstants.isNull(); }
1332 bool hasLogicalIndexedParameters() const { return !mFloatLogicalToPhysical.isNull(); }
1333
1339 void setConstant(size_t index, const Vector4& vec);
1347 void setConstant(size_t index, Real val);
1355 void setConstant(size_t index, const Vector3& vec);
1363 void setConstant(size_t index, const Vector2& vec);
1370 void setConstant(size_t index, const Matrix4& m);
1378 void setConstant(size_t index, const Matrix4* m, size_t numEntries);
1385 void setConstant(size_t index, const float *val, size_t count);
1392 void setConstant(size_t index, const double *val, size_t count);
1398 void setConstant(size_t index, const ColourValue& colour);
1399
1414 void setConstant(size_t index, const int *val, size_t count);
1415
1422 void _writeRawConstants(size_t physicalIndex, const float* val, size_t count);
1429 void _writeRawConstants(size_t physicalIndex, const double* val, size_t count);
1436 void _writeRawConstants(size_t physicalIndex, const int* val, size_t count);
1443 void _readRawConstants(size_t physicalIndex, size_t count, float* dest);
1450 void _readRawConstants(size_t physicalIndex, size_t count, int* dest);
1451
1462 void _writeRawConstant(size_t physicalIndex, const Vector4& vec,
1463 size_t count = 4);
1471 void _writeRawConstant(size_t physicalIndex, Real val);
1479 void _writeRawConstant(size_t physicalIndex, Real val, size_t count);
1487 void _writeRawConstant(size_t physicalIndex, int val);
1495 void _writeRawConstant(size_t physicalIndex, const Vector3& vec);
1503 void _writeRawConstant(size_t physicalIndex, const Vector2& vec);
1512 void _writeRawConstant(size_t physicalIndex, const Matrix4& m, size_t elementCount);
1520 void _writeRawConstant(size_t physicalIndex, const Matrix4* m, size_t numEntries);
1530 void _writeRawConstant(size_t physicalIndex, const ColourValue& colour,
1531 size_t count = 4);
1532
1533
1540
1546
1552
1558 const GpuLogicalBufferStructPtr& getFloatLogicalBufferStruct() const { return mFloatLogicalToPhysical; }
1559
1565 size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex);
1576 const GpuLogicalBufferStructPtr& getDoubleLogicalBufferStruct() const { return mDoubleLogicalToPhysical; }
1577
1583 size_t getDoubleLogicalIndexForPhysicalIndex(size_t physicalIndex);
1589 size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex);
1590
1596 const GpuLogicalBufferStructPtr& getIntLogicalBufferStruct() const { return mIntLogicalToPhysical; }
1598 const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
1600 float* getFloatPointer(size_t pos) { return &mFloatConstants[pos]; }
1602 const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
1604 const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
1606 double* getDoublePointer(size_t pos) { return &mDoubleConstants[pos]; }
1608 const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
1610 const IntConstantList& getIntConstantList() const { return mIntConstants; }
1612 int* getIntPointer(size_t pos) { return &mIntConstants[pos]; }
1614 const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
1616 const AutoConstantList& getAutoConstantList() const { return mAutoConstants; }
1617
1631 void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
1632 void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData);
1633
1648 void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
1649
1653 void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo,
1654 uint16 variability, size_t elementSize = 4);
1658 void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData,
1659 uint16 variability, size_t elementSize = 4);
1660
1661
1663 void clearAutoConstant(size_t index);
1664
1669 void setConstantFromTime(size_t index, Real factor);
1670
1677 size_t getAutoConstantCount(void) const { return mAutoConstants.size(); }
1684 bool hasAutoConstants(void) const { return !(mAutoConstants.empty()); }
1699 const AutoConstantEntry* findIntAutoConstantEntry(size_t logicalIndex);
1716
1721 void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask);
1722
1725 void setIgnoreMissingParams(bool state) { mIgnoreMissingParams = state; }
1726
1746 void setNamedConstant(const String& name, Real val);
1766 void setNamedConstant(const String& name, int val);
1771 void setNamedConstant(const String& name, const Vector4& vec);
1779 void setNamedConstant(const String& name, const Vector3& vec);
1784 void setNamedConstant(const String& name, const Vector2& vec);
1789 void setNamedConstant(const String& name, const Matrix4& m);
1797 void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
1814 void setNamedConstant(const String& name, const float *val, size_t count,
1815 size_t multiple = 4);
1832 void setNamedConstant(const String& name, const double *val, size_t count,
1833 size_t multiple = 4);
1838 void setNamedConstant(const String& name, const ColourValue& colour);
1839
1856 void setNamedConstant(const String& name, const int *val, size_t count,
1857 size_t multiple = 4);
1858
1873 void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
1874 void setNamedAutoConstantReal(const String& name, AutoConstantType acType, Real rData);
1875
1891 void setNamedAutoConstant(const String& name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
1892
1900 void setNamedConstantFromTime(const String& name, Real factor);
1901
1904
1915 const String& name, bool throwExceptionIfMissing = false) const;
1922 size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
1929 size_t _getDoubleConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
1936 size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
1937
1945 void setTransposeMatrices(bool val) { mTransposeMatrices = val; }
1947 bool getTransposeMatrices(void) const { return mTransposeMatrices; }
1948
1956
1966
1975 static const AutoConstantDefinition* getAutoConstantDefinition(const size_t idx);
1979
1980
1986 { return mActivePassIterationIndex != (std::numeric_limits<size_t>::max)(); }
1989 { return mActivePassIterationIndex; }
1990
1991
1998
2006 void addSharedParameters(const String& sharedParamsName);
2007
2009 bool isUsingSharedParameters(const String& sharedParamsName) const;
2010
2012 void removeSharedParameters(const String& sharedParamsName);
2013
2016
2019
2021 void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
2023 const Any& _getRenderSystemData() const { return mRenderSystemData; }
2024
2033
2034 size_t calculateSize(void) const;
2035
2038 void setNamedSubroutine(const String& subroutineSlot, const String& subroutine);
2039
2042 void setSubroutine(size_t index, const String& subroutine);
2043
2046 const SubroutineMap& getSubroutineMap() const { return mSubroutineMap; }
2047 };
2048
2051
2054}
2055
2056#include "OgreHeaderSuffix.h"
2057
2058#endif
2059
#define _OgreExport
#define HashMap
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Variant type that can hold Any other type.
Definition OgreAny.h:57
This utility class is used to hold the information used to generate the matrices and other informatio...
Class representing colour.
Concrete IteratorWrapper for const access to the underlying key-value container.
Concrete IteratorWrapper for const access to the underlying container.
Simple class for loading / saving GpuNamedConstants.
void exportNamedConstants(const GpuNamedConstants *pConsts, const String &filename, Endian endianMode=ENDIAN_NATIVE)
void importNamedConstants(DataStreamPtr &stream, GpuNamedConstants *pDest)
void exportNamedConstants(const GpuNamedConstants *pConsts, DataStreamPtr stream, Endian endianMode=ENDIAN_NATIVE)
Structure recording the use of an automatic parameter.
AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, uint16 theVariability, size_t theElemCount=4)
uint16 variability
The variability of this parameter (see GpuParamVariability)
size_t elementCount
The number of elements per individual entry in this constant Used in case people used packed elements...
AutoConstantType paramType
The type of parameter.
AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData, uint16 theVariability, size_t theElemCount=4)
size_t physicalIndex
The target (physical) constant index.
Collects together the program parameters used for a GpuProgram.
GpuLogicalIndexUse * _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the low-level structure for a logical index.
GpuLogicalIndexUse * _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical int constant index.
const AutoConstantEntry * _findRawAutoConstantEntryFloat(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the floating-point buffer.
size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the float buffer, for programs which supp...
const AutoConstantList & getAutoConstantList() const
Get a reference to the list of auto constant bindings.
void setConstant(size_t index, const int *val, size_t count)
Sets a multiple value constant integer parameter to the program.
void copyConstantsFrom(const GpuProgramParameters &source)
Copies the values of all constants (including auto constants) from another GpuProgramParameters objec...
static size_t getNumAutoConstantDefinitions(void)
Returns the number of auto constant definitions.
void setConstant(size_t index, Real val)
Sets a single floating-point parameter to the program.
void setNamedAutoConstant(const String &name, AutoConstantType acType, size_t extraInfo=0)
Sets up a constant which will automatically be updated by the system.
GpuLogicalBufferStructPtr mIntLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
ConstVectorIterator< AutoConstantList > AutoConstantIterator
AutoConstantType
Defines the types of automatically updated values that may be bound to GpuProgram parameters,...
@ ACT_TRANSPOSE_VIEW_MATRIX
Provides transpose of view matrix.
@ ACT_SHADOW_SCENE_DEPTH_RANGE_ARRAY
Provides an array of information about the depth range of the scene as viewed from a given shadow cam...
@ ACT_DERIVED_LIGHT_DIFFUSE_COLOUR_ARRAY
Array of derived light diffuse colours (count set by extra param)
@ ACT_SPOTLIGHT_PARAMS
Spotlight parameters, Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and outerFactor ...
@ ACT_SPOTLIGHT_VIEWPROJ_MATRIX
The view/projection matrix of a given spotlight.
@ ACT_TIME_0_X
Single float value, which repeats itself based on given as parameter "cycle time".
@ ACT_TANTIME_0_1
Tangent of "Time0_1". Equivalent to RenderMonkey's "TanTime0_1".
@ ACT_VIEWPORT_HEIGHT
Current viewport height (in pixels) as floating point value.
@ ACT_LIGHT_SPECULAR_COLOUR
Light specular colour (index determined by setAutoConstant call)
@ ACT_SINTIME_0_2PI
Sine of "Time0_2PI". Equivalent to RenderMonkey's "SinTime0_2PI".
@ ACT_TIME_0_1
Single float value, which represents scaled time value [0..1], which repeats itself based on given as...
@ ACT_CAMERA_POSITION
The current camera's position in world space.
@ ACT_LIGHT_ATTENUATION
Light attenuation parameters, Vector4(range, constant, linear, quadric)
@ ACT_LIGHT_POWER_SCALE
Light power level, a single scalar as set in Light::setPowerScale (index determined by setAutoConstan...
@ ACT_CUSTOM
A custom parameter which will come from the renderable, using 'data' as the identifier.
@ ACT_INVERSE_TRANSPOSE_WORLD_MATRIX
The current world matrix, inverted & transposed.
@ ACT_SPOTLIGHT_PARAMS_ARRAY
Spotlight parameters array of Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and oute...
@ ACT_VIEWPORT_WIDTH
viewport-related values
@ ACT_INVERSE_TRANSPOSE_WORLDVIEWPROJ_MATRIX
Provides inverse transpose of concatenated world, view and projection matrices.
@ ACT_LIGHT_DIFFUSE_COLOUR_ARRAY
Array of light diffuse colours (count set by extra param)
@ ACT_WORLD_MATRIX_ARRAY_3x4
The current array of world matrices, as a 3x4 matrix, used for blending.
@ ACT_INVERSE_VIEWPORT_WIDTH
This variable represents 1.0/ViewportWidth.
@ ACT_TRANSPOSE_PROJECTION_MATRIX
Provides transpose of projection matrix.
@ ACT_VIEW_UP_VECTOR
This variable provides the view up vector (world space).
@ ACT_TANTIME_0_2PI
Tangent of "Time0_2PI". Equivalent to RenderMonkey's "TanTime0_2PI".
@ ACT_INVERSE_VIEWPROJ_MATRIX
Provides inverse of concatenated view and projection matrices.
@ ACT_NEAR_CLIP_DISTANCE
This variable provides the near clip distance as a floating point value.
@ ACT_TEXTURE_MATRIX
Provides the current transform matrix of the texture unit (index determined by setAutoConstant call),...
@ ACT_TEXTURE_WORLDVIEWPROJ_MATRIX
The view/projection matrix of the assigned texture projection frustum, combined with the current worl...
@ ACT_LIGHT_CASTS_SHADOWS_ARRAY
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param)
@ ACT_LIGHT_DIRECTION_ARRAY
Array of light directions in world space (count set by extra param)
@ ACT_LIGHT_DISTANCE_OBJECT_SPACE
The distance of the light from the center of the object a useful approximation as an alternative to p...
@ ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY
Array of view/projection matrix of a given spotlight.
@ ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED
Light specular colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
@ ACT_SURFACE_ALPHA_REJECTION_VALUE
Surface alpha rejection value, not as set in Pass::setAlphaRejectionValue, but a floating number betw...
@ ACT_TIME
provides current elapsed time
@ ACT_LIGHT_DIRECTION_OBJECT_SPACE_ARRAY
Array of light directions in object space (count set by extra param)
@ ACT_TANTIME_0_X
Tangent of "Time0_X". Equivalent to RenderMonkey's "TanTime0_X".
@ ACT_LIGHT_POSITION_OBJECT_SPACE_ARRAY
Array of light positions in object space (count set by extra param)
@ ACT_AMBIENT_LIGHT_COLOUR
The ambient light colour set in the scene.
@ ACT_TEXTURE_SIZE
Provides texture size of the texture unit (index determined by setAutoConstant call).
@ ACT_LIGHT_DIRECTION_OBJECT_SPACE
A light direction in object space (index determined by setAutoConstant call)
@ ACT_INVERSE_TEXTURE_SIZE
Provides inverse texture size of the texture unit (index determined by setAutoConstant call).
@ ACT_INVERSE_TRANSPOSE_VIEW_MATRIX
Provides inverse transpose of view matrix.
@ ACT_PASS_NUMBER
provides the pass index number within the technique of the active materil.
@ ACT_TRANSPOSE_WORLDVIEW_MATRIX
Provides transpose of concatenated world and view matrices.
@ ACT_LIGHT_DISTANCE_OBJECT_SPACE_ARRAY
Array of distances of the lights from the center of the object a useful approximation as an alternati...
@ ACT_WORLD_MATRIX
The current world matrix.
@ ACT_VIEWPROJ_MATRIX
The current view & projection matrices concatenated.
@ ACT_TEXEL_OFFSETS
Provides the texel offsets required by this rendersystem to map texels to pixels.
@ ACT_DERIVED_LIGHT_SPECULAR_COLOUR_ARRAY
Array of derived light specular colours (count set by extra param)
@ ACT_LIGHT_DIFFUSE_COLOUR
Light diffuse colour (index determined by setAutoConstant call)
@ ACT_SURFACE_SPECULAR_COLOUR
Surface specular colour, as set in Pass::setSpecular.
@ ACT_INVERSE_WORLD_MATRIX
The current world matrix, inverted.
@ ACT_TIME_0_X_PACKED
Vector of "Time0_X", "SinTime0_X", "CosTime0_X", "TanTime0_X".
@ ACT_TRANSPOSE_WORLD_MATRIX
Provides transpose of world matrix.
@ ACT_LOD_CAMERA_POSITION
Provides the position of the LOD camera in world space, allowing you to perform separate LOD calculat...
@ ACT_LIGHT_POSITION_OBJECT_SPACE
A light position in object space (index determined by setAutoConstant call)
@ ACT_RENDER_TARGET_FLIPPING
render target related values
@ ACT_LIGHT_POSITION_VIEW_SPACE
A light position in view space (index determined by setAutoConstant call)
@ ACT_TIME_0_2PI
Single float value, which represents scaled time value [0..2*Pi], which repeats itself based on given...
@ ACT_INVERSE_VIEW_MATRIX
The current view matrix, inverted.
@ ACT_LIGHT_POSITION_VIEW_SPACE_ARRAY
Array of light positions in view space (count set by extra param)
@ ACT_COSTIME_0_1
Cosine of "Time0_1". Equivalent to RenderMonkey's "CosTime0_1".
@ ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED_ARRAY
Array of light diffuse colours scaled by light power (count set by extra param)
@ ACT_LIGHT_CUSTOM
Binds custom per-light constants to the shaders.
@ ACT_FAR_CLIP_DISTANCE
This variable provides the far clip distance as a floating point value.
@ ACT_DERIVED_AMBIENT_LIGHT_COLOUR
The derived ambient light colour, with 'r', 'g', 'b' components filled with product of surface ambien...
@ ACT_FOG_PARAMS
Fog params: density, linear start, linear end, 1/(end-start)
@ ACT_TEXTURE_WORLDVIEWPROJ_MATRIX_ARRAY
Array of world/view/projection matrices of the first n texture projection frustums.
@ ACT_VIEW_SIDE_VECTOR
This variable provides the view side vector (world space).
@ ACT_LIGHT_DIRECTION
A light direction in world space (index determined by setAutoConstant call)
@ ACT_SURFACE_DIFFUSE_COLOUR
Surface diffuse colour, as set in Pass::setDiffuse.
@ ACT_TRANSPOSE_VIEWPROJ_MATRIX
Provides transpose of concatenated view and projection matrices.
@ ACT_LIGHT_POWER_SCALE_ARRAY
Array of light power levels, a single scalar as set in Light::setPowerScale (count set by extra param...
@ ACT_INVERSE_TRANSPOSE_PROJECTION_MATRIX
Provides inverse transpose of projection matrix.
@ ACT_SURFACE_AMBIENT_COLOUR
Surface ambient colour, as set in Pass::setAmbient.
@ ACT_LIGHT_CASTS_SHADOWS
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param)
@ ACT_WORLDVIEW_MATRIX
The current world & view matrices concatenated.
@ ACT_VIEW_MATRIX
The current view matrix.
@ ACT_TIME_0_2PI_PACKED
Vector of "Time0_2PI", "SinTime0_2PI", "CosTime0_2PI", "TanTime0_2PI".
@ ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX
The view/projection matrix of a given spotlight projection frustum, combined with the current world m...
@ ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED
Light diffuse colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
@ ACT_WORLD_SCALE_SHEAR_MATRIX_ARRAY_3x4
The scale and shear components of the current array of world matrices.
@ ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED_ARRAY
Array of light specular colours scaled by light power (count set by extra param)
@ ACT_INVERSE_VIEWPORT_HEIGHT
This variable represents 1.0/ViewportHeight.
@ ACT_SHADOW_SCENE_DEPTH_RANGE
Provides information about the depth range of the scene as viewed from a given shadow camera.
@ ACT_PASS_ITERATION_NUMBER
provides the current iteration number of the pass.
@ ACT_SURFACE_SHININESS
Surface shininess, as set in Pass::setShininess.
@ ACT_PROJECTION_MATRIX
The current projection matrix.
@ ACT_FRAME_TIME
provides the scaled frame time, returned as a floating point value.
@ ACT_WORLD_DUALQUATERNION_ARRAY_2x4
The current array of world matrices transformed to an array of dual quaternions, represented as a 2x4...
@ ACT_SHADOW_COLOUR
Provides the fixed shadow colour as configured via SceneManager::setShadowColour; useful for integrat...
@ ACT_LOD_CAMERA_POSITION_OBJECT_SPACE
Provides the position of the LOD camera in object space, allowing you to perform separate LOD calcula...
@ ACT_PACKED_TEXTURE_SIZE
Provides packed texture size of the texture unit (index determined by setAutoConstant call).
@ ACT_DERIVED_SCENE_COLOUR
The derived scene colour, with 'r', 'g' and 'b' components filled with sum of derived ambient light c...
@ ACT_LIGHT_DIRECTION_VIEW_SPACE
A light direction in view space (index determined by setAutoConstant call)
@ ACT_FOV
This variable provides the field of view as a floating point value.
@ ACT_INVERSE_WORLDVIEWPROJ_MATRIX
Provides inverse of concatenated world, view and projection matrices.
@ ACT_FPS
provides the calculated frames per second, returned as a floating point value.
@ ACT_TRANSPOSE_WORLDVIEWPROJ_MATRIX
Provides transpose of concatenated world, view and projection matrices.
@ ACT_ANIMATION_PARAMETRIC
Provides a parametric animation value [0..1], only available where the renderable specifically implem...
@ ACT_CAMERA_POSITION_OBJECT_SPACE
The current camera's position in object space.
@ ACT_VIEWPORT_SIZE
Packed of "ViewportWidth", "ViewportHeight", "ViewportWidthInverse", "ViewportHeightInverse".
@ ACT_SINTIME_0_1
Sine of "Time0_1". Equivalent to RenderMonkey's "SinTime0_1".
@ ACT_COSTIME_0_X
Cosine of "Time0_X". Equivalent to RenderMonkey's "CosTime0_X".
@ ACT_LIGHT_ATTENUATION_ARRAY
Array of light attenuation parameters, Vector4(range, constant, linear, quadric) (count set by extra ...
@ ACT_INVERSE_PROJECTION_MATRIX
Provides inverse of projection matrix.
@ ACT_TEXTURE_VIEWPROJ_MATRIX_ARRAY
Array of view/projection matrices of the first n texture projection frustums.
@ ACT_SURFACE_EMISSIVE_COLOUR
Surface emissive colour, as set in Pass::setSelfIllumination.
@ ACT_INVERSE_TRANSPOSE_WORLDVIEW_MATRIX
The current world & view matrices concatenated, then inverted & transposed.
@ ACT_VERTEX_WINDING
-1 if the winding has been inverted (e.g.
@ ACT_DERIVED_LIGHT_DIFFUSE_COLOUR
The derived light diffuse colour (index determined by setAutoConstant call), with 'r',...
@ ACT_INVERSE_TRANSPOSE_VIEWPROJ_MATRIX
Provides inverse transpose of concatenated view and projection matrices.
@ ACT_TEXTURE_VIEWPROJ_MATRIX
The view/projection matrix of the assigned texture projection frustum.
@ ACT_LIGHT_COUNT
The number of active light sources (better than gl_MaxLights)
@ ACT_WORLD_MATRIX_ARRAY
The current array of world matrices, used for blending.
@ ACT_SHADOW_EXTRUSION_DISTANCE
The distance a shadow volume should be extruded when using finite extrusion programs.
@ ACT_SCENE_DEPTH_RANGE
Provides information about the depth range of the scene as viewed from the current camera.
@ ACT_COSTIME_0_2PI
Cosine of "Time0_2PI". Equivalent to RenderMonkey's "CosTime0_2PI".
@ ACT_LIGHT_DIRECTION_VIEW_SPACE_ARRAY
Array of light directions in view space (count set by extra param)
@ ACT_SINTIME_0_X
Sine of "Time0_X". Equivalent to RenderMonkey's "SinTime0_X".
@ ACT_LIGHT_POSITION
A light position in world space (index determined by setAutoConstant call)
@ ACT_TIME_0_1_PACKED
Vector of "Time0_1", "SinTime0_1", "CosTime0_1", "TanTime0_1".
@ ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX_ARRAY
An array of the view/projection matrix of a given spotlight projection frustum, combined with the cur...
@ ACT_LIGHT_NUMBER
The absolute light number of a local light index.
@ ACT_LIGHT_SPECULAR_COLOUR_ARRAY
Array of light specular colours (count set by extra param)
@ ACT_INVERSE_WORLDVIEW_MATRIX
The current world & view matrices concatenated, then inverted.
@ ACT_LIGHT_POSITION_ARRAY
Array of light positions in world space (count set by extra param)
@ ACT_DERIVED_LIGHT_SPECULAR_COLOUR
The derived light specular colour (index determined by setAutoConstant call), with 'r',...
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
vector< AutoConstantEntry >::type AutoConstantList
void copyMatchingNamedConstantsFrom(const GpuProgramParameters &source)
Copies the values of all matching named constants (including auto constants) from another GpuProgramP...
void setConstant(size_t index, const ColourValue &colour)
Sets a ColourValue parameter to the program.
void setNamedAutoConstantReal(const String &name, AutoConstantType acType, Real rData)
void setNamedConstant(const String &name, const double *val, size_t count, size_t multiple=4)
Sets a multiple value constant floating-point parameter to the program.
void setConstantFromTime(size_t index, Real factor)
Sets a named parameter up to track a derivation of the current time.
ACDataType
Defines the type of the extra data item used by the auto constant.
@ ACDT_INT
the auto constant requires data of type int
size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical int constant index.
void setSubroutine(size_t index, const String &subroutine)
Set subroutine name by slot index.
void setConstant(size_t index, const float *val, size_t count)
Sets a multiple value constant floating-point parameter to the program.
const AutoConstantEntry * findFloatAutoConstantEntry(size_t logicalIndex)
Finds an auto constant that's affecting a given logical parameter index for floating-point values.
const AutoConstantEntry * _findRawAutoConstantEntryDouble(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the double-point buffer.
void setConstant(size_t index, const Vector3 &vec)
Sets a 4-element floating-point parameter to the program via Vector3.
void setNamedConstant(const String &name, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
bool mTransposeMatrices
Do we need to transpose matrices?
size_t getDoubleLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the double buffer, for programs which sup...
void _writeRawConstant(size_t physicalIndex, const Vector3 &vec)
Write a 3-element floating-point parameter to the program via Vector3.
void _readRawConstants(size_t physicalIndex, size_t count, float *dest)
Read a series of floating point values from the underlying float constant buffer at the given physica...
void _writeRawConstant(size_t physicalIndex, int val)
Write a single integer parameter to the program.
const GpuLogicalBufferStructPtr & getFloatLogicalBufferStruct() 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.
void copySharedParamSetUsage(const GpuSharedParamUsageList &srcList)
bool mIgnoreMissingParams
flag to indicate if names not found will be ignored
const double * getDoublePointer(size_t pos) const
Get a pointer to the 'nth' item in the double buffer.
void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
Sets up a constant which will automatically be updated by the system.
size_t mActivePassIterationIndex
physical index for active pass iteration parameter real constant entry;
void addSharedParameters(GpuSharedParametersPtr sharedParams)
Use a set of shared parameters in this parameters object.
ElementType
Defines the base element type of the auto constant.
void clearNamedAutoConstant(const String &name)
Unbind an auto constant so that the constant is manually controlled again.
void setNamedConstant(const String &name, const ColourValue &colour)
Sets a ColourValue parameter to the program.
FloatConstantList mFloatConstants
Packed list of floating-point constants (physical indexing)
void _setNamedConstants(const GpuNamedConstantsPtr &constantmap)
Internal method for providing a link to a name->definition map for parameters.
const SubroutineMap & getSubroutineMap() const
Get map with.
void setIgnoreMissingParams(bool state)
Tells the program whether to ignore missing parameters or not.
void setNamedConstant(const String &name, const Vector4 &vec)
Sets a Vector4 parameter to the program.
GpuProgramParameters(const GpuProgramParameters &oth)
Copy constructor.
void _writeRawConstants(size_t physicalIndex, const double *val, size_t count)
Write a series of floating point values into the underlying float constant buffer at the given physic...
const GpuConstantDefinition * _findNamedConstantDefinition(const String &name, bool throwExceptionIfMissing=false) const
Find a constant definition for a named parameter.
size_t getPassIterationNumberIndex() const
Get the physical buffer index of the pass iteration number constant.
void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData)
size_t _getDoubleConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical double constant index.
void _writeRawConstant(size_t physicalIndex, Real val)
Write a single floating-point parameter to the program.
void _readRawConstants(size_t physicalIndex, size_t count, int *dest)
Read a series of integer values from the underlying integer constant buffer at the given physical ind...
void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo, uint16 variability, size_t elementSize=4)
As setAutoConstant, but sets up the auto constant directly against a physical buffer index.
void _writeRawConstant(size_t physicalIndex, Real val, size_t count)
Write a variable number of floating-point parameters to the program.
const AutoConstantEntry * findDoubleAutoConstantEntry(size_t logicalIndex)
Finds an auto constant that's affecting a given logical parameter index for double-point values.
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
const AutoConstantEntry * _findRawAutoConstantEntryInt(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the integer buffer.
size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the int buffer, for programs which suppor...
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
void setNamedConstant(const String &name, const float *val, size_t count, size_t multiple=4)
Sets a multiple value constant floating-point parameter to the program.
void clearAutoConstants(void)
Clears all the existing automatic constants.
void setConstant(size_t index, const Matrix4 *m, size_t numEntries)
Sets a list of Matrix4 parameters to the program.
void _copySharedParams()
Update the parameters by copying the data from the shared parameters.
const GpuLogicalBufferStructPtr & getIntLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
void setNamedConstantFromTime(const String &name, Real factor)
Sets a named parameter up to track a derivation of the current time.
void setConstant(size_t index, const double *val, size_t count)
Sets a multiple value constant floating-point parameter to the program.
AutoConstantEntry * getAutoConstantEntry(const size_t index)
Gets a specific Auto Constant entry if index is in valid range otherwise returns a NULL.
bool hasNamedParameters() const
Does this parameter set include named parameters?
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
bool isUsingSharedParameters(const String &sharedParamsName) const
Returns whether this parameter set is using the named shared parameter set.
IntConstantList mIntConstants
Packed list of integer constants (physical indexing)
void _setLogicalIndexes(const GpuLogicalBufferStructPtr &floatIndexMap, const GpuLogicalBufferStructPtr &doubleIndexMap, const GpuLogicalBufferStructPtr &intIndexMap)
Internal method for providing a link to a logical index->physical index map for parameters.
void setConstant(size_t index, const Vector4 &vec)
Sets a 4-element floating-point parameter to the program.
const GpuSharedParamUsageList & getSharedParameters() const
Get the list of shared parameter sets.
bool hasAutoConstants(void) const
Returns true if this instance has any automatic constants.
void removeAllSharedParameters()
Stop using all shared parameter sets.
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
size_t calculateSize(void) const
void setTransposeMatrices(bool val)
Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo=0)
Sets up a constant which will automatically be updated by the system.
uint16 deriveVariability(AutoConstantType act)
Return the variability for an auto constant.
const int * getIntPointer(size_t pos) const
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 Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
const AutoConstantEntry * findIntAutoConstantEntry(size_t logicalIndex)
Finds an auto constant that's affecting a given logical parameter index for integer values.
GpuNamedConstantsPtr mNamedConstants
Mapping from parameter names to def - high-level programs are expected to populate this.
GpuLogicalBufferStructPtr mDoubleLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
uint16 mCombinedVariability
The combined variability masks of all parameters.
const AutoConstantEntry * findAutoConstantEntry(const String &paramName)
Finds an auto constant that's affecting a given named parameter index.
void incPassIterationNumber(void)
increments the multipass number entry by 1 if it exists
const GpuConstantDefinition & getConstantDefinition(const String &name) const
Get a specific GpuConstantDefinition for a named parameter.
GpuSharedParamUsageList mSharedParamSets
vector< GpuSharedParametersUsage >::type GpuSharedParamUsageList
void setNamedConstant(const String &name, const Vector2 &vec)
Sets a Vector2 parameter to the program.
const GpuLogicalBufferStructPtr & getDoubleLogicalBufferStruct() const
Retrieves the logical index relating to a physical index in the int buffer, for programs which suppor...
GpuLogicalIndexUse * _getDoubleConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the low-level structure for a logical index.
void setNamedSubroutine(const String &subroutineSlot, const String &subroutine)
Set subroutine name by slot name.
void _writeRawConstant(size_t physicalIndex, const Matrix4 &m, size_t elementCount)
Write a Matrix4 parameter to the program.
void setNamedConstant(const String &name, const Vector3 &vec)
Sets a Vector3 parameter to the program.
void _writeRawConstants(size_t physicalIndex, const int *val, size_t count)
Write a series of integer values into the underlying integer constant buffer at the given physical in...
static const AutoConstantDefinition * getAutoConstantDefinition(const size_t idx)
gets the auto constant definition using an index into the auto constant definition array.
void setConstant(size_t index, const Vector2 &vec)
Sets a 4-element floating-point parameter to the program via Vector2.
void removeSharedParameters(const String &sharedParamsName)
Stop using the named shared parameter set.
GpuProgramParameters & operator=(const GpuProgramParameters &oth)
Operator = overload.
void setNamedConstant(const String &name, Real val)
Sets a single value constant floating-point parameter to the program.
void _writeRawConstant(size_t physicalIndex, const Matrix4 *m, size_t numEntries)
Write a list of Matrix4 parameters to the program.
bool getTransposeMatrices(void) const
Gets whether or not matrices are to be transposed when set.
HashMap< unsigned int, String > SubroutineMap
static const AutoConstantDefinition * getAutoConstantDefinition(const String &name)
gets the auto constant definition associated with name if found else returns NULL
HashMap< unsignedint, String >::const_iterator SubroutineIterator
void setNamedConstant(const String &name, const Matrix4 *m, size_t numEntries)
Sets a list of Matrix4 parameters to the program.
AutoConstantIterator getAutoConstantIterator(void) const
Gets an iterator over the automatic constant bindings currently in place.
void _writeRawConstant(size_t physicalIndex, const Vector2 &vec)
Write a 2-element floating-point parameter to the program via Vector2.
void _updateAutoParams(const AutoParamDataSource *source, uint16 variabilityMask)
Update automatic parameters.
AutoConstantList mAutoConstants
List of automatically updated parameters.
DoubleConstantList mDoubleConstants
Packed list of double-point constants (physical indexing)
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
bool hasPassIterationNumber() const
Does this parameters object have a pass iteration number constant?
void setNamedAutoConstant(const String &name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
Sets up a constant which will automatically be updated by the system.
size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical float constant index.
void setNamedConstant(const String &name, const int *val, size_t count, size_t multiple=4)
Sets a multiple value constant floating-point parameter to the program.
void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData, uint16 variability, size_t elementSize=4)
As setAutoConstantReal, but sets up the auto constant directly against a physical buffer index.
void setConstant(size_t index, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
void _writeRawConstant(size_t physicalIndex, const ColourValue &colour, size_t count=4)
Write a ColourValue parameter to the program.
void clearAutoConstant(size_t index)
Unbind an auto constant so that the constant is manually controlled again.
void _writeRawConstants(size_t physicalIndex, const float *val, size_t count)
Write a series of floating point values into the underlying float constant buffer at the given physic...
bool hasLogicalIndexedParameters() const
Does this parameter set include logically indexed parameters?
void setNamedConstant(const String &name, int val)
Sets a single value constant integer parameter to the program.
const GpuNamedConstants & getConstantDefinitions() const
Get the full list of GpuConstantDefinition instances.
void _writeRawConstant(size_t physicalIndex, const Vector4 &vec, size_t count=4)
Write a 4-element floating-point parameter to the program directly to the underlying constants buffer...
GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const
Gets an iterator over the named GpuConstantDefinition instances as defined by the program for which t...
size_t getAutoConstantCount(void) const
Gets the number of int constants that have been set.
void addSharedParameters(const String &sharedParamsName)
Use a set of shared parameters in this parameters object.
This class records the usage of a set of shared parameters in a concrete set of GpuProgramParameters.
GpuProgramParameters * getTargetParams() const
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
GpuSharedParametersUsage(GpuSharedParametersPtr sharedParams, GpuProgramParameters *params)
Construct usage.
void _copySharedParamsToTargetParams()
Update the target parameters by copying the data from the shared parameters.
const String & getName() const
Get the name of the shared parameter set.
GpuSharedParametersPtr getSharedParams() const
vector< CopyDataEntry >::type CopyDataList
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
unsigned long mCopyDataVersion
Version of shared params we based the copydata on.
A group of manually updated parameters that are shared between many parameter sets.
const double * getDoublePointer(size_t pos) const
Get a pointer to the 'nth' item in the double buffer.
GpuSharedParameters(const String &name)
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
void setNamedConstant(const String &name, const double *val, size_t count)
void setNamedConstant(const String &name, const Vector2 &vec)
Sets a Vector2 parameter to the program.
size_t mFrameLastUpdated
Not used when copying data, but might be useful to RS using shared buffers.
const int * getIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the int buffer.
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
unsigned long getVersion() const
Get the version number of this shared parameter set, can be used to identify when changes have occurr...
void setNamedConstant(const String &name, const Matrix4 *m, size_t numEntries)
Sets a list of Matrix4 parameters to the program.
void setNamedConstant(const String &name, const Vector4 &vec)
Sets a Vector4 parameter to the program.
const GpuNamedConstants & getConstantDefinitions() const
Get the full list of GpuConstantDefinition instances.
void removeAllConstantDefinitions()
Remove a constant definition from this shared set of parameters.
const String & getName()
Get the name of this shared parameter set.
DoubleConstantList mDoubleConstants
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
unsigned long mVersion
Version number of the definitions in this buffer.
GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const
Gets an iterator over the named GpuConstantDefinition instances as defined by the user.
void _markDirty()
Mark the shared set as being dirty (values modified).
void setNamedConstant(const String &name, const int *val, size_t count)
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
void setNamedConstant(const String &name, const Vector3 &vec)
Sets a Vector3 parameter to the program.
void setNamedConstant(const String &name, Real val)
Sets a single value constant floating-point parameter to the program.
void addConstantDefinition(const String &name, GpuConstantType constType, size_t arraySize=1)
Add a new constant definition to this shared set of parameters.
const GpuConstantDefinition & getConstantDefinition(const String &name) const
Get a specific GpuConstantDefinition for a named parameter.
void setNamedConstant(const String &name, const float *val, size_t count)
float * getFloatPointer(size_t pos)
Get a pointer to the 'nth' item in the float buffer.
void setNamedConstant(const String &name, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
void setNamedConstant(const String &name, int val)
Sets a single value constant integer parameter to the program.
void removeConstantDefinition(const String &name)
Remove a constant definition from this shared set of parameters.
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
size_t getFrameLastUpdated() const
Get the frame in which this shared parameter set was last updated.
void setNamedConstant(const String &name, const ColourValue &colour)
Sets a ColourValue parameter to the program.
size_t calculateSize(void) const
Class encapsulating a standard 4x4 homogeneous matrix.
Definition OgreMatrix4.h:79
Generic class for serialising data to / from binary stream-based files.
Endian
The endianness of written files.
bool isNull(void) const
Standard 2-dimensional vector.
Definition OgreVector2.h:52
Standard 3-dimensional vector.
Definition OgreVector3.h:52
4-dimensional homogeneous vector.
Definition OgreVector4.h:46
map< size_t, GpuLogicalIndexUse >::type GpuLogicalIndexUseMap
vector< int >::type IntConstantList
Definition of container that holds the current float constants.
GpuParamVariability
The variability of a GPU parameter, as derived from auto-params targeting it.
SharedPtr< GpuLogicalBufferStruct > GpuLogicalBufferStructPtr
vector< double >::type DoubleConstantList
Definition of container that holds the current double constants.
SharedPtr< GpuSharedParameters > GpuSharedParametersPtr
Shared pointer used to hold references to GpuProgramParameters instances.
map< String, GpuConstantDefinition >::type GpuConstantDefinitionMap
vector< float >::type FloatConstantList
Definition of container that holds the current float constants.
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
SharedPtr< GpuNamedConstants > GpuNamedConstantsPtr
SharedPtr< GpuProgramParameters > GpuProgramParametersSharedPtr
Shared pointer used to hold references to GpuProgramParameters instances.
ConstMapIterator< GpuConstantDefinitionMap > GpuConstantDefinitionIterator
@ GPV_PASS_ITERATION_NUMBER
Varies with pass iteration number.
@ GPV_PER_OBJECT
Varies per object (based on an auto param usually), but not per light setup.
@ GPV_GLOBAL
No variation except by manual setting - the default.
@ GPV_ALL
Full mask (16-bit)
@ GPV_LIGHTS
Varies with light setup.
float Real
Software floating point type.
unsigned short uint16
_StringBase String
Information about predefined program constants.
static bool isFloat(GpuConstantType c)
GpuConstantType constType
Data type.
size_t elementSize
Number of raw buffer slots per element (some programs pack each array element to float4,...
static bool isSubroutine(GpuConstantType c)
size_t physicalIndex
Physical start index in buffer (either float, double or int buffer)
uint16 variability
How this parameter varies (bitwise combination of GpuProgramVariability)
static bool isSampler(GpuConstantType c)
size_t logicalIndex
Logical index - used to communicate this constant to the rendersystem.
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....
static bool isDouble(GpuConstantType c)
size_t arraySize
Length of array.
Container struct to allow params to safely & update shared list of logical buffer assignments.
GpuLogicalIndexUseMap map
Map from logical index to physical buffer location.
size_t bufferSize
Shortcut to know the buffer size needs.
Structure recording the use of a physical buffer by a logical parameter index.
size_t currentSize
Current physical size allocation.
GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
uint16 variability
How the contents of this slot vary.
size_t physicalIndex
Physical buffer index.
Struct collecting together the information for named constants.
static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll)
Sets whether all array entries will be generated and added to the definitions map.
static bool getGenerateAllConstantDefinitionArrayEntries()
Indicates whether all array entries will be generated and added to the definitions map.
void save(const String &filename) const
Saves constant definitions to a file, compatible with GpuProgram::setManualNamedConstantsFile.
size_t floatBufferSize
Total size of the float buffer required.
size_t intBufferSize
Total size of the int buffer required.
size_t doubleBufferSize
Total size of the double buffer required.
void load(DataStreamPtr &stream)
Loads constant definitions from a stream, compatible with GpuProgram::setManualNamedConstantsFile.
size_t calculateSize(void) const
static bool msGenerateAllConstantDefinitionArrayEntries
Indicates whether all array entries will be generated and added to the definitions map.
void generateConstantDefinitionArrayEntries(const String &paramName, const GpuConstantDefinition &baseDef)
Generate additional constant entries for arrays based on a base definition.
GpuConstantDefinitionMap map
Map of parameter names to GpuConstantDefinition.
Structure defining an auto constant that's available for use in a parameters object.
AutoConstantDefinition(AutoConstantType _acType, const String &_name, size_t _elementCount, ElementType _elementType, ACDataType _dataType)
ElementType elementType
The type of the constant in the program.
std::map< K, V, P, A > type
std::vector< T, A > type