OGRE  1.11.6
Object-Oriented Graphics Rendering Engine
Ogre::GpuSharedParameters Class Reference

A group of manually updated parameters that are shared between many parameter sets. More...

#include <OgreGpuProgramParams.h>

+ Inheritance diagram for Ogre::GpuSharedParameters:

Public Member Functions

 GpuSharedParameters (const String &name)
 
const Any_getRenderSystemData () const
 Internal method that the RenderSystem might use to store optional data. More...
 
void _markClean ()
 Mark the shared set as being clean (values successfully updated by the render system). More...
 
void _markDirty ()
 Mark the shared set as being dirty (values modified and not yet updated in render system). More...
 
void _setRenderSystemData (const Any &data) const
 Internal method that the RenderSystem might use to store optional data. More...
 
void addConstantDefinition (const String &name, GpuConstantType constType, size_t arraySize=1)
 Add a new constant definition to this shared set of parameters. More...
 
size_t calculateSize (void) const
 Calculate the expected size of the shared parameter buffer based on constant definition data types. More...
 
const GpuConstantDefinitiongetConstantDefinition (const String &name) const
 Get a specific GpuConstantDefinition for a named parameter. More...
 
GpuConstantDefinitionIterator getConstantDefinitionIterator (void) const
 Gets an iterator over the named GpuConstantDefinition instances as defined by the user. More...
 
const GpuNamedConstantsgetConstantDefinitions () const
 Get the full list of GpuConstantDefinition instances. More...
 
const DoubleConstantListgetDoubleConstantList () const
 Get a reference to the list of double constants. More...
 
double * getDoublePointer (size_t pos)
 Get a pointer to the 'nth' item in the double buffer. More...
 
const double * getDoublePointer (size_t pos) const
 Get a pointer to the 'nth' item in the double buffer. More...
 
const FloatConstantListgetFloatConstantList () const
 Get a reference to the list of float constants. More...
 
float * getFloatPointer (size_t pos)
 Get a pointer to the 'nth' item in the float buffer. More...
 
const float * getFloatPointer (size_t pos) const
 Get a pointer to the 'nth' item in the float buffer. More...
 
size_t getFrameLastUpdated () const
 Get the frame in which this shared parameter set was last updated. More...
 
const IntConstantListgetIntConstantList () const
 Get a reference to the list of int constants. More...
 
int * getIntPointer (size_t pos)
 Get a pointer to the 'nth' item in the int buffer. More...
 
const int * getIntPointer (size_t pos) const
 Get a pointer to the 'nth' item in the int buffer. More...
 
const StringgetName ()
 Get the name of this shared parameter set. More...
 
const UnsignedIntConstantListgetUnsignedIntConstantList () const
 
uintgetUnsignedIntPointer (size_t pos)
 Get a pointer to the 'nth' item in the uint buffer. More...
 
const uintgetUnsignedIntPointer (size_t pos) const
 Get a pointer to the 'nth' item in the uint buffer. More...
 
unsigned long getVersion () const
 Get the version number of this shared parameter set, can be used to identify when changes have occurred. More...
 
bool isDirty () const
 True if this parameter set is dirty (values have been modified, but the render system has not updated them yet). More...
 
void removeAllConstantDefinitions ()
 Remove a constant definition from this shared set of parameters. More...
 
void removeConstantDefinition (const String &name)
 Remove a constant definition from this shared set of parameters. More...
 
void setNamedConstant (const String &name, Real val)
 Sets a single value constant parameter to the program. More...
 
void setNamedConstant (const String &name, int val)
 
void setNamedConstant (const String &name, uint val)
 
void setNamedConstant (const String &name, const Vector4 &vec)
 
void setNamedConstant (const String &name, const Vector3 &vec)
 
void setNamedConstant (const String &name, const Vector2 &vec)
 
void setNamedConstant (const String &name, const Matrix4 &m)
 
void setNamedConstant (const String &name, const Matrix4 *m, size_t numEntries)
 Sets a list of Matrix4 parameters to the program. More...
 
void setNamedConstant (const String &name, const float *val, size_t count)
 
void setNamedConstant (const String &name, const double *val, size_t count)
 
void setNamedConstant (const String &name, const ColourValue &colour)
 
void setNamedConstant (const String &name, const int *val, size_t count)
 
void setNamedConstant (const String &name, const uint *val, size_t count)
 

Detailed Description

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)

Member Function Documentation

◆ getName()

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

Get the name of this shared parameter set.

Referenced by Ogre::GpuSharedParametersUsage::getName().

◆ 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.

◆ removeConstantDefinition()

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

Remove a constant definition from this shared set of parameters.

◆ removeAllConstantDefinitions()

void Ogre::GpuSharedParameters::removeAllConstantDefinitions ( )

Remove a constant definition from this shared set of parameters.

◆ 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.

◆ calculateSize()

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

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

◆ 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).

◆ _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.

◆ getFrameLastUpdated()

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

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

◆ getConstantDefinitionIterator()

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

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

◆ getConstantDefinition()

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

Get a specific GpuConstantDefinition for a named parameter.

◆ getConstantDefinitions()

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

Get the full list of GpuConstantDefinition instances.

◆ setNamedConstant() [1/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
Real  val 
)

Sets a single value constant parameter to the program.

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
nameThe name of the parameter
valThe value to set

◆ setNamedConstant() [2/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
int  val 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [3/13]

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [4/13]

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [5/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const Vector3 vec 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [6/13]

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [7/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const Matrix4 m 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [8/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const Matrix4 m,
size_t  numEntries 
)

Sets a list of Matrix4 parameters to the program.

Parameters
nameThe 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.
mPointer to an array of matrices to set
numEntriesNumber of Matrix4 entries

◆ setNamedConstant() [9/13]

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

◆ setNamedConstant() [10/13]

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

◆ setNamedConstant() [11/13]

void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const ColourValue colour 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setNamedConstant() [12/13]

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

◆ setNamedConstant() [13/13]

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

◆ getFloatPointer() [1/2]

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

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

◆ getFloatPointer() [2/2]

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

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

◆ getDoublePointer() [1/2]

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

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

◆ getDoublePointer() [2/2]

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

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

◆ getIntPointer() [1/2]

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

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

◆ getIntPointer() [2/2]

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

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

◆ getUnsignedIntPointer() [1/2]

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

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

◆ getUnsignedIntPointer() [2/2]

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

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

◆ getFloatConstantList()

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

Get a reference to the list of float constants.

◆ getDoubleConstantList()

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

Get a reference to the list of double constants.

◆ getIntConstantList()

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

Get a reference to the list of int constants.

◆ getUnsignedIntConstantList()

const UnsignedIntConstantList& Ogre::GpuSharedParameters::getUnsignedIntConstantList ( ) const
inline
Deprecated:
use getIntConstantList

◆ _setRenderSystemData()

void Ogre::GpuSharedParameters::_setRenderSystemData ( const Any data) const
inline

Internal method that the RenderSystem might use to store optional data.

◆ _getRenderSystemData()

const Any& Ogre::GpuSharedParameters::_getRenderSystemData ( ) const
inline

Internal method that the RenderSystem might use to store optional data.


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