Api for setting and updating component render constants
| Namespace: | dmGameSystem |
| Include: | #include <dmsdk/gamesys/render_constants.h> |
| TYPES | |
|---|---|
| CompGetConstantCallback | Used in GetMaterialConstant to resolve a render co... |
| CompSetConstantCallback | Used in SetMaterialConstant to set a render consta... |
| HashState32 | Found in hash.h |
| HComponentRenderConstants | Render constants handle |
int AreRenderConstantsUpdated(dmGameSystem::HComponentRenderConstants constants)
check if the constants have changed
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
RETURNS
int |
non zero if the constants were changed |
int ClearRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash)
Removes a render constant from the container
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
dmhash_t |
name_hash |
the hashed name of the constant |
RETURNS
int |
non zero if the constant was removed |
dmGameSystem::HComponentRenderConstants CreateRenderConstants()
Create a new HComponentRenderConstants container
PARAMETERS
RETURNS
dmGameSystem::HComponentRenderConstants |
void DestroyRenderConstants(dmGameSystem::HComponentRenderConstants constants)
Destroys a render constants container
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
(must not be 0) |
void EnableRenderObjectConstants(dmRender::RenderObject* ro, dmGameSystem::HComponentRenderConstants constants)
set the constants of a render object
PARAMETERS
dmRender::RenderObject* |
ro |
the render object |
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
dmGameObject::PropertyResult GetMaterialConstant(dmRender::HMaterial material, dmhash_t name_hash, int32_t value_index, dmGameObject::PropertyDesc& out_desc, bool use_value_ptr, CompGetConstantCallback callback, void* callback_user_data)
Helper function to get material constants of components that use them: sprite, label, tile maps, spine and models Sprite and Label should not use value ptr. Deleting a gameobject (that included sprite(s) or label(s)) will rearrange the object pool for components (due to EraseSwap in the Free for the object pool). This result in the original animation value pointer will still point to the original memory location in the component object pool.
PARAMETERS
dmRender::HMaterial |
material |
the material |
dmhash_t |
name_hash |
the name of the property |
int32_t |
value_index |
the index of the constant value to get, if it is an array |
dmGameObject::PropertyDesc& |
out_desc |
the property descriptor |
bool |
use_value_ptr |
should the property pointer be used (m_ValuePtr) |
CompGetConstantCallback |
callback |
callback to resolve property |
void* |
callback_user_data |
callback user data |
RETURNS
dmGameObject::PropertyResult |
the result |
bool GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmRender::Constant** out_constant)
Destroys a render constants container
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
dmhash_t |
name_hash |
the hashed name of the property |
dmRender::Constant** |
out_constant |
the pointer where to store the constant |
RETURNS
bool |
returns true if the constant exists |
dmRender::HConstant GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, uint32_t index)
Get a render constant by index
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
uint32_t |
index |
the index |
RETURNS
dmRender::HConstant |
the pointer where to store the constant |
uint32_t GetRenderConstantCount(dmGameSystem::HComponentRenderConstants constants)
Get the number of render constants
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
RETURNS
uint32_t |
returns the number of set constants |
void HashRenderConstants(dmGameSystem::HComponentRenderConstants constants, HashState32* state)
Hashes the constants
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
HashState32* |
state |
the hash state to update |
dmGameObject::PropertyResult SetMaterialConstant(dmRender::HMaterial material, dmhash_t name_hash, uint32_t value_index, dmGameObject::PropertyVar var, CompGetConstantCallback callback, void* callback_user_data)
Helper function to set material constants of components that use them: sprite, label, tile maps, spine and models
PARAMETERS
dmRender::HMaterial |
material |
the material |
dmhash_t |
name_hash |
the name of the property |
uint32_t |
value_index |
index of the constant value to set, if the material constant is an array |
dmGameObject::PropertyVar |
var |
the property |
CompGetConstantCallback |
callback |
the callback used to set the property |
void* |
callback_user_data |
callback user data |
RETURNS
dmGameObject::PropertyResult |
the result |
void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmRender::HMaterial material, dmhash_t name_hash, uint32_t value_index, uint32_t* element_index, const dmGameObject::PropertyVar& var)
Set a render constant by name. The constant must exist in the material
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the render constants buffer |
dmRender::HMaterial |
material |
the material to get default values from if constant didn't already exist in the render constants buffer |
dmhash_t |
name_hash |
the hashed name of the constant |
uint32_t |
value_index |
index of the constant value to set, if the constant is an array |
uint32_t* |
element_index |
pointer to the index of the element (in range [0,3]). May be 0 |
const dmGameObject::PropertyVar& |
var |
the constant value |
void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmVMath::Vector4* values, uint32_t num_values)
Set a render constant by name. The constant must exist in the material
PARAMETERS
dmGameSystem::HComponentRenderConstants |
constants |
the constants |
dmhash_t |
name_hash |
the hashed name of the constant |
dmVMath::Vector4* |
values |
the values |
uint32_t |
num_values |
number of values in the array |
void CompGetConstantCallback()
Used in GetMaterialConstant to resolve a render constant's value
PARAMETERS
void CompSetConstantCallback()
Used in SetMaterialConstant to set a render constant's value
PARAMETERS
void HashState32()
Found in hash.h
PARAMETERS
void HComponentRenderConstants()
Render constants handle
PARAMETERS