All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
meshTopology.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
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 PXOSD_MESH_TOPOLOGY_H
25 #define PXOSD_MESH_TOPOLOGY_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/imaging/pxOsd/api.h"
31 #include "pxr/imaging/pxOsd/subdivTags.h"
32 
33 #include "pxr/base/vt/array.h"
34 #include "pxr/base/vt/value.h"
35 
36 #include "pxr/base/tf/token.h"
37 
38 #include <boost/shared_ptr.hpp>
39 #include <boost/weak_ptr.hpp>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
43 
44 typedef boost::shared_ptr<class PxOsdMeshTopology> PxOsdMeshTopologySharedPtr;
45 
51 
52 public:
53 
54  typedef uint64_t ID;
55 
56  PXOSD_API
58 
59  PXOSD_API
60  ~PxOsdMeshTopology();
61 
62  PXOSD_API
63  PxOsdMeshTopology(const PxOsdMeshTopology &);
64 
65  PXOSD_API
66  PxOsdMeshTopology(
67  TfToken scheme,
68  TfToken orientation,
69  VtIntArray faceVertexCounts,
70  VtIntArray faceVertexIndices);
71 
72  PXOSD_API
73  PxOsdMeshTopology(
74  TfToken scheme,
75  TfToken orientation,
76  VtIntArray faceVertexCounts,
77  VtIntArray faceVertexIndices,
78  VtIntArray holeIndices);
79 
80 public:
81 
83  TfToken const GetScheme() const {
84  return _scheme;
85  }
86 
92  void SetScheme(TfToken const& scheme) {
93  _scheme = scheme;
94  }
95 
97  VtIntArray const &GetFaceVertexCounts() const {
98  return _faceVertexCounts;
99  }
100 
102  VtIntArray const &GetFaceVertexIndices() const {
103  return _faceVertexIndices;
104  }
105 
107  TfToken const &GetOrientation() const {
108  return _orientation;
109  }
110 
111 
115 
117  PXOSD_API
118  void SetHoleIndices(VtIntArray const &holeFaceIndices) {
119  _holeIndices = holeFaceIndices;
120  }
121 
123  VtIntArray const &GetHoleIndices() const {
124  return _holeIndices;
125  }
126 
128 
132 
134  void SetSubdivTags(PxOsdSubdivTags const &subdivTags) {
135  _subdivTags = subdivTags;
136  }
137 
139  PxOsdSubdivTags const & GetSubdivTags() const {
140  return _subdivTags;
141  }
142 
145  return _subdivTags;
146  }
147 
149 
150 public:
151 
153  PXOSD_API
154  ID ComputeHash() const;
155 
157  PXOSD_API
158  bool operator==(PxOsdMeshTopology const &other) const;
159 
160 private:
161 
162  // note: if you're going to add more members, make sure
163  // ComputeHash will be updated too.
164 
165  TfToken _scheme,
166  _orientation;
167 
168  VtIntArray _faceVertexCounts;
169  VtIntArray _faceVertexIndices;
170  VtIntArray _holeIndices;
171 
172  PxOsdSubdivTags _subdivTags;
173 };
174 
175 PXOSD_API
176 std::ostream& operator << (std::ostream &out, PxOsdMeshTopology const &);
177 PXOSD_API
178 bool operator!=(const PxOsdMeshTopology& lhs, const PxOsdMeshTopology& rhs);
179 
180 
181 PXR_NAMESPACE_CLOSE_SCOPE
182 
183 #endif // PXOSD_MESH_TOPOLOGY_H
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:41
PxOsdSubdivTags const & GetSubdivTags() const
Returns subdivision tags.
Definition: meshTopology.h:139
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Topology data for meshes.
Definition: meshTopology.h:50
VtIntArray const & GetFaceVertexCounts() const
Returns face vertex counts.
Definition: meshTopology.h:97
PXOSD_API bool operator==(PxOsdMeshTopology const &other) const
Equality check between two mesh topologies.
PXOSD_API void SetHoleIndices(VtIntArray const &holeFaceIndices)
Sets hole face indices for the control mesh.
Definition: meshTopology.h:118
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
PxOsdSubdivTags & GetSubdivTags()
Returns subdivision tags (non-const)
Definition: meshTopology.h:144
VtIntArray const & GetHoleIndices() const
Returns the hole face indices.
Definition: meshTopology.h:123
void SetScheme(TfToken const &scheme)
Sets the subdivision scheme to be used during refinement.
Definition: meshTopology.h:92
void SetSubdivTags(PxOsdSubdivTags const &subdivTags)
Sets subdivision tags.
Definition: meshTopology.h:134
VtIntArray const & GetFaceVertexIndices() const
Returns face vertex indics.
Definition: meshTopology.h:102
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
TfToken const GetScheme() const
Returns the subdivision scheme.
Definition: meshTopology.h:83
PXOSD_API ID ComputeHash() const
Returns the hash value of this topology to be used for instancing.
TfToken const & GetOrientation() const
Returns orientation.
Definition: meshTopology.h:107