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

Interface representing a subdivision surface. More...

#include <isubdivision_surface.h>

Inheritance diagram for mi::neuraylib::ISubdivision_surface:

Public Member Functions

Methods related to triangles and quads
virtual Uint32 triangles_size () const =0
 Returns the number of triangles in the mesh. 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 Uint32 quads_size () const =0
 Returns the number of quads in the mesh. More...
 
virtual Uint32 quads_capacity () const =0
 Returns the number of quads for which space is allocated in the mesh. More...
 
virtual void reserve_quads (Uint32 n)=0
 Reserves space for at least n quads. More...
 
Methods related to creases
virtual Sint32 set_crease_value (Polygon_handle_struct p, Uint32 index, Float32 value)=0
 Sets crease values for an edge. More...
 
virtual Float32 get_crease_value (Polygon_handle_struct p, Uint32 index) const =0
 Returns crease values for an edge. More...
 
virtual Sint32 set_crease_values (Polygon_handle_struct p, const Float32 *values)=0
 Sets crease values for all edges of a polygon. More...
 
virtual const Float32get_crease_values (Polygon_handle_struct p) const =0
 Returns crease values for all edges of a polygon. More...
 
virtual IArrayget_inconsistent_crease_values () const =0
 Checks all crease values for consistency and returns inconsistent values. More...
 
Methods related to vertex features
virtual Sint32 set_vertex_feature (Uint32 index, Vertex_feature feature)=0
 Sets a vertex feature. More...
 
virtual Vertex_feature get_vertex_feature (Uint32 index) const =0
 Returns a vertex features. More...
 
- Public Member Functions inherited from mi::neuraylib::IPolygon_mesh
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...
 
virtual Uint32 polygons_size () const =0
 Returns the number of polygons. More...
 
virtual Uint32 polygon_corners_size (Polygon_handle_struct p) const =0
 Returns the number of vertices for a given polygon p. More...
 
virtual bool is_hole (Polygon_handle_struct p) const =0
 Indicates whether the polygon p represents a hole. More...
 
virtual Uint32 indices_size () const =0
 Returns the total number of indices, i.e., the sum of the number of vertices of all polygons. More...
 
virtual bool is_polygon_size_constant () const =0
 Indicates whether all polygons have the same number of vertices. More...
 
virtual Polygon_handle_struct add_polygon (Uint32 num_vertices, bool hole=false)=0
 Adds a polygon to the mesh. More...
 
virtual const IPolygon_connectivityaccess_mesh_connectivity () const =0
 Returns the mesh connectivity. More...
 
virtual IPolygon_connectivityedit_mesh_connectivity ()=0
 Detaches and returns the mesh connectivity. More...
 
virtual Sint32 attach_mesh_connectivity (IPolygon_connectivity *connectivity)=0
 Attaches the mesh connectivity to the mesh. More...
 
virtual IPolygon_connectivitycreate_connectivity (Connectivity_map_type map_type=CONNECTIVITY_MAP_GENERIC)=0
 Creates a new connectivity for non-per-primitive attributes. More...
 
virtual const IPolygon_connectivityaccess_connectivity (Mesh_attribute_name name) const =0
 Returns the connectivity for a given mesh attribute. More...
 
virtual IPolygon_connectivityedit_connectivity (Mesh_attribute_name name)=0
 Detaches and returns the connectivity for a given mesh attribute. More...
 
