topologyLevel.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 DreamWorks Animation LLC.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H
25 #define OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H
26 
27 #include "../version.h"
28 
29 #include "../vtr/level.h"
30 #include "../vtr/refinement.h"
31 #include "../far/types.h"
32 
33 #include <vector>
34 
35 namespace OpenSubdiv {
36 namespace OPENSUBDIV_VERSION {
37 
38 namespace Far {
39 
48 
49 public:
51 
60  int GetNumVertices() const { return _level->getNumVertices(); }
61 
63  int GetNumFaces() const { return _level->getNumFaces(); }
64 
66  int GetNumEdges() const { return _level->getNumEdges(); }
67 
69  int GetNumFaceVertices() const { return _level->getNumFaceVerticesTotal(); }
71 
73  //
89 
91  ConstIndexArray GetFaceVertices(Index f) const { return _level->getFaceVertices(f); }
92 
94  ConstIndexArray GetFaceEdges(Index f) const { return _level->getFaceEdges(f); }
95 
97  ConstIndexArray GetEdgeVertices(Index e) const { return _level->getEdgeVertices(e); }
98 
100  ConstIndexArray GetEdgeFaces(Index e) const { return _level->getEdgeFaces(e); }
101 
103  ConstIndexArray GetVertexFaces( Index v) const { return _level->getVertexFaces(v); }
104 
106  ConstIndexArray GetVertexEdges( Index v) const { return _level->getVertexEdges(v); }
107 
110 
113 
116 
118  Index FindEdge(Index v0, Index v1) const { return _level->findEdge(v0, v1); }
120 
122 
129  float GetEdgeSharpness(Index e) const { return _level->getEdgeSharpness(e); }
130 
132  float GetVertexSharpness(Index v) const { return _level->getVertexSharpness(v); }
133 
135  bool IsFaceHole(Index f) const { return _level->isFaceHole(f); }
136 
138  Sdc::Crease::Rule GetVertexRule(Index v) const { return _level->getVertexRule(v); }
140 
142 
162  int GetNumFVarChannels() const { return _level->getNumFVarChannels(); }
163 
166  int GetNumFVarValues(int channel = 0) const { return _level->getNumFVarValues(channel); }
167 
169  ConstIndexArray GetFaceFVarValues(Index f, int channel = 0) const { return _level->getFaceFVarValues(f, channel); }
171 
173 
176  ConstIndexArray GetFaceChildFaces(Index f) const { return _refToChild->getFaceChildFaces(f); }
177 
179  ConstIndexArray GetFaceChildEdges(Index f) const { return _refToChild->getFaceChildEdges(f); }
180 
182  ConstIndexArray GetEdgeChildEdges(Index e) const { return _refToChild->getEdgeChildEdges(e); }
183 
185  Index GetFaceChildVertex( Index f) const { return _refToChild->getFaceChildVertex(f); }
186 
188  Index GetEdgeChildVertex( Index e) const { return _refToChild->getEdgeChildVertex(e); }
189 
191  Index GetVertexChildVertex(Index v) const { return _refToChild->getVertexChildVertex(v); }
192 
194  Index GetFaceParentFace(Index f) const { return _refToParent->getChildFaceParentFace(f); }
196 
198 
200  bool ValidateTopology() const { return _level->validateTopology(); }
201  void PrintTopology(bool children = true) const { _level->print((children && _refToChild) ? _refToChild : 0); }
203 
204 
205 private:
206  friend class TopologyRefiner;
207 
208  Vtr::internal::Level const * _level;
209  Vtr::internal::Refinement const * _refToParent;
210  Vtr::internal::Refinement const * _refToChild;
211 
212 public:
213  // Not intended for public use, but required by std::vector, etc...
216 };
217 
218 } // end namespace Far
219 
220 } // end namespace OPENSUBDIV_VERSION
221 using namespace OPENSUBDIV_VERSION;
222 } // end namespace OpenSubdiv
223 
224 #endif /* OPENSUBDIV3_FAR_TOPOLOGY_LEVEL_H */
ConstIndexArray GetVertexEdges(Index v) const
Access the edges incident a given vertex.
ConstIndexArray GetFaceVertices(Index f) const
Access the vertices incident a given face.
Definition: topologyLevel.h:91
int GetNumFaces() const
Return the number of faces in this level.
Definition: topologyLevel.h:63
bool validateTopology(ValidationCallback callback=0, void const *clientData=0) const
ConstIndexArray GetFaceEdges(Index f) const
Access the edges incident a given face.
Definition: topologyLevel.h:94
Index GetEdgeChildVertex(Index e) const
Return the child vertex (in the next level) of a given edge.
float GetEdgeSharpness(Index e) const
Return the sharpness assigned a given edge.
ConstIndexArray GetFaceFVarValues(Index f, int channel=0) const
Access the face-varying values associated with a particular face.
Sdc::Crease::Rule getVertexRule(Index vertIndex) const
Definition: level.h:673
ConstIndexArray getEdgeVertices(Index edgeIndex) const
Definition: level.h:604
ConstIndexArray getFaceChildEdges(Index parentFace) const
Definition: refinement.h:425
ConstIndexArray GetEdgeVertices(Index e) const
Access the vertices incident a given edge.
Definition: topologyLevel.h:97
ConstLocalIndexArray getEdgeFaceLocalIndices(Index edgeIndex) const
Definition: level.h:627
ConstLocalIndexArray getVertexFaceLocalIndices(Index vertIndex) const
Definition: level.h:534
ConstLocalIndexArray GetVertexEdgeLocalIndices(Index v) const
Access the local indices of a vertex with respect to its incident edges.
Index GetFaceParentFace(Index f) const
Return the parent face (in the previous level) of a given face.
ConstIndexArray GetFaceChildFaces(Index f) const
Access the child faces (in the next level) of a given face.
float getEdgeSharpness(Index edgeIndex) const
Definition: level.h:655
Index FindEdge(Index v0, Index v1) const
Identify the edge matching the given vertex pair.
ConstIndexArray getFaceChildFaces(Index parentFace) const
Definition: refinement.h:411
float GetVertexSharpness(Index v) const
Return the sharpness assigned a given vertex.
int GetNumVertices() const
Return the number of vertices in this level.
Definition: topologyLevel.h:60
bool isFaceHole(Index faceIndex) const
Definition: level.h:685
void print(const Refinement *parentRefinement=0) const
ConstIndexArray GetFaceChildEdges(Index f) const
Access the child edges (in the next level) of a given face.
ConstIndexArray getVertexFaces(Index vertIndex) const
Definition: level.h:523
ConstLocalIndexArray getVertexEdgeLocalIndices(Index vertIndex) const
Definition: level.h:571
int GetNumFaceVertices() const
Return the total number of face-vertices, i.e. the sum of all vertices for all faces.
Definition: topologyLevel.h:69
ConstIndexArray getFaceVertices(Index faceIndex) const
Definition: level.h:479
float getVertexSharpness(Index vertIndex) const
Definition: level.h:664
ConstIndexArray GetVertexFaces(Index v) const
Access the faces incident a given vertex.
Index GetFaceChildVertex(Index f) const
Return the child vertex (in the next level) of a given face.
ConstIndexArray getEdgeChildEdges(Index parentEdge) const
Definition: refinement.h:438
Stores topology data for a specified set of refinement options.
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...
ConstIndexArray getEdgeFaces(Index edgeIndex) const
Definition: level.h:616
int GetNumFVarChannels() const
Return the number of face-varying channels (should be same for all levels)
Index findEdge(Index v0Index, Index v1Index) const
ConstIndexArray getVertexEdges(Index vertIndex) const
Definition: level.h:560
ConstLocalIndexArray GetEdgeFaceLocalIndices(Index e) const
Access the local indices of an edge with respect to its incident faces.
Sdc::Crease::Rule GetVertexRule(Index v) const
Return the subdivision rule assigned a given vertex specific to this level.
int GetNumEdges() const
Return the number of edges in this level.
Definition: topologyLevel.h:66
ConstLocalIndexArray GetVertexFaceLocalIndices(Index v) const
Access the local indices of a vertex with respect to its incident faces.
ConstIndexArray GetEdgeChildEdges(Index e) const
Access the child edges (in the next level) of a given edge.
void PrintTopology(bool children=true) const
ConstIndexArray getFaceEdges(Index faceIndex) const
Definition: level.h:509
bool IsFaceHole(Index f) const
Return if a given face has been tagged as a hole.
ConstIndexArray GetEdgeFaces(Index e) const
Access the faces incident a given edge.
Index GetVertexChildVertex(Index v) const
Return the child vertex (in the next level) of a given vertex.
TopologyLevel is an interface for accessing data in a specific level of a refined topology hierarchy...
Definition: topologyLevel.h:47
ConstIndexArray getFaceFVarValues(Index faceIndex, int channel) const