| OpenSubdiv

Loading...
Searching...
No Matches
topologyLevel.h
Go to the documentation of this file.
1//
2// Copyright 2015 DreamWorks Animation LLC.
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7#ifndef OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H
8#define OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H
9
10#include "../version.h"
11
12#include "../vtr/level.h"
13#include "../vtr/refinement.h"
14#include "../far/types.h"
15
16#include <vector>
17
18 namespace OpenSubdiv {
19 namespace OPENSUBDIV_VERSION {
20
21 namespace Far {
22
32 class TopologyLevel {
33
34 public:
36
43
45 int GetNumVertices() const { return _level->getNumVertices(); }
46
48 int GetNumFaces() const { return _level->getNumFaces(); }
49
51 int GetNumEdges() const { return _level->getNumEdges(); }
52
54 int GetNumFaceVertices() const { return _level->getNumFaceVerticesTotal(); }
56
58
73 //
74
76 ConstIndexArray GetFaceVertices(Index f) const { return _level->getFaceVertices(f); }
77
79 ConstIndexArray GetFaceEdges(Index f) const { return _level->getFaceEdges(f); }
80
82 ConstIndexArray GetEdgeVertices(Index e) const { return _level->getEdgeVertices(e); }
83
85 ConstIndexArray GetEdgeFaces(Index e) const { return _level->getEdgeFaces(e); }
86
88 ConstIndexArray GetVertexFaces(Index v) const { return _level->getVertexFaces(v); }
89
91 ConstIndexArray GetVertexEdges(Index v) const { return _level->getVertexEdges(v); }
92
94 ConstLocalIndexArray GetVertexFaceLocalIndices(Index v) const { return _level->getVertexFaceLocalIndices(v); }
95
97 ConstLocalIndexArray GetVertexEdgeLocalIndices(Index v) const { return _level->getVertexEdgeLocalIndices(v); }
98
100 ConstLocalIndexArray GetEdgeFaceLocalIndices(Index e) const { return _level->getEdgeFaceLocalIndices(e); }
101
103 Index FindEdge(Index v0, Index v1) const { return _level->findEdge(v0, v1); }
105
107
109
111 bool IsEdgeNonManifold(Index e) const { return _level->isEdgeNonManifold(e); }
112
114 bool IsVertexNonManifold(Index v) const { return _level->isVertexNonManifold(v); }
115
117 bool IsEdgeBoundary(Index e) const { return _level->getEdgeTag(e)._boundary; }
118
120 bool IsVertexBoundary(Index v) const { return _level->getVertexTag(v)._boundary; }
121
123 bool IsVertexCorner(Index v) const { return (_level->getNumVertexFaces(v) == 1); }
124
145 bool IsVertexValenceRegular(Index v) const { return !_level->getVertexTag(v)._xordinary || IsVertexCorner(v); }
147
149
154
156 float GetEdgeSharpness(Index e) const { return _level->getEdgeSharpness(e); }
157
159 float GetVertexSharpness(Index v) const { return _level->getVertexSharpness(v); }
160
162 bool IsEdgeInfSharp(Index e) const { return _level->getEdgeTag(e)._infSharp; }
163
165 bool IsVertexInfSharp(Index v) const { return _level->getVertexTag(v)._infSharp; }
166
168 bool IsEdgeSemiSharp(Index e) const { return _level->getEdgeTag(e)._semiSharp; }
169
171 bool IsVertexSemiSharp(Index v) const { return _level->getVertexTag(v)._semiSharp; }
172
174 bool IsFaceHole(Index f) const { return _level->isFaceHole(f); }
175
177 Sdc::Crease::Rule GetVertexRule(Index v) const { return _level->getVertexRule(v); }
179
181
211
213 int GetNumFVarChannels() const { return _level->getNumFVarChannels(); }
214
217 int GetNumFVarValues(int channel = 0) const { return _level->getNumFVarValues(channel); }
218
220 ConstIndexArray GetFaceFVarValues(Index f, int channel = 0) const {
221 return _level->getFaceFVarValues(f, channel);
222 }
223
225 bool DoesVertexFVarTopologyMatch(Index v, int channel = 0) const {
226 return _level->doesVertexFVarTopologyMatch(v, channel);
227 }
228
230 bool DoesEdgeFVarTopologyMatch(Index e, int channel = 0) const {
231 return _level->doesEdgeFVarTopologyMatch(e, channel);
232 }
233
235 bool DoesFaceFVarTopologyMatch(Index f, int channel = 0) const {
236 return _level->doesFaceFVarTopologyMatch(f, channel);
237 }
238
240
242
243
245 ConstIndexArray GetFaceChildFaces(Index f) const { return _refToChild->getFaceChildFaces(f); }
246
248 ConstIndexArray GetFaceChildEdges(Index f) const { return _refToChild->getFaceChildEdges(f); }
249
251 ConstIndexArray GetEdgeChildEdges(Index e) const { return _refToChild->getEdgeChildEdges(e); }
252
254 Index GetFaceChildVertex( Index f) const { return _refToChild->getFaceChildVertex(f); }
255
257 Index GetEdgeChildVertex( Index e) const { return _refToChild->getEdgeChildVertex(e); }
258
260 Index GetVertexChildVertex(Index v) const { return _refToChild->getVertexChildVertex(v); }
261
263 Index GetFaceParentFace(Index f) const { return _refToParent->getChildFaceParentFace(f); }
265
267
268
269 bool ValidateTopology() const { return _level->validateTopology(); }
270 void PrintTopology(bool children = true) const { _level->print((children && _refToChild) ? _refToChild : 0); }
272
273
274 private:
275 friend class TopologyRefiner;
276
277 Vtr::internal::Level const * _level;
278 Vtr::internal::Refinement const * _refToParent;
279 Vtr::internal::Refinement const * _refToChild;
280
281 public:
282 // Not intended for public use, but required by std::vector, etc...
283 TopologyLevel() { }
284 ~TopologyLevel() { }
285};
286
287} // end namespace Far
288
289} // end namespace OPENSUBDIV_VERSION
290 using namespace OPENSUBDIV_VERSION;
291} // end namespace OpenSubdiv
292
293#endif /* OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H */
refinement.h
level.h
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:19
OpenSubdiv::OPENSUBDIV_VERSION::Far::ConstIndexArray
Vtr::ConstIndexArray ConstIndexArray
Definition types.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Far::ConstLocalIndexArray
Vtr::ConstLocalIndexArray ConstLocalIndexArray
Definition types.h:31
OpenSubdiv::OPENSUBDIV_VERSION::Far::Index
Vtr::Index Index
Definition types.h:24
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceParentFace
Index GetFaceParentFace(Index f) const
Return the parent face (in the previous level) of a given face.
Definition topologyLevel.h:263
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::TopologyLevel
TopologyLevel()
Definition topologyLevel.h:283
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::TopologyRefiner
friend class TopologyRefiner
Definition topologyLevel.h:275
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexValenceRegular
bool IsVertexValenceRegular(Index v) const
Return if the valence of the vertex is regular (must be manifold).
Definition topologyLevel.h:145
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeSharpness
float GetEdgeSharpness(Index e) const
Return the sharpness assigned a given edge.
Definition topologyLevel.h:156
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::DoesFaceFVarTopologyMatch
bool DoesFaceFVarTopologyMatch(Index f, int channel=0) const
Return if face-varying topology around a face matches.
Definition topologyLevel.h:235
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexRule
Sdc::Crease::Rule GetVertexRule(Index v) const
Return the subdivision rule assigned a given vertex specific to this level.
Definition topologyLevel.h:177
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexCorner
bool IsVertexCorner(Index v) const
Return if the vertex is a corner (only one incident face).
Definition topologyLevel.h:123
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexChildVertex
Index GetVertexChildVertex(Index v) const
Return the child vertex (in the next level) of a given vertex.
Definition topologyLevel.h:260
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeFaceLocalIndices
ConstLocalIndexArray GetEdgeFaceLocalIndices(Index e) const
Access the local indices of an edge with respect to its incident faces.
Definition topologyLevel.h:100
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceChildEdges
ConstIndexArray GetFaceChildEdges(Index f) const
Access the child edges (in the next level) of a given face.
Definition topologyLevel.h:248
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::DoesEdgeFVarTopologyMatch
bool DoesEdgeFVarTopologyMatch(Index e, int channel=0) const
Return if face-varying topology across the edge only matches.
Definition topologyLevel.h:230
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::PrintTopology
void PrintTopology(bool children=true) const
Definition topologyLevel.h:270
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceVertices
ConstIndexArray GetFaceVertices(Index f) const
Access the vertices incident a given face.
Definition topologyLevel.h:76
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceChildFaces
ConstIndexArray GetFaceChildFaces(Index f) const
Access the child faces (in the next level) of a given face.
Definition topologyLevel.h:245
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumEdges
int GetNumEdges() const
Return the number of edges in this level.
Definition topologyLevel.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::ValidateTopology
bool ValidateTopology() const
Definition topologyLevel.h:269
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsEdgeNonManifold
bool IsEdgeNonManifold(Index e) const
Return if the edge is non-manifold.
Definition topologyLevel.h:111
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsFaceHole
bool IsFaceHole(Index f) const
Return if a given face has been tagged as a hole.
Definition topologyLevel.h:174
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexEdges
ConstIndexArray GetVertexEdges(Index v) const
Access the edges incident a given vertex.
Definition topologyLevel.h:91
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceChildVertex
Index GetFaceChildVertex(Index f) const
Return the child vertex (in the next level) of a given face.
Definition topologyLevel.h:254
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::DoesVertexFVarTopologyMatch
bool DoesVertexFVarTopologyMatch(Index v, int channel=0) const
Return if face-varying topology around a vertex matches.
Definition topologyLevel.h:225
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeChildEdges
ConstIndexArray GetEdgeChildEdges(Index e) const
Access the child edges (in the next level) of a given edge.
Definition topologyLevel.h:251
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsEdgeInfSharp
bool IsEdgeInfSharp(Index e) const
Return if the edge is infinitely-sharp.
Definition topologyLevel.h:162
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexFaces
ConstIndexArray GetVertexFaces(Index v) const
Access the faces incident a given vertex.
Definition topologyLevel.h:88
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::FindEdge
Index FindEdge(Index v0, Index v1) const
Identify the edge matching the given vertex pair.
Definition topologyLevel.h:103
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexEdgeLocalIndices
ConstLocalIndexArray GetVertexEdgeLocalIndices(Index v) const
Access the local indices of a vertex with respect to its incident edges.
Definition topologyLevel.h:97
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceEdges
ConstIndexArray GetFaceEdges(Index f) const
Access the edges incident a given face.
Definition topologyLevel.h:79
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumFaces
int GetNumFaces() const
Return the number of faces in this level.
Definition topologyLevel.h:48
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexBoundary
bool IsVertexBoundary(Index v) const
Return if the vertex is on a boundary (at least one incident boundary edge).
Definition topologyLevel.h:120
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumFVarChannels
int GetNumFVarChannels() const
Return the number of face-varying channels (should be same for all levels).
Definition topologyLevel.h:213
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumVertices
int GetNumVertices() const
Return the number of vertices in this level.
Definition topologyLevel.h:45
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeFaces
ConstIndexArray GetEdgeFaces(Index e) const
Access the faces incident a given edge.
Definition topologyLevel.h:85
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetFaceFVarValues
ConstIndexArray GetFaceFVarValues(Index f, int channel=0) const
Access the face-varying values associated with a particular face.
Definition topologyLevel.h:220
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeVertices
ConstIndexArray GetEdgeVertices(Index e) const
Access the vertices incident a given edge.
Definition topologyLevel.h:82
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsEdgeSemiSharp
bool IsEdgeSemiSharp(Index e) const
Return if the edge is semi-sharp.
Definition topologyLevel.h:168
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::~TopologyLevel
~TopologyLevel()
Definition topologyLevel.h:284
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexSharpness
float GetVertexSharpness(Index v) const
Return the sharpness assigned a given vertex.
Definition topologyLevel.h:159
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetEdgeChildVertex
Index GetEdgeChildVertex(Index e) const
Return the child vertex (in the next level) of a given edge.
Definition topologyLevel.h:257
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexSemiSharp
bool IsVertexSemiSharp(Index v) const
Return if the vertex is semi-sharp.
Definition topologyLevel.h:171
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumFaceVertices
int GetNumFaceVertices() const
Return the total number of face-vertices, i.e. the sum of all vertices for all faces.
Definition topologyLevel.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexNonManifold
bool IsVertexNonManifold(Index v) const
Return if the vertex is non-manifold.
Definition topologyLevel.h:114
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsEdgeBoundary
bool IsEdgeBoundary(Index e) const
Return if the edge is a boundary (only one incident face).
Definition topologyLevel.h:117
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::IsVertexInfSharp
bool IsVertexInfSharp(Index v) const
Return if the vertex is infinitely-sharp.
Definition topologyLevel.h:165
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumFVarValues
int GetNumFVarValues(int channel=0) const
Return the total number of face-varying values in a particular channel (the upper bound of a face-var...
Definition topologyLevel.h:217
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetVertexFaceLocalIndices
ConstLocalIndexArray GetVertexFaceLocalIndices(Index v) const
Access the local indices of a vertex with respect to its incident faces.
Definition topologyLevel.h:94
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Crease::Rule
Rule
Definition crease.h:65
types.h