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 PXOSD_SUBDIV_TAGS_H
25 #define PXOSD_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 
48  const TfToken& vertexInterpolationRule,
49  const TfToken& faceVaryingInterpolationRule,
50  const TfToken& creaseMethod,
51  const TfToken& triangleSubdivision,
52  const VtIntArray& creaseIndices,
53  const VtIntArray& creaseLengths,
54  const VtFloatArray& creaseWeights,
55  const VtIntArray& cornerIndices,
56  const VtFloatArray& cornerWeights)
57  : _vtxInterpolationRule(vertexInterpolationRule)
58  , _fvarInterpolationRule(faceVaryingInterpolationRule)
59  , _creaseMethod(creaseMethod)
60  , _trianglesSubdivision(triangleSubdivision)
61  , _creaseIndices(creaseIndices)
62  , _creaseLengths(creaseLengths)
63  , _creaseWeights(creaseWeights)
64  , _cornerIndices(cornerIndices)
65  , _cornerWeights(cornerWeights) {}
66 
69  return _vtxInterpolationRule;
70  }
71 
74  _vtxInterpolationRule = vtxInterp;
75  }
76 
79  return _fvarInterpolationRule;
80  }
81 
84  _fvarInterpolationRule = fvarInterp;
85  }
86 
89  return _creaseMethod;
90  }
91 
93  void SetCreaseMethod(TfToken creaseMethod) {
94  _creaseMethod = creaseMethod;
95  }
96 
99  return _trianglesSubdivision;
100  }
101 
103  void SetTriangleSubdivision(TfToken triangleSubdivision) {
104  _trianglesSubdivision = triangleSubdivision;
105  }
106 
107 
111 
113  VtIntArray const &GetCreaseIndices() const {
114  return _creaseIndices;
115  }
116 
118  void SetCreaseIndices(VtIntArray const &creaseIndices) {
119  _creaseIndices = creaseIndices;
120  }
121 
123  VtIntArray const &GetCreaseLengths() const {
124  return _creaseLengths;
125  }
126 
128  void SetCreaseLengths(VtIntArray const &creaseLengths) {
129  _creaseLengths = creaseLengths;
130  }
131 
133  VtFloatArray const &GetCreaseWeights() const {
134  return _creaseWeights;
135  }
136 
138  void SetCreaseWeights(VtFloatArray const &creaseWeights) {
139  _creaseWeights = creaseWeights;
140  }
142 
143 
147 
149  VtIntArray const &GetCornerIndices() const {
150  return _cornerIndices;
151  }
152 
154  void SetCornerIndices(VtIntArray const &cornerIndices) {
155  _cornerIndices = cornerIndices;
156  }
157 
159  VtFloatArray const &GetCornerWeights() const {
160  return _cornerWeights;
161  }
162 
164  void SetCornerWeights(VtFloatArray const &cornerWeights) {
165  _cornerWeights = cornerWeights;
166  }
168 
169  typedef size_t ID;
170 
172  PXOSD_API
173  ID ComputeHash() const;
174 
175 private:
176 
177  // note: if you're going to add more members, make sure
178  // ComputeHash will be updated too.
179 
180  TfToken _vtxInterpolationRule,
181  _fvarInterpolationRule,
182  _creaseMethod,
183  _trianglesSubdivision;
184 
185  VtIntArray _creaseIndices,
186  _creaseLengths;
187  VtFloatArray _creaseWeights;
188 
189  VtIntArray _cornerIndices;
190  VtFloatArray _cornerWeights;
191 };
192 
193 PXOSD_API
194 std::ostream& operator<<(std::ostream &out, PxOsdSubdivTags const &);
195 PXOSD_API
196 bool operator==(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
197 PXOSD_API
198 bool operator!=(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
199 
200 
201 PXR_NAMESPACE_CLOSE_SCOPE
202 
203 #endif // PXOSD_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:154
void SetTriangleSubdivision(TfToken triangleSubdivision)
Set the triangle subdivision method.
Definition: subdivTags.h:103
VtFloatArray const & GetCreaseWeights() const
Returns the edge crease weights.
Definition: subdivTags.h:133
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:164
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:68
void SetVertexInterpolationRule(TfToken vtxInterp)
Set the vertex boundary interpolation rule.
Definition: subdivTags.h:73
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
VtIntArray const & GetCreaseLengths() const
Returns the edge crease loop lengths.
Definition: subdivTags.h:123
void SetCreaseWeights(VtFloatArray const &creaseWeights)
Set the edge crease weights.
Definition: subdivTags.h:138
void SetFaceVaryingInterpolationRule(TfToken fvarInterp)
Set the face-varying boundary interpolation rule.
Definition: subdivTags.h:83
VtIntArray const & GetCornerIndices() const
Returns the edge corner indices.
Definition: subdivTags.h:149
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:88
void SetCreaseLengths(VtIntArray const &creaseLengths)
Set the edge crease loop lengths.
Definition: subdivTags.h:128
VtFloatArray const & GetCornerWeights() const
Returns the edge corner weights.
Definition: subdivTags.h:159
TfToken GetTriangleSubdivision() const
Returns the triangle subdivision method.
Definition: subdivTags.h:98
TfToken GetFaceVaryingInterpolationRule() const
Returns the face-varying boundary interpolation rule.
Definition: subdivTags.h:78
void SetCreaseMethod(TfToken creaseMethod)
Set the creasing method.
Definition: subdivTags.h:93
VtIntArray const & GetCreaseIndices() const
Returns the edge crease indices.
Definition: subdivTags.h:113
void SetCreaseIndices(VtIntArray const &creaseIndices)
Set the edge crease indices.
Definition: subdivTags.h:118