Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::GpuProgramParameters Class Reference

Collects together the program parameters used for a GpuProgram. More...

`#include <OgreGpuProgram.h>`

List of all members.

## Public Types

typedef ConstVectorIterator< RealConstantList > | RealConstantIterator
typedef ConstVectorIterator< IntConstantList > | IntConstantIterator
typedef ConstVectorIterator< AutoConstantList > | AutoConstantIterator

enum

AutoConstantType {
ACT_WORLD_MATRIX, ACT_WORLD_MATRIX_ARRAY_3x4, ACT_WORLD_MATRIX_ARRAY, ACT_VIEW_MATRIX,
ACT_PROJECTION_MATRIX, ACT_VIEWPROJ_MATRIX, ACT_WORLDVIEW_MATRIX, ACT_WORLDVIEWPROJ_MATRIX,
ACT_INVERSE_WORLD_MATRIX, ACT_INVERSE_WORLDVIEW_MATRIX, ACT_LIGHT_DIFFUSE_COLOUR, ACT_LIGHT_SPECULAR_COLOUR,
ACT_LIGHT_ATTENUATION, ACT_LIGHT_POSITION, ACT_LIGHT_DIRECTION, ACT_LIGHT_POSITION_OBJECT_SPACE,
ACT_LIGHT_DIRECTION_OBJECT_SPACE, ACT_LIGHT_DISTANCE_OBJECT_SPACE, ACT_SHADOW_EXTRUSION_DISTANCE, ACT_CAMERA_POSITION_OBJECT_SPACE,
ACT_AMBIENT_LIGHT_COLOUR, ACT_TEXTURE_VIEWPROJ_MATRIX, ACT_CUSTOM
}

| Defines the types of automatically updated values that may be bound to GpuProgram parameters, or used to modify parameters on a per-object basis. More...

## Public Methods

| GpuProgramParameters ()
| ~GpuProgramParameters ()
void | setConstant (size_t index, const Vector4 &vec)
| Sets a 4-element floating-point parameter to the program.
void | setConstant (size_t index, const Vector3 &vec)
| Sets a 4-element floating-point parameter to the program via Vector3.
void | setConstant (size_t index, const Matrix4 &m)
| Sets a Matrix4 parameter to the program.
void | setConstant (size_t index, const Matrix4 *m, size_t numEntries)
| Sets a list of Matrix4 parameters to the program.
void | setConstant (size_t index, const Real *val, size_t count)
| Sets a multiple value constant floating-point parameter to the program.
void | setConstant (size_t index, const ColourValue &colour)
| Sets a ColourValue parameter to the program.
void | setConstant (size_t index, const int *val, size_t count)
| Sets a multiple value constant integer parameter to the program.
void | resetRealConstants (void)
| Deletes the contents of the Real constants registers.
void | resetIntConstants (void)
| Deletes the contents of the int constants registers.
RealConstantIterator | getRealConstantIterator (void) const
| Gets an iterator over the Real constant parameters.
IntConstantIterator | getIntConstantIterator (void) const
| Gets an iterator over the integer constant parameters.
RealConstantEntry * | getRealConstantEntry (const size_t index)
| Gets a specific Real Constant entry if index is in valid range otherwise returns a NULL.
IntConstantEntry * | getIntConstantEntry (const size_t index)
| Gets a specific Int Constant entry if index is in valid range otherwise returns a NULL.
RealConstantEntry * | getNamedRealConstantEntry (const String &name)
| Gets a Named Real Constant entry if the name is found otherwise returns a NULL.
IntConstantEntry * | getNamedIntConstantEntry (const String &name)
| Gets a named Int Constant entry if name is found otherwise returns a NULL.
size_t | getRealConstantCount (void) const
| Gets the number of Real constants that have been set.
size_t | getIntConstantCount (void) const
| Gets the number of int constants that have been set.
bool | hasRealConstantParams (void) const
| Returns true if there are any Real constants contained here.
bool | hasIntConstantParams (void) const
| Returns true if there are any int constants contained here.
void | setAutoConstant (size_t index, AutoConstantType acType, size_t extraInfo=0)
| Sets up a constant which will automatically be updated by the system.
void | setConstantFromTime (size_t index, Real factor)
| Sets a named parameter up to track a derivation of the current time.
void | clearAutoConstants (void)
| Clears all the existing automatic constants.
AutoConstantIterator | getAutoConstantIterator (void) const
| Gets an iterator over the automatic constant bindings currently in place.
bool | hasAutoConstants (void) const
| Returns true if this instance has any automatic constants.
void | _updateAutoParamsNoLights (const AutoParamDataSource &source)
| Updates the automatic parameters (except lights) based on the details provided.
void | _updateAutoParamsLightsOnly (const AutoParamDataSource &source)
| Updates the automatic parameters for lights based on the details provided.
void | setAutoAddParamName (bool state)
| Sets the auto add parameter name flag.
void | setNamedConstant (const String &name, Real val)
| Sets a single value constant floating-point parameter to the program.
void | setNamedConstant (const String &name, int val)
| Sets a single value constant integer parameter to the program.
void | setNamedConstant (const String &name, const Vector4 &vec)
| Sets a Vector4 parameter to the program.
void | setNamedConstant (const String &name, const Vector3 &vec)
| Sets a Vector3 parameter to the program.
void | setNamedConstant (const String &name, const Matrix4 &m)
| Sets a Matrix4 parameter to the program.
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 Real *val, size_t count)
| Sets a multiple value constant floating-point parameter to the program.
void | setNamedConstant (const String &name, const ColourValue &colour)
| Sets a ColourValue parameter to the program.
void | setNamedConstant (const String &name, const int *val, size_t count)
| Sets a multiple value constant integer 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.
void | setNamedConstantFromTime (const String &name, Real factor)
| Sets a named parameter up to track a derivation of the current time.
void | _mapParameterNameToIndex (const String &name, size_t index)
| Internal method for associating a parameter name with an index.
size_t | getParamIndex (const String &name)
| Gets the constant index associated with a named parameter.
void | setTransposeMatrices (bool val)
| Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
bool | getTransposeMatrices (void) const
| Gets whether or not matrices are to be transposed when set.
void | copyConstantsFrom (const GpuProgramParameters &source)
| Copies the values of all constants (including auto constants) from another GpuProgramParameters object.

