Ogre::GpuSharedParameters Class Reference
Core » Materials

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

`#include <OgreGpuProgramParams.h>`

Inheritance diagram for Ogre::GpuSharedParameters:
[legend]

## Public Member Functions

| GpuSharedParameters (const String &name)
virtual | ~GpuSharedParameters ()
const Any & | _getRenderSystemData () const
| Internal method that the RenderSystem might use to store optional data. More...
void | _markDirty ()
| Mark the shared set as being dirty (values modified). 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
const GpuConstantDefinition & | getConstantDefinition (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 GpuNamedConstants & | getConstantDefinitions () const
| Get the full list of GpuConstantDefinition instances. More...
const DoubleConstantList & | getDoubleConstantList () 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 FloatConstantList & | getFloatConstantList () 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 IntConstantList & | getIntConstantList () 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 String & | getName ()
| Get the name of this shared parameter set. More...
unsigned long | getVersion () const
| Get the version number of this shared parameter set, can be used to identify when changes have occurred. More...
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info More...
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new More...
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info More...
void * | operator new[] (size_t sz)
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 floating-point parameter to the program. More...
void | setNamedConstant (const String &name, int val)
| Sets a single value constant integer parameter to the program. More...
void | setNamedConstant (const String &name, const Vector4 &vec)
| Sets a Vector4 parameter to the program. More...
void | setNamedConstant (const String &name, const Vector3 &vec)
| Sets a Vector3 parameter to the program. More...
void | setNamedConstant (const String &name, const Vector2 &vec)
| Sets a Vector2 parameter to the program. More...
void | setNamedConstant (const String &name, const Matrix4 &m)
| Sets a Matrix4 parameter to the program. More...
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)
| Sets a ColourValue parameter to the program. More...
void | setNamedConstant (const String &name, const int *val, size_t count)

## Protected Attributes

DoubleConstantList | mDoubleConstants
FloatConstantList | mFloatConstants
size_t | mFrameLastUpdated
| Not used when copying data, but might be useful to RS using shared buffers. More...
IntConstantList | mIntConstants
String | mName
GpuNamedConstants | mNamedConstants
Any | mRenderSystemData
unsigned long | mVersion
| Version number of the definitions in this buffer. More...

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

Definition at line 490 of file OgreGpuProgramParams.h.

## Constructor & Destructor Documentation

## GpuSharedParameters()

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

## ~GpuSharedParameters()

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

virtual

## Member Function Documentation

## _getRenderSystemData()

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

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

Definition at line 607 of file OgreGpuProgramParams.h.

## _markDirty()

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

Mark the shared set as being dirty (values modified).

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

## _setRenderSystemData()

void Ogre::GpuSharedParameters::_setRenderSystemData | ( | const Any & | data | ) | const

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

Definition at line 605 of file OgreGpuProgramParams.h.

## 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 | ( | void |  | ) | const

## getConstantDefinition()

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

Get a specific GpuConstantDefinition for a named parameter.

## getConstantDefinitionIterator()

GpuConstantDefinitionIterator Ogre::GpuSharedParameters::getConstantDefinitionIterator | ( | void |  | ) | 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

Get a reference to the list of double constants.

Definition at line 600 of file OgreGpuProgramParams.h.

## getDoublePointer() [1/2]

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

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

Definition at line 589 of file OgreGpuProgramParams.h.

## getDoublePointer() [2/2]

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

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

Definition at line 591 of file OgreGpuProgramParams.h.

## getFloatConstantList()

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

Get a reference to the list of float constants.

Definition at line 598 of file OgreGpuProgramParams.h.

## getFloatPointer() [1/2]

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

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

Definition at line 585 of file OgreGpuProgramParams.h.

## getFloatPointer() [2/2]

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

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

Definition at line 587 of file OgreGpuProgramParams.h.

## getFrameLastUpdated()

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

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

Definition at line 546 of file OgreGpuProgramParams.h.

## getIntConstantList()

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

Get a reference to the list of int constants.

Definition at line 602 of file OgreGpuProgramParams.h.

## getIntPointer() [1/2]

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

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

Definition at line 593 of file OgreGpuProgramParams.h.

## getIntPointer() [2/2]

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

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

Definition at line 595 of file OgreGpuProgramParams.h.

## getName()

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

Get the name of this shared parameter set.

Definition at line 513 of file OgreGpuProgramParams.h.

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

## getVersion()

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

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

Definition at line 535 of file OgreGpuProgramParams.h.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  |

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) |

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## 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/11]

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() [2/11]

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() [3/11]

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

## setNamedConstant() [4/11]

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

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

## setNamedConstant() [5/11]

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() [6/11]

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/11]

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/11]

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

## setNamedConstant() [9/11]

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

## setNamedConstant() [10/11]

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() [11/11]

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

## Member Data Documentation

## mDoubleConstants

DoubleConstantList Ogre::GpuSharedParameters::mDoubleConstants

protected

Definition at line 495 of file OgreGpuProgramParams.h.

## mFloatConstants

FloatConstantList Ogre::GpuSharedParameters::mFloatConstants

protected

Definition at line 494 of file OgreGpuProgramParams.h.

## mFrameLastUpdated

size_t Ogre::GpuSharedParameters::mFrameLastUpdated

protected

Not used when copying data, but might be useful to RS using shared buffers.

Definition at line 503 of file OgreGpuProgramParams.h.

## mIntConstants

IntConstantList Ogre::GpuSharedParameters::mIntConstants

protected

Definition at line 496 of file OgreGpuProgramParams.h.

## mName

String Ogre::GpuSharedParameters::mName

protected

Definition at line 497 of file OgreGpuProgramParams.h.

## mNamedConstants

GpuNamedConstants Ogre::GpuSharedParameters::mNamedConstants

protected

Definition at line 493 of file OgreGpuProgramParams.h.

## mRenderSystemData

Any Ogre::GpuSharedParameters::mRenderSystemData

mutable protected

Definition at line 500 of file OgreGpuProgramParams.h.

## mVersion

unsigned long Ogre::GpuSharedParameters::mVersion

protected

Version number of the definitions in this buffer.

Definition at line 506 of file OgreGpuProgramParams.h.

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

- OgreGpuProgramParams.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.