24 #ifndef OPENSUBDIV3_VTR_LEVEL_H
25 #define OPENSUBDIV3_VTR_LEVEL_H
27 #include "../version.h"
29 #include "../sdc/types.h"
30 #include "../sdc/crease.h"
31 #include "../sdc/options.h"
32 #include "../vtr/types.h"
41 namespace OPENSUBDIV_VERSION {
278 int fvarChannel = -1)
const;
281 int fvarChannel = -1)
const;
283 int fvarChannel = -1)
const;
285 int fvarChannel = -1)
const;
445 std::vector<Index> _faceVertCountsAndOffsets;
446 std::vector<Index> _faceVertIndices;
447 std::vector<Index> _faceEdgeIndices;
448 std::vector<FTag> _faceTags;
451 std::vector<Index> _edgeVertIndices;
452 std::vector<Index> _edgeFaceCountsAndOffsets;
453 std::vector<Index> _edgeFaceIndices;
454 std::vector<LocalIndex> _edgeFaceLocalIndices;
456 std::vector<float> _edgeSharpness;
457 std::vector<ETag> _edgeTags;
460 std::vector<Index> _vertFaceCountsAndOffsets;
461 std::vector<Index> _vertFaceIndices;
462 std::vector<LocalIndex> _vertFaceLocalIndices;
464 std::vector<Index> _vertEdgeCountsAndOffsets;
465 std::vector<Index> _vertEdgeIndices;
466 std::vector<LocalIndex> _vertEdgeLocalIndices;
468 std::vector<float> _vertSharpness;
469 std::vector<VTag> _vertTags;
472 std::vector<FVarLevel*> _fvarChannels;
480 return ConstIndexArray(&_faceVertIndices[_faceVertCountsAndOffsets[faceIndex*2+1]],
481 _faceVertCountsAndOffsets[faceIndex*2]);
485 return IndexArray(&_faceVertIndices[_faceVertCountsAndOffsets[faceIndex*2+1]],
486 _faceVertCountsAndOffsets[faceIndex*2]);
492 int* countOffsetPair = &_faceVertCountsAndOffsets[faceIndex*2];
494 countOffsetPair[0] = count;
495 countOffsetPair[1] = (faceIndex == 0) ? 0 : (countOffsetPair[-2] + countOffsetPair[-1]);
497 _maxValence = std::max(_maxValence, count);
502 return ConstIndexArray(&_faceVertIndices[0], (
int)_faceVertIndices.size());
510 return ConstIndexArray(&_faceEdgeIndices[_faceVertCountsAndOffsets[faceIndex*2+1]],
511 _faceVertCountsAndOffsets[faceIndex*2]);
515 return IndexArray(&_faceEdgeIndices[_faceVertCountsAndOffsets[faceIndex*2+1]],
516 _faceVertCountsAndOffsets[faceIndex*2]);
524 return ConstIndexArray(&_vertFaceIndices[_vertFaceCountsAndOffsets[vertIndex*2+1]],
525 _vertFaceCountsAndOffsets[vertIndex*2]);
529 return IndexArray(&_vertFaceIndices[_vertFaceCountsAndOffsets[vertIndex*2+1]],
530 _vertFaceCountsAndOffsets[vertIndex*2]);
536 _vertFaceCountsAndOffsets[vertIndex*2]);
540 return LocalIndexArray(&_vertFaceLocalIndices[_vertFaceCountsAndOffsets[vertIndex*2+1]],
541 _vertFaceCountsAndOffsets[vertIndex*2]);
546 int* countOffsetPair = &_vertFaceCountsAndOffsets[vertIndex*2];
548 countOffsetPair[0] = count;
549 countOffsetPair[1] = (vertIndex == 0) ? 0 : (countOffsetPair[-2] + countOffsetPair[-1]);
553 _vertFaceCountsAndOffsets[vertIndex*2] = count;
561 return ConstIndexArray(&_vertEdgeIndices[_vertEdgeCountsAndOffsets[vertIndex*2+1]],
562 _vertEdgeCountsAndOffsets[vertIndex*2]);
566 return IndexArray(&_vertEdgeIndices[_vertEdgeCountsAndOffsets[vertIndex*2+1]],
567 _vertEdgeCountsAndOffsets[vertIndex*2]);
573 _vertEdgeCountsAndOffsets[vertIndex*2]);
577 return LocalIndexArray(&_vertEdgeLocalIndices[_vertEdgeCountsAndOffsets[vertIndex*2+1]],
578 _vertEdgeCountsAndOffsets[vertIndex*2]);
583 int* countOffsetPair = &_vertEdgeCountsAndOffsets[vertIndex*2];
585 countOffsetPair[0] = count;
586 countOffsetPair[1] = (vertIndex == 0) ? 0 : (countOffsetPair[-2] + countOffsetPair[-1]);
588 _maxValence = std::max(_maxValence, count);
592 _vertEdgeCountsAndOffsets[vertIndex*2] = count;
597 _maxValence = valence;
609 return IndexArray(&_edgeVertIndices[edgeIndex*2], 2);
617 return ConstIndexArray(&_edgeFaceIndices[_edgeFaceCountsAndOffsets[edgeIndex*2+1]],
618 _edgeFaceCountsAndOffsets[edgeIndex*2]);
622 return IndexArray(&_edgeFaceIndices[_edgeFaceCountsAndOffsets[edgeIndex*2+1]],
623 _edgeFaceCountsAndOffsets[edgeIndex*2]);
629 _edgeFaceCountsAndOffsets[edgeIndex*2]);
633 return LocalIndexArray(&_edgeFaceLocalIndices[_edgeFaceCountsAndOffsets[edgeIndex*2+1]],
634 _edgeFaceCountsAndOffsets[edgeIndex*2]);
639 int* countOffsetPair = &_edgeFaceCountsAndOffsets[edgeIndex*2];
641 countOffsetPair[0] = count;
642 countOffsetPair[1] = (edgeIndex == 0) ? 0 : (countOffsetPair[-2] + countOffsetPair[-1]);
644 _maxEdgeFaces = std::max(_maxEdgeFaces, count);
648 _edgeFaceCountsAndOffsets[edgeIndex*2] = count;
656 return _edgeSharpness[edgeIndex];
660 return _edgeSharpness[edgeIndex];
665 return _vertSharpness[vertIndex];
669 return _vertSharpness[vertIndex];
682 _faceTags[faceIndex]._hole = b;
686 return _faceTags[faceIndex]._hole;
694 _edgeTags[edgeIndex]._nonManifold = b;
698 return _edgeTags[edgeIndex]._nonManifold;
703 _vertTags[vertIndex]._nonManifold = b;
707 return _vertTags[vertIndex]._nonManifold;
715 _faceCount = faceCount;
716 _faceVertCountsAndOffsets.resize(2 * faceCount);
718 _faceTags.resize(faceCount);
719 std::memset(&_faceTags[0], 0, _faceCount *
sizeof(
FTag));
723 _faceVertIndices.resize(totalFaceVertCount);
727 _faceEdgeIndices.resize(totalFaceEdgeCount);
733 _edgeCount = edgeCount;
734 _edgeFaceCountsAndOffsets.resize(2 * edgeCount);
736 _edgeSharpness.resize(edgeCount);
737 _edgeTags.resize(edgeCount);
740 std::memset(&_edgeTags[0], 0, _edgeCount *
sizeof(
ETag));
746 _edgeVertIndices.resize(2 * _edgeCount);
751 _edgeFaceIndices.resize(totalEdgeFaceCount);
752 _edgeFaceLocalIndices.resize(totalEdgeFaceCount);
758 _vertCount = vertCount;
759 _vertFaceCountsAndOffsets.resize(2 * vertCount);
760 _vertEdgeCountsAndOffsets.resize(2 * vertCount);
762 _vertSharpness.resize(vertCount);
763 _vertTags.resize(vertCount);
764 std::memset(&_vertTags[0], 0, _vertCount *
sizeof(
VTag));
769 _vertFaceIndices.resize(totalVertFaceCount);
770 _vertFaceLocalIndices.resize(totalVertFaceCount);
775 _vertEdgeIndices.resize(totalVertEdgeCount);
776 _vertEdgeLocalIndices.resize(totalVertEdgeCount);
783 return IndexArray(const_cast<Index *>(&_faceVertCountsAndOffsets[0]),
784 (
int)_faceVertCountsAndOffsets.size());
791 using namespace OPENSUBDIV_VERSION;
void setEdgeNonManifold(Index edgeIndex, bool b)
ETag getFaceCompositeETag(ConstIndexArray &faceEdges) const
int gatherTriRegularInteriorPatchPoints(Index fIndex, Index patchVerts[], int rotation=0) const
int getOffsetOfFaceEdges(Index faceIndex) const
int getNumEdgeVerticesTotal() const
int getNumVertexEdgesTotal() const
IndexArray shareFaceVertCountsAndOffsets() const
void resizeEdgeFaces(int numEdgeFacesTotal)
void(* ValidationCallback)(TopologyError errCode, char const *msg, void const *clientData)
bool validateTopology(ValidationCallback callback=0, void const *clientData=0) const
Array< Index > IndexArray
FTag const & getFaceTag(Index faceIndex) const
void resizeVertices(int numVertices)
Sdc::Crease::Rule getVertexRule(Index vertIndex) const
FVarLevel & getFVarLevel(int channel)
void resizeVertexEdges(int numVertexEdgesTotal)
void resizeFaceVertices(int numFaceVertsTotal)
int gatherTriRegularCornerVertexPatchPoints(Index fIndex, Index patchVerts[], int cornerVertInFace) const
ConstIndexArray getEdgeVertices(Index edgeIndex) const
int gatherTriRegularBoundaryVertexPatchPoints(Index fIndex, Index patchVerts[], int boundaryVertInFace) const
int createFVarChannel(int fvarValueCount, Sdc::Options const &options)
ConstLocalIndexArray getEdgeFaceLocalIndices(Index edgeIndex) const
ConstLocalIndexArray getVertexFaceLocalIndices(Index vertIndex) const
float getEdgeSharpness(Index edgeIndex) const
void resizeEdgeVertices()
void setFaceHole(Index faceIndex, bool b)
bool isSingleCreasePatch(Index face, float *sharpnessOut=NULL, int *rotationOut=NULL) const
FTag & getFaceTag(Index faceIndex)
ETag const & getEdgeTag(Index edgeIndex) const
bool isEdgeNonManifold(Index edgeIndex) const
void trimVertexFaces(Index vertIndex, int count)
Array< LocalIndex > LocalIndexArray
VTag getFaceCompositeVTag(ConstIndexArray &faceVerts) const
int gatherTriRegularBoundaryEdgePatchPoints(Index fIndex, Index patchVerts[], int boundaryEdgeInFace) const
int gatherQuadLinearPatchPoints(Index fIndex, Index patchPoints[], int rotation=0, int fvarChannel=-1) const
VTag const & getVertexTag(Index vertIndex) const
int getNumFVarChannels() const
FVarLevel const & getFVarLevel(int channel) const
bool isFaceHole(Index faceIndex) const
friend class TriRefinement
int getNumVertexEdges(Index vertIndex) const
void print(const Refinement *parentRefinement=0) const
void destroyFVarChannel(int channel)
int getNumFaceVertices(Index faceIndex) const
ConstIndexArray getFaceVertices() const
int getNumVertexFacesTotal() const
int getOffsetOfEdgeFaces(Index edgeIndex) const
int gatherQuadRegularInteriorPatchPoints(Index fIndex, Index patchPoints[], int rotation=0, int fvarChannel=-1) const
int getNumEdgeVertices(Index) const
int getNumEdgeFacesTotal() const
All supported options applying to subdivision scheme.
ConstIndexArray getVertexFaces(Index vertIndex) const
ConstLocalIndexArray getVertexEdgeLocalIndices(Index vertIndex) const
int getNumFaceVerticesTotal() const
void populateLocalIndices()
void setVertexNonManifold(Index vertIndex, bool b)
int getNumVertexFaces(Index vertIndex) const
float getVertexSharpness(Index vertIndex) const
int gatherTriRegularCornerEdgePatchPoints(Index fIndex, Index patchVerts[], int cornerEdgeInFace) const
Sdc::Options getFVarOptions(int channel) const
ETag & getEdgeTag(Index edgeIndex)
int getMaxEdgeFaces() const
int getOffsetOfVertexEdges(Index vertIndex) const
int getNumFaceEdges(Index faceIndex) const
void resizeFaceEdges(int numFaceEdgesTotal)
static char const * getTopologyErrorString(TopologyError errCode)
int getNumEdgeFaces(Index edgeIndex) const
int getOffsetOfEdgeVertices(Index edgeIndex) const
bool isVertexNonManifold(Index vertIndex) const
int getOffsetOfVertexFaces(Index vertIndex) const
void setMaxValence(int maxValence)
friend class QuadRefinement
ConstIndexArray getEdgeFaces(Index edgeIndex) const
ConstArray< Index > ConstIndexArray
int gatherQuadRegularRingAroundVertex(Index vIndex, Index ringPoints[], int fvarChannel=-1) const
int getNumFaceEdgesTotal() const
int getOffsetOfFaceVertices(Index faceIndex) const
Index findEdge(Index v0Index, Index v1Index) const
ConstIndexArray getVertexEdges(Index vertIndex) const
void resizeFaces(int numFaces)
int getNumVertices() const
int gatherQuadRegularCornerPatchPoints(Index fIndex, Index patchPoints[], int cornerVertInFace, int fvarChannel=-1) const
void resizeEdges(int numEdges)
VTag & getVertexTag(Index vertIndex)
void resizeVertexFaces(int numVertexFacesTotal)
int gatherQuadRegularBoundaryPatchPoints(Index fIndex, Index patchPoints[], int boundaryEdgeInFace, int fvarChannel=-1) const
ConstIndexArray getFaceEdges(Index faceIndex) const
void trimVertexEdges(Index vertIndex, int count)
bool completeTopologyFromFaceVertices()
void orientIncidentComponents()
int getMaxValence() const
bool orderVertexFacesAndEdges(Index vIndex, Index *vFaces, Index *vEdges) const
void trimEdgeFaces(Index edgeIndex, int count)
ConstIndexArray getFaceFVarValues(Index faceIndex, int channel) const
ConstArray< LocalIndex > ConstLocalIndexArray
void completeFVarChannelTopology(int channel, int regBoundaryValence)
int getNumFVarValues(int channel) const