## Protected Types

typedef std::vector< RealConstantEntry > | RealConstantList
typedef std::vector< IntConstantEntry > | IntConstantList
typedef std::vector< AutoConstantEntry > | AutoConstantList
typedef std::map< String, size_t > | ParamNameMap
| Mapping from parameter names to indexes - high-level programs are expected to populate this.

## Protected Attributes

RealConstantList | mRealConstants
| Packed list of floating-point constants.
IntConstantList | mIntConstants
| Packed list of integer constants.
AutoConstantList | mAutoConstants
| List of automatically updated parameters.
ParamNameMap | mParamNameMap
bool | mTransposeMatrices
| Do we need to transpose matrices?
bool | mAutoAddParamName
| flag to indicate if names not found will be automatically added

## Detailed Description

Collects together the program parameters used for a GpuProgram.

Remarks:
  Gpu program state includes constant parameters used by the program, and bindings to render system state which is propagated into the constants by the engine automatically if requested.

  GpuProgramParameters objects should be created through the GpuProgramManager and may be shared between multiple GpuProgram instances. For this reason they are managed using a shared pointer, which will ensure they are automatically deleted when no program is using them anymore.

Definition at line 55 of file OgreGpuProgram.h.

## Member Typedef Documentation

typedef ConstVectorIterator<AutoConstantList> Ogre::GpuProgramParameters::AutoConstantIterator

| Definition at line 295 of file OgreGpuProgram.h. Referenced by copyConstantsFrom(), and getAutoConstantIterator().

typedef std::vector<AutoConstantEntry> Ogre::GpuProgramParameters::AutoConstantList`[protected]`

| Definition at line 155 of file OgreGpuProgram.h.

typedef ConstVectorIterator<IntConstantList> Ogre::GpuProgramParameters::IntConstantIterator

| Definition at line 239 of file OgreGpuProgram.h. Referenced by copyConstantsFrom(), and getIntConstantIterator().

typedef std::vector<IntConstantEntry> Ogre::GpuProgramParameters::IntConstantList`[protected]`

