NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members
References in manual:  1 
mi::ISubdivision_surface Class Referenceabstract

Interface representing a subdivision surface. More...

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

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 Float32 get_crease_values (Polygon_handle_struct p) const =0
  Returns crease values for all edges of a polygon. More...
 
virtual IArray get_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...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x6a65666a, 0x849d, 0x4081, 0xaa, 0x32, 0xb3, 0xa1, 0xeb, 0xa0, 0x6f, 0xe2, IPolygon_mesh >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IPolygon_mesh
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< 0x6a65666a, 0x849d, 0x4081, 0xaa, 0x32, 0xb3, 0xa1, 0xeb, 0xa0, 0x6f, 0xe2, IPolygon_mesh >
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 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::IAttribute_set for information how to control the approximation of the limit surface.

Member Function Documentation

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

Returns crease values for an edge.

Parameters
p The polygon to return the crease values for.
index The 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.
virtual const Float32* mi::ISubdivision_surface::get_crease_values ( Polygon_handle_struct  p) const
pure virtual

Returns crease values for all edges of a polygon.

Parameters
p The 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.
virtual IArray* mi::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.
virtual Vertex_feature mi::ISubdivision_surface::get_vertex_feature ( Uint32  index) const
pure virtual

Returns a vertex features.

Parameters
index The index of the point to return the vertex feature for.
Returns
The feature of the point index (undefined if index is out of bounds).
virtual Uint32 mi::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().
virtual Uint32 mi::ISubdivision_surface::quads_size ( ) const
pure virtual

Returns the number of quads in the mesh.

virtual void mi::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().
virtual void mi::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().
virtual Sint32 mi::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
p The polygon to set the crease values for.
index The edge to set the crease value for. Edge i is the edge from vertex i to vertex i+1.
value The 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].
virtual Sint32 mi::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
p The polygon to set the crease values for.
values The 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].
virtual Sint32 mi::ISubdivision_surface::set_vertex_feature ( Uint32  index,
Vertex_feature  feature 
)
pure virtual

Sets a vertex feature.

Parameters
index The index of the point to set the vertex feature for.
feature The desired feature.
Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: Invalid value for feature.
virtual Uint32 mi::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().
virtual Uint32 mi::ISubdivision_surface::triangles_size ( ) const
pure virtual

Returns the number of triangles in the mesh.