virtual Sint32 attach_connectivity (IPolygon_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...
 
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_vectorcreate_attribute_vector (Mesh_attribute_name name, Uint32 dim=1)=0
 Creates a per-primitive mesh attribute. More...
 
virtual const IAttribute_vectoraccess_attribute_vector (Mesh_attribute_name name) const =0
 Returns a per-primitive mesh attribute. More...
 
virtual IAttribute_vectoredit_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...
 
virtual Bbox3_struct get_bbox () const =0
 Returns the bounding box of the polygon mesh. More...
 
virtual Bbox3_struct get_tight_bbox (const Float64_4_4_struct &transformation_matrix) const =0
 Returns the bounding box of the polygon mesh after transformation. More...
 
virtual void set_maximum_displacement (Float32 displacement)=0
 Sets the maximum displacement of the polygon mesh. More...
 
virtual Float32 get_maximum_displacement () const =0
 Returns the maximum displacement of the polygon mesh. More...
 
- Public Member Functions inherited from mi::neuraylib::IScene_element
virtual Element_type get_element_type () const =0
 Indicates the actual scene element represented by interfaces derived from this interface. More...
 
- Public Member Functions inherited from mi::neuraylib::IAttribute_set
virtual IDatacreate_attribute (const char *name, const char *type)=0
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name, const char *type)
 Creates a new attribute name of the type type. More...
 
template<class T>
T * create_attribute (const char *name)
 Creates a new attribute name of the type T. More...
 
virtual bool destroy_attribute (const char *name)=0
 Destroys the attribute name. More...
 
virtual const IDataaccess_attribute (const char *name) const =0
 Returns a const pointer to the attribute name. More...
 
template<class T>
const T * access_attribute (const char *name) const
 Returns a const pointer to the attribute name. More...
 
virtual IDataedit_attribute (const char *name)=0
 Returns a mutable pointer to the attribute name. More...
 
template<class T>
T * edit_attribute (const char *name)
 Returns a mutable pointer to the attribute name. More...
 
virtual bool is_attribute (const char *name) const =0
 Indicates existence of an attribute. More...
 
virtual const char * get_attribute_type_name (const char *name) const =0
 Returns the type of an attribute. More...
 
virtual Sint32 set_attribute_propagation (const char *name, Propagation_type value)=0
 Sets the propagation type of the attribute name. More...
 
virtual Propagation_type get_attribute_propagation (const char *name) const =0
 Returns the propagation type of the attribute name. More...
 
virtual const char * enumerate_attributes (Sint32 index) const =0
 Returns the name of the attribute indicated by index. 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< 0x6a65666a, ... >
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::Interface_declare< 0x598d264b, ... >
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::Interface_declare< 0x8a2a4da9, ... >
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::Interface_declare< 0x1bcb8d48, ... >
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< 0x6a65666a, ... >
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::Interface_declare< 0x598d264b, ... >
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::Interface_declare< 0x8a2a4da9, ... >
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::Interface_declare< 0x1bcb8d48, ... >
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 a subdivision surface.

Subdivision surfaces are smooth surfaces that are represented by a coarse control mesh. The smooth surface is the limit surface that results from recursive application of a subdivision process that splits each polygon into smaller polygons that are a better approximation of the limit surface than the input polygon.

The control mesh is represented as a polygon mesh with the limitation that only triangles and quads are supported. Holes are not supported, either. Additionally, vertices may be flagged as smooth (the default) or as corners. For each edge it is possible to set a crease value that defines its sharpness.

Note: If quads have already been added and per-primitive attribute vectors are attached, adding another triangle needs time linear in the number of quads. Thus, it is recommended to either first add the triangles and then the quads, or to detach the per-primitive attribute vectors if a large number of triangles is to be added later.

See also the "approx" attribute on mi::neuraylib::IAttribute_set for information how to control the approximation of the limit surface.

Member Function Documentation

 get_crease_value()

virtual Float32 mi::neuraylib::ISubdivision_surface::get_crease_value ( Polygon_handle_struct  p,
Uint32  index 
) const
pure virtual

Returns crease values for an edge.

Parameters
pThe polygon to return the crease values for.
indexThe edge to return the crease value for. Edge i is the edge from vertex i to vertex i+1.
Returns
The requested crease value, or -2.0 if p is out of bounds, or -3.0 if index is out of bounds.

 get_crease_values()

virtual const Float32 * mi::neuraylib::ISubdivision_surface::get_crease_values ( Polygon_handle_struct  p) const
pure virtual

Returns crease values for all edges of a polygon.

