Render API documentation

Version: stable

FUNCTION
AddToRender() Adds a render object to the current render frame
ClearNamedConstantBuffer() Clears a named constant buffer from any constants.
DeleteConstant() Deletes a shader program constant
DeleteNamedConstantBuffer() Deletes a named constant buffer
dmRender::GetMaterialVertexSpace() Get the vertex space (local or world)
dmRender::RenderObject::MAX_TEXTURE_COUNT() The maximum number of textures the render object c...
GetConstantLocation() Gets the shader program constant location
GetConstantName() Gets the shader program constant name
GetConstantName() Gets the shader program constant name
GetConstantType() Gets the type of the constant
GetConstantValues() Gets the shader program constant values
GetMaterialTagListKey() Gets the key to the material tag list
GetNamedConstant() Gets a named constant from the buffer
GetNamedConstant() Gets a named constant from the buffer - with type ...
GetNamedConstantCount() Gets number of constants in the buffer
IterateNamedConstants() Iterates over the constants
NewConstant() Creates a shader program constant
NewNamedConstantBuffer() Allocates a named constant buffer
RemoveNamedConstant() Removes a named constant from the buffer
RenderListAlloc() Allocates an array of render entries
RenderListEntry() Represents a renderable object (e.g. a single spri...
RenderListMakeDispatch() Register a render dispatch function
RenderListSubmit() Adds a render object to the current render frame
SetConstantLocation() Sets the shader program constant location
SetConstantType() Sets the type of the constant
SetConstantValues() Sets the shader program constant values
SetNamedConstant() Sets one or more named constants to the buffer
SetNamedConstant() Sets one or more named constants to the buffer wit...
SetNamedConstantAtIndex() Sets a named constant in the buffer at a specific ...
SetNamedConstants() Sets a list of named constants to the buffer
ENUMS
FrustumPlanes Frustum planes to use in a frustum
RenderListOperation Render batch callback states
RenderOrder Render order
Result
Visibility Visibility status

Functions

AddToRender()

AddToRender(context,ro)

Adds a render object to the current render frame

PARAMETERS

context dmRender::HRenderContext the context
ro dmRender::RenderObject* the render object

RETURNS

result dmRender::Result the result

ClearNamedConstantBuffer()

ClearNamedConstantBuffer(buffer)

Clears a named constant buffer from any constants.

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer

DeleteConstant()

DeleteConstant(constant)

Deletes a shader program constant

PARAMETERS

constant dmRender::HConstant The shader constant

DeleteNamedConstantBuffer()

DeleteNamedConstantBuffer(buffer)

Deletes a named constant buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer

dmRender::GetMaterialVertexSpace()

dmRender::GetMaterialVertexSpace(material)

Get the vertex space (local or world)

PARAMETERS

material dmRender::HMaterial the material

RETURNS

vertex_space dmRenderDDF::MaterialDesc::VertexSpace the vertex space

dmRender::RenderObject::MAX_TEXTURE_COUNT()

dmRender::RenderObject::MAX_TEXTURE_COUNT()

The maximum number of textures the render object can hold (currently 8)

PARAMETERS

None


GetConstantLocation()

GetConstantLocation(constant)

Gets the shader program constant location

PARAMETERS

constant dmRender::HConstant The shader constant

RETURNS

location int32_t the location

GetConstantName()

GetConstantName(constant)

Gets the shader program constant name

PARAMETERS

constant dmRender::HConstant The shader constant

RETURNS

name dmhash_t the hash name

GetConstantName()

GetConstantName(constant,name)

Gets the shader program constant name

PARAMETERS

constant dmRender::HConstant The shader constant
name dmhash_t the hash name

GetConstantType()

GetConstantType(constant)

Gets the type of the constant

PARAMETERS

constant dmRender::HConstant The shader constant

RETURNS

type dmRenderDDF::MaterialDesc::ConstantType the type of the constant

GetConstantValues()

GetConstantValues(constant,num_values)

Gets the shader program constant values

PARAMETERS

constant dmRender::HConstant The shader constant
num_values uint32_t* (out) the array num_values

RETURNS

values dmVMath::Vector4* the uniform values

GetMaterialTagListKey()

GetMaterialTagListKey(material)

Gets the key to the material tag list

PARAMETERS

material dmGraphics::HMaterial the material

RETURNS

listkey uint32_t the list key

GetNamedConstant()

GetNamedConstant(buffer,name_hash,values,num_values)

Gets a named constant from the buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
name_hash dmhash_t the name of the constant
values 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.

GetNamedConstant()

GetNamedConstant(buffer,name_hash,values,num_values,constant_type)

Gets a named constant from the buffer - with type information

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
name_hash dmhash_t the name of the constant
values 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.

GetNamedConstantCount()

GetNamedConstantCount(buffer)

Gets number of constants in the buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer

RETURNS

ok bool true if constant existed.

IterateNamedConstants()

IterateNamedConstants(buffer,callback,ctx)

Iterates over the constants

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
callback void (*callback)(dmhash_t name_hash, void* ctx) the callback function void (callback)(dmhash_t name_hash, void ctx)
ctx void* the callback context

NewConstant()

NewConstant(name_hash)

Creates a shader program constant

PARAMETERS

name_hash dmhash_t the name of the material constant

RETURNS

constant dmRender::HConstant the constant

NewNamedConstantBuffer()

NewNamedConstantBuffer()

Allocates a named constant buffer

PARAMETERS

None

RETURNS

buffer dmRender::HNamedConstantBuffer the constants buffer

RemoveNamedConstant()

RemoveNamedConstant(buffer,name_hash)

Removes a named constant from the buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
name_hash dmhash_t the name of the constant

RenderListAlloc()

RenderListAlloc(context,entries)

Allocates an array of render entries

PARAMETERS

context dmRender::HRenderContext the context
entries uint32_t the number of entries to allocate

RETURNS

array dmRender::RenderListEntry* the render list entry array

RenderListEntry()

RenderListEntry(m_WorldPosition,m_Order,m_BatchKey,m_TagListKey,m_UserData,m_MinorOrder,m_MajorOrder,m_Dispatch)

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 object
m_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 tags
m_UserData uint64_t user data (available in the render dispatch callback)
m_MinorOrder uint32_t:4 used to sort within a batch
m_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)

