Project

General

Profile

Previous Up Next

M3setRenderCallback
Attributes a callback to the topology given as a parameter.
This rendering callback will be called each time the scene is rendered : it allows the user to modify - or not - the associated topology.

H3d M3setRenderCallback (
S3d _session_
H3d _topo_
fun [H3d] [[[[F F F] I I] r1] [[HMat3d I F F F F I F F F F I F F F F] r1]]] _callback_
)
Parameters

_session_
3D Session
_topo_
Topology to which an automatic rendering callback is to be attributed
_callback_
The rendering callback.
For the topology to be modified, the callback must return a tuple containing the new list of vertices and the new list of faces, organised as follows : .
  • list of vertices : each vertex is decribed by [[x y z] color1 color2], with :
    - x, y, z : floating-point coordinates of the vertex
    - color1, color2 : primary and secondary colors for the vertex (hexadecimal RGB)
  • list of faces : each face is described by [mat index1 u11 v11 u21 v21 index2 u21 v21 u22 v22 index3 u31 v31 u32 v32], with :
    - mat : material
    - index'i' : index of the 'i'th vertex of the face
    - u'i''j', v'i''j' : u and v texture coordinates, at the 'i'th vertex, for the texture #'j'
For the topology to remain unchanged, the callback must return the CB_NOCHANGE constant.
Return value

Topology to which an automatic rendering callback has been attributed
Remark

If this topology already has a rendering callback, it is replaced.
If the callback parameter is set to nil, then the topology no longer has a callback.