Parameters
pThe polygon to return the crease values for.
Returns
A pointer to an array of crease values (3 or 4 values depending on p being a triangle or quad), or NULL if p is out of bounds, or no crease values for the given polygon are specified. The first value is for the edge from vertex 0 to vertex 1, and so on.

 get_inconsistent_crease_values()

virtual IArray * mi::neuraylib::ISubdivision_surface::get_inconsistent_crease_values ( ) const
pure virtual

Checks all crease values for consistency and returns inconsistent values.

The array elements are of type "Crease_info[]" and describe all inconsistent crease values for a particular edge. The type "Crease_info" is a structure with the following members:

It stores the crease value that was set via the given polygon and its edge index.

Note
The method always returns NULL if the mesh connectivity is not attached.

 get_vertex_feature()

virtual Vertex_feature mi::neuraylib::ISubdivision_surface::get_vertex_feature ( Uint32  index) const
pure virtual

Returns a vertex features.

Parameters
indexThe index of the point to return the vertex feature for.
Returns
The feature of the point index (undefined if index is out of bounds).

 quads_capacity()

virtual Uint32 mi::neuraylib::ISubdivision_surface::quads_capacity ( ) const
pure virtual

Returns the number of quads for which space is allocated in the mesh.

One can add quads_capacity() - quads_size() many quads to the mesh before internal reallocation may become necessary.

See also
reserve_quads().

 quads_size()

virtual Uint32 mi::neuraylib::ISubdivision_surface::quads_size ( ) const
pure virtual

Returns the number of quads in the mesh.

 reserve_quads()

virtual void mi::neuraylib::ISubdivision_surface::reserve_quads ( Uint32  n)
pure virtual

Reserves space for at least n quads.

Sets the internal capacity to at least n quads before reallocation may become necessary. The number of quads currently stored is not changed by this method.

See also
quads_capacity().

 reserve_triangles()

virtual void mi::neuraylib::ISubdivision_surface::reserve_triangles ( Uint32  n)
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.

See also
triangles_capacity().

 set_crease_value()

virtual Sint32 mi::neuraylib::ISubdivision_surface::set_crease_value ( Polygon_handle_struct  p,
Uint32  index,
Float32  value 
)
pure virtual

Sets crease values for an edge.

Note
It is the user's responsibility to ensure that crease values are consistent, i.e., that the crease values set for a given edge via different polygons are identical (or not set at all). Inconsistent crease values may lead to wrong results. See also get_inconsistent_crease_values().
If no crease values have been set for the other edges of the polygon p, this method sets them to 0.0.
Parameters
pThe polygon to set the crease values for.
indexThe edge to set the crease value for. Edge i is the edge from vertex i to vertex i+1.
valueThe new crease value.
Returns
  • 0: Success.
  • -2: p is out of bounds.
  • -3: index is out of bounds.
  • -4: value is not in the interval [0, 1].

 set_crease_values()

virtual Sint32 mi::neuraylib::ISubdivision_surface::set_crease_values ( Polygon_handle_struct  p,
const Float32 values 
)
pure virtual

Sets crease values for all edges of a polygon.

Note
It is the user's responsibility to ensure that crease values are consistent, i.e., that the crease values set for a given edge via different polygons are identical (or not set at all). Inconsistent crease values may lead to wrong results. See also get_inconsistent_crease_values().
Parameters
pThe polygon to set the crease values for.
valuesThe array of values (3 or 4 values depending on p being a triangle or quad). The first value is for the edge from vertex 0 to vertex 1, and so on.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: p is out of bounds.
  • -4: At least one value is not in the interval [0, 1].

 set_vertex_feature()

virtual Sint32 mi::neuraylib::ISubdivision_surface::set_vertex_feature ( Uint32  index,
Vertex_feature  feature 
)
pure virtual

Sets a vertex feature.

Parameters
indexThe index of the point to set the vertex feature for.
featureThe desired feature.
Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: Invalid value for feature.

 triangles_capacity()

virtual Uint32 mi::neuraylib::ISubdivision_surface::triangles_capacity ( ) const
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.

See also
reserve_triangles().

 triangles_size()

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

Returns the number of triangles in the mesh.