OGRE-Next: Ogre::GpuSharedParameters Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Ogre::GpuSharedParameters Class Reference
Core » Materials

Definition of container that holds the current bool constants. More...

`#include <OgreGpuProgramParams.h>`

Inheritance diagram for Ogre::GpuSharedParameters:
[legend]

## Public Member Functions
| GpuSharedParameters (const String &name)
virtual | ~GpuSharedParameters ()
void | _markClean ()
| Mark the shared set as being clean (values successfully updated by the render system).
void | _markDirty ()
| Mark the shared set as being dirty (values modified and not yet updated in render system).
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 () const
| Calculate the expected size of the shared parameter buffer based on constant definition data types.
const GpuConstantDefinition & | getConstantDefinition (const String &name) const
| Get a specific GpuConstantDefinition for a named parameter.
GpuConstantDefinitionIterator | getConstantDefinitionIterator () const
| Gets an iterator over the named GpuConstantDefinition instances as defined by the user.
const GpuNamedConstants & | getConstantDefinitions () const
| Get the full list of GpuConstantDefinition instances.
const DoubleConstantList & | getDoubleConstantList () const
| Get a reference to the list of double constants.
double * | getDoublePointer (size_t pos)
| Get a pointer to the 'nth' item in the double buffer.
const double * | getDoublePointer (size_t pos) const
| Get a pointer to the 'nth' item in the double buffer.
const FloatConstantList & | getFloatConstantList () const
| Get a reference to the list of float constants.
float * | getFloatPointer (size_t pos)
| Get a pointer to the 'nth' item in the float buffer.
const float * | getFloatPointer (size_t pos) const
| Get a pointer to the 'nth' item in the float buffer.
size_t | getFrameLastUpdated () const
| Get the frame in which this shared parameter set was last updated.
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.
const int * | getIntPointer (size_t pos) const
| Get a pointer to the 'nth' item in the int buffer.
const String & | getName ()
| Get the name of this shared parameter set.
const UnsignedIntConstantList & | getUnsignedIntConstantList () const
| Get a reference to the list of uint constants.
uint * | getUnsignedIntPointer (size_t pos)
| Get a pointer to the 'nth' item in the uint buffer.
const uint * | getUnsignedIntPointer (size_t pos) const
| Get a pointer to the 'nth' item in the uint buffer.
unsigned long | getVersion () const
| Get the version number of this shared parameter set, can be used to identify when changes have occurred.
bool | isDirty () const
| True if this parameter set is dirty (values have been modified, but the render system has not updated them yet).
void | removeAllConstantDefinitions ()
| Remove a constant definition from this shared set of parameters.
void | removeConstantDefinition (const String &name)
| Remove a constant definition from this shared set of parameters.
void | setNamedConstant (const String &name, const bool *val, size_t count)
void | setNamedConstant (const String &name, const ColourValue &colour)
| Sets a ColourValue parameter to the program.
void | setNamedConstant (const String &name, const double *val, size_t count)
void | setNamedConstant (const String &name, const float *val, size_t count)
void | setNamedConstant (const String &name, const int *val, size_t count)
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 uint *val, size_t count)
void | setNamedConstant (const String &name, const Vector2 &vec)
| Sets a Vector2 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 Vector4 &vec)
void | setNamedConstant (const String &name, int val)
| Sets a single value constant integer parameter to the program.
void | setNamedConstant (const String &name, Real val)
| Sets a single value constant floating-point parameter to the program.
void | setNamedConstant (const String &name, uint val)
| Sets a single value constant unsigned integer parameter to the program.

## Detailed Description

Definition of container that holds the current bool constants.

Note
  Not necessarily in direct index order to constant indexes, logical to physical index map is derived from GpuProgram A group of manually updated parameters that are shared between many parameter sets.

Remarks
  Sometimes you want to set some common parameters across many otherwise different parameter sets, and keep them all in sync together. This class allows you to define a set of parameters that you can share across many parameter sets and have the parameters that match automatically be pulled from the shared set, rather than you having to set them on all the parameter sets individually.

  Parameters in a shared set are matched up with instances in a GpuProgramParameters structure by matching names. It is up to you to define the named parameters that a shared set contains, and ensuring the definition matches.

Note
  Shared parameter sets can be named, and looked up using the GpuProgramManager.

## Constructor & Destructor Documentation

## ◆ GpuSharedParameters()

Ogre::GpuSharedParameters::GpuSharedParameters | ( | const String & | name | ) |

## ◆ ~GpuSharedParameters()

virtual Ogre::GpuSharedParameters::~GpuSharedParameters | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ _markClean()

void Ogre::GpuSharedParameters::_markClean | ( |  | ) |

Mark the shared set as being clean (values successfully updated by the render system).

Remarks
  You do not need to call this yourself. The set is marked as clean whenever the render system updates dirty shared parameters.

## ◆ _markDirty()

void Ogre::GpuSharedParameters::_markDirty | ( |  | ) |

Mark the shared set as being dirty (values modified and not yet updated in render system).

Remarks
  You do not need to call this yourself. The set is marked as dirty whenever setNamedConstant or (non const) getFloatPointer et al are called.

Referenced by getDoublePointer(), getFloatPointer(), getIntPointer(), and getUnsignedIntPointer().

## ◆ addConstantDefinition()

void Ogre::GpuSharedParameters::addConstantDefinition | ( | const String & | name,
|  | GpuConstantType | constType,
|  | size_t | arraySize = 1 )

Add a new constant definition to this shared set of parameters.

Remarks
  Unlike GpuProgramParameters, where the parameter list is defined by the program being compiled, this shared parameter set is defined by the user. Only parameters which have been predefined here may be later updated.