| Definition at line 153 of file OgreGpuProgram.h.

typedef std::map<String, size_t> Ogre::GpuProgramParameters::ParamNameMap`[protected]`

| Mapping from parameter names to indexes - high-level programs are expected to populate this. Definition at line 163 of file OgreGpuProgram.h.

typedef ConstVectorIterator<RealConstantList> Ogre::GpuProgramParameters::RealConstantIterator

| Definition at line 238 of file OgreGpuProgram.h. Referenced by copyConstantsFrom(), and getRealConstantIterator().

typedef std::vector<RealConstantEntry> Ogre::GpuProgramParameters::RealConstantList`[protected]`

| Definition at line 152 of file OgreGpuProgram.h.

## Member Enumeration Documentation

enum Ogre::GpuProgramParameters::AutoConstantType

Defines the types of automatically updated values that may be bound to GpuProgram parameters, or used to modify parameters on a per-object basis.

Enumeration values:

  ACT_WORLD_MATRIX | The current world matrix.
  ACT_WORLD_MATRIX_ARRAY_3x4 | The current array of world matrices, as a 3x4 matrix, used for blending.
  ACT_WORLD_MATRIX_ARRAY | The current array of world matrices, used for blending.
  ACT_VIEW_MATRIX | The current view matrix.
  ACT_PROJECTION_MATRIX | The current projection matrix.
  ACT_VIEWPROJ_MATRIX | The current view & projection matrices concatenated.
  ACT_WORLDVIEW_MATRIX | The current world & view matrices concatenated.
  ACT_WORLDVIEWPROJ_MATRIX | The current world, view & projection matrices concatenated.
  ACT_INVERSE_WORLD_MATRIX | The current world matrix, inverted.
  ACT_INVERSE_WORLDVIEW_MATRIX | The current world & view matrices concatenated, then inverted.
  ACT_LIGHT_DIFFUSE_COLOUR | Light diffuse colour (index determined by setAutoConstant call).
  ACT_LIGHT_SPECULAR_COLOUR | Light diffuse colour (index determined by setAutoConstant call).
  ACT_LIGHT_ATTENUATION | Light attenuation parameters, Vector4(range, constant, linear, quadric).
  ACT_LIGHT_POSITION | A light position in world space (index determined by setAutoConstant call).
  ACT_LIGHT_DIRECTION | A light direction in world space (index determined by setAutoConstant call).
  ACT_LIGHT_POSITION_OBJECT_SPACE | A light position in object space (index determined by setAutoConstant call).
  ACT_LIGHT_DIRECTION_OBJECT_SPACE | A light direction in object space (index determined by setAutoConstant call).
  ACT_LIGHT_DISTANCE_OBJECT_SPACE | The distance of the light from the center of the object a useful approximation as an alternative to per-vertex distance calculations.
  ACT_SHADOW_EXTRUSION_DISTANCE | The distance a shadow volume should be extruded when using finite extrusion programs.
  ACT_CAMERA_POSITION_OBJECT_SPACE | The current camera's position in object space.
  ACT_AMBIENT_LIGHT_COLOUR | The ambient light colour set in the scene.
  ACT_TEXTURE_VIEWPROJ_MATRIX | The view/projection matrix of the assigned texture projection frustum.
  ACT_CUSTOM | A custom parameter which will come from the renderable, using 'data' as the identifier.

Definition at line 61 of file OgreGpuProgram.h.

## Constructor & Destructor Documentation

Ogre::GpuProgramParameters::GpuProgramParameters | ( |  | ) |

| Definition at line 116 of file OgreGpuProgram.cpp.

Ogre::GpuProgramParameters::~GpuProgramParameters | ( |  | ) |

| Definition at line 172 of file OgreGpuProgram.h.

## Member Function Documentation

void Ogre::GpuProgramParameters::_mapParameterNameToIndex | ( | const String & | name,
|  | size_t | index
| ) |

| Internal method for associating a parameter name with an index. Definition at line 365 of file OgreGpuProgram.cpp. References mParamNameMap, and Ogre::String. Referenced by getParamIndex().

void Ogre::GpuProgramParameters::_updateAutoParamsLightsOnly | ( | const AutoParamDataSource & | source | ) |

