Om
1.0.0
A universal framework for multimedia simulation
|
A class that stores a collection of shader constants with their associated usages. More...
#include <omGraphicsConstantSet.h>
Public Member Functions | |
ConstantSet () | |
Create a new constant set object with no constants stored. More... | |
ConstantSet (Size constantDataCapacity) | |
Create a new constant set object with the specified initial capacity in bytes. More... | |
~ConstantSet () | |
Destroy a constant set, releasing all internal resources. More... | |
Size | getConstantCount () const |
Return the number of constants that are stored in this constant set. More... | |
UByte * | getConstantData (Index constantIndex) |
Return a pointer to the storage for the specified constant index. More... | |
const UByte * | getConstantData (Index constantIndex) const |
Return a pointer to the storage for the specified constant index. More... | |
const AttributeType & | getConstantType (Index constantIndex) const |
Return the type of the constant at the specified index. More... | |
template<typename T > | |
const T * | getConstant (ConstantUsage::Enum usage) const |
Return a pointer to the storage for the specified constant usage if it is part of this buffer. More... | |
template<typename T > | |
const T * | getConstant (const ConstantUsage &usage) const |
Return a pointer to the storage for the specified constant usage if it is part of this buffer. More... | |
Bool | getConstant (Index constantIndex, AttributeValue &value) const |
Get the value for the specified constant index if it is part of this buffer. More... | |
Bool | getConstant (ConstantUsage::Enum usage, AttributeValue &value) const |
Get the value for the specified constant usage if it is part of this buffer. More... | |
Bool | getConstant (const ConstantUsage &usage, AttributeValue &value) const |
Get the value for the specified constant usage if it is part of this buffer. More... | |
Bool | getConstant (Index constantIndex, const AttributeType &outputType, void *value) const |
Get the value for the specified constant index if it is part of this buffer. More... | |
Bool | getConstant (ConstantUsage::Enum usage, const AttributeType &outputType, void *value) const |
Get the value for the specified constant usage if it is part of this buffer. More... | |
Bool | getConstant (const ConstantUsage &usage, const AttributeType &outputType, void *value) const |
Get the value for the specified constant usage if it is part of this buffer. More... | |
template<typename T > | |
Bool | setConstant (ConstantUsage::Enum usage, const T &value) |
Set the value of the stored constant with the given usage. More... | |
template<typename T > | |
Bool | setConstant (const ConstantUsage &usage, const T &value) |
Set the value of the stored constant with the given usage. More... | |
Bool | setConstant (ConstantUsage::Enum usage, const AttributeValue &value) |
Set the value of the stored constant with the given usgae. More... | |
Bool | setConstant (const ConstantUsage &usage, const AttributeValue &value) |
Set the value of the stored constant with the given usgae. More... | |
const ConstantUsage & | getConstantUsage (Index constantIndex) const |
Return the usage of the constant at the specified index in this constant set. More... | |
void | setConstantUsage (Index constantIndex, const ConstantUsage &newUsage) |
Set the usage of the constant at the specified index in this constant set. More... | |
template<typename T > | |
Bool | addConstant (const ConstantUsage &usage, const T &value) |
Add a new constant with the specified usage and value to this constant set. More... | |
Bool | addConstant (const ConstantUsage &usage, const AttributeValue &value) |
Add a new constant with the specified usage and value to this constant set. More... | |
Bool | addConstant (const ConstantUsage &usage, const AttributeType &type, const void *value=((void *) 0)) |
Add a new constant with the specified usage and value to this constant set. More... | |
void | clearConstants () |
Remove all stored constants from this constant set object. More... | |
Size | getConstantDataSize () const |
Return the size of the constant data in bytes. More... | |
UByte * | getConstantData () |
Return a pointer to the internal array of shader constant data. More... | |
const UByte * | getConstantData () const |
Return a const pointer to the internal array of shader constant data. More... | |
Static Public Attributes | |
static const Size | DEFAULT_CONSTANT_BUFFER_SIZE = 64 |
The default size of a constant set's constant buffer in bytes. More... | |
static const ResourceType | RESOURCE_TYPE |
The resource type for a constant set. More... | |
A class that stores a collection of shader constants with their associated usages.
This allows objects like meshes and shapes to store constants (such as color) independently of the shader pass that is used to render the object. At render time, the constant set is used as source of constant data for shader constant variables that require input for certain constant usages.
om::graphics::materials::ConstantSet::ConstantSet | ( | ) |
Create a new constant set object with no constants stored.
om::graphics::materials::ConstantSet::ConstantSet | ( | Size | constantDataCapacity | ) |
Create a new constant set object with the specified initial capacity in bytes.
om::graphics::materials::ConstantSet::~ConstantSet | ( | ) |
Destroy a constant set, releasing all internal resources.
|
inline |
Return the number of constants that are stored in this constant set.
Return a pointer to the storage for the specified constant index.
|
inline |
Return a pointer to the storage for the specified constant index.
|
inline |
Return the type of the constant at the specified index.
|
inline |
Return a pointer to the storage for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage that is compatible with the templated return type, a pointer to the stored value is returned. Otherwise, the method fails and returns NULL.
|
inline |
Return a pointer to the storage for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage that is compatible with the templated return type, a pointer to the stored value is returned. Otherwise, the method fails and returns NULL.
|
inline |
Get the value for the specified constant index if it is part of this buffer.
If the method succeeds in finds a constant with that index, the constant's value is stored in the output parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Get the value for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage, the constant's value is stored in the output parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Get the value for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage, the constant's value is stored in the output parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Get the value for the specified constant index if it is part of this buffer.
If the method succeeds in finds a constant with that index that is compatible with the specified value output type, the constant's value is stored in the output value parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Get the value for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage that is compatible with the specified value output type, the constant's value is stored in the output value parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Get the value for the specified constant usage if it is part of this buffer.
If the method succeeds in finds a constant with that usage that is compatible with the specified value output type, the constant's value is stored in the output value parameter and the method returns TRUE. Otherwise the method has no effect and returns FALSE.
|
inline |
Set the value of the stored constant with the given usage.
If the method finds a stored constant with the specified usage and the given templated value type is compatible with the stored value, the constants value is set to the new value and TRUE is returned. If not found, the method adds the given constant value to the buffer as if calling addConstant(). If the value is incompatible with the usage, the method fails and FALSE is returned.
|
inline |
Set the value of the stored constant with the given usage.
If the method finds a stored constant with the specified usage and the given templated value type is compatible with the stored value, the constants value is set to the new value and TRUE is returned. If not found, the method adds the given constant value to the buffer as if calling addConstant(). If the value is incompatible with the usage, the method fails and FALSE is returned.
|
inline |
Set the value of the stored constant with the given usgae.
If the method finds a stored constant with the specified usage and the given value type is compatible with the stored value, the constants value is set to the new value and TRUE is returned. If not found, the method adds the given constant value to the buffer as if calling addConstant(). If the value is incompatible with the usage, the method fails and FALSE is returned.
|
inline |
Set the value of the stored constant with the given usgae.
If the method finds a stored constant with the specified usage and the given value type is compatible with the stored value, the constants value is set to the new value and TRUE is returned. If not found, the method adds the given constant value to the buffer as if calling addConstant(). If the value is incompatible with the usage, the method fails and FALSE is returned.
|
inline |
Return the usage of the constant at the specified index in this constant set.
|
inline |
Set the usage of the constant at the specified index in this constant set.
|
inline |
Add a new constant with the specified usage and value to this constant set.
The method returns whether or not a new constant was successfully added to this buffer. The method can fail if the specified value does not have a type that is compatible with the given usage.
|
inline |
Add a new constant with the specified usage and value to this constant set.
The method returns whether or not a new constant was successfully added to this buffer. The method can fail if the specified value does not have a type that is compatible with the given usage.
|
inline |
Add a new constant with the specified usage and value to this constant set.
The method returns whether or not a new constant was successfully added to this buffer. The method can fail if the specified value does not have a type that is compatible with the given usage. If the value pointer is NULL, the constant value is uninitialized.
|
inline |
Remove all stored constants from this constant set object.
|
inline |
Return the size of the constant data in bytes.
|
inline |
Return a pointer to the internal array of shader constant data.
|
inline |
Return a const pointer to the internal array of shader constant data.
|
static |
The default size of a constant set's constant buffer in bytes.
|
static |
The resource type for a constant set.