Radeon ProRender

rprContextCreateMesh

Creates a new mesh object.

rpr_status rprContextCreateMesh( rpr_context context,
  rpr_float const * vertices,
  size_t num_vertices,
  rpr_int vertex_stride,
  rpr_float const * normals,
  size_t num_normals,
  rpr_int normal_stride,
  rpr_float const * texcoords,
  size_t num_texcoords,
  rpr_int texcoord_stride,
  rpr_int const * vertex_indices,
  rpr_int vidx_stride,
  rpr_int const * normal_indices,
  rpr_int nidx_stride,
  rpr_int const * texcoord_indices,
  rpr_int tidx_stride,
  rpr_int const * num_face_vertices,
  size_t num_faces,
  rpr_shape * out_mesh);

Parameters

Parameter Description
context The rendering context hosting the mesh.
vertices Pointer to position data (each position is described with 3 rpr_float numbers).
num_vertices Number of entries in the position array.
vertex_stride Number of bytes between the beginnings of two successive position entries.
normals Pointer to normal data (each normal is described with 3 rpr_float numbers), can be NULL.
num_normals Number of entries in the normal array.
normal_stride Number of bytes between the beginnings of two successive normal entries.
texcoords Pointer to texcoord data (each texcoord is described with 2 rpr_float numbers), can be NULL.
num_texcoords Number of entries in the texcoord array.
texcoord_stride Number of bytes between the beginnings of two successive texcoord entries.
vertex_indices Pointer to an array of vertex indices, used to indicate shared vertices, allowing for some saving on storage space.
vidx_stride Number of bytes between the beginnings of two successive vertex index entries.
normal_indices Pointer to an array of normal indices.
nidx_stride Number of bytes between the beginnings of two successive normal index entries.
texcoord_indices Pointer to an array of texcoord indices.
tidx_stride Number of bytes between the beginnings of two successive texcoord index entries.
num_face_vertices Pointer to an array of num_faces numbers describing number of vertices for each face (can be 3 (triangle) or 4 (quadrangle).
num_faces Number of faces in a mesh.
out_mesh A pointer to the created mesh object.

Notes

AMD Radeon ProRender supports mixed meshes consisting of either triangles or quads. It also supports meshes with mixed quad/triangle construction.

Postions stored on a per-vertex basis allow data re-use (with multiple indices) and consequently save on storage space.

Mesh import libraries or plugins using RPR essentially translate data into a format ready for rprContextCreateMesh() to use.

Output

A pointer to a mesh object.

Return

Returns RPR_SUCCESS in case of success, or RPR_ERROR code if a problem was encountered.

To learn how to handle errors in AMD Radeon ProRender SDK, see Error Handling.