Iray SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::ISimple_mesh Class Referenceabstract

Interface representing the geometry of on-demand meshes. More...

#include <isimple_mesh.h>

Inheritance diagram for mi::neuraylib::ISimple_mesh:

Public Member Functions

virtual Uint32 data_size () const =0
 Returns the size of the data arrays. More...
 
virtual const Float32_3_structget_points () const =0
 Returns the data array for points. More...
 
virtual const Float32_3_structget_normals () const =0
 Returns the data array for normals. More...
 
virtual Uint32 get_texture_dimension (Uint32 texture_space_id) const =0
 Returns the dimension of a texture space. More...
 
virtual const Float32get_texture_coordinates (Uint32 texture_space_id) const =0
 Returns the data array for a texture space. More...
 
virtual const Float32_3_structget_derivatives () const =0
 Returns the data array for derivatives. More...
 
virtual Uint32 get_motion_vector_count () const =0
 Returns the number of motion vectors per point. More...
 
virtual const Float32_3_structget_motion_vectors () const =0
 Returns the data array for motion vectors. More...
 
virtual Uint32 triangles_size () const =0
 Returns the number of triangles. More...
 
virtual const Uint32_3_structget_triangles () const =0
 Returns the array of triangle indices. More...
 
virtual bool has_unique_material () const =0
 Indicates whether all triangles use the same material. More...
 
virtual const Uint32get_material_indices () const =0
 Returns the array of material indices. More...
 
virtual Uint32 get_userdata_dimension (Uint32 userdata_id) const =0
 Returns the dimension of a userdata array. More...
 
virtual const Float32get_userdata (Uint32 userdata_id) const =0
 Returns a userdata array. More...
 
virtual const char * get_userdata_name (Uint32 userdata_id) const =0
 Returns the name of a userdata array. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xd678b434, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xd678b434, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

Interface representing the geometry of on-demand meshes.

There are five different types of data arrays: for points, normals, texture coordinates, derivatives, and motion vectors. The data array for points is mandatory, all other data arrays are optional. Each type exists at most once, except for texture coordinates where one data array is used per texture space.

The data arrays are referenced via the indices stored at the triangle vertices. Note that only one index is used for all arrays together, hence, all arrays have the same length.

The pointers returned by the various methods have to be valid as long as the interface is valid.

Note
The callback that returns an instance of this interface might be executed several times, e.g., in a first pass to retrieve the characteristics of the simple mesh, like number of points, triangles, etc., and in a second pass to access the actual mesh data, i.e., the point vectors, triangles indices, and so on. This does not matter if the implementation of this interface is just a thin adaptor to existing data structures. But if the existing data structures need to be converted to implement this interface it is recommended to do the data conversion lazily when the data arrays and triangle indices are actually requested.
See also
mi::neuraylib::IOn_demand_mesh, mi::neuraylib::IOn_demand_mesh_callback

Member Function Documentation

 data_size()

virtual Uint32 mi::neuraylib::ISimple_mesh::data_size ( ) const
pure virtual

Returns the size of the data arrays.

 get_derivatives()

virtual const Float32_3_struct * mi::neuraylib::ISimple_mesh::get_derivatives ( ) const
pure virtual

Returns the data array for derivatives.

Derivatives are computed w.r.t. to the first texture space. If there are no derivatives, i.e., the methods returns NULL, the derivatives are approximated internally based on the mesh data and the texture coordinates of the first texture space.

Note
This data array contains 2 * data_size() elements of type mi::Float32_3_struct. The derivatives w.r.t. dU and dV are consecutively stored in that order per index.
Returns
A pointer to the first element of the data array for derivatives, or NULL if there are no derivatives.

 get_material_indices()

virtual const Uint32 * mi::neuraylib::ISimple_mesh::get_material_indices ( ) const
pure virtual

Returns the array of material indices.

If has_unique_material() returns true, the length of the array is 1. Otherwise, the length is given by triangles_size() (one material index per triangle).

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.

 get_motion_vector_count()

virtual Uint32 mi::neuraylib::ISimple_mesh::get_motion_vector_count ( ) const
pure virtual

Returns the number of motion vectors per point.

Returns
The number of motion vectors per point, or 0 if there are no motion vectors available.

 get_motion_vectors()

virtual const Float32_3_struct * mi::neuraylib::ISimple_mesh::get_motion_vectors ( ) const
pure virtual

Returns the data array for motion vectors.