Updates the automatic parameters for lights based on the details provided.

Definition at line 306 of file OgreGpuProgram.cpp.

References ACT_LIGHT_ATTENUATION, ACT_LIGHT_DIFFUSE_COLOUR, ACT_LIGHT_DIRECTION, ACT_LIGHT_DIRECTION_OBJECT_SPACE, ACT_LIGHT_DISTANCE_OBJECT_SPACE, ACT_LIGHT_POSITION, ACT_LIGHT_POSITION_OBJECT_SPACE, ACT_LIGHT_SPECULAR_COLOUR, ACT_SHADOW_EXTRUSION_DISTANCE, Ogre::Light::getAs4DVector(), Ogre::Light::getAttenuationConstant(), Ogre::Light::getAttenuationLinear(), Ogre::Light::getAttenuationQuadric(), Ogre::Light::getAttenuationRange(), Ogre::Light::getDerivedDirection(), Ogre::Light::getDerivedPosition(), Ogre::Light::getDiffuseColour(), Ogre::AutoParamDataSource::getInverseWorldMatrix(), Ogre::AutoParamDataSource::getLight(), Ogre::AutoParamDataSource::getShadowExtrusionDistance(), Ogre::Light::getSpecularColour(), hasAutoConstants(), Ogre::Vector3::length(), mAutoConstants, Ogre::Vector3::normalise(), setConstant(), Ogre::Vector4::w, Ogre::Vector4::x, Ogre::Vector3::x, Ogre::Vector4::y, Ogre::Vector3::y, Ogre::Vector4::z, and Ogre::Vector3::z.

void Ogre::GpuProgramParameters::_updateAutoParamsNoLights | ( | const AutoParamDataSource & | source | ) |

Updates the automatic parameters (except lights) based on the details provided.

Definition at line 229 of file OgreGpuProgram.cpp.

References Ogre::Renderable::_updateCustomGpuParameter(), ACT_AMBIENT_LIGHT_COLOUR, ACT_CAMERA_POSITION_OBJECT_SPACE, ACT_CUSTOM, ACT_INVERSE_WORLD_MATRIX, ACT_INVERSE_WORLDVIEW_MATRIX, ACT_PROJECTION_MATRIX, ACT_TEXTURE_VIEWPROJ_MATRIX, ACT_VIEW_MATRIX, ACT_VIEWPROJ_MATRIX, ACT_WORLD_MATRIX, ACT_WORLD_MATRIX_ARRAY, ACT_WORLD_MATRIX_ARRAY_3x4, ACT_WORLDVIEW_MATRIX, ACT_WORLDVIEWPROJ_MATRIX, Ogre::AutoParamDataSource::getAmbientLightColour(), Ogre::AutoParamDataSource::getCameraPositionObjectSpace(), Ogre::AutoParamDataSource::getCurrentRenderable(), Ogre::AutoParamDataSource::getInverseWorldMatrix(), Ogre::AutoParamDataSource::getInverseWorldViewMatrix(), Ogre::AutoParamDataSource::getProjectionMatrix(), Ogre::AutoParamDataSource::getTextureViewProjMatrix(), Ogre::AutoParamDataSource::getViewMatrix(), Ogre::AutoParamDataSource::getViewProjectionMatrix(), Ogre::AutoParamDataSource::getWorldMatrix(), Ogre::AutoParamDataSource::getWorldMatrixArray(), Ogre::AutoParamDataSource::getWorldMatrixCount(), Ogre::AutoParamDataSource::getWorldViewMatrix(), Ogre::AutoParamDataSource::getWorldViewProjMatrix(), hasAutoConstants(), mAutoConstants, and setConstant().

void Ogre::GpuProgramParameters::clearAutoConstants | ( | void |  | ) |

| Clears all the existing automatic constants. Definition at line 219 of file OgreGpuProgram.cpp. References mAutoConstants. Referenced by copyConstantsFrom().

void Ogre::GpuProgramParameters::copyConstantsFrom | ( | const GpuProgramParameters & | source | ) |

Copies the values of all constants (including auto constants) from another GpuProgramParameters object.

Definition at line 537 of file OgreGpuProgram.cpp.

