Interface representing a triangle mesh. More...
Public Member Functions | |
Methods related to points | |
virtual Uint32 | points_size () const =0 |
Returns the number of points in the mesh. More... |
|
virtual Uint32 | points_capacity () const =0 |
Returns the number of points for which space is allocated in the mesh. More... |
|
virtual void | reserve_points (Uint32 n)=0 |
Reserves space for at least n points. More... |
|
virtual Sint32 | point (Uint32 index, Float32_3_struct &p) const =0 |
Returns the coordinates of the point of index index in the output parameter p . More... |
|
virtual Sint32 | point (Uint32 index, Float64_3_struct &p) const =0 |
Returns the coordinates of the point of index index in the output parameter p . More... |
|
virtual Uint32 | append_point (const Float32_3_struct &p)=0 |
Adds a point p to the end of all points and returns the index of the new point. More... |
|
virtual Uint32 | append_point (const Float64_3_struct &p)=0 |
Adds a point p to the end of all points and returns the index of the new point. More... |
|
virtual Sint32 | set_point (Uint32 index, const Float32_3_struct &p)=0 |
Sets the point of index index to the new point p . More... |
|
virtual Sint32 | set_point (Uint32 index, const Float64_3_struct &p)=0 |
Sets the point of index index to the new point p . More... |
|
Methods related to triangles | |
virtual Uint32 | triangles_size () const =0 |
Returns the number of triangles. More... |
|
virtual Uint32 | triangles_capacity () const =0 |
Returns the number of triangles for which space is allocated in the mesh. More... |
|
virtual void | reserve_triangles (Uint32 n)=0 |
Reserves space for at least n triangles. More... |
|
virtual Triangle_point_indices_struct |
triangle_point_indices (Triangle_handle_struct hnd) const =0 |
Returns the triple of indices describing the vertices of the triangle of index i . More... |
|
virtual Triangle_handle_struct | append_triangle (const Triangle_point_indices_struct &triangle)=0 |
Adds a triangle to the mesh. More... |
|
virtual Sint32 | set_triangle (Triangle_handle_struct hnd, const Triangle_point_indices_struct &triangle)=0 |
Modifies a triangle of the mesh. More... |
|
Methods related to the mesh connectivity | |
virtual const ITriangle_connectivity * |
access_mesh_connectivity () const =0 |
Returns the mesh connectivity. More... |
|
virtual ITriangle_connectivity * | edit_mesh_connectivity ()=0 |
Detaches and returns the mesh connectivity. More... |
|
virtual Sint32 | attach_mesh_connectivity (ITriangle_connectivity *connectivity)=0 |
Attaches the mesh connectivity to the mesh. More... |
|
Methods related to custom connectivities | |
virtual ITriangle_connectivity * | create_connectivity (Connectivity_map_type map_type=CONNECTIVITY_MAP_GENERIC)=0 |
Creates a new connectivity for non-per-primitive attributes. More... |
|
virtual const ITriangle_connectivity * |
access_connectivity (Mesh_attribute_name name) const =0 |
Returns the connectivity for a given mesh attribute. More... |
|
virtual ITriangle_connectivity * | edit_connectivity (Mesh_attribute_name name)=0 |
Detaches and returns the connectivity for a given mesh attribute. More... |
|
virtual Sint32 | attach_connectivity (ITriangle_connectivity *connectivity)=0 |
Attaches a given connectivity to the mesh. More... |
|
virtual Sint32 | remove_connectivity (Mesh_attribute_name name)=0 |
Removes the connectivity for a non-per-primitive mesh attribute. More... |
|
Methods related to per-primitive attributes | |
virtual bool | has_attribute (Mesh_attribute_name name) const =0 |
Indicates whether the mesh has a particular mesh attribute (per-primitive or other types). More... |
|
virtual IAttribute_vector * | create_attribute_vector (Mesh_attribute_name name, Uint32 dim=1)=0 |
Creates a per-primitive mesh attribute. More... |
|
virtual const IAttribute_vector * | access_attribute_vector (Mesh_attribute_name name) const =0 |
Returns a per-primitive mesh attribute. More... |
|
virtual IAttribute_vector * | edit_attribute_vector (Mesh_attribute_name name)=0 |
Detaches and returns a per-primitive mesh attribute. More... |
|
virtual Sint32 | attach_attribute_vector (IAttribute_vector *attribute_vector)=0 |
Attaches a given per-primitive mesh attribute to the mesh. More... |
|
virtual Sint32 | remove_attribute_vector (Mesh_attribute_name name)=0 |
Removes a per-primitive mesh attribute. More... |
|
Methods related to the bounding box | |
virtual const Float32_3_struct & | get_bbox_min () const =0 |
Returns minimal corner of the bounding box. More... |
|
virtual const Float32_3_struct & | get_bbox_max () const =0 |
Returns maximal corner of the bounding box. More... |
|
virtual Bbox3_struct | get_tight_bbox (const Float64_4_4_struct &transformation_matrix) const =0 |
Returns the bounding box of the triangle mesh after transformation. More... |
|
Methods related to displacement | |
virtual void | set_maximum_displacement (Float32 displacement)=0 |
Sets the maximum displacement of the triangle mesh. More... |
|
virtual Float32 | get_maximum_displacement () const =0 |
Returns the maximum displacement of the triangle mesh. More... |
|
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0x71006633, 0x1e05, 0x4c21, 0xa0, 0x09, 0x07, 0x6f, 0x33, 0x6d, 0x9c, 0x89, neuraylib::IScene_element > | |
typedef Interface_declare< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11, neuraylib::IScene_element > |
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< 0x71006633, 0x1e05, 0x4c21, 0xa0, 0x09, 0x07, 0x6f, 0x33, 0x6d, 0x9c, 0x89, neuraylib::IScene_element > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... |
|
Interface representing a triangle mesh.
Triangle meshes are represented in an indexed format where triangles are triples of indices pointing into an array of points. Points and triangles are stored with consecutive indices, starting with the index 0 each. Both, points and triangles, can then be referred to by their index numbers. For type safety, triangle indices are represented using mi::neuraylib::Triangle_handle instead of plain integers.
In addition to regular attributes (see mi::neuraylib::IAttribute_set), meshes can also have mesh attributes. In contrast to regular attributes which exist only once per object, mesh attributes are always a vector of values with one vector element per primitive, per point, or per vertex (see mi::neuraylib::Mesh_attribute_name and mi::neuraylib::IAttribute_vector for details).
Per-primitive attributes can be directly used with the methods of this interface, namely create_attribute_vector(), access_attribute_vector(), edit_attribute_vector(), and attach_attribute_vector().
Per-point and per-vertex attributes require the use of a connectivity instead. Per-point attributes use the mesh connectivity (see edit_mesh_connectivity() and related methods), whereas per-vertex attributes use custom connectivities (see create_connectivity() and related methods).
This mesh interface supports the incremental construction of a mesh. Points and triangles can be added one at a time and in alternating order, if so desired. The only constraint is that triangles shall only refer to point indices of points that have been added already. Triangles can only be added or modified while the mesh connectivity is attached. This implies that per-point attributes (using the mesh connectivity) can only be created or modified before or after the triangles are added, not during that process.
The deletion of once added elements is not supported.
See also the "approx"
attribute on mi::neuraylib::IAttribute_set for information how to control the tessellation of the triangle mesh.
Example: Create a mesh with a single triangle with one normal and three texture coordinates
|
pure virtual |
Returns a per-primitive mesh attribute.
name | The name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute. |
NULL
in case of failure.
|
pure virtual |
Returns the connectivity for a given mesh attribute.
name | The name of the attribute to return the connectivity for, see Mesh_attribute_name. |
name
, or NULL
if there is no such attribute, or the attribute is a per-primitive attribute.
|
pure virtual |
Returns the mesh connectivity.
NULL
if it currently not attached.
|
pure virtual |
Adds a point p
to the end of all points and returns the index of the new point.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
|
pure virtual |
Adds a point p
to the end of all points and returns the index of the new point.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
|
pure virtual |
Adds a triangle to the mesh.
This method requires that the mesh connectivity is attached. Afterwards all other connectivities and attributes must be updated accordingly.
triangle | The vertex indices of the new triangle. |
|
pure virtual |
Attaches a given per-primitive mesh attribute to the mesh.
The attribute vector must not be used any longer after it has been attached.
NULL
pointer).
|
pure virtual |
Attaches a given connectivity to the mesh.
This implicitly binds all attributes of the connectivity to the mesh. The connectivity must not be used any longer after it has been attached.
NULL
pointer).
|
pure virtual |
Attaches the mesh connectivity to the mesh.
This implicitly binds all attributes of the connectivity to the mesh. The connectivity must not be used any longer after it has been attached.
NULL
pointer).
|
pure virtual |
Creates a per-primitive mesh attribute.
The attribute is not yet attached to the mesh. It needs to be attached before it is released.
name | The name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute. |
dim | Dimension of an attribute value. Only used for those attributes that have user specifiable dimensions. |
NULL
in case of failure.
|
pure virtual |
Creates a new connectivity for non-per-primitive attributes.
The attribute is not yet attached to the mesh. It needs to be attached before it is released.
|
pure virtual |
Detaches and returns a per-primitive mesh attribute.
The attribute needs to be reattached before it is released. Otherwise, the attribute is effectively removed from the mesh.
name | The name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute. |
NULL
in case of failure.
|
pure virtual |
Detaches and returns the connectivity for a given mesh attribute.
The connectivity needs to be reattached before it is released.
name | The name of the attribute to return the connectivity for, see Mesh_attribute_name. |
name
, or NULL
if there is no such attribute, or the attribute is a per-primitive attribute.
|
pure virtual |
Detaches and returns the mesh connectivity.
The connectivity needs to be reattached before it is released.
NULL
if it currently not attached.
|
pure virtual |
Returns maximal corner of the bounding box.
|
pure virtual |
Returns minimal corner of the bounding box.
|
pure virtual |
Returns the maximum displacement of the triangle mesh.
|
pure virtual |
Returns the bounding box of the triangle mesh after transformation.
transformation_matrix | The transformation matrix |
|
pure virtual |
Indicates whether the mesh has a particular mesh attribute (per-primitive or other types).
name | The name of the attribute to query, see Mesh_attribute_name. |
true
if the mesh has this attribute, false
otherwise.
|
pure virtual |
Returns the coordinates of the point of index index
in the output parameter p
.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
index
is out of bounds.
|
pure virtual |
Returns the coordinates of the point of index index
in the output parameter p
.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
index
is out of bounds.
|
pure virtual |
Returns the number of points for which space is allocated in the mesh.
One can add points_capacity() - points_size() many points to the mesh before internal reallocation may become necessary.
|
pure virtual |
Returns the number of points in the mesh.
|
pure virtual |
Removes a per-primitive mesh attribute.
name | The name of the attribute, see Mesh_attribute_name. The attribute must be a per-primitive attribute. |
|
pure virtual |
Removes the connectivity for a non-per-primitive mesh attribute.
If there are several mesh attributes attached to the same connectivity, only the given mesh attribute will be removed and the connectivity itself remains. Otherwise, removal of the connectivity implies removal of the corresponding mesh attribute.
name | The name of the attribute to remove the connectivity for, see Mesh_attribute_name. |
|
pure virtual |
Reserves space for at least n
points.
Sets the internal capacity to at least n
points before reallocation may become necessary. The number of points currently stored is not changed by this method.
|
pure virtual |
Reserves space for at least n
triangles.
Sets the internal capacity to at least n
triangles before reallocation may become necessary. The number of triangles currently stored is not changed by this method.
|
pure virtual |
Sets the maximum displacement of the triangle mesh.
This value is the maximum absolute value of any displacement applied to the object (defaults to 0.0). The bounding box of the object will be expanded all around by this value.
|
pure virtual |
Sets the point of index index
to the new point p
.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
index
is out of bounds.
|
pure virtual |
Sets the point of index index
to the new point p
.
The mesh class provides several overloaded versions for different parameter types. No information about the underlying storage is specified. The caller should use the best matching call for the caller's data representation.
index
is out of bounds.
|
pure virtual |
Modifies a triangle of the mesh.
hnd | The triangle to modify. |
triangle | The new vertex indices of the triangle. |
hnd
is out of bounds.
|
pure virtual |
Returns the triple of indices describing the vertices of the triangle of index i
.
If the mesh connectivity is not attached, the triple (0,0,0) is returned.
|
pure virtual |
Returns the number of triangles for which space is allocated in the mesh.
One can add triangles_capacity() - triangles_size() many triangles to the mesh before internal reallocation may become necessary.
|
pure virtual |
Returns the number of triangles.