| OpenSubdiv OpenSubdiv

Loading...
Searching...
No Matches
Classes | Static Public Member Functions | Protected Types | List of all members
TopologyRefinerFactory< MESH > Class Template Reference

Factory for constructing TopologyRefiners from specific mesh classes. More...

`#include <topologyRefinerFactory.h>`

Inheritance diagram for TopologyRefinerFactory< MESH >:

## Classes
struct | Options
| Options related to the construction of each TopologyRefiner. More...

## Static Public Member Functions
static TopologyRefiner * | Create (MESH const &mesh, Options options=Options())
| Instantiates a TopologyRefiner from client-provided topological representation.
static TopologyRefiner * | Create (TopologyRefiner const &baseLevel)
| Instantiates a TopologyRefiner from the base level of an existing instance.

## Protected Types
typedef Vtr::internal::Level::TopologyError | TopologyError
Protected Types inherited from TopologyRefinerFactoryBase
typedef Vtr::internal::Level::ValidationCallback | TopologyCallback

## Static Protected Member Functions
Methods to be provided to complete assembly of the TopologyRefiner
These methods are to be specialized to implement all details specific to class MESH required to convert MESH data to TopologyRefiner. Note that some of these must be specialized in order to complete construction while some are optional. There are two minimal construction requirements (to specify the size and content of all topology relations) and three optional (to specify feature tags, face-varying data, and runtime validation and error reporting). See comments in the generic stubs, the factory for Far::TopologyDescriptor or the tutorials for more details on writing these.
static bool | resizeComponentTopology (TopologyRefiner &newRefiner, MESH const &mesh)
| Specify the number of vertices, faces, face-vertices, etc.
static bool | assignComponentTopology (TopologyRefiner &newRefiner, MESH const &mesh)
| Specify the relationships between vertices, faces, etc. ie the face-vertices, vertex-faces, edge-vertices, etc.
static bool | assignComponentTags (TopologyRefiner &newRefiner, MESH const &mesh)
| (Optional) Specify edge or vertex sharpness or face holes
static bool | assignFaceVaryingTopology (TopologyRefiner &newRefiner, MESH const &mesh)
| (Optional) Specify face-varying data per face
static void | reportInvalidTopology (TopologyError errCode, char const *msg, MESH const &mesh)
| (Optional) Control run-time topology validation and error reporting
Base level assembly methods to be used within resizeComponentTopology()
These methods specify sizes of various quantities, e.g. the number of vertices, faces, face-vertices, etc. The number of the primary components (vertices, faces and edges) should be specified prior to anything else that references them (e.g. we need to know the number of faces before specifying the vertices for that face. If a full boundary representation with all neighborhood information is not available, e.g. faces and vertices are available but not edges, only the face-vertices should be specified. The remaining topological relationships will be constructed later in the assembly (though at greater cost than if specified directly). The sizes for topological relationships between individual components should be specified in order, i.e. the number of face-vertices for each successive face.
static void | setNumBaseVertices (TopologyRefiner &newRefiner, int count)
| Specify the number of vertices to be accommodated.
static void | setNumBaseFaces (TopologyRefiner &newRefiner, int count)
| Specify the number of faces to be accommodated.
static void | setNumBaseEdges (TopologyRefiner &newRefiner, int count)
| Specify the number of edges to be accommodated.
static void | setNumBaseFaceVertices (TopologyRefiner &newRefiner, Index f, int count)
| Specify the number of vertices incident each face.
static void | setNumBaseEdgeFaces (TopologyRefiner &newRefiner, Index e, int count)
| Specify the number of faces incident each edge.
static void | setNumBaseVertexFaces (TopologyRefiner &newRefiner, Index v, int count)
| Specify the number of faces incident each vertex.
static void | setNumBaseVertexEdges (TopologyRefiner &newRefiner, Index v, int count)
| Specify the number of edges incident each vertex.
static int | getNumBaseVertices (TopologyRefiner const &newRefiner)
static int | getNumBaseFaces (TopologyRefiner const &newRefiner)
static int | getNumBaseEdges (TopologyRefiner const &newRefiner)
Base level assembly methods to be used within assignComponentTopology()
These methods populate relationships between components – in much the same manner as they are inspected once the TopologyRefiner is completed. An array of fixed size is returned from these methods and its entries are to be populated with the appropriate indices for its neighbors. At minimum, the vertices for each face must be specified. As noted previously, the remaining relationships will be constructed as needed. The ordering of entries in these arrays is important – they are expected to be ordered counter-clockwise for a right-hand orientation. Non-manifold components must be explicitly tagged as such and they do not require the ordering expected of manifold components. Special consideration must also be given to certain non-manifold situations, e.g. the same edge cannot appear twice in a face, and a degenerate edge (same vertex at both ends) can only have one incident face. Such considerations are typically achievable by creating multiple instances of an edge. So while there will always be a one-to-one correspondence between vertices and faces, the same is not guaranteed of edges in certain non-manifold circumstances.
static IndexArray | getBaseFaceVertices (TopologyRefiner &newRefiner, Index f)
| Assign the vertices incident each face.
static IndexArray | getBaseFaceEdges (TopologyRefiner &newRefiner, Index f)
| Assign the edges incident each face.
static IndexArray | getBaseEdgeVertices (TopologyRefiner &newRefiner, Index e)
| Assign the vertices incident each edge.
static IndexArray | getBaseEdgeFaces (TopologyRefiner &newRefiner, Index e)
| Assign the faces incident each edge.
static IndexArray | getBaseVertexFaces (TopologyRefiner &newRefiner, Index v)
| Assign the faces incident each vertex.
static IndexArray | getBaseVertexEdges (TopologyRefiner &newRefiner, Index v)
| Assign the edges incident each vertex.
static LocalIndexArray | getBaseVertexFaceLocalIndices (TopologyRefiner &newRefiner, Index v)
| Assign the local indices of a vertex within each of its incident faces.
static LocalIndexArray | getBaseVertexEdgeLocalIndices (TopologyRefiner &newRefiner, Index v)
| Assign the local indices of a vertex within each of its incident edges.
static LocalIndexArray | getBaseEdgeFaceLocalIndices (TopologyRefiner &newRefiner, Index e)
| Assign the local indices of an edge within each of its incident faces.
static void | populateBaseLocalIndices (TopologyRefiner &newRefiner)
| Determine all local indices by inspection (only for pure manifold meshes)
static void | setBaseEdgeNonManifold (TopologyRefiner &newRefiner, Index e, bool b)
| Tag an edge as non-manifold.
static void | setBaseVertexNonManifold (TopologyRefiner &newRefiner, Index v, bool b)
| Tag a vertex as non-manifold.
Base level assembly methods to be used within assignComponentTags()
These methods are used to assign edge or vertex sharpness, for tagging faces as holes, etc. Unlike topological assignment, only those components that possess a feature of interest need be explicitly assigned. Since topological construction is largely complete by this point, a method is available to identify an edge for sharpness assignment given a pair of vertices.
static Index | findBaseEdge (TopologyRefiner const &newRefiner, Index v0, Index v1)
| Identify an edge to be assigned a sharpness value given a vertex pair.
static void | setBaseEdgeSharpness (TopologyRefiner &newRefiner, Index e, float sharpness)
| Assign a sharpness value to a given edge.
static void | setBaseVertexSharpness (TopologyRefiner &newRefiner, Index v, float sharpness)
| Assign a sharpness value to a given vertex.
static void | setBaseFaceHole (TopologyRefiner &newRefiner, Index f, bool isHole)
| Tag a face as a hole.
Static Protected Member Functions inherited from TopologyRefinerFactoryBase
static bool | prepareComponentTopologySizing (TopologyRefiner &refiner)
static bool | prepareComponentTopologyAssignment (TopologyRefiner &refiner, bool fullValidation, TopologyCallback callback, void const *callbackData)
static bool | prepareComponentTagsAndSharpness (TopologyRefiner &refiner)
static bool | prepareFaceVaryingChannels (TopologyRefiner &refiner)

## Base level assembly methods to be used within assignFaceVaryingTopology()
Face-varying data is assigned to faces in much the same way as face-vertex topology is assigned – indices for face-varying values are assigned to the corners of each face just as indices for vertices were assigned. Independent sets of face-varying data are stored in channels. The identifier of each channel (an integer) is expected whenever referring to face-varying data in any form.
static int | createBaseFVarChannel (TopologyRefiner &newRefiner, int numValues)
| Create a new face-varying channel with the given number of values.
static int | createBaseFVarChannel (TopologyRefiner &newRefiner, int numValues, Sdc::Options const &fvarOptions)
| Create a new face-varying channel with the given number of values and independent interpolation options.
static IndexArray | getBaseFaceFVarValues (TopologyRefiner &newRefiner, Index face, int channel=0)
| Assign the face-varying values for the corners of each face.
static bool | populateBaseLevel (TopologyRefiner &refiner, MESH const &mesh, Options options)

## Detailed Description

template<class MESH>
class OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefinerFactory< MESH >

Factory for constructing TopologyRefiners from specific mesh classes.

TopologyRefinerFactory<MESH> is the factory class template to convert an instance of TopologyRefiner from an arbitrary mesh class. While a class template, the implementation is not (cannot) be complete, so specialization of a few methods is required (it is a stateless factory, so no instance and only static methods).

This template provides both the interface and high level assembly for the construction of the TopologyRefiner instance. The high level construction executes a specific set of operations to convert the client's MESH into TopologyRefiner. This set of operations combines methods independent of MESH from the base class with those specialized here for class MESH.

Definition at line 78 of file topologyRefinerFactory.h.

## Member Typedef Documentation

## ◆ TopologyError

template<class MESH >

typedef Vtr::internal::Level::TopologyError TopologyError
| protected

Definition at line 131 of file topologyRefinerFactory.h.

## Member Function Documentation

## ◆ assignComponentTags()

template<class MESH >

bool assignComponentTags | ( | TopologyRefiner & | newRefiner,
|  | MESH const & | mesh
| ) |  |
| static protected

(Optional) Specify edge or vertex sharpness or face holes

Definition at line 690 of file topologyRefinerFactory.h.

## ◆ assignComponentTopology()

template<class MESH >

bool assignComponentTopology | ( | TopologyRefiner & | newRefiner,
|  | MESH const & | mesh
| ) |  |
| static protected

Specify the relationships between vertices, faces, etc. ie the face-vertices, vertex-faces, edge-vertices, etc.

Definition at line 621 of file topologyRefinerFactory.h.

## ◆ assignFaceVaryingTopology()

template<class MESH >

bool assignFaceVaryingTopology | ( | TopologyRefiner & | newRefiner,
|  | MESH const & | mesh
| ) |  |
| static protected

(Optional) Specify face-varying data per face

Definition at line 674 of file topologyRefinerFactory.h.

## ◆ Create() [1/2]

template<class MESH >

TopologyRefiner * Create | ( | MESH const & | mesh,
|  | Options | options = `Options()`
| ) |  |
| static

Instantiates a TopologyRefiner from client-provided topological representation.

If only the face-vertices topological relationships are specified with this factory, edge relationships have to be inferred, which requires additional processing. If the client topological rep can provide this information, it is highly recommended to do so.

Parameters

  mesh | Client's topological representation (or a converter)
  options | Options controlling the creation of the TopologyRefiner

Returns
  A new instance of TopologyRefiner or 0 for failure

Definition at line 346 of file topologyRefinerFactory.h.

## ◆ Create() [2/2]

template<class MESH >

TopologyRefiner * Create | ( | TopologyRefiner const & | baseLevel | ) |
| static

Instantiates a TopologyRefiner from the base level of an existing instance.

This allows lightweight copies of the same topology to be refined differently for each new instance. As with other classes that refer to an existing TopologyRefiner, it must generally exist for the entire lifetime of the new instance. In this case, the base level of the original instance must be preserved.

Parameters

  baseLevel | An existing TopologyRefiner to share base level.

Returns
  A new instance of TopologyRefiner or 0 for failure

Definition at line 364 of file topologyRefinerFactory.h.

## ◆ createBaseFVarChannel() [1/2]

template<class MESH >

int createBaseFVarChannel | ( | TopologyRefiner & | newRefiner,
|  | int | numValues
| ) |  |
| inline static protected

Create a new face-varying channel with the given number of values.

Definition at line 561 of file topologyRefinerFactory.h.

## ◆ createBaseFVarChannel() [2/2]

template<class MESH >

int createBaseFVarChannel | ( | TopologyRefiner & | newRefiner,
|  | int | numValues,
|  | Sdc::Options const & | fvarOptions
| ) |  |
| inline static protected

Create a new face-varying channel with the given number of values and independent interpolation options.

Definition at line 566 of file topologyRefinerFactory.h.

## ◆ findBaseEdge()

template<class MESH >

Index findBaseEdge | ( | TopologyRefiner const & | newRefiner,
|  | Index | v0,
|  | Index | v1
| ) |  |
| inline static protected

Identify an edge to be assigned a sharpness value given a vertex pair.

Definition at line 521 of file topologyRefinerFactory.h.

## ◆ getBaseEdgeFaceLocalIndices()

template<class MESH >

LocalIndexArray getBaseEdgeFaceLocalIndices | ( | TopologyRefiner & | newRefiner,
|  | Index | e
| ) |  |
| inline static protected

Assign the local indices of an edge within each of its incident faces.

Definition at line 505 of file topologyRefinerFactory.h.

## ◆ getBaseEdgeFaces()

template<class MESH >

IndexArray getBaseEdgeFaces | ( | TopologyRefiner & | newRefiner,
|  | Index | e
| ) |  |
| inline static protected

Assign the faces incident each edge.

Definition at line 489 of file topologyRefinerFactory.h.

## ◆ getBaseEdgeVertices()

template<class MESH >

IndexArray getBaseEdgeVertices | ( | TopologyRefiner & | newRefiner,
|  | Index | e
| ) |  |
| inline static protected

Assign the vertices incident each edge.

Definition at line 484 of file topologyRefinerFactory.h.

## ◆ getBaseFaceEdges()

template<class MESH >

IndexArray getBaseFaceEdges | ( | TopologyRefiner & | newRefiner,
|  | Index | f
| ) |  |
| inline static protected

Assign the edges incident each face.

Definition at line 479 of file topologyRefinerFactory.h.

## ◆ getBaseFaceFVarValues()

template<class MESH >

IndexArray getBaseFaceFVarValues | ( | TopologyRefiner & | newRefiner,
|  | Index | face,
|  | int | channel = `0`
| ) |  |
| inline static protected

Assign the face-varying values for the corners of each face.

Definition at line 573 of file topologyRefinerFactory.h.

## ◆ getBaseFaceVertices()

template<class MESH >

IndexArray getBaseFaceVertices | ( | TopologyRefiner & | newRefiner,
|  | Index | f
| ) |  |
| inline static protected

Assign the vertices incident each face.

Definition at line 474 of file topologyRefinerFactory.h.

## ◆ getBaseVertexEdgeLocalIndices()

template<class MESH >

LocalIndexArray getBaseVertexEdgeLocalIndices | ( | TopologyRefiner & | newRefiner,
|  | Index | v
| ) |  |
| inline static protected

Assign the local indices of a vertex within each of its incident edges.

Definition at line 515 of file topologyRefinerFactory.h.

## ◆ getBaseVertexEdges()

template<class MESH >

IndexArray getBaseVertexEdges | ( | TopologyRefiner & | newRefiner,
|  | Index | v
| ) |  |
| inline static protected

Assign the edges incident each vertex.

Definition at line 499 of file topologyRefinerFactory.h.

## ◆ getBaseVertexFaceLocalIndices()

template<class MESH >

LocalIndexArray getBaseVertexFaceLocalIndices | ( | TopologyRefiner & | newRefiner,
|  | Index | v
| ) |  |
| inline static protected

Assign the local indices of a vertex within each of its incident faces.

Definition at line 510 of file topologyRefinerFactory.h.

## ◆ getBaseVertexFaces()

template<class MESH >

IndexArray getBaseVertexFaces | ( | TopologyRefiner & | newRefiner,
|  | Index | v
| ) |  |
| inline static protected

Assign the faces incident each vertex.

Definition at line 494 of file topologyRefinerFactory.h.

## ◆ getNumBaseEdges()

template<class MESH >

int getNumBaseEdges | ( | TopologyRefiner const & | newRefiner | ) |
| inline static protected

Definition at line 441 of file topologyRefinerFactory.h.

## ◆ getNumBaseFaces()

template<class MESH >

int getNumBaseFaces | ( | TopologyRefiner const & | newRefiner | ) |
| inline static protected

Definition at line 436 of file topologyRefinerFactory.h.

## ◆ getNumBaseVertices()

template<class MESH >

int getNumBaseVertices | ( | TopologyRefiner const & | newRefiner | ) |
| inline static protected

Definition at line 446 of file topologyRefinerFactory.h.

## ◆ populateBaseLevel()

template<class MESH >

bool populateBaseLevel | ( | TopologyRefiner & | refiner,
|  | MESH const & | mesh,
|  | Options | options
| ) |  |
| static protected

Definition at line 371 of file topologyRefinerFactory.h.

## ◆ populateBaseLocalIndices()

template<class MESH >

void populateBaseLocalIndices | ( | TopologyRefiner & | newRefiner | ) |
| inline static protected

Determine all local indices by inspection (only for pure manifold meshes)

Definition at line 527 of file topologyRefinerFactory.h.

## ◆ reportInvalidTopology()

template<class MESH >

void reportInvalidTopology | ( | TopologyError | errCode,
|  | char const * | msg,
|  | MESH const & | mesh
| ) |  |
| static protected

(Optional) Control run-time topology validation and error reporting

Definition at line 707 of file topologyRefinerFactory.h.

## ◆ resizeComponentTopology()

template<class MESH >

bool resizeComponentTopology | ( | TopologyRefiner & | newRefiner,
|  | MESH const & | mesh
| ) |  |
| static protected

Specify the number of vertices, faces, face-vertices, etc.

Definition at line 580 of file topologyRefinerFactory.h.

## ◆ setBaseEdgeNonManifold()

template<class MESH >

void setBaseEdgeNonManifold | ( | TopologyRefiner & | newRefiner,
|  | Index | e,
|  | bool | b
| ) |  |
| inline static protected

Tag an edge as non-manifold.

Definition at line 533 of file topologyRefinerFactory.h.

## ◆ setBaseEdgeSharpness()

template<class MESH >

void setBaseEdgeSharpness | ( | TopologyRefiner & | newRefiner,
|  | Index | e,
|  | float | sharpness
| ) |  |
| inline static protected

Assign a sharpness value to a given edge.

Definition at line 544 of file topologyRefinerFactory.h.

## ◆ setBaseFaceHole()

template<class MESH >

void setBaseFaceHole | ( | TopologyRefiner & | newRefiner,
|  | Index | f,
|  | bool | isHole
| ) |  |
| inline static protected

Tag a face as a hole.

Definition at line 554 of file topologyRefinerFactory.h.

## ◆ setBaseVertexNonManifold()

template<class MESH >

void setBaseVertexNonManifold | ( | TopologyRefiner & | newRefiner,
|  | Index | v,
|  | bool | b
| ) |  |
| inline static protected

Tag a vertex as non-manifold.

Definition at line 538 of file topologyRefinerFactory.h.

## ◆ setBaseVertexSharpness()

template<class MESH >

void setBaseVertexSharpness | ( | TopologyRefiner & | newRefiner,
|  | Index | v,
|  | float | sharpness
| ) |  |
| inline static protected

Assign a sharpness value to a given vertex.

Definition at line 549 of file topologyRefinerFactory.h.

## ◆ setNumBaseEdgeFaces()

template<class MESH >

void setNumBaseEdgeFaces | ( | TopologyRefiner & | newRefiner,
|  | Index | e,
|  | int | count
| ) |  |
| inline static protected

Specify the number of faces incident each edge.

Definition at line 458 of file topologyRefinerFactory.h.

## ◆ setNumBaseEdges()

template<class MESH >

void setNumBaseEdges | ( | TopologyRefiner & | newRefiner,
|  | int | count
| ) |  |
| inline static protected

Specify the number of edges to be accommodated.

Definition at line 425 of file topologyRefinerFactory.h.

## ◆ setNumBaseFaces()

template<class MESH >

void setNumBaseFaces | ( | TopologyRefiner & | newRefiner,
|  | int | count
| ) |  |
| inline static protected

Specify the number of faces to be accommodated.

Definition at line 420 of file topologyRefinerFactory.h.

## ◆ setNumBaseFaceVertices()

template<class MESH >

void setNumBaseFaceVertices | ( | TopologyRefiner & | newRefiner,
|  | Index | f,
|  | int | count
| ) |  |
| inline static protected

Specify the number of vertices incident each face.

Definition at line 452 of file topologyRefinerFactory.h.

## ◆ setNumBaseVertexEdges()

template<class MESH >

void setNumBaseVertexEdges | ( | TopologyRefiner & | newRefiner,
|  | Index | v,
|  | int | count
| ) |  |
| inline static protected

Specify the number of edges incident each vertex.

Definition at line 468 of file topologyRefinerFactory.h.

## ◆ setNumBaseVertexFaces()

template<class MESH >

void setNumBaseVertexFaces | ( | TopologyRefiner & | newRefiner,
|  | Index | v,
|  | int | count
| ) |  |
| inline static protected

Specify the number of faces incident each vertex.

Definition at line 463 of file topologyRefinerFactory.h.

## ◆ setNumBaseVertices()

template<class MESH >

void setNumBaseVertices | ( | TopologyRefiner & | newRefiner,
|  | int | count
| ) |  |
| inline static protected

Specify the number of vertices to be accommodated.

Definition at line 430 of file topologyRefinerFactory.h.

The documentation for this class was generated from the following files:

- opensubdiv/far/topologyRefiner.h
- opensubdiv/far/topologyRefinerFactory.h