RenderListMakeDispatch()

RenderListMakeDispatch(context,dispatch_fn,visibility_fn,user_data)

Register a render dispatch function

PARAMETERS

context dmRender::HRenderContext the context
dispatch_fn dmRender::RenderListDispatchFn the render batch callback function
visibility_fn dmRender::RenderListVisibilityFn the render list visibility callback function. May be 0
user_data void* userdata to the callback

RETURNS

dispatch dmRender::HRenderListDispatch the render dispatch function handle

RenderListSubmit()

RenderListSubmit(context,begin,end)

Adds a render object to the current render frame

PARAMETERS

context dmRender::HRenderContext the context
begin dmRender::RenderListEntry* the start of the array
end dmRender::RenderListEntry* the end of the array (i.e. "while begin!=end: *begin ..."")

SetConstantLocation()

SetConstantLocation(constant,location)

Sets the shader program constant location

PARAMETERS

constant dmRender::HConstant The shader constant
location dmGraphics::HUniformLocation the location

SetConstantType()

SetConstantType(constant,type)

Sets the type of the constant

PARAMETERS

constant dmRender::HConstant The shader constant
type dmRenderDDF::MaterialDesc::ConstantType the type of the constant

SetConstantValues()

SetConstantValues(constant,values,num_values)

Sets the shader program constant values

PARAMETERS

constant dmRender::HConstant The shader constant
values dmVMath::Vector4* the array values
num_values uint32_t the array size (number of Vector4's)

RETURNS

result dmRender::Result the result

SetNamedConstant()

SetNamedConstant(buffer,name_hash,values,num_values)

Sets one or more named constants to the buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
name_hash dmhash_t the name of the constant
values dmVMath::Vector4* the values
num_values uint32_t the number of values

SetNamedConstant()

SetNamedConstant(buffer,name_hash,values,num_values,constant_type)

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 buffer
name_hash dmhash_t the name of the constant
values dmVMath::Vector4* the values
num_values uint32_t the number of values
constant_type dmRenderDDF::MaterialDesc::ConstantType The constant type

SetNamedConstantAtIndex()

SetNamedConstantAtIndex(buffer,name_hash,value,value_index)

Sets a named constant in the buffer at a specific index

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
name_hash dmhash_t the name of the constant
value dmVMath::Vector4 the value
value_index uint32_t the index of the value to set

RETURNS

result Result the result

SetNamedConstants()

SetNamedConstants(buffer,constants,num_constants)

Sets a list of named constants to the buffer

PARAMETERS

buffer dmRender::HNamedConstantBuffer the constants buffer
constants dmRender::HConstant* the constants
num_constants uint32_t the number of constants