NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::ISimple_mesh Class Referenceabstract

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

Inheritance diagram for mi::ISimple_mesh:
Inheritance graph
[legend]

Public Member Functions

virtual Uint32  data_size () const =0
  Returns the size of the data arrays. More...
 
virtual const Float32_3_struct get_points () const =0
  Returns the data array for points. More...
 
virtual const Float32_3_struct get_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 Float32 get_texture_coordinates (Uint32 texture_space_id) const =0
  Returns the data array for a texture space. More...
 
virtual const Float32_3_struct get_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_struct get_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_struct get_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 Uint32 get_material_indices () const =0
  Returns the array of material indices. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xd678b434, 0x675f, 0x4d55, 0x8f, 0xed, 0x50, 0x34, 0x1e, 0x0b, 0xa9, 0xf2 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xd678b434, 0x675f, 0x4d55, 0x8f, 0xed, 0x50, 0x34, 0x1e, 0x0b, 0xa9, 0xf2 >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. 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::IOn_demand_mesh, mi::IOn_demand_mesh_callback

Member Function Documentation

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

Returns the size of the data arrays.

virtual const Float32_3_struct* mi::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.
virtual const Uint32* mi::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).

virtual Uint32 mi::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.
virtual const Float32_3_struct* mi::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.
virtual const Float32_3_struct* mi::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.
virtual const Float32_3_struct* mi::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).
virtual const Float32* mi::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::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_id The 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.
virtual Uint32 mi::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::ATTR_TEXTURE_NUM.
Parameters
texture_space_id The ID of the texture space.
Returns
The dimension of this texture space, or 0 if there is no texture space with the given ID.
virtual const Uint32_3_struct* mi::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.

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

Indicates whether all triangles use the same material.

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

Returns the number of triangles.