24 #ifndef OPENSUBDIV3_FAR_TOPOLOGY_REFINER_FACTORY_H
25 #define OPENSUBDIV3_FAR_TOPOLOGY_REFINER_FACTORY_H
27 #include "../version.h"
29 #include "../far/topologyRefiner.h"
30 #include "../far/error.h"
34 namespace OpenSubdiv {
35 namespace OPENSUBDIV_VERSION {
331 template <
class MESH>
337 if (! populateBaseLevel(*refiner, mesh, options)) {
349 template <
class MESH>
356 template <
class MESH>
374 if (! resizeComponentTopology(refiner, mesh))
return false;
375 if (! prepareComponentTopologySizing(refiner))
return false;
384 void const * userData = &mesh;
386 if (! assignComponentTopology(refiner, mesh))
return false;
387 if (! prepareComponentTopologyAssignment(refiner, validate, callback, userData))
return false;
393 if (! assignComponentTags(refiner, mesh))
return false;
394 if (! prepareComponentTagsAndSharpness(refiner))
return false;
399 if (! assignFaceVaryingTopology(refiner, mesh))
return false;
400 if (! prepareFaceVaryingChannels(refiner))
return false;
405 template <
class MESH>
408 newRefiner._levels[0]->resizeFaces(count);
410 template <
class MESH>
413 newRefiner._levels[0]->resizeEdges(count);
415 template <
class MESH>
418 newRefiner._levels[0]->resizeVertices(count);
421 template <
class MESH>
424 return newRefiner._levels[0]->getNumFaces();
426 template <
class MESH>
429 return newRefiner._levels[0]->getNumEdges();
431 template <
class MESH>
434 return newRefiner._levels[0]->getNumVertices();
437 template <
class MESH>
440 newRefiner._levels[0]->resizeFaceVertices(f, count);
441 newRefiner._hasIrregFaces |= (count != newRefiner._regFaceSize);
443 template <
class MESH>
446 newRefiner._levels[0]->resizeEdgeFaces(e, count);
448 template <
class MESH>
451 newRefiner._levels[0]->resizeVertexFaces(v, count);
453 template <
class MESH>
456 newRefiner._levels[0]->resizeVertexEdges(v, count);
459 template <
class MESH>
462 return newRefiner._levels[0]->getFaceVertices(f);
464 template <
class MESH>
467 return newRefiner._levels[0]->getFaceEdges(f);
469 template <
class MESH>
472 return newRefiner._levels[0]->getEdgeVertices(e);
474 template <
class MESH>
477 return newRefiner._levels[0]->getEdgeFaces(e);
479 template <
class MESH>
482 return newRefiner._levels[0]->getVertexFaces(v);
484 template <
class MESH>
487 return newRefiner._levels[0]->getVertexEdges(v);
490 template <
class MESH>
493 return newRefiner._levels[0]->getEdgeFaceLocalIndices(e);
495 template <
class MESH>
498 return newRefiner._levels[0]->getVertexFaceLocalIndices(v);
500 template <
class MESH>
503 return newRefiner._levels[0]->getVertexEdgeLocalIndices(v);
506 template <
class MESH>
509 return newRefiner._levels[0]->findEdge(v0, v1);
512 template <
class MESH>
515 newRefiner._levels[0]->populateLocalIndices();
518 template <
class MESH>
521 newRefiner._levels[0]->setEdgeNonManifold(e, b);
523 template <
class MESH>
526 newRefiner._levels[0]->setVertexNonManifold(v, b);
529 template <
class MESH>
532 newRefiner._levels[0]->getEdgeSharpness(e) = s;
534 template <
class MESH>
537 newRefiner._levels[0]->getVertexSharpness(v) = s;
539 template <
class MESH>
542 newRefiner._levels[0]->setFaceHole(f, b);
543 newRefiner._hasHoles |= b;
546 template <
class MESH>
549 return newRefiner._levels[0]->createFVarChannel(numValues, newRefiner._subdivOptions);
551 template <
class MESH>
556 return newRefiner._levels[0]->createFVarChannel(numValues, newOptions);
558 template <
class MESH>
561 return newRefiner._levels[0]->getFaceFVarValues(face, channel);
565 template <
class MESH>
570 "Failure in TopologyRefinerFactory<>::resizeComponentTopology() -- no specialization provided.");
606 template <
class MESH>
611 "Failure in TopologyRefinerFactory<>::assignComponentTopology() -- no specialization provided.");
659 template <
class MESH>
675 template <
class MESH>
692 template <
class MESH>
707 using namespace OPENSUBDIV_VERSION;
Vtr::internal::Level::TopologyError TopologyError
static bool prepareComponentTagsAndSharpness(TopologyRefiner &refiner)
Sdc::Options schemeOptions
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 void setBaseFaceHole(TopologyRefiner &newRefiner, Index f, bool isHole)
Tag a face as a hole.
static void setNumBaseFaces(TopologyRefiner &newRefiner, int count)
Specify the number of faces to be accommodated.
static IndexArray getBaseEdgeVertices(TopologyRefiner &newRefiner, Index e)
Assign the vertices incident each edge.
static LocalIndexArray getBaseVertexEdgeLocalIndices(TopologyRefiner &newRefiner, Index v)
Assign the local indices of a vertex within each of its incident edges.
static bool populateBaseLevel(TopologyRefiner &refiner, MESH const &mesh, Options options)
Private base class of Factories for constructing TopologyRefiners.
static IndexArray getBaseEdgeFaces(TopologyRefiner &newRefiner, Index e)
Assign the faces incident each edge.
static int getNumBaseEdges(TopologyRefiner const &newRefiner)
static void setNumBaseVertexFaces(TopologyRefiner &newRefiner, Index v, int count)
Specify the number of faces incident each vertex.
unsigned int validateFullTopology
static int getNumBaseVertices(TopologyRefiner const &newRefiner)
static int getNumBaseFaces(TopologyRefiner const &newRefiner)
Issue a generic runtime error, but continue execution.
static IndexArray getBaseFaceEdges(TopologyRefiner &newRefiner, Index f)
Assign the edges incident each face.
static bool assignComponentTags(TopologyRefiner &newRefiner, MESH const &mesh)
(Optional) Specify edge or vertex sharpness or face holes
Stores topology data for a specified set of refinement options.
static TopologyRefiner * Create(MESH const &mesh, Options options=Options())
Instantiates a TopologyRefiner from client-provided topological representation.
static void populateBaseLocalIndices(TopologyRefiner &newRefiner)
Determine all local indices by inspection (only for pure manifold meshes)
static bool resizeComponentTopology(TopologyRefiner &newRefiner, MESH const &mesh)
Specify the number of vertices, faces, face-vertices, etc.
static void setNumBaseVertexEdges(TopologyRefiner &newRefiner, Index v, int count)
Specify the number of edges incident each vertex.
static void setBaseVertexSharpness(TopologyRefiner &newRefiner, Index v, float sharpness)
Assign a sharpness value to a given vertex.
void(* ValidationCallback)(TopologyError errCode, char const *msg, void const *clientData)
static IndexArray getBaseFaceVertices(TopologyRefiner &newRefiner, Index f)
Assign the vertices incident each face.
static void setNumBaseEdgeFaces(TopologyRefiner &newRefiner, Index e, int count)
Specify the number of faces incident each edge.
static void setBaseVertexNonManifold(TopologyRefiner &newRefiner, Index v, bool b)
Tag a vertex as non-manifold.
Factory for constructing TopologyRefiners from specific mesh classes.
static void setNumBaseVertices(TopologyRefiner &newRefiner, int count)
Specify the number of vertices to be accommodated.
static void setNumBaseEdges(TopologyRefiner &newRefiner, int count)
Specify the number of edges to be accommodated.
static IndexArray getBaseFaceFVarValues(TopologyRefiner &newRefiner, Index face, int channel=0)
Assign the face-varying values for the corners of each face.
static IndexArray getBaseVertexFaces(TopologyRefiner &newRefiner, Index v)
Assign the faces incident each vertex.
static int createBaseFVarChannel(TopologyRefiner &newRefiner, int numValues)
Create a new face-varying channel with the given number of values.
All supported options applying to subdivision scheme.
static LocalIndexArray getBaseVertexFaceLocalIndices(TopologyRefiner &newRefiner, Index v)
Assign the local indices of a vertex within each of its incident faces.
FVarLinearInterpolation GetFVarLinearInterpolation() const
Get face-varying interpolation rule.
Sdc::SchemeType schemeType
The subdivision scheme type identifier.
Vtr::internal::Level::ValidationCallback TopologyCallback
void Error(ErrorType err, const char *format,...)
Sends an OSD error with a message (internal use only)
static void setBaseEdgeSharpness(TopologyRefiner &newRefiner, Index e, float sharpness)
Assign a sharpness value to a given edge.
static void setNumBaseFaceVertices(TopologyRefiner &newRefiner, Index f, int count)
Specify the number of vertices incident each face.
SchemeType
Enumerated type for all subdivision schemes supported by OpenSubdiv.
static bool assignFaceVaryingTopology(TopologyRefiner &newRefiner, MESH const &mesh)
(Optional) Specify face-varying data per face
static bool prepareComponentTopologyAssignment(TopologyRefiner &refiner, bool fullValidation, TopologyCallback callback, void const *callbackData)
Options related to the construction of each TopologyRefiner.
static void setBaseEdgeNonManifold(TopologyRefiner &newRefiner, Index e, bool b)
Tag an edge as non-manifold.
static bool prepareFaceVaryingChannels(TopologyRefiner &refiner)
static LocalIndexArray getBaseEdgeFaceLocalIndices(TopologyRefiner &newRefiner, Index e)
Assign the local indices of an edge within each of its incident faces.
static void reportInvalidTopology(TopologyError errCode, char const *msg, MESH const &mesh)
(Optional) Control run-time topology validation and error reporting
Options(Sdc::SchemeType sdcType=Sdc::SCHEME_CATMARK, Sdc::Options sdcOptions=Sdc::Options())
void SetFVarLinearInterpolation(FVarLinearInterpolation b)
Set face-varying interpolation rule.
static IndexArray getBaseVertexEdges(TopologyRefiner &newRefiner, Index v)
Assign the edges incident each vertex.
static Index findBaseEdge(TopologyRefiner const &newRefiner, Index v0, Index v1)
Identify an edge to be assigned a sharpness value given a vertex pair.
static bool prepareComponentTopologySizing(TopologyRefiner &refiner)