OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
A group of manually updated parameters that are shared between many parameter sets. More...
#include <OgreGpuProgramParams.h>
Public Member Functions | |
GpuSharedParameters (const String &name) | |
const HardwareBufferPtr & | _getHardwareBuffer () const |
Internal method that the RenderSystem might use to store optional data. | |
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 | _setHardwareBuffer (const HardwareBufferPtr &data) |
Internal method that the RenderSystem might use to store optional data. | |
void | _upload () const |
upload parameter data to GPU memory. Must have a HardwareBuffer | |
void | addConstantDefinition (const String &name, GpuConstantType constType, uint32 arraySize=1) |
Add a new constant definition to this shared set of parameters. | |
size_t | calculateSize (void) const |
Calculate the expected size of the shared parameter buffer based on constant definition data types. | |
void | download () |
download data from GPU memory. Must have a writable HardwareBuffer | |
const GpuConstantDefinition & | getConstantDefinition (const String &name) const |
Get a specific GpuConstantDefinition for a named parameter. | |
GpuConstantDefinitionIterator | getConstantDefinitionIterator (void) const |
const GpuNamedConstants & | getConstantDefinitions () const |
Get the full list of GpuConstantDefinition instances. | |
const ConstantList & | getConstantList () const |
Get a reference to the list of 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. | |
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. | |
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. | |
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. | |
uint32 | 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) |
void | 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. | |
void | setNamedConstant (const String &name, const double *val, uint32 count) |
void | setNamedConstant (const String &name, const float *val, uint32 count) |
void | setNamedConstant (const String &name, const int *val, uint32 count) |
void | 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. | |
void | setNamedConstant (const String &name, const Matrix4 *m, uint32 numEntries) |
Sets a list of Matrix4 parameters to the program. | |
void | setNamedConstant (const String &name, const uint *val, uint32 count) |
template<int dims, typename T > | |
void | setNamedConstant (const String &name, const Vector< dims, T > &vec) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T > | |
void | setNamedConstant (const String &name, T val) |
Sets a single value constant parameter to the program. | |
A group of manually updated parameters that are shared between many parameter sets.
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.
Get the name of this shared parameter set.
Referenced by Ogre::GpuSharedParametersUsage::getName().
void Ogre::GpuSharedParameters::addConstantDefinition | ( | const String & | name, |
GpuConstantType | constType, | ||
uint32 | arraySize = 1 |
||
) |
Add a new constant definition to this shared set of parameters.
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.
void Ogre::GpuSharedParameters::removeAllConstantDefinitions | ( | ) |
Remove a constant definition from this shared set of parameters.
|
inline |
Get the version number of this shared parameter set, can be used to identify when changes have occurred.
Calculate the expected size of the shared parameter buffer based on constant definition data types.
|
inline |
True if this parameter set is dirty (values have been modified, but the render system has not updated them yet).
void Ogre::GpuSharedParameters::_markClean | ( | ) |
Mark the shared set as being clean (values successfully updated by the render system).
You do not need to call this yourself. The set is marked as clean whenever the render system updates dirty shared parameters.
void Ogre::GpuSharedParameters::_markDirty | ( | ) |
Mark the shared set as being dirty (values modified and not yet updated in render system).
You do not need to call this yourself. The set is marked as dirty whenever setNamedConstant or (non const) getFloatPointer et al are called.
GpuConstantDefinitionIterator Ogre::GpuSharedParameters::getConstantDefinitionIterator | ( | void | ) | const |
const GpuConstantDefinition & Ogre::GpuSharedParameters::getConstantDefinition | ( | const String & | name | ) | const |
Get a specific GpuConstantDefinition for a named parameter.
const GpuNamedConstants & Ogre::GpuSharedParameters::getConstantDefinitions | ( | ) | const |
Get the full list of GpuConstantDefinition instances.
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.
name | The name of the parameter |
val | The value to set |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name, |
const Matrix4 * | m, | ||
uint32 | numEntries | ||
) |
Sets a list of Matrix4 parameters to the program.
void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name, |
const float * | val, | ||
uint32 | count | ||
) |
void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name, |
const double * | val, | ||
uint32 | count | ||
) |
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.
void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name, |
const int * | val, | ||
uint32 | count | ||
) |
void Ogre::GpuSharedParameters::setNamedConstant | ( | const String & | name, |
const uint * | val, | ||
uint32 | count | ||
) |
Get a pointer to the 'nth' item in the float buffer.
Get a pointer to the 'nth' item in the float buffer.
Get a pointer to the 'nth' item in the double buffer.
Get a pointer to the 'nth' item in the double buffer.
Get a pointer to the 'nth' item in the int buffer.
Get a pointer to the 'nth' item in the int buffer.
Get a pointer to the 'nth' item in the uint buffer.
Get a pointer to the 'nth' item in the uint buffer.
|
inline |
Get a reference to the list of constants.
|
inline |
Internal method that the RenderSystem might use to store optional data.
|
inline |
Internal method that the RenderSystem might use to store optional data.
void Ogre::GpuSharedParameters::_upload | ( | ) | const |
upload parameter data to GPU memory. Must have a HardwareBuffer
void Ogre::GpuSharedParameters::download | ( | ) |
download data from GPU memory. Must have a writable HardwareBuffer