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 #include <iosfwd>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
44 
45 public:
46 
47  PxOsdSubdivTags() = default;
48  PxOsdSubdivTags(PxOsdSubdivTags const&) = default;
49  PxOsdSubdivTags(PxOsdSubdivTags&&) = default;
50  PxOsdSubdivTags& operator=(PxOsdSubdivTags const&) = default;
51  PxOsdSubdivTags& operator=(PxOsdSubdivTags&&) = default;
52 
54  const TfToken& vertexInterpolationRule,
55  const TfToken& faceVaryingInterpolationRule,
56  const TfToken& creaseMethod,
57  const TfToken& triangleSubdivision,
58  const VtIntArray& creaseIndices,
59  const VtIntArray& creaseLengths,
60  const VtFloatArray& creaseWeights,
61  const VtIntArray& cornerIndices,
62  const VtFloatArray& cornerWeights)
63  : _vtxInterpolationRule(vertexInterpolationRule)
64  , _fvarInterpolationRule(faceVaryingInterpolationRule)
65  , _creaseMethod(creaseMethod)
66  , _trianglesSubdivision(triangleSubdivision)
67  , _creaseIndices(creaseIndices)
68  , _creaseLengths(creaseLengths)
69  , _creaseWeights(creaseWeights)
70  , _cornerIndices(cornerIndices)
71  , _cornerWeights(cornerWeights) {}
72 
75  return _vtxInterpolationRule;
76  }
77 
80  _vtxInterpolationRule = vtxInterp;
81  }
82 
85  return _fvarInterpolationRule;
86  }
87 
90  _fvarInterpolationRule = fvarInterp;
91  }
92 
95  return _creaseMethod;
96  }
97 
99  void SetCreaseMethod(TfToken creaseMethod) {
100  _creaseMethod = creaseMethod;
101  }
102 
105  return _trianglesSubdivision;
106  }
107 
109  void SetTriangleSubdivision(TfToken triangleSubdivision) {
110  _trianglesSubdivision = triangleSubdivision;
111  }
112 
113 
117 
119  VtIntArray const &GetCreaseIndices() const {
120  return _creaseIndices;
121  }
122 
124  void SetCreaseIndices(VtIntArray const &creaseIndices) {
125  _creaseIndices = creaseIndices;
126  }
127 
129  VtIntArray const &GetCreaseLengths() const {
130  return _creaseLengths;
131  }
132 
134  void SetCreaseLengths(VtIntArray const &creaseLengths) {
135  _creaseLengths = creaseLengths;
136  }
137 
139  VtFloatArray const &GetCreaseWeights() const {
140  return _creaseWeights;
141  }
142 
144  void SetCreaseWeights(VtFloatArray const &creaseWeights) {
145  _creaseWeights = creaseWeights;
146  }
148 
149 
153 
155  VtIntArray const &GetCornerIndices() const {
156  return _cornerIndices;
157  }
158 
160  void SetCornerIndices(VtIntArray const &cornerIndices) {
161  _cornerIndices = cornerIndices;
162  }
163 
165  VtFloatArray const &GetCornerWeights() const {
166  return _cornerWeights;
167  }
168 
170  void SetCornerWeights(VtFloatArray const &cornerWeights) {
171  _cornerWeights = cornerWeights;
172  }
174 
175  typedef size_t ID;
176 
178  PXOSD_API
179  ID ComputeHash() const;
180 
181 private:
182 
183  // note: if you're going to add more members, make sure
184  // ComputeHash will be updated too.
185 
186  TfToken _vtxInterpolationRule,
187  _fvarInterpolationRule,
188  _creaseMethod,
189  _trianglesSubdivision;
190 
191  VtIntArray _creaseIndices,
192  _creaseLengths;
193  VtFloatArray _creaseWeights;
194 
195  VtIntArray _cornerIndices;
196  VtFloatArray _cornerWeights;
197 };
198 
199 PXOSD_API
200 std::ostream& operator<<(std::ostream &out, PxOsdSubdivTags const &);
201 PXOSD_API
202 bool operator==(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
203 PXOSD_API
204 bool operator!=(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
205 
206 
207 PXR_NAMESPACE_CLOSE_SCOPE
208 
209 #endif // PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:43
void SetCornerIndices(VtIntArray const &cornerIndices)
Set the edge corner indices.
Definition: subdivTags.h:160
void SetTriangleSubdivision(TfToken triangleSubdivision)
Set the triangle subdivision method.
Definition: subdivTags.h:109
TfToken GetTriangleSubdivision() const
Returns the triangle subdivision method.
Definition: subdivTags.h:104
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:170
VtFloatArray const & GetCreaseWeights() const
Returns the edge crease weights.
Definition: subdivTags.h:139
TfToken GetVertexInterpolationRule() const
Returns the vertex boundary interpolation rule.
Definition: subdivTags.h:74
void SetVertexInterpolationRule(TfToken vtxInterp)
Set the vertex boundary interpolation rule.
Definition: subdivTags.h:79
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
TfToken GetFaceVaryingInterpolationRule() const
Returns the face-varying boundary interpolation rule.
Definition: subdivTags.h:84
void SetCreaseWeights(VtFloatArray const &creaseWeights)
Set the edge crease weights.
Definition: subdivTags.h:144
void SetFaceVaryingInterpolationRule(TfToken fvarInterp)
Set the face-varying boundary interpolation rule.
Definition: subdivTags.h:89
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
void SetCreaseLengths(VtIntArray const &creaseLengths)
Set the edge crease loop lengths.
Definition: subdivTags.h:134
VtIntArray const & GetCornerIndices() const
Returns the edge corner indices.
Definition: subdivTags.h:155
VtIntArray const & GetCreaseIndices() const
Returns the edge crease indices.
Definition: subdivTags.h:119
VtFloatArray const & GetCornerWeights() const
Returns the edge corner weights.
Definition: subdivTags.h:165
TfToken GetCreaseMethod() const
Returns the creasing method.
Definition: subdivTags.h:94
void SetCreaseMethod(TfToken creaseMethod)
Set the creasing method.
Definition: subdivTags.h:99
VtIntArray const & GetCreaseLengths() const
Returns the edge crease loop lengths.
Definition: subdivTags.h:129
void SetCreaseIndices(VtIntArray const &creaseIndices)
Set the edge crease indices.
Definition: subdivTags.h:124
PXOSD_API ID ComputeHash() const
Returns the hash value of this topology to be used for instancing.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...