Go to the documentation of this file.
28 #ifndef __GpuProgramParams_H_
29 #define __GpuProgramParams_H_
140 return isFloat(constType);
167 return isDouble(constType);
198 return isSampler(constType);
221 return isSubroutine(constType);
234 if (padToMultiplesOf4)
345 , physicalIndex((
std::numeric_limits<size_t>::max)())
422 Endian endianMode = ENDIAN_NATIVE);
424 Endian endianMode = ENDIAN_NATIVE);
441 : physicalIndex(99999), currentSize(0), variability(
GPV_GLOBAL) {}
443 : physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
593 int*
getIntPointer(
size_t pos) { _markDirty();
return &mIntConstants[pos]; }
1207 :acType(_acType), name(_name), elementCount(_elementCount),
1208 elementType(_elementType), dataType(_dataType)
1235 uint16 theVariability,
size_t theElemCount = 4)
1236 : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1237 data(theData), variability(theVariability) {}
1240 uint16 theVariability,
size_t theElemCount = 4)
1241 : paramType(theType), physicalIndex(theIndex), elementCount(theElemCount),
1242 fData(theData), variability(theVariability) {}
1654 uint16 variability,
size_t elementSize = 4);
1659 uint16 variability,
size_t elementSize = 4);
1815 size_t multiple = 4);
1833 size_t multiple = 4);
1857 size_t multiple = 4);
1915 const String& name,
bool throwExceptionIfMissing =
false)
const;
1986 {
return mActivePassIterationIndex != (std::numeric_limits<size_t>::max)(); }
1989 {
return mActivePassIterationIndex; }
AutoConstantType paramType
The type of parameter.
This class records the usage of a set of shared parameters in a concrete set of GpuProgramParameters.
@ ACT_INVERSE_VIEWPORT_HEIGHT
This variable represents 1.0/ViewportHeight.
const double * getDoublePointer(size_t pos) const
Get a pointer to the 'nth' item in the double buffer.
@ ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED_ARRAY
Array of light specular colours scaled by light power (count set by extra param)
void addSharedParameters(GpuSharedParametersPtr sharedParams)
Use a set of shared parameters in this parameters object.
HashMap< unsigned int, String > SubroutineMap
@ ACT_SHADOW_EXTRUSION_DISTANCE
The distance a shadow volume should be extruded when using finite extrusion programs.
@ ACT_ANIMATION_PARAMETRIC
Provides a parametric animation value [0..1], only available where the renderable specifically implem...
@ ACT_LIGHT_POSITION_OBJECT_SPACE_ARRAY
Array of light positions in object space (count set by extra param)
This utility class is used to hold the information used to generate the matrices and other informatio...
GpuSharedParameters(const String &name)
@ ACT_CAMERA_POSITION_OBJECT_SPACE
The current camera's position in object space.
@ ACT_LIGHT_COUNT
The number of active light sources (better than gl_MaxLights)
size_t elementSize
Number of raw buffer slots per element (some programs pack each array element to float4,...
static bool isFloat(GpuConstantType c)
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...
@ ACT_TIME_0_1
Single float value, which represents scaled time value [0..1], which repeats itself based on given as...
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 setNamedConstant(const String &name, Real val)
Sets a single value constant floating-point parameter to the program.
float * getFloatPointer(size_t pos)
Get a pointer to the 'nth' item in the float buffer.
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.
@ ACT_TEXTURE_WORLDVIEWPROJ_MATRIX_ARRAY
Array of world/view/projection matrices of the first n texture projection frustums.
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
void setNamedConstant(const String &name, const Vector2 &vec)
Sets a Vector2 parameter to the program.
@ ACT_DERIVED_LIGHT_DIFFUSE_COLOUR_ARRAY
Array of derived light diffuse colours (count set by extra param)
@ ACT_INVERSE_TRANSPOSE_WORLDVIEW_MATRIX
The current world & view matrices concatenated, then inverted & transposed.
size_t _getDoubleConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical double constant index.
@ ACT_TIME_0_X_PACKED
Vector of "Time0_X", "SinTime0_X", "CosTime0_X", "TanTime0_X".
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
@ ACT_DERIVED_SCENE_COLOUR
The derived scene colour, with 'r', 'g' and 'b' components filled with sum of derived ambient light c...
@ ACT_LIGHT_POSITION_VIEW_SPACE_ARRAY
Array of light positions in view space (count set by extra param)
const GpuLogicalBufferStructPtr & getFloatLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
@ ACT_VIEW_DIRECTION
view parameters
Struct collecting together the information for named constants.
GpuConstantDefinitionMap map
Map of parameter names to GpuConstantDefinition.
@ ACT_FRAME_TIME
provides the scaled frame time, returned as a floating point value.
uint16 deriveVariability(AutoConstantType act)
Return the variability for an auto constant.
GpuLogicalIndexUse * _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the low-level structure for a logical index.
ConstVectorIterator< AutoConstantList > AutoConstantIterator
@ ACT_INVERSE_TRANSPOSE_VIEWPROJ_MATRIX
Provides inverse transpose of concatenated view and projection matrices.
const AutoConstantEntry * _findRawAutoConstantEntryDouble(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the double-point buffer.
@ ACT_INVERSE_WORLDVIEWPROJ_MATRIX
Provides inverse of concatenated world, view and projection matrices.
const AutoConstantEntry * findIntAutoConstantEntry(size_t logicalIndex)
Finds an auto constant that's affecting a given logical parameter index for integer values.
@ ACT_TIME
provides current elapsed time
void setNamedConstant(const String &name, const Matrix4 *m, size_t numEntries)
Sets a list of Matrix4 parameters to the program.
void setConstant(size_t index, const ColourValue &colour)
Sets a ColourValue parameter to the program.
void clearAutoConstants(void)
Clears all the existing automatic 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.
const String & getName()
Get the name of this shared parameter set.
const GpuConstantDefinition * dstDefinition
@ ACT_TEXTURE_SIZE
Provides texture size of the texture unit (index determined by setAutoConstant call).
@ ACT_CAMERA_POSITION
The current camera's position in world space.
@ ACT_LIGHT_DIRECTION_OBJECT_SPACE_ARRAY
Array of light directions in object space (count set by extra param)
void setTransposeMatrices(bool val)
Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
void _writeRawConstant(size_t physicalIndex, Real val, size_t count)
Write a variable number of floating-point parameters to the program.
@ ACT_TEXTURE_VIEWPROJ_MATRIX_ARRAY
Array of view/projection matrices of the first n texture projection frustums.
size_t intBufferSize
Total size of the int buffer required.
void generateConstantDefinitionArrayEntries(const String ¶mName, const GpuConstantDefinition &baseDef)
Generate additional constant entries for arrays based on a base definition.
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
@ ACT_SURFACE_SPECULAR_COLOUR
Surface specular colour, as set in Pass::setSpecular.
void setNamedConstant(const String &name, const int *val, size_t count)
size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical float constant index.
const SubroutineMap & getSubroutineMap() const
Get map with.
FloatConstantList mFloatConstants
size_t bufferSize
Shortcut to know the buffer size needs.
void exportNamedConstants(const GpuNamedConstants *pConsts, DataStreamPtr stream, Endian endianMode=ENDIAN_NATIVE)
@ ACT_LIGHT_DISTANCE_OBJECT_SPACE_ARRAY
Array of distances of the lights from the center of the object a useful approximation as an alternati...
static const AutoConstantDefinition * getAutoConstantDefinition(const size_t idx)
gets the auto constant definition using an index into the auto constant definition array.
@ ACT_DERIVED_AMBIENT_LIGHT_COLOUR
The derived ambient light colour, with 'r', 'g', 'b' components filled with product of surface ambien...
static bool getGenerateAllConstantDefinitionArrayEntries()
Indicates whether all array entries will be generated and added to the definitions map.
@ ACT_TRANSPOSE_WORLDVIEWPROJ_MATRIX
Provides transpose of concatenated world, view and projection matrices.
GpuConstantType constType
Data type.
@ ACT_WORLD_MATRIX_ARRAY_3x4
The current array of world matrices, as a 3x4 matrix, used for blending.
@ ACT_VIEW_SIDE_VECTOR
This variable provides the view side vector (world space).
void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData)
@ ACT_SURFACE_EMISSIVE_COLOUR
Surface emissive colour, as set in Pass::setSelfIllumination.
const AutoConstantEntry * _findRawAutoConstantEntryFloat(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the floating-point buffer.
AutoConstantIterator getAutoConstantIterator(void) const
Gets an iterator over the automatic constant bindings currently in place.
size_t getAutoConstantCount(void) const
Gets the number of int constants that have been set.
void addConstantDefinition(const String &name, GpuConstantType constType, size_t arraySize=1)
Add a new constant definition to this shared set of parameters.
size_t calculateSize(void) const
size_t mFrameLastUpdated
Not used when copying data, but might be useful to RS using shared buffers.
Structure recording the use of an automatic parameter.
void setNamedConstant(const String &name, const Vector3 &vec)
Sets a Vector3 parameter to the program.
void setSubroutine(size_t index, const String &subroutine)
Set subroutine name by slot index.
size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the int buffer, for programs which suppor...
GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v)
const AutoConstantList & getAutoConstantList() const
Get a reference to the list of auto constant bindings.
@ ACT_COSTIME_0_1
Cosine of "Time0_1". Equivalent to RenderMonkey's "CosTime0_1".
const AutoConstantEntry * findAutoConstantEntry(const String ¶mName)
Finds an auto constant that's affecting a given named parameter index.
AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData, uint16 theVariability, size_t theElemCount=4)
const GpuNamedConstants & getConstantDefinitions() const
Get the full list of GpuConstantDefinition instances.
@ ACT_LIGHT_POSITION_ARRAY
Array of light positions in world space (count set by extra param)
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
SharedPtr< GpuProgramParameters > GpuProgramParametersSharedPtr
Shared pointer used to hold references to GpuProgramParameters instances.
size_t currentSize
Current physical size allocation.
HashMap< unsigned int, String >::const_iterator SubroutineIterator
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
@ ACT_LIGHT_CUSTOM
Binds custom per-light constants to the shaders.
Variant type that can hold Any other type.
@ ACT_FOV
This variable provides the field of view as a floating point value.
@ ACT_INVERSE_TRANSPOSE_WORLD_MATRIX
The current world matrix, inverted & transposed.
SharedPtr< GpuNamedConstants > GpuNamedConstantsPtr
unsigned long mVersion
Version number of the definitions in this buffer.
GpuProgramParameters(const GpuProgramParameters &oth)
Copy constructor.
void removeAllConstantDefinitions()
Remove a constant definition from this shared set of parameters.
void setNamedConstant(const String &name, int val)
Sets a single value constant integer parameter to the program.
size_t arraySize
Length of array.
void setConstant(size_t index, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
void addSharedParameters(const String &sharedParamsName)
Use a set of shared parameters in this parameters object.
@ ACT_TIME_0_X
Single float value, which repeats itself based on given as parameter "cycle time".
@ ACT_TIME_0_2PI
Single float value, which represents scaled time value [0..2*Pi], which repeats itself based on given...
CopyDataList mCopyDataList
static bool isDouble(GpuConstantType c)
@ ACT_LIGHT_POSITION_OBJECT_SPACE
A light position in object space (index determined by setAutoConstant call)
@ GPV_PER_OBJECT
Varies per object (based on an auto param usually), but not per light setup.
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
void setNamedConstant(const String &name, const double *val, size_t count)
DoubleConstantList mDoubleConstants
Simple class for loading / saving GpuNamedConstants.
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.
AutoConstantDefinition(AutoConstantType _acType, const String &_name, size_t _elementCount, ElementType _elementType, ACDataType _dataType)
@ ACT_PASS_ITERATION_NUMBER
provides the current iteration number of the pass.
const GpuConstantDefinition & getConstantDefinition(const String &name) const
Get a specific GpuConstantDefinition for a named parameter.
GpuLogicalIndexUseMap map
Map from logical index to physical buffer location.
map< size_t, GpuLogicalIndexUse >::type GpuLogicalIndexUseMap
size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical int constant index.
void setNamedConstant(const String &name, const Vector2 &vec)
Sets a Vector2 parameter to the program.
GpuProgramParameters * mParams
const GpuLogicalBufferStructPtr & getIntLogicalBufferStruct() const
Get the current list of mappings from low-level logical param indexes to physical buffer locations in...
bool isUsingSharedParameters(const String &sharedParamsName) const
Returns whether this parameter set is using the named shared parameter set.
uint16 variability
The variability of this parameter (see GpuParamVariability)
const FloatConstantList & getFloatConstantList() const
Get a reference to the list of float constants.
@ ACT_SINTIME_0_X
Sine of "Time0_X". Equivalent to RenderMonkey's "SinTime0_X".
float * getFloatPointer(size_t pos)
Get a pointer to the 'nth' item in the float buffer.
@ ACT_DERIVED_LIGHT_SPECULAR_COLOUR_ARRAY
Array of derived light specular colours (count set by extra param)
@ ACT_LOD_CAMERA_POSITION_OBJECT_SPACE
Provides the position of the LOD camera in object space, allowing you to perform separate LOD calcula...
@ ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY
Array of view/projection matrix of a given spotlight.
size_t getPassIterationNumberIndex() const
Get the physical buffer index of the pass iteration number constant.
@ ACT_LIGHT_ATTENUATION
Light attenuation parameters, Vector4(range, constant, linear, quadric)
vector< AutoConstantEntry >::type AutoConstantList
@ ACT_TRANSPOSE_PROJECTION_MATRIX
Provides transpose of projection matrix.
@ ACT_LIGHT_POSITION
A light position in world space (index determined by setAutoConstant call)
static const AutoConstantDefinition * getAutoConstantDefinition(const String &name)
gets the auto constant definition associated with name if found else returns NULL
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
@ ACT_NEAR_CLIP_DISTANCE
This variable provides the near clip distance as a floating point value.
@ ACT_TANTIME_0_1
Tangent of "Time0_1". Equivalent to RenderMonkey's "TanTime0_1".
void _updateAutoParams(const AutoParamDataSource *source, uint16 variabilityMask)
Update automatic parameters.
@ ACT_SURFACE_DIFFUSE_COLOUR
Surface diffuse colour, as set in Pass::setDiffuse.
@ ACT_LIGHT_NUMBER
The absolute light number of a local light index.
@ ACT_WORLD_MATRIX_ARRAY
The current array of world matrices, used for blending.
GpuProgramParameters * getTargetParams() const
@ GPV_ALL
Full mask (16-bit)
@ ACT_VERTEX_WINDING
-1 if the winding has been inverted (e.g.
@ ACT_FAR_CLIP_DISTANCE
This variable provides the far clip distance as a floating point value.
GpuLogicalBufferStructPtr mIntLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
void clearNamedAutoConstant(const String &name)
Unbind an auto constant so that the constant is manually controlled again.
@ ACT_SINTIME_0_2PI
Sine of "Time0_2PI". Equivalent to RenderMonkey's "SinTime0_2PI".
@ ACT_SHADOW_COLOUR
Provides the fixed shadow colour as configured via SceneManager::setShadowColour; useful for integrat...
@ GPV_LIGHTS
Varies with light setup.
void setNamedConstantFromTime(const String &name, Real factor)
Sets a named parameter up to track a derivation of the current time.
@ ACT_SURFACE_AMBIENT_COLOUR
Surface ambient colour, as set in Pass::setAmbient.
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.
size_t doubleBufferSize
Total size of the double buffer required.
@ ACT_TRANSPOSE_WORLDVIEW_MATRIX
Provides transpose of concatenated world and view matrices.
@ ACT_SPOTLIGHT_PARAMS
Spotlight parameters, Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and outerFactor ...
@ ACT_INVERSE_WORLDVIEW_MATRIX
The current world & view matrices concatenated, then inverted.
size_t elementCount
The number of elements per individual entry in this constant Used in case people used packed elements...
@ ACT_TIME_0_2PI_PACKED
Vector of "Time0_2PI", "SinTime0_2PI", "CosTime0_2PI", "TanTime0_2PI".
Class encapsulating a standard 4x4 homogeneous matrix.
const IntConstantList & getIntConstantList() const
Get a reference to the list of int constants.
void setConstant(size_t index, const float *val, size_t count)
Sets a multiple value constant floating-point parameter 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.
virtual ~GpuNamedConstantsSerializer()
@ ACT_LIGHT_CASTS_SHADOWS
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param)
SubroutineMap mSubroutineMap
static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll)
Sets whether all array entries will be generated and added to the definitions map.
void exportNamedConstants(const GpuNamedConstants *pConsts, const String &filename, Endian endianMode=ENDIAN_NATIVE)
@ ACT_SHADOW_SCENE_DEPTH_RANGE
Provides information about the depth range of the scene as viewed from a given shadow camera.
size_t logicalIndex
Logical index - used to communicate this constant to the rendersystem.
void setNamedSubroutine(const String &subroutineSlot, const String &subroutine)
Set subroutine name by slot name.
@ ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED_ARRAY
Array of light diffuse colours scaled by light power (count set by extra param)
SharedPtr< GpuSharedParameters > GpuSharedParametersPtr
Shared pointer used to hold references to GpuProgramParameters instances.
@ ACT_INVERSE_TEXTURE_SIZE
Provides inverse texture size of the texture unit (index determined by setAutoConstant call).
const String & getName() const
Get the name of the shared parameter set.
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...
bool mIgnoreMissingParams
flag to indicate if names not found will be ignored
bool isSubroutine() const
void setNamedConstant(const String &name, const ColourValue &colour)
Sets a ColourValue parameter to the program.
GpuSharedParametersPtr mSharedParams
@ ACT_INVERSE_PROJECTION_MATRIX
Provides inverse of projection matrix.
const int * getIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the int buffer.
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
size_t physicalIndex
The target (physical) constant index.
vector< GpuSharedParametersUsage >::type GpuSharedParamUsageList
@ ACDT_INT
the auto constant requires data of type int
const AutoConstantEntry * _findRawAutoConstantEntryInt(size_t physicalIndex)
Finds an auto constant that's affecting a given physical position in the integer buffer.
@ ACT_LIGHT_SPECULAR_COLOUR_ARRAY
Array of light specular colours (count set by extra param)
void setNamedConstant(const String &name, const Matrix4 *m, size_t numEntries)
Sets a list of Matrix4 parameters to the program.
@ ACT_INVERSE_VIEWPORT_WIDTH
This variable represents 1.0/ViewportWidth.
void incPassIterationNumber(void)
increments the multipass number entry by 1 if it exists
@ ACT_PROJECTION_MATRIX
The current projection matrix.
@ ACT_RENDER_TARGET_FLIPPING
render target related values
@ ACT_FPS
provides the calculated frames per second, returned as a floating point value.
GpuProgramParameters & operator=(const GpuProgramParameters &oth)
Operator = overload.
@ ACT_LIGHT_POWER_SCALE
Light power level, a single scalar as set in Light::setPowerScale (index determined by setAutoConstan...
void _writeRawConstant(size_t physicalIndex, const ColourValue &colour, size_t count=4)
Write a ColourValue parameter to the program.
GpuLogicalIndexUse * _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the physical buffer index associated with a logical int constant index.
void setNamedAutoConstant(const String &name, AutoConstantType acType, size_t extraInfo=0)
Sets up a constant which will automatically be updated by the system.
@ ACT_AMBIENT_LIGHT_COLOUR
The ambient light colour set in the scene.
static bool isSampler(GpuConstantType c)
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...
@ ACT_LIGHT_POWER_SCALE_ARRAY
Array of light power levels, a single scalar as set in Light::setPowerScale (count set by extra param...
@ ACT_TIME_0_1_PACKED
Vector of "Time0_1", "SinTime0_1", "CosTime0_1", "TanTime0_1".
@ ACT_SURFACE_ALPHA_REJECTION_VALUE
Surface alpha rejection value, not as set in Pass::setAlphaRejectionValue, but a floating number betw...
void _copySharedParams()
Update the parameters by copying the data from the shared parameters.
AutoConstantEntry * getAutoConstantEntry(const size_t index)
Gets a specific Auto Constant entry if index is in valid range otherwise returns a NULL.
void setConstant(size_t index, Real val)
Sets a single floating-point parameter to the program.
bool hasAutoConstants(void) const
Returns true if this instance has any automatic constants.
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...
const GpuSharedParamUsageList & getSharedParameters() const
Get the list of shared parameter sets.
uint16 variability
How this parameter varies (bitwise combination of GpuProgramVariability)
@ ACT_COSTIME_0_X
Cosine of "Time0_X". Equivalent to RenderMonkey's "CosTime0_X".
void importNamedConstants(DataStreamPtr &stream, GpuNamedConstants *pDest)
@ ACT_COSTIME_0_2PI
Cosine of "Time0_2PI". Equivalent to RenderMonkey's "CosTime0_2PI".
@ ACT_INVERSE_WORLD_MATRIX
The current world matrix, inverted.
@ ACT_WORLDVIEWPROJ_MATRIX
view matrices.
@ ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX_ARRAY
An array of the view/projection matrix of a given spotlight projection frustum, combined with the cur...
const GpuLogicalBufferStructPtr & getDoubleLogicalBufferStruct() const
Retrieves the logical index relating to a physical index in the int buffer, for programs which suppor...
bool hasNamedParameters() const
Does this parameter set include named parameters?
AutoConstantList mAutoConstants
List of automatically updated parameters.
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
Collects together the program parameters used for a GpuProgram.
@ 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...
static bool msGenerateAllConstantDefinitionArrayEntries
Indicates whether all array entries will be generated and added to the definitions map.
@ ACT_FOG_COLOUR
Fog colour.
void _writeRawConstant(size_t physicalIndex, const Matrix4 *m, size_t numEntries)
Write a list of Matrix4 parameters to the program.
@ ACT_INVERSE_VIEW_MATRIX
The current view matrix, inverted.
GpuNamedConstantsPtr mNamedConstants
Mapping from parameter names to def - high-level programs are expected to populate this.
size_t floatBufferSize
Total size of the float buffer required.
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.
size_t getDoubleLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the double buffer, for programs which sup...
void setNamedAutoConstant(const String &name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
Sets up a constant which will automatically be updated by the system.
@ ACT_VIEW_UP_VECTOR
This variable provides the view up vector (world space).
@ ACT_WORLD_DUALQUATERNION_ARRAY_2x4
The current array of world matrices transformed to an array of dual quaternions, represented as a 2x4...
@ ACT_INVERSE_TRANSPOSE_WORLDVIEWPROJ_MATRIX
Provides inverse transpose of concatenated world, view and projection matrices.
double * getDoublePointer(size_t pos)
Get a pointer to the 'nth' item in the double buffer.
unsigned long mCopyDataVersion
Version of shared params we based the copydata on.
GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const
Gets an iterator over the named GpuConstantDefinition instances as defined by the program for which t...
@ ACT_TEXTURE_VIEWPROJ_MATRIX
The view/projection matrix of the assigned texture projection frustum.
@ ACT_SPOTLIGHT_VIEWPROJ_MATRIX
The view/projection matrix of a given spotlight.
@ ACT_LIGHT_POSITION_VIEW_SPACE
A light position in view space (index determined by setAutoConstant call)
GpuSharedParamUsageList mSharedParamSets
@ ACT_LIGHT_DIRECTION_OBJECT_SPACE
A light direction in object space (index determined by setAutoConstant call)
@ ACT_VIEWPORT_HEIGHT
Current viewport height (in pixels) as floating point value.
void removeSharedParameters(const String &sharedParamsName)
Stop using the named shared parameter set.
AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, uint16 theVariability, size_t theElemCount=4)
void _writeRawConstant(size_t physicalIndex, const Matrix4 &m, size_t elementCount)
Write a Matrix4 parameter to the program.
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
@ ACT_VIEW_MATRIX
The current view matrix.
void setConstantFromTime(size_t index, Real factor)
Sets a named parameter up to track a derivation of the current time.
@ ACT_LIGHT_CASTS_SHADOWS_ARRAY
Returns (int) 1 if the given light casts shadows, 0 otherwise (index set in extra param)
@ ACT_VIEWPROJ_MATRIX
The current view & projection matrices concatenated.
map< String, GpuConstantDefinition >::type GpuConstantDefinitionMap
@ ACT_LIGHT_DIRECTION_VIEW_SPACE_ARRAY
Array of light directions in view space (count set by extra param)
size_t mActivePassIterationIndex
physical index for active pass iteration parameter real constant entry;
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....
@ ACT_LIGHT_DIRECTION_ARRAY
Array of light directions in world space (count set by extra param)
@ ACT_LIGHT_ATTENUATION_ARRAY
Array of light attenuation parameters, Vector4(range, constant, linear, quadric) (count set by extra ...
@ ACT_WORLD_MATRIX
The current world matrix.
IntConstantList mIntConstants
bool getTransposeMatrices(void) const
Gets whether or not matrices are to be transposed when set.
@ ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED
Light specular colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
uint16 variability
How the contents of this slot vary.
void clearAutoConstant(size_t index)
Unbind an auto constant so that the constant is manually controlled again.
void setNamedConstant(const String &name, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
SharedPtr< GpuLogicalBufferStruct > GpuLogicalBufferStructPtr
GpuLogicalBufferStructPtr mDoubleLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
@ ACT_INVERSE_VIEWPROJ_MATRIX
Provides inverse of concatenated view and projection matrices.
Class representing colour.
vector< double >::type DoubleConstantList
Definition of container that holds the current double constants.
void setConstant(size_t index, const Vector2 &vec)
Sets a 4-element floating-point parameter to the program via Vector2.
void setNamedAutoConstantReal(const String &name, AutoConstantType acType, Real rData)
@ ACT_TEXTURE_MATRIX
Provides the current transform matrix of the texture unit (index determined by setAutoConstant call),...
Information about predefined program constants.
IntConstantList mIntConstants
Packed list of integer constants (physical indexing)
@ ACT_SINTIME_0_1
Sine of "Time0_1". Equivalent to RenderMonkey's "SinTime0_1".
4-dimensional homogeneous vector.
void removeConstantDefinition(const String &name)
Remove a constant definition from this shared set of parameters.
void _copySharedParamsToTargetParams()
Update the target parameters by copying the data from the shared parameters.
virtual ~GpuSharedParameters()
const float * getFloatPointer(size_t pos) const
Get a pointer to the 'nth' item in the float buffer.
@ ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX
The view/projection matrix of a given spotlight projection frustum, combined with the current world m...
AutoConstantType
Defines the types of automatically updated values that may be bound to GpuProgram parameters,...
void _writeRawConstant(size_t physicalIndex, int val)
Write a single integer parameter to the program.
GpuLogicalIndexUse * _getDoubleConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
Gets the low-level structure for a logical index.
void copySharedParamSetUsage(const GpuSharedParamUsageList &srcList)
Standard 2-dimensional vector.
@ ACT_SURFACE_SHININESS
Surface shininess, as set in Pass::setShininess.
@ GPV_GLOBAL
No variation except by manual setting - the default.
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
void setNamedConstant(const String &name, Real val)
Sets a single value constant floating-point parameter to the program.
@ ACT_TRANSPOSE_VIEW_MATRIX
Provides transpose of view matrix.
ElementType
Defines the base element type of the auto constant.
size_t getFrameLastUpdated() const
Get the frame in which this shared parameter set was last updated.
const GpuConstantDefinition * _findNamedConstantDefinition(const String &name, bool throwExceptionIfMissing=false) const
Find a constant definition for a named parameter.
GpuParamVariability
The variability of a GPU parameter, as derived from auto-params targeting it.
const AutoConstantEntry * findFloatAutoConstantEntry(size_t logicalIndex)
Finds an auto constant that's affecting a given logical parameter index for floating-point values.
size_t physicalIndex
Physical buffer index.
@ ACT_LIGHT_DIRECTION
A light direction in world space (index determined by setAutoConstant call)
const GpuConstantDefinition & getConstantDefinition(const String &name) const
Get a specific GpuConstantDefinition for a named parameter.
static size_t getNumAutoConstantDefinitions(void)
Returns the number of auto constant definitions.
@ ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED
Light diffuse colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
GpuSharedParametersUsage(GpuSharedParametersPtr sharedParams, GpuProgramParameters *params)
Construct usage.
@ ACT_LIGHT_SPECULAR_COLOUR
Light specular colour (index determined by setAutoConstant call)
unsigned long getVersion() const
Get the version number of this shared parameter set, can be used to identify when changes have occurr...
GpuLogicalBufferStructPtr mFloatLogicalToPhysical
Logical index to physical index map - for low-level programs or high-level programs which pass params...
@ ACT_LIGHT_DIFFUSE_COLOUR_ARRAY
Array of light diffuse colours (count set by extra param)
void _writeRawConstant(size_t physicalIndex, const Vector2 &vec)
Write a 2-element floating-point parameter to the program via Vector2.
Structure defining an auto constant that's available for use in a parameters object.
void setConstant(size_t index, const double *val, size_t count)
Sets a multiple value constant floating-point parameter to the program.
bool hasPassIterationNumber() const
Does this parameters object have a pass iteration number constant?
@ ACT_WORLD_SCALE_SHEAR_MATRIX_ARRAY_3x4
The scale and shear components of the current array of world matrices.
@ ACDT_NONE
no data is required
@ ACT_DERIVED_LIGHT_SPECULAR_COLOUR
The derived light specular colour (index determined by setAutoConstant call), with 'r',...
A group of manually updated parameters that are shared between many parameter sets.
float Real
Software floating point type.
@ ACT_PASS_NUMBER
provides the pass index number within the technique of the active materil.
@ ACT_SCENE_DEPTH_RANGE
Provides information about the depth range of the scene as viewed from the current camera.
void setNamedConstant(const String &name, const Vector3 &vec)
Sets a Vector3 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...
Generic class for serialising data to / from binary stream-based files.
@ ACT_INVERSE_TRANSPOSE_PROJECTION_MATRIX
Provides inverse transpose of projection matrix.
Concrete IteratorWrapper for const access to the underlying key-value container.
void setNamedConstant(const String &name, const Vector4 &vec)
Sets a Vector4 parameter to the program.
@ ACT_LIGHT_DIFFUSE_COLOUR
Light diffuse colour (index determined by setAutoConstant call)
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.
@ ACT_VIEWPORT_WIDTH
viewport-related values
@ ACT_VIEWPORT_SIZE
Packed of "ViewportWidth", "ViewportHeight", "ViewportWidthInverse", "ViewportHeightInverse".
@ ACT_TEXEL_OFFSETS
Provides the texel offsets required by this rendersystem to map texels to pixels.
@ ACT_LIGHT_DIRECTION_VIEW_SPACE
A light direction in view space (index determined by setAutoConstant call)
void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo=0)
Sets up a constant which will automatically be updated by the system.
@ ACT_TANTIME_0_2PI
Tangent of "Time0_2PI". Equivalent to RenderMonkey's "TanTime0_2PI".
bool hasLogicalIndexedParameters() const
Does this parameter set include logically indexed parameters?
@ ACT_LOD_CAMERA_POSITION
Provides the position of the LOD camera in world space, allowing you to perform separate LOD calculat...
void copyMatchingNamedConstantsFrom(const GpuProgramParameters &source)
Copies the values of all matching named constants (including auto constants) from another GpuProgramP...
Structure recording the use of a physical buffer by a logical parameter index.
@ ACT_WORLDVIEW_MATRIX
The current world & view matrices concatenated.
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...
vector< float >::type FloatConstantList
Definition of container that holds the current float constants.
const DoubleConstantList & getDoubleConstantList() const
Get a reference to the list of double constants.
GpuSharedParametersPtr getSharedParams() const
@ ACT_TRANSPOSE_WORLD_MATRIX
Provides transpose of world matrix.
@ ACT_DERIVED_LIGHT_DIFFUSE_COLOUR
The derived light diffuse colour (index determined by setAutoConstant call), with 'r',...
const GpuNamedConstants & getConstantDefinitions() const
Get the full list of GpuConstantDefinition instances.
uint16 mCombinedVariability
The combined variability masks of all parameters.
bool mTransposeMatrices
Do we need to transpose matrices?
void setConstant(size_t index, 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.
size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex)
Retrieves the logical index relating to a physical index in the float buffer, for programs which supp...
void copyConstantsFrom(const GpuProgramParameters &source)
Copies the values of all constants (including auto constants) from another GpuProgramParameters objec...
@ ACT_PACKED_TEXTURE_SIZE
Provides packed texture size of the texture unit (index determined by setAutoConstant call).
Endian
The endianness of written files.
@ ACT_TEXTURE_WORLDVIEWPROJ_MATRIX
The view/projection matrix of the assigned texture projection frustum, combined with the current worl...
@ GPV_PASS_ITERATION_NUMBER
Varies with pass iteration number.
@ ACT_TANTIME_0_X
Tangent of "Time0_X". Equivalent to RenderMonkey's "TanTime0_X".
void setConstant(size_t index, const Vector4 &vec)
Sets a 4-element floating-point parameter to the program.
void setNamedConstant(const String &name, const float *val, size_t count)
static bool isSubroutine(GpuConstantType c)
void setConstant(size_t index, const int *val, size_t count)
Sets a multiple value constant integer parameter to the program.
ACDataType
Defines the type of the extra data item used by the auto constant.
GpuNamedConstants mNamedConstants
const int * getIntPointer(size_t pos) const
Get a pointer to the 'nth' item in the int buffer.
vector< CopyDataEntry >::type CopyDataList
ConstMapIterator< GpuConstantDefinitionMap > GpuConstantDefinitionIterator
FloatConstantList mFloatConstants
Packed list of floating-point constants (physical indexing)
void _setRenderSystemData(const Any &data) const
Internal method that the RenderSystem might use to store optional data.
Container struct to allow params to safely & update shared list of logical buffer assignments.
@ ACT_CUSTOM
A custom parameter which will come from the renderable, using 'data' as the identifier.
@ ACT_TRANSPOSE_VIEWPROJ_MATRIX
Provides transpose of concatenated view and projection matrices.
void _writeRawConstant(size_t physicalIndex, const Vector3 &vec)
Write a 3-element floating-point parameter to the program via Vector3.
Standard 3-dimensional vector.
vector< int >::type IntConstantList
Definition of container that holds the current float constants.
const GpuConstantDefinition * srcDefinition
@ ACT_FOG_PARAMS
Fog params: density, linear start, linear end, 1/(end-start)
void load(DataStreamPtr &stream)
Loads constant definitions from a stream, compatible with GpuProgram::setManualNamedConstantsFile.
@ ACT_LIGHT_DISTANCE_OBJECT_SPACE
The distance of the light from the center of the object a useful approximation as an alternative to p...
const Any & _getRenderSystemData() const
Internal method that the RenderSystem might use to store optional data.
void setNamedConstant(const String &name, const ColourValue &colour)
Sets a ColourValue parameter to the program.
Concrete IteratorWrapper for const access to the underlying container.
void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
Sets up a constant which will automatically be updated by the system.
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, int val)
Sets a single value constant integer parameter to the program.
@ ACT_INVERSE_TRANSPOSE_VIEW_MATRIX
Provides inverse transpose of view matrix.
int * getIntPointer(size_t pos)
Get a pointer to the 'nth' item in the int buffer.
void _setNamedConstants(const GpuNamedConstantsPtr &constantmap)
Internal method for providing a link to a name->definition map for parameters.
void setIgnoreMissingParams(bool state)
Tells the program whether to ignore missing parameters or not.
void _markDirty()
Mark the shared set as being dirty (values modified).
void setNamedConstant(const String &name, const Matrix4 &m)
Sets a Matrix4 parameter to the program.
void removeAllSharedParameters()
Stop using all shared parameter sets.
void _writeRawConstant(size_t physicalIndex, Real val)
Write a single floating-point parameter to the program.
size_t physicalIndex
Physical start index in buffer (either float, double or int buffer)
@ ACT_SPOTLIGHT_PARAMS_ARRAY
Spotlight parameters array of Vector4(innerFactor, outerFactor, falloff, isSpot) innerFactor and oute...
size_t calculateSize(void) const
GpuNamedConstantsSerializer()
DoubleConstantList mDoubleConstants
Packed list of double-point constants (physical indexing)
ACDataType dataType
The type of any extra data.
void save(const String &filename) const
Saves constant definitions to a file, compatible with GpuProgram::setManualNamedConstantsFile.
size_t calculateSize(void) const
GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const
Gets an iterator over the named GpuConstantDefinition instances as defined by the user.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.