Note
This data array contains get_motion_vector_count() * data_size() elements of type mi::Float32_3_struct. The elements for one point are stored consecutively.
Returns
A pointer to the first element of the data array for motion vectors, or NULL if there are no motion vectors available.

 get_normals()

virtual const Float32_3_struct * mi::neuraylib::ISimple_mesh::get_normals ( ) const
pure virtual

Returns the data array for normals.

If there are no normals, i.e., the methods returns NULL, face normals will be used.

Returns
A pointer to the first element of the data array for normals, or NULL if there are no normals available.

 get_points()

virtual const Float32_3_struct * mi::neuraylib::ISimple_mesh::get_points ( ) const
pure virtual

Returns the data array for points.

Returns
A pointer to the first element of the data array for points (never NULL, unless data_size() and triangles_size() both return 0).

 get_texture_coordinates()

virtual const Float32 * mi::neuraylib::ISimple_mesh::get_texture_coordinates ( Uint32  texture_space_id) const
pure virtual

Returns the data array for a texture space.

Note
Texture spaces need to use consecutive texture space IDs starting with 0. The number of texture spaces is limited to mi::neuraylib::ATTR_TEXTURE_NUM.
This data array contains get_texture_dimension() * data_size() elements of type mi::Float32. The elements for one single point are stored consecutively.
Parameters
texture_space_idThe ID of the texture space.
Returns
A pointer to the first element of the data array for this texture space, or NULL if there is no texture space with the given ID.

 get_texture_dimension()

virtual Uint32 mi::neuraylib::ISimple_mesh::get_texture_dimension ( Uint32  texture_space_id) const
pure virtual

Returns the dimension of a texture space.

The dimension of a texture space is the dimension of the vector data stored for each triangle vertex. Typically, the dimension is 2 representing UV texture coordinates.

Note
Texture spaces need to use consecutive texture space IDs starting with 0. The number of texture spaces is limited to mi::neuraylib::ATTR_TEXTURE_NUM.
Parameters
texture_space_idThe ID of the texture space.
Returns
The dimension of this texture space, or 0 if there is no texture space with the given ID.

 get_triangles()

virtual const Uint32_3_struct * mi::neuraylib::ISimple_mesh::get_triangles ( ) const
pure virtual

Returns the array of triangle indices.

These indices reference the corresponding elements in the data arrays. The indices represent the vertices in CCW order.

Note
For best performance it is recommended to sort the triangles by their material index such that when looping over all triangles the material index changes as infrequently as possible.

 get_userdata()

virtual const Float32 * mi::neuraylib::ISimple_mesh::get_userdata ( Uint32  userdata_id) const
pure virtual

Returns a userdata array.

Note
Userdata arrays need to use consecutive userdata IDs starting with 0. The number of userdata arrays is limited to mi::neuraylib::ATTR_USER_NUM.
This data array contains get_userdata_dimension() * data_size() elements of type mi::Float32. The elements for one single point are stored consecutively.
Parameters
userdata_idThe ID of the userdata array.
Returns
A pointer to the first element of the data array for this userdata array, or NULL if there is no userdata array with the given ID.

 get_userdata_dimension()

virtual Uint32 mi::neuraylib::ISimple_mesh::get_userdata_dimension ( Uint32  userdata_id) const
pure virtual

Returns the dimension of a userdata array.

The dimension of a userdata array is the dimension of the vector data stored for each triangle vertex.

Note
Userdata arrays need to use consecutive userdata IDs starting with 0. The number of userdata arrays is limited to mi::neuraylib::ATTR_USER_NUM.
Parameters
userdata_idThe ID of the userdata array.
Returns
The dimension of this userdata array, or 0 if there is no userdata array with the given ID.

 get_userdata_name()

virtual const char * mi::neuraylib::ISimple_mesh::get_userdata_name ( Uint32  userdata_id) const
pure virtual

Returns the name of a userdata array.

Note
Userdata arrays need to use consecutive userdata IDs starting with 0. The number of userdata arrays is limited to mi::neuraylib::ATTR_USER_NUM.
Parameters
userdata_idThe ID of the userdata array.
Returns
The name of this userdata array, or NULL if there is no userdata array with the given ID.

 has_unique_material()

virtual bool mi::neuraylib::ISimple_mesh::has_unique_material ( ) const
pure virtual

Indicates whether all triangles use the same material.

 triangles_size()

virtual Uint32 mi::neuraylib::ISimple_mesh::triangles_size ( ) const
pure virtual

Returns the number of triangles.