## ◆ calculateSize()

size_t Ogre::GpuSharedParameters::calculateSize | ( |  | ) | const

Calculate the expected size of the shared parameter buffer based on constant definition data types.

## ◆ getConstantDefinition()

const GpuConstantDefinition & Ogre::GpuSharedParameters::getConstantDefinition | ( | const String & | name | ) | const

Get a specific GpuConstantDefinition for a named parameter.

## ◆ getConstantDefinitionIterator()

GpuConstantDefinitionIterator Ogre::GpuSharedParameters::getConstantDefinitionIterator | ( |  | ) | const

Gets an iterator over the named GpuConstantDefinition instances as defined by the user.

## ◆ getConstantDefinitions()

const GpuNamedConstants & Ogre::GpuSharedParameters::getConstantDefinitions | ( |  | ) | const

Get the full list of GpuConstantDefinition instances.

## ◆ getDoubleConstantList()

const DoubleConstantList & Ogre::GpuSharedParameters::getDoubleConstantList | ( |  | ) | const
| inline

Get a reference to the list of double constants.

## ◆ getDoublePointer() [1/2]

double * Ogre::GpuSharedParameters::getDoublePointer | ( | size_t | pos | ) |
| inline

Get a pointer to the 'nth' item in the double buffer.

References _markDirty().

## ◆ getDoublePointer() [2/2]

const double * Ogre::GpuSharedParameters::getDoublePointer | ( | size_t | pos | ) | const
| inline

Get a pointer to the 'nth' item in the double buffer.

## ◆ getFloatConstantList()

const FloatConstantList & Ogre::GpuSharedParameters::getFloatConstantList | ( |  | ) | const
| inline

Get a reference to the list of float constants.

## ◆ getFloatPointer() [1/2]

float * Ogre::GpuSharedParameters::getFloatPointer | ( | size_t | pos | ) |
| inline

Get a pointer to the 'nth' item in the float buffer.

References _markDirty().

## ◆ getFloatPointer() [2/2]

const float * Ogre::GpuSharedParameters::getFloatPointer | ( | size_t | pos | ) | const
| inline

Get a pointer to the 'nth' item in the float buffer.

## ◆ getFrameLastUpdated()

size_t Ogre::GpuSharedParameters::getFrameLastUpdated | ( |  | ) | const
| inline

Get the frame in which this shared parameter set was last updated.

## ◆ getIntConstantList()

const IntConstantList & Ogre::GpuSharedParameters::getIntConstantList | ( |  | ) | const
| inline

Get a reference to the list of int constants.

## ◆ getIntPointer() [1/2]

int * Ogre::GpuSharedParameters::getIntPointer | ( | size_t | pos | ) |
| inline

Get a pointer to the 'nth' item in the int buffer.

References _markDirty().

## ◆ getIntPointer() [2/2]

const int * Ogre::GpuSharedParameters::getIntPointer | ( | size_t | pos | ) | const
| inline

Get a pointer to the 'nth' item in the int buffer.

## ◆ getName()

const String & Ogre::GpuSharedParameters::getName | ( |  | ) |
| inline

Get the name of this shared parameter set.

## ◆ getUnsignedIntConstantList()

const UnsignedIntConstantList & Ogre::GpuSharedParameters::getUnsignedIntConstantList | ( |  | ) | const
| inline

Get a reference to the list of uint constants.

## ◆ getUnsignedIntPointer() [1/2]

uint * Ogre::GpuSharedParameters::getUnsignedIntPointer | ( | size_t | pos | ) |
| inline

Get a pointer to the 'nth' item in the uint buffer.

References _markDirty().

## ◆ getUnsignedIntPointer() [2/2]

const uint * Ogre::GpuSharedParameters::getUnsignedIntPointer | ( | size_t | pos | ) | const
| inline

Get a pointer to the 'nth' item in the uint buffer.

## ◆ getVersion()

unsigned long Ogre::GpuSharedParameters::getVersion | ( |  | ) | const
| inline

Get the version number of this shared parameter set, can be used to identify when changes have occurred.

## ◆ isDirty()

bool Ogre::GpuSharedParameters::isDirty | ( |  | ) | const
| inline

True if this parameter set is dirty (values have been modified, but the render system has not updated them yet).

## ◆ removeAllConstantDefinitions()

void Ogre::GpuSharedParameters::removeAllConstantDefinitions | ( |  | ) |

Remove a constant definition from this shared set of parameters.

## ◆ removeConstantDefinition()

void Ogre::GpuSharedParameters::removeConstantDefinition | ( | const String & | name | ) |

Remove a constant definition from this shared set of parameters.

## ◆ setNamedConstant() [1/14]

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

## ◆ setNamedConstant() [2/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [3/14]

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

## ◆ setNamedConstant() [4/14]

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

## ◆ setNamedConstant() [5/14]

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

## ◆ setNamedConstant() [6/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [7/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [8/14]

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

## ◆ setNamedConstant() [9/14]

void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name,
|  | const Vector2 & | vec )

Sets a Vector2 parameter to the program.

Parameters

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

## ◆ setNamedConstant() [10/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [11/14]

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

Sets a single value constant boolean 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 Sets a Vector4 parameter to the program.
  name | The name of the parameter
  vec | The value to set

## ◆ setNamedConstant() [12/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [13/14]

void Ogre::GpuSharedParameters::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

## ◆ setNamedConstant() [14/14]

void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name,
|  | uint | val )

Sets a single value constant unsigned 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

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

- OgreGpuProgramParams.h