References AutoConstantIterator, clearAutoConstants(), Ogre::GpuProgramParameters::AutoConstantEntry::data, getAutoConstantIterator(), getIntConstantIterator(), getRealConstantIterator(), Ogre::GpuProgramParameters::AutoConstantEntry::index, IntConstantIterator, Ogre::GpuProgramParameters::IntConstantEntry::isSet, Ogre::GpuProgramParameters::RealConstantEntry::isSet, mParamNameMap, Ogre::GpuProgramParameters::AutoConstantEntry::paramType, RealConstantIterator, setAutoConstant(), setConstant(), Ogre::ushort, Ogre::GpuProgramParameters::IntConstantEntry::val, and Ogre::GpuProgramParameters::RealConstantEntry::val.

GpuProgramParameters::AutoConstantIterator Ogre::GpuProgramParameters::getAutoConstantIterator | ( | void |  | ) | const

| Gets an iterator over the automatic constant bindings currently in place. Definition at line 224 of file OgreGpuProgram.cpp. References AutoConstantIterator, and mAutoConstants. Referenced by copyConstantsFrom().

size_t Ogre::GpuProgramParameters::getIntConstantCount | ( | void |  | ) | const

| Gets the number of int constants that have been set. Definition at line 267 of file OgreGpuProgram.h.

GpuProgramParameters::IntConstantEntry * Ogre::GpuProgramParameters::getIntConstantEntry | ( | const size_t | index | ) |

Gets a specific Int Constant entry if index is in valid range otherwise returns a NULL.

em index which entry is to be retrieved

Definition at line 486 of file OgreGpuProgram.cpp.

References mIntConstants.

Referenced by getNamedIntConstantEntry().

GpuProgramParameters::IntConstantIterator Ogre::GpuProgramParameters::getIntConstantIterator | ( | void |  | ) | const

| Gets an iterator over the integer constant parameters. Definition at line 467 of file OgreGpuProgram.cpp. References IntConstantIterator, and mIntConstants. Referenced by copyConstantsFrom().

GpuProgramParameters::IntConstantEntry * Ogre::GpuProgramParameters::getNamedIntConstantEntry | ( | const String & | name | ) |

Gets a named Int Constant entry if name is found otherwise returns a NULL.

em name The name of the entry to be retrieved

Definition at line 518 of file OgreGpuProgram.cpp.

References getIntConstantEntry(), mParamNameMap, and Ogre::String.

GpuProgramParameters::RealConstantEntry * Ogre::GpuProgramParameters::getNamedRealConstantEntry | ( | const String & | name | ) |

Gets a Named Real Constant entry if the name is found otherwise returns a NULL.

em name The name of the entry to be retrieved

Definition at line 499 of file OgreGpuProgram.cpp.

References getRealConstantEntry(), mParamNameMap, and Ogre::String.

size_t Ogre::GpuProgramParameters::getParamIndex | ( | const String & | name | ) |

| Gets the constant index associated with a named parameter. Definition at line 371 of file OgreGpuProgram.cpp. References _mapParameterNameToIndex(), Except, mIntConstants, mParamNameMap, mRealConstants, and Ogre::String. Referenced by setNamedAutoConstant(), setNamedConstant(), and setNamedConstantFromTime().

size_t Ogre::GpuProgramParameters::getRealConstantCount | ( | void |  | ) | const

| Gets the number of Real constants that have been set. Definition at line 265 of file OgreGpuProgram.h.

GpuProgramParameters::RealConstantEntry * Ogre::GpuProgramParameters::getRealConstantEntry | ( | const size_t | index | ) |

Gets a specific Real Constant entry if index is in valid range otherwise returns a NULL.

em index which entry is to be retrieved

Definition at line 473 of file OgreGpuProgram.cpp.

References mRealConstants.

Referenced by getNamedRealConstantEntry().

GpuProgramParameters::RealConstantIterator Ogre::GpuProgramParameters::getRealConstantIterator | ( | void |  | ) | const

| Gets an iterator over the Real constant parameters. Definition at line 462 of file OgreGpuProgram.cpp. References mRealConstants, and RealConstantIterator. Referenced by copyConstantsFrom().

bool Ogre::GpuProgramParameters::getTransposeMatrices | ( | void |  | ) | const

