All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
subdivTags.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 PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
25 #define PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/imaging/pxOsd/api.h"
31 #include "pxr/base/vt/array.h"
32 #include "pxr/base/tf/token.h"
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 
42 
43 public:
44 
45  PxOsdSubdivTags() = default;
46  PxOsdSubdivTags(PxOsdSubdivTags const&) = default;
47  PxOsdSubdivTags(PxOsdSubdivTags&&) = default;
48  PxOsdSubdivTags& operator=(PxOsdSubdivTags const&) = default;
49  PxOsdSubdivTags& operator=(PxOsdSubdivTags&&) = default;
50 
52  const TfToken& vertexInterpolationRule,
53  const TfToken& faceVaryingInterpolationRule,
54  const TfToken& creaseMethod,
55  const TfToken& triangleSubdivision,
56  const VtIntArray& creaseIndices,
57  const VtIntArray& creaseLengths,
58  const VtFloatArray& creaseWeights,
59  const VtIntArray& cornerIndices,
60  const VtFloatArray& cornerWeights)
61  : _vtxInterpolationRule(vertexInterpolationRule)
62  , _fvarInterpolationRule(faceVaryingInterpolationRule)
63  , _creaseMethod(creaseMethod)
64  , _trianglesSubdivision(triangleSubdivision)
65  , _creaseIndices(creaseIndices)
66  , _creaseLengths(creaseLengths)
67  , _creaseWeights(creaseWeights)
68  , _cornerIndices(cornerIndices)
69  , _cornerWeights(cornerWeights) {}
70 
73  return _vtxInterpolationRule;
74  }
75 
78  _vtxInterpolationRule = vtxInterp;
79  }
80 
83  return _fvarInterpolationRule;
84  }
85 
88  _fvarInterpolationRule = fvarInterp;
89  }
90 
93  return _creaseMethod;
94  }
95 
97  void SetCreaseMethod(TfToken creaseMethod) {
98  _creaseMethod = creaseMethod;
99  }
100 
103  return _trianglesSubdivision;
104  }
105 
107  void SetTriangleSubdivision(TfToken triangleSubdivision) {
108  _trianglesSubdivision = triangleSubdivision;
109  }
110 
111 
115 
117  VtIntArray const &GetCreaseIndices() const {
118  return _creaseIndices;
119  }
120 
122  void SetCreaseIndices(VtIntArray const &creaseIndices) {
123  _creaseIndices = creaseIndices;
124  }
125 
127  VtIntArray const &GetCreaseLengths() const {
128  return _creaseLengths;
129  }
130 
132  void SetCreaseLengths(VtIntArray const &creaseLengths) {
133  _creaseLengths = creaseLengths;
134  }
135 
137  VtFloatArray const &GetCreaseWeights() const {
138  return _creaseWeights;
139  }
140 
142  void SetCreaseWeights(VtFloatArray const &creaseWeights) {
143  _creaseWeights = creaseWeights;
144  }
146 
147 
151 
153  VtIntArray const &GetCornerIndices() const {
154  return _cornerIndices;
155  }
156 
158  void SetCornerIndices(VtIntArray const &cornerIndices) {
159  _cornerIndices = cornerIndices;
160  }
161 
163  VtFloatArray const &GetCornerWeights() const {
164  return _cornerWeights;
165  }
166 
168  void SetCornerWeights(VtFloatArray const &cornerWeights) {
169  _cornerWeights = cornerWeights;
170  }
172 
173  typedef size_t ID;
174 
176  PXOSD_API
177  ID ComputeHash() const;
178 
179 private:
180 
181  // note: if you're going to add more members, make sure
182  // ComputeHash will be updated too.
183 
184  TfToken _vtxInterpolationRule,
185  _fvarInterpolationRule,
186  _creaseMethod,
187  _trianglesSubdivision;
188 
189  VtIntArray _creaseIndices,
190  _creaseLengths;
191  VtFloatArray _creaseWeights;
192 
193  VtIntArray _cornerIndices;
194  VtFloatArray _cornerWeights;
195 };
196 
197 PXOSD_API
198 std::ostream& operator<<(std::ostream &out, PxOsdSubdivTags const &);
199 PXOSD_API
200 bool operator==(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
201 PXOSD_API
202 bool operator!=(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
203 
204 
205 PXR_NAMESPACE_CLOSE_SCOPE
206 
207 #endif // PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:41
void SetCornerIndices(VtIntArray const &cornerIndices)
Set the edge corner indices.
Definition: subdivTags.h:158
void SetTriangleSubdivision(TfToken triangleSubdivision)
Set the triangle subdivision method.
Definition: subdivTags.h:107
VtFloatArray const & GetCreaseWeights() const
Returns the edge crease weights.
Definition: subdivTags.h:137
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
void SetCornerWeights(VtFloatArray const &cornerWeights)
Set the edge corner weights.
Definition: subdivTags.h:168
PXOSD_API ID ComputeHash() const
Returns the hash value of this topology to be used for instancing.
TfToken GetVertexInterpolationRule() const
Returns the vertex boundary interpolation rule.
Definition: subdivTags.h:72
void SetVertexInterpolationRule(TfToken vtxInterp)
Set the vertex boundary interpolation rule.
Definition: subdivTags.h:77
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
VtIntArray const & GetCreaseLengths() const
Returns the edge crease loop lengths.
Definition: subdivTags.h:127
void SetCreaseWeights(VtFloatArray const &creaseWeights)
Set the edge crease weights.
Definition: subdivTags.h:142
void SetFaceVaryingInterpolationRule(TfToken fvarInterp)
Set the face-varying boundary interpolation rule.
Definition: subdivTags.h:87
VtIntArray const & GetCornerIndices() const
Returns the edge corner indices.
Definition: subdivTags.h:153
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
TfToken GetCreaseMethod() const
Returns the creasing method.
Definition: subdivTags.h:92
void SetCreaseLengths(VtIntArray const &creaseLengths)
Set the edge crease loop lengths.
Definition: subdivTags.h:132
VtFloatArray const & GetCornerWeights() const
Returns the edge corner weights.
Definition: subdivTags.h:163
TfToken GetTriangleSubdivision() const
Returns the triangle subdivision method.
Definition: subdivTags.h:102
TfToken GetFaceVaryingInterpolationRule() const
Returns the face-varying boundary interpolation rule.
Definition: subdivTags.h:82
void SetCreaseMethod(TfToken creaseMethod)
Set the creasing method.
Definition: subdivTags.h:97
VtIntArray const & GetCreaseIndices() const
Returns the edge crease indices.
Definition: subdivTags.h:117
void SetCreaseIndices(VtIntArray const &creaseIndices)
Set the edge crease indices.
Definition: subdivTags.h:122
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...