OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::GpuSharedParameters Class Reference

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

#include <OgreGpuProgramParams.h>

+ Inheritance diagram for Ogre::GpuSharedParameters:
+ Collaboration diagram for Ogre::GpuSharedParameters:

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 _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)
 
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
 Get a reference to the list of uint constants. More...
 
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 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, uint val)
 Sets a single value constant unsigned integer parameter to the program. More...
 
void setNamedConstant (const String &name, const Vector4 &vec)
 
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)
 
void setNamedConstant (const String &name, const uint *val, size_t count)
 

Protected Attributes

bool mDirty
 
DoubleConstantList mDoubleConstants
 List of double constants values. More...
 
FloatConstantList mFloatConstants
 List of float constant values. More...
 
size_t mFrameLastUpdated
 Not used when copying data, but might be useful to RS using shared buffers. More...
 
IntConstantList mIntConstants
 List of int constant values. More...
 
String mName
 Name of the shared parameter set. More...
 
GpuNamedConstants mNamedConstants
 Shared parameter definitions and related data. More...
 
Any mRenderSystemData
 Optional data the rendersystem might want to store. More...
 
UnsignedIntConstantList mUnsignedIntConstants
 List of unsigned int constant values. More...
 
unsigned long mVersion
 Version number of the definitions in this buffer. More...
 

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 GpuProgramA 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 627 of file OgreGpuProgramParams.h.

Constructor & Destructor Documentation

Ogre::GpuSharedParameters::GpuSharedParameters ( const String name)
virtual Ogre::GpuSharedParameters::~GpuSharedParameters ( )
virtual

Member Function Documentation

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

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

Definition at line 795 of file OgreGpuProgramParams.h.

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.
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.
void Ogre::GpuSharedParameters::_setRenderSystemData ( const Any data) const
inline

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

Definition at line 793 of file OgreGpuProgramParams.h.

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.
size_t Ogre::GpuSharedParameters::calculateSize ( void  ) const

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

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

Get a specific GpuConstantDefinition for a named parameter.

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

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

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

Get the full list of GpuConstantDefinition instances.

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

Get a reference to the list of double constants.

Definition at line 784 of file OgreGpuProgramParams.h.

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

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

Definition at line 765 of file OgreGpuProgramParams.h.

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

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

Definition at line 767 of file OgreGpuProgramParams.h.

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

Get a reference to the list of float constants.

Definition at line 782 of file OgreGpuProgramParams.h.

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

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

Definition at line 761 of file OgreGpuProgramParams.h.

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

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

Definition at line 763 of file OgreGpuProgramParams.h.

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

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

Definition at line 714 of file OgreGpuProgramParams.h.

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

Get a reference to the list of int constants.

Definition at line 786 of file OgreGpuProgramParams.h.

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

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

Definition at line 769 of file OgreGpuProgramParams.h.

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

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

Definition at line 771 of file OgreGpuProgramParams.h.

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

Get the name of this shared parameter set.

Definition at line 662 of file OgreGpuProgramParams.h.

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

Get a reference to the list of uint constants.

Definition at line 788 of file OgreGpuProgramParams.h.

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

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

Definition at line 773 of file OgreGpuProgramParams.h.

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

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

Definition at line 775 of file OgreGpuProgramParams.h.

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.

Definition at line 684 of file OgreGpuProgramParams.h.

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

Definition at line 694 of file OgreGpuProgramParams.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

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

Definition at line 108 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

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

Definition at line 119 of file OgreMemoryAllocatedObject.h.

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

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

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

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

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

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

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

Definition at line 91 of file OgreMemoryAllocatedObject.h.

void Ogre::GpuSharedParameters::removeAllConstantDefinitions ( )

Remove a constant definition from this shared set of parameters.

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

Remove a constant definition from this shared set of parameters.

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
nameThe name of the parameter
valThe value to set
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
nameThe name of the parameter
valThe value to set
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
nameThe name of the parameter
valThe value to set
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
nameThe name of the parameter
valThe value to setSets a Vector4 parameter to the program.
nameThe name of the parameter
vecThe value to set
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
indexThe 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).
vecThe value to set
void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const Vector2 vec 
)

Sets a Vector2 parameter to the program.

Parameters
nameThe name of the parameter
vecThe value to set
void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const Matrix4 m 
)

Sets a Matrix4 parameter to the program.

Parameters
nameThe name of the parameter
mThe value to set
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
void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const float *  val,
size_t  count 
)

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

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

Sets a ColourValue parameter to the program.

Parameters
nameThe name of the parameter
colourThe value to set
void Ogre::GpuSharedParameters::setNamedConstant ( const String name,
const int *  val,
size_t  count 
)

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

Member Data Documentation

bool Ogre::GpuSharedParameters::mDirty
protected

Definition at line 655 of file OgreGpuProgramParams.h.

DoubleConstantList Ogre::GpuSharedParameters::mDoubleConstants
protected

List of double constants values.

Definition at line 639 of file OgreGpuProgramParams.h.

FloatConstantList Ogre::GpuSharedParameters::mFloatConstants
protected

List of float constant values.

Definition at line 637 of file OgreGpuProgramParams.h.

size_t Ogre::GpuSharedParameters::mFrameLastUpdated
protected

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

Definition at line 650 of file OgreGpuProgramParams.h.

IntConstantList Ogre::GpuSharedParameters::mIntConstants
protected

List of int constant values.

Definition at line 641 of file OgreGpuProgramParams.h.

String Ogre::GpuSharedParameters::mName
protected

Name of the shared parameter set.

Definition at line 631 of file OgreGpuProgramParams.h.

GpuNamedConstants Ogre::GpuSharedParameters::mNamedConstants
protected

Shared parameter definitions and related data.

Definition at line 634 of file OgreGpuProgramParams.h.

Any Ogre::GpuSharedParameters::mRenderSystemData
mutableprotected

Optional data the rendersystem might want to store.

Definition at line 647 of file OgreGpuProgramParams.h.

UnsignedIntConstantList Ogre::GpuSharedParameters::mUnsignedIntConstants
protected

List of unsigned int constant values.

Definition at line 643 of file OgreGpuProgramParams.h.

unsigned long Ogre::GpuSharedParameters::mVersion
protected

Version number of the definitions in this buffer.

Definition at line 653 of file OgreGpuProgramParams.h.


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