| Gets whether or not matrices are to be transposed when set. Definition at line 478 of file OgreGpuProgram.h.

bool Ogre::GpuProgramParameters::hasAutoConstants | ( | void |  | ) | const

| Returns true if this instance has any automatic constants. Definition at line 299 of file OgreGpuProgram.h. Referenced by _updateAutoParamsLightsOnly(), and _updateAutoParamsNoLights().

bool Ogre::GpuProgramParameters::hasIntConstantParams | ( | void |  | ) | const

| Returns true if there are any int constants contained here. Definition at line 271 of file OgreGpuProgram.h.

bool Ogre::GpuProgramParameters::hasRealConstantParams | ( | void |  | ) | const

| Returns true if there are any Real constants contained here. Definition at line 269 of file OgreGpuProgram.h.

void Ogre::GpuProgramParameters::resetIntConstants | ( | void |  | ) |

| Deletes the contents of the int constants registers. Definition at line 236 of file OgreGpuProgram.h.

void Ogre::GpuProgramParameters::resetRealConstants | ( | void |  | ) |

| Deletes the contents of the Real constants registers. Definition at line 234 of file OgreGpuProgram.h.

void Ogre::GpuProgramParameters::setAutoAddParamName | ( | bool | state | ) |

Sets the auto add parameter name flag.

Remarks:
  Not all GPU programs make named parameters available after the high level source is compiled. GLSL is one such case. If parameter names are not loaded prior to the material serializer reading in parameter names in a script then an exception is generated. Set AutoAddParamName to true to have names not found in the map added to the map.

Note:
  The index of the parameter name will be set to the end of the Real Constant List.

Parameters:

  state | true to enable automatic name

Definition at line 316 of file OgreGpuProgram.h.

void Ogre::GpuProgramParameters::setAutoConstant | ( | size_t | index,
|  | AutoConstantType | acType,
|  | size_t | extraInfo = 0
| ) |

Sets up a constant which will automatically be updated by the system.

Remarks:
  Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.

Parameters:

  index | The location in the constant list to place this updated constant every time it is changed. Note that because of the nature of the types, we know how big the parameter details will be so you don't need to set that like you do for manual constants.
  acType | The type of automatic constant to set
  extraInfo | If the constant type needs more information (like a light index) put it here.

Definition at line 214 of file OgreGpuProgram.cpp.

References mAutoConstants.

Referenced by copyConstantsFrom(), and setNamedAutoConstant().

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const int * | val,
|  | size_t | count
| ) |

Sets a multiple value constant integer parameter to the program.

Remarks:
  Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on RenderSystemCapabilities to determine the options.

Parameters:

  index | The constant index at which to place the parameter (each constant is a 4D integer)
  val | Pointer to the values to write, must contain 4*count ints
  count | The number of groups of 4 ints to write

Definition at line 198 of file OgreGpuProgram.cpp.

References Ogre::GpuProgramParameters::IntConstantEntry::isSet, mIntConstants, and Ogre::GpuProgramParameters::IntConstantEntry::val.

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const ColourValue & | colour
| ) |

Sets a ColourValue parameter to the program.

Parameters:

  index | The constant index at which to place the parameter (each constant is a 4D float)
  colour | The value to set

Definition at line 176 of file OgreGpuProgram.cpp.

References setConstant(), and Ogre::ColourValue::val.

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const Real * | val,
|  | size_t | count
| ) |

Sets a multiple value constant floating-point parameter to the program.

Parameters:

  index | The constant index at which to start placing parameters (each constant is a 4D float)
  val | Pointer to the values to write, must contain 4*count floats
  count | The number of groups of 4 floats to write

Definition at line 181 of file OgreGpuProgram.cpp.

References Ogre::GpuProgramParameters::RealConstantEntry::isSet, mRealConstants, Ogre::Real, and Ogre::GpuProgramParameters::RealConstantEntry::val.

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const Matrix4 * | m,
|  | size_t | numEntries
| ) |

Sets a list of Matrix4 parameters to the program.

Parameters:

  index | The constant index at which to start placing the parameter (each constant is a 4D float). NB since a Matrix4 is 16 floats long, so each entry will take up 4 indexes.
  m | Pointer to an array of matrices to set
  numEntries | Number of Matrix4 entries

