Namespace: dmRender
Language: C++
Type: Defold C++
File: render.h
Source: engine/render/src/dmsdk/render/render.h
Include: dmsdk/render/render.h
Api for render specific data
Type: FUNCTION Adds a render object to the current render frame
Parameters
context (dmRender::HRenderContext) - the contextro (dmRender::RenderObject*) - the render objectReturns
result (dmRender::Result) - the resultType: FUNCTION
Parameters
render_context (dmRender::HRenderContext) - Render contextmaterial (dmRender::Material)render_object (const dmRender::RenderObject*)Type: FUNCTION
Parameters
render_context (dmRender::HRenderContext)material (dmRender::HMaterial)sampler (dmRender::HSampler)value_index (uint8_t)texture (dmGraphics::HTexture)Type: FUNCTION
Parameters
material (dmRender::HMaterial)Type: FUNCTION Clears a named constant buffer from any constants.
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants bufferType: FUNCTION Deletes a shader program constant
Parameters
constant (dmRender::HConstant) - The shader constantType: FUNCTION
Parameters
render_context (dmRender::HRenderContext) - Render contextmaterial (dmRender::Material)Type: FUNCTION Deletes a named constant buffer
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants bufferType: FUNCTION Get the vertex space (local or world)
Parameters
material (dmRender::HMaterial) - the materialReturns
vertex_space (dmRenderDDF::MaterialDesc::VertexSpace) - the vertex spaceType: CONSTANT The maximum number of textures the render object can hold (currently 8)
Type: STRUCT Frustum options used when setting up a draw call
Members
m_FrustumMatrix (matrix4) - the frustum matrixm_SkipNearFarPlanes (bool) - should the frustum culling use the near and far planesType: ENUM Frustum planes to use in a frustum
Members
FRUSTUM_PLANES_SIDESFRUSTUM_PLANES_ALLType: FUNCTION Gets the shader program constant location
Parameters
constant (dmRender::HConstant) - The shader constantReturns
location (int32_t) - the locationType: FUNCTION Gets the shader program constant name
Parameters
constant (dmRender::HConstant) - The shader constantReturns
name (dmhash_t) - the hash nameType: FUNCTION Gets the shader program constant name
Parameters
constant (dmRender::HConstant) - The shader constantname (dmhash_t) - the hash nameType: FUNCTION Gets the type of the constant
Parameters
constant (dmRender::HConstant) - The shader constantReturns
type (dmRenderDDF::MaterialDesc::ConstantType) - the type of the constantType: FUNCTION Gets the shader program constant values
Parameters
constant (dmRender::HConstant) - The shader constantnum_values (uint32_t*) - (out) the array num_valuesReturns
values (dmVMath::Vector4*) - the uniform valuesType: FUNCTION
Type: FUNCTION
Parameters
material (dmRender::HMaterial)unit (uint32_t)Returns
name_hash (dmhash_t)Type: FUNCTION
Parameters
material (dmRender::HMaterial)name_hash (dmhash_t)Returns
sampler_unit (uint32_t)Type: FUNCTION Gets the key to the material tag list
Parameters
material (dmGraphics::HMaterial) - the materialReturns
listkey (uint32_t) - the list keyType: FUNCTION Gets a named constant from the buffer
Notes
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantvalues (dmVMath::Vector4**) - (out) the values. May not be null.num_values (uint32_t*) - (out) the number of values. May not be null.Returns
ok (bool) - true if constant existed.Type: FUNCTION Gets a named constant from the buffer - with type information
Notes
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantvalues (dmVMath::Vector4**) - (out) the values. May not be null.num_values (uint32_t*) - (out) the number of values. May not be null.constant_type (dmRenderDDF::MaterialDesc::ConstantType*) - (out) the constant type.Returns
ok (bool) - true if constant existed.Type: FUNCTION Gets number of constants in the buffer
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants bufferReturns
ok (bool) - true if constant existed.Type: FUNCTION
Parameters
render_context (dmRender::HRenderContext) - Render contextReturns
view_matrix (const dmVMath::Matrix4&)Type: TYPEDEF Shader constant handle
Type: TYPEDEF Font map handle
Type: TYPEDEF Material instance handle
Type: TYPEDEF Shader constant buffer handle. Holds name and values for a constant.
Type: TYPEDEF The render context
Type: TYPEDEF Render dispatch function handle.
Type: FUNCTION Iterates over the constants
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffercallback (IterateNamedConstantsFn) - the callback functionctx (void*) - the callback contextType: TYPEDEF
Parameters
name_hash (dmhash_t)ctx (void*)Type: FUNCTION Creates a shader program constant
Parameters
name_hash (dmhash_t) - the name of the material constantReturns
constant (dmRender::HConstant) - the constantType: FUNCTION
Parameters
render_context (dmRender::HContext) - Render contextprogram (dmGraphics::HProgram)Returns
new_material (dmRender::HMaterial)Type: FUNCTION Allocates a named constant buffer
Returns
buffer (dmRender::HNamedConstantBuffer) - the constants bufferType: FUNCTION Removes a named constant from the buffer
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantType: FUNCTION Allocates an array of render entries
Notes
Parameters
context (dmRender::HRenderContext) - the contextentries (uint32_t) - the number of entries to allocateReturns
array (dmRender::RenderListEntry*) - the render list entry arrayType: TYPEDEF Render dispatch function callback.
Parameters
params (dmRender::RenderListDispatchParams) - the paramsType: STRUCT Render dispatch function callback.
Members
m_Context (dmRender::HRenderContext) - the contextm_UserData (void*) - the callback user data (registered with RenderListMakeDispatch())m_Operation (dmRender::RenderListOperation) - the operationm_Buf (dmRender::RenderListEntry) - the render entry arraym_Begin (uint32_t*) - the start of the render batch. contains index into the m_Buf arraym_End (uint32_t*) - the end of the render batch. Loop while “m_Begin != m_End”Type: FUNCTION Represents a renderable object (e.g. a single sprite) The renderer will (each frame) collect all entries with the current material tag, then batch these objects together. Batching is done based on the batch key and Z value (or order for GUI nodes) The caller will also register a callback function where the batched entries will be returned. Each callback then represents a draw call, and will register a RenderObject
Parameters
m_WorldPosition (dmVMath::Point3) - the world position of the objectm_Order (uint32_t) - the order to sort on (used if m_MajorOrder != RENDER_ORDER_WORLD)m_BatchKey (uint32_t) - the batch key to sort on (note: only 48 bits are currently used by renderer)m_TagListKey (uint32_t) - the key to the list of material tagsm_UserData (uint64_t) - user data (available in the render dispatch callback)m_MinorOrder (uint32_t:4) - used to sort within a batchm_MajorOrder (uint32_t:2) - If RENDER_ORDER_WORLD, then sorting is done based on the world position.
Otherwise the sorting uses the m_Order value directly.m_Dispatch (uint32_t:8) - The dispatch function callback (dmRender::HRenderListDispatch)m_Visibility (uint32_t:1) - Visibility flag. Used for frustrum culling. See enum VisibilityType: FUNCTION Register a render dispatch function
Parameters
context (dmRender::HRenderContext) - the contextdispatch_fn (dmRender::RenderListDispatchFn) - the render batch callback functionvisibility_fn (dmRender::RenderListVisibilityFn) - the render list visibility callback function. May be 0user_data (void*) - userdata to the callbackReturns
dispatch (dmRender::HRenderListDispatch) - the render dispatch function handleType: ENUM Render batch callback states
Members
RENDER_LIST_OPERATION_BEGINRENDER_LIST_OPERATION_BATCHRENDER_LIST_OPERATION_ENDType: FUNCTION Adds a render object to the current render frame
Parameters
context (dmRender::HRenderContext) - the contextbegin (dmRender::RenderListEntry*) - the start of the arrayend (dmRender::RenderListEntry*) - the end of the array (i.e. “while begin!=end: *begin …””)Type: TYPEDEF Render visibility function callback.
Parameters
params (dmRender::RenderListVisibilityParams) - the paramsType: STRUCT Visibility dispatch function callback.
Members
m_UserData (void*) - the callback user data (registered with RenderListMakeDispatch())m_Entries (dmRender::RenderListEntry) - the render entry arraym_NumEntries (uint32_t) - the number of render entries in the arrayType: STRUCT Render objects represent an actual draw call
Members
m_Constants (dmRender::HConstant[) - ] the shader constantsm_WorldTransform (dmVMath::Matrix4) - the world transform (usually identity for batched objects)m_TextureTransform (dmVMath::Matrix4) - the texture transformm_VertexBuffer (dmGraphics::HVertexBuffer) - the vertex bufferm_VertexDeclaration (dmGraphics::HVertexDeclaration) - the vertex declarationm_IndexBuffer (dmGraphics::HIndexBuffer) - the index bufferm_Material (dmRender::HMaterial) - the materialm_Textures (dmGraphics::HTexture[) - ] the texturesm_PrimitiveType (dmGraphics::PrimitiveType) - the primitive typem_IndexType (dmGraphics::Type) - the index type (16/32 bit)m_SourceBlendFactor (dmGraphics::BlendFactor) - the source blend factorm_DestinationBlendFactor (dmGraphics::BlendFactor) - the destination blend factorm_StencilTestParams (dmRender::StencilTestParams) - the stencil test paramsm_VertexStart (uint32_t) - the vertex startm_VertexCount (uint32_t) - the vertex countm_SetBlendFactors (uint8_t:1) - use the blend factorsm_SetStencilTest (uint8_t:1) - use the stencil testType: ENUM Render order
Members
RENDER_ORDER_WORLD - Used by game objectsRENDER_ORDER_AFTER_WORLD - Used by guiType: ENUM
Members
RESULT_OKRESULT_INVALID_CONTEXTRESULT_OUT_OF_RESOURCESRESULT_BUFFER_IS_FULLRESULT_INVALID_PARAMETERType: FUNCTION Sets the shader program constant location
Parameters
constant (dmRender::HConstant) - The shader constantlocation (dmGraphics::HUniformLocation) - the locationType: FUNCTION Sets the type of the constant
Parameters
constant (dmRender::HConstant) - The shader constanttype (dmRenderDDF::MaterialDesc::ConstantType) - the type of the constantType: FUNCTION Sets the shader program constant values
Parameters
constant (dmRender::HConstant) - The shader constantvalues (dmVMath::Vector4*) - the array valuesnum_values (uint32_t) - the array size (number of Vector4’s)Returns
result (dmRender::Result) - the resultType: FUNCTION
Parameters
material (dmRender::HMaterial)name_hash (dmhash_t)unit (uint32_t)u_wrap (dmGraphics::TextureWrap)v_wrap (dmGraphics::TextureWrap)min_filter (dmGraphics::TextureFilter)mag_filter (dmGraphics::TextureFilter)max_anisotropy (float)Returns
is_succeed (bool)Type: FUNCTION
Parameters
material (dmRender::Material)tag_count (uint32_t)tags (const dmhash_t*)Type: FUNCTION Sets one or more named constants to the buffer
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantvalues (dmVMath::Vector4*) - the valuesnum_values (uint32_t) - the number of valuesType: FUNCTION Sets one or more named constants to the buffer with a specified data type. Currently only dmRenderDDF::MaterialDesc::CONSTANT_TYPE_USER and dmRenderDDF::MaterialDesc::CONSTANT_TYPE_USER_MATRIX4 are supported.
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantvalues (dmVMath::Vector4*) - the valuesnum_values (uint32_t) - the number of valuesconstant_type (dmRenderDDF::MaterialDesc::ConstantType) - The constant typeType: FUNCTION Sets a named constant in the buffer at a specific index
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants buffername_hash (dmhash_t) - the name of the constantvalue (dmVMath::Vector4) - the valuevalue_index (uint32_t) - the index of the value to setReturns
result (Result) - the resultType: FUNCTION Sets a list of named constants to the buffer
Parameters
buffer (dmRender::HNamedConstantBuffer) - the constants bufferconstants (dmRender::HConstant*) - the constantsnum_constants (uint32_t) - the number of constantsType: STRUCT Struct holding stencil operation setup
Members
m_Func (dmGraphics::CompareFunc) - the compare functionm_OpSFail (dmGraphics::StencilOp) - the stencil fail operationm_OpDPFail (dmGraphics::StencilOp) - the depth pass fail operationm_OpDPPass (dmGraphics::StencilOp) - the depth pass pass operationm_Ref (uint8_t)m_RefMask (uint8_t)m_BufferMask (uint8_t)m_ColorBufferMask (uint8_t:4)m_ClearBuffer (uint8_t:1)Type: ENUM Visibility status
Members
VISIBILITY_NONEVISIBILITY_FULL