Namespace: dmGameSystem
Language: C++
Type: Defold C++
File: render_constants.h
Source: engine/gamesys/src/dmsdk/gamesys/render_constants.h
Include: dmsdk/gamesys/render_constants.h
Api for setting and updating component render constants
Type: FUNCTION check if the constants have changed
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsReturns
result (int) - non zero if the constants were changedType: FUNCTION Removes a render constant from the container
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsname_hash (dmhash_t) - the hashed name of the constantReturns
result (int) - non zero if the constant was removedType: TYPEDEF Used in GetMaterialConstant to resolve a render constant’s value
Type: TYPEDEF Used in SetMaterialConstant to set a render constant’s value
Type: FUNCTION Create a new HComponentRenderConstants container
Returns
constants (dmGameSystem::HComponentRenderConstants)Type: FUNCTION Destroys a render constants container
Parameters
constants (dmGameSystem::HComponentRenderConstants) - (must not be 0)Type: FUNCTION set the constants of a render object
Parameters
ro (dmRender::RenderObject*) - the render objectconstants (dmGameSystem::HComponentRenderConstants) - the constantsType: FUNCTION 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
material (dmRender::HMaterial) - the materialname_hash (dmhash_t) - the name of the propertyvalue_index (int32_t) - the index of the constant value to get, if it is an arrayout_desc (dmGameObject::PropertyDesc&) - the property descriptoruse_value_ptr (bool) - should the property pointer be used (m_ValuePtr)callback (CompGetConstantCallback) - callback to resolve propertycallback_user_data (void*) - callback user dataReturns
result (dmGameObject::PropertyResult) - the resultType: FUNCTION Destroys a render constants container
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsname_hash (dmhash_t) - the hashed name of the propertyout_constant (dmRender::Constant**) - the pointer where to store the constantReturns
result (bool) - returns true if the constant existsType: FUNCTION Get a render constant by index
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsindex (uint32_t) - the indexReturns
constant (dmRender::HConstant) - the pointer where to store the constantType: FUNCTION Get the number of render constants
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsReturns
size (uint32_t) - returns the number of set constantsType: FUNCTION Hashes the constants
Notes
AreRenderConstantsUpdated will always return false.Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsstate (HashState32*) - the hash state to updateType: TYPEDEF Found in hash.h
Type: TYPEDEF Render constants handle
Type: FUNCTION Helper function to set material constants of components that use them: sprite, label, tile maps, spine and models
Parameters
material (dmRender::HMaterial) - the materialname_hash (dmhash_t) - the name of the propertyvalue_index (uint32_t) - index of the constant value to set, if the material constant is an arrayvar (dmGameObject::PropertyVar) - the propertycallback (CompGetConstantCallback) - the callback used to set the propertycallback_user_data (void*) - callback user dataReturns
result (dmGameObject::PropertyResult) - the resultType: FUNCTION Set a render constant by name. The constant must exist in the material
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the render constants buffermaterial (dmRender::HMaterial) - the material to get default values from if constant didn’t already exist in the render constants buffername_hash (dmhash_t) - the hashed name of the constantvalue_index (uint32_t) - index of the constant value to set, if the constant is an arrayelement_index (uint32_t*) - pointer to the index of the element (in range [0,3]). May be 0var (const dmGameObject::PropertyVar&) - the constant valueType: FUNCTION Set a render constant by name. The constant must exist in the material
Parameters
constants (dmGameSystem::HComponentRenderConstants) - the constantsname_hash (dmhash_t) - the hashed name of the constantvalues (dmVMath::Vector4*) - the valuesnum_values (uint32_t) - number of values in the array