Definition at line 151 of file OgreGpuProgram.cpp.

References Ogre::Matrix4::transpose().

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const Matrix4 & | m
| ) |

Sets a Matrix4 parameter to the program.

Parameters:

  index | The constant index at which to place the parameter (each constant is a 4D float). NB since a Matrix4 is 16 floats long, this parameter will take up 4 indexes.
  m | The value to set

Definition at line 131 of file OgreGpuProgram.cpp.

References Ogre::Matrix4::transpose().

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const Vector3 & | vec
| ) |

Sets a 4-element floating-point parameter to the program via Vector3.

Parameters:

  index | The constant index at which to place the parameter (each constant is a 4D float). Note that since you're passing a Vector3, the last element of the 4-element value will be set to 1 (a homogenous vector)
  vec | The value to set

Definition at line 126 of file OgreGpuProgram.cpp.

References setConstant(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::GpuProgramParameters::setConstant | ( | size_t | index,
|  | const Vector4 & | vec
| ) |

Sets a 4-element floating-point parameter to the program.

Parameters:

  index | The constant index at which to place the parameter (each constant is a 4D float)
  vec | The value to set

Definition at line 121 of file OgreGpuProgram.cpp.

References Ogre::Vector4::val.

Referenced by _updateAutoParamsLightsOnly(), _updateAutoParamsNoLights(), Ogre::TerrainRenderable::_updateCustomGpuParameter(), Ogre::Renderable::_updateCustomGpuParameter(), copyConstantsFrom(), setConstant(), setNamedConstant(), and Ogre::FloatGpuParameterControllerValue::setValue().

void Ogre::GpuProgramParameters::setConstantFromTime | ( | size_t | index,
|  | Real | factor
| ) |

Sets a named parameter up to track a derivation of the current time.

Parameters:

  index | The index of the parameter
  factor | The amount by which to scale the time value

Definition at line 450 of file OgreGpuProgram.cpp.

References Ogre::Real.

Referenced by setNamedConstantFromTime().

void Ogre::GpuProgramParameters::setNamedAutoConstant | ( | const String & | name,
|  | AutoConstantType | acType,
|  | size_t | extraInfo = 0
| ) |

Sets up a constant which will automatically be updated by the system.

Remarks:
  Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  acType | The type of automatic constant to set
  extraInfo | If the constant type needs more information (like a light index) put it here.

Definition at line 445 of file OgreGpuProgram.cpp.

References getParamIndex(), setAutoConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const int * | val,
|  | size_t | count
| ) |

Sets a multiple value constant integer parameter to the program.

Remarks:
  Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on RenderSystemCapabilities to determine the options.

  Another possible limitation is that some systems only allow constants to be set on certain boundaries, e.g. in sets of 4 values for example. Again, see RenderSystemCapabilities for full details.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  val | Pointer to the values to write
  count | The number of integers to write

Definition at line 440 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const ColourValue & | colour
| ) |

Sets a ColourValue parameter to the program.

Parameters:

  name | The name of the parameter
  colour | The value to set

Definition at line 435 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const Real * | val,
|  | size_t | count
| ) |

Sets a multiple value constant floating-point parameter to the program.

Remarks:
  Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on RenderSystemCapabilities to determine the options.

  Another possible limitation is that some systems only allow constants to be set on certain boundaries, e.g. in sets of 4 values for example. Again, see RenderSystemCapabilities for full details.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  val | Pointer to the values to write
  count | The number of floats to write

Definition at line 430 of file OgreGpuProgram.cpp.

References getParamIndex(), Ogre::Real, setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const Matrix4 * | m,
|  | size_t | numEntries
| ) |

Sets a list of Matrix4 parameters to the program.

Parameters:

  name | The name of the parameter; this must be the first index of an array, for examples 'matrices[0]' NB since a Matrix4 is 16 floats long, so each entry will take up 4 indexes.
  m | Pointer to an array of matrices to set
  numEntries | Number of Matrix4 entries

Definition at line 424 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const Matrix4 & | m
| ) |

Sets a Matrix4 parameter to the program.

Parameters:

  name | The name of the parameter
  m | The value to set

Definition at line 419 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const Vector3 & | vec
| ) |

Sets a Vector3 parameter to the program.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  index | The index at which to place the parameter NB this index refers to the number of floats, so a Vector3 is 3. Note that many rendersystems & programs assume that every floating point parameter is passed in as a vector of 4 items, so you are strongly advised to check with RenderSystemCapabilities before using this version - if in doubt use Vector4 or ColourValue instead (both are 4D).
  vec | The value to set

Definition at line 414 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | const Vector4 & | vec
| ) |

Sets a Vector4 parameter to the program.

Parameters:

  name | The name of the parameter
  vec | The value to set

Definition at line 409 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | int | val
| ) |

Sets a single value constant integer parameter to the program.

Remarks:
  Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on RenderSystemCapabilities to determine the options.

  Another possible limitation is that some systems only allow constants to be set on certain boundaries, e.g. in sets of 4 values for example. Again, see RenderSystemCapabilities for full details.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  val | The value to set

Definition at line 404 of file OgreGpuProgram.cpp.

References getParamIndex(), setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstant | ( | const String & | name,
|  | Real | val
| ) |

Sets a single value constant floating-point parameter to the program.

Remarks:
  Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on RenderSystemCapabilities to determine the options.

  Another possible limitation is that some systems only allow constants to be set on certain boundaries, e.g. in sets of 4 values for example. Again, see RenderSystemCapabilities for full details.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  val | The value to set

Definition at line 399 of file OgreGpuProgram.cpp.

References getParamIndex(), Ogre::Real, setConstant(), and Ogre::String.

void Ogre::GpuProgramParameters::setNamedConstantFromTime | ( | const String & | name,
|  | Real | factor
| ) |

Sets a named parameter up to track a derivation of the current time.

Note:
  This named option will only work if you are using a parameters object created from a high-level program (HighLevelGpuProgram).

Parameters:

  name | The name of the parameter
  factor | The amount by which to scale the time value

Definition at line 457 of file OgreGpuProgram.cpp.

References getParamIndex(), Ogre::Real, setConstantFromTime(), and Ogre::String.

void Ogre::GpuProgramParameters::setTransposeMatrices | ( | bool | val | ) |

Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.

Remarks:
  D3D uses transposed matrices compared to GL and OGRE; this is not important when you use programs which are written to process row-major matrices, such as those generated by Cg, but if you use a program written to D3D's matrix layout you will need to enable this flag.

Definition at line 476 of file OgreGpuProgram.h.

## Member Data Documentation

bool Ogre::GpuProgramParameters::mAutoAddParamName`[protected]`

| flag to indicate if names not found will be automatically added Definition at line 168 of file OgreGpuProgram.h.

AutoConstantList Ogre::GpuProgramParameters::mAutoConstants`[protected]`

| List of automatically updated parameters. Definition at line 161 of file OgreGpuProgram.h. Referenced by _updateAutoParamsLightsOnly(), _updateAutoParamsNoLights(), clearAutoConstants(), getAutoConstantIterator(), and setAutoConstant().

IntConstantList Ogre::GpuProgramParameters::mIntConstants`[protected]`

| Packed list of integer constants. Definition at line 159 of file OgreGpuProgram.h. Referenced by getIntConstantEntry(), getIntConstantIterator(), getParamIndex(), and setConstant().

ParamNameMap Ogre::GpuProgramParameters::mParamNameMap`[protected]`

| Definition at line 164 of file OgreGpuProgram.h. Referenced by _mapParameterNameToIndex(), copyConstantsFrom(), getNamedIntConstantEntry(), getNamedRealConstantEntry(), and getParamIndex().

RealConstantList Ogre::GpuProgramParameters::mRealConstants`[protected]`

| Packed list of floating-point constants. Definition at line 157 of file OgreGpuProgram.h. Referenced by getParamIndex(), getRealConstantEntry(), getRealConstantIterator(), and setConstant().

bool Ogre::GpuProgramParameters::mTransposeMatrices`[protected]`

| Do we need to transpose matrices? Definition at line 166 of file OgreGpuProgram.h.

The documentation for this class was generated from the following files:

- OgreGpuProgram.h
- OgreGpuProgram.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:59 2004