All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
subdivTags.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
8#define PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/imaging/pxOsd/api.h"
14#include "pxr/base/vt/array.h"
15#include "pxr/base/tf/token.h"
16
17#include <iosfwd>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
27
28public:
29
30 PxOsdSubdivTags() = default;
31 PxOsdSubdivTags(PxOsdSubdivTags const&) = default;
33 PxOsdSubdivTags& operator=(PxOsdSubdivTags const&) = default;
34 PxOsdSubdivTags& operator=(PxOsdSubdivTags&&) = default;
35
37 const TfToken& vertexInterpolationRule,
38 const TfToken& faceVaryingInterpolationRule,
39 const TfToken& creaseMethod,
40 const TfToken& triangleSubdivision,
41 const VtIntArray& creaseIndices,
42 const VtIntArray& creaseLengths,
43 const VtFloatArray& creaseWeights,
44 const VtIntArray& cornerIndices,
45 const VtFloatArray& cornerWeights)
46 : _vtxInterpolationRule(vertexInterpolationRule)
47 , _fvarInterpolationRule(faceVaryingInterpolationRule)
48 , _creaseMethod(creaseMethod)
49 , _trianglesSubdivision(triangleSubdivision)
50 , _creaseIndices(creaseIndices)
51 , _creaseLengths(creaseLengths)
52 , _creaseWeights(creaseWeights)
53 , _cornerIndices(cornerIndices)
54 , _cornerWeights(cornerWeights) {}
55
58 return _vtxInterpolationRule;
59 }
60
63 _vtxInterpolationRule = vtxInterp;
64 }
65
68 return _fvarInterpolationRule;
69 }
70
73 _fvarInterpolationRule = fvarInterp;
74 }
75
78 return _creaseMethod;
79 }
80
82 void SetCreaseMethod(TfToken creaseMethod) {
83 _creaseMethod = creaseMethod;
84 }
85
88 return _trianglesSubdivision;
89 }
90
92 void SetTriangleSubdivision(TfToken triangleSubdivision) {
93 _trianglesSubdivision = triangleSubdivision;
94 }
95
96
100
102 VtIntArray const &GetCreaseIndices() const {
103 return _creaseIndices;
104 }
105
107 void SetCreaseIndices(VtIntArray const &creaseIndices) {
108 _creaseIndices = creaseIndices;
109 }
110
112 VtIntArray const &GetCreaseLengths() const {
113 return _creaseLengths;
114 }
115
117 void SetCreaseLengths(VtIntArray const &creaseLengths) {
118 _creaseLengths = creaseLengths;
119 }
120
122 VtFloatArray const &GetCreaseWeights() const {
123 return _creaseWeights;
124 }
125
127 void SetCreaseWeights(VtFloatArray const &creaseWeights) {
128 _creaseWeights = creaseWeights;
129 }
131
132
136
138 VtIntArray const &GetCornerIndices() const {
139 return _cornerIndices;
140 }
141
143 void SetCornerIndices(VtIntArray const &cornerIndices) {
144 _cornerIndices = cornerIndices;
145 }
146
148 VtFloatArray const &GetCornerWeights() const {
149 return _cornerWeights;
150 }
151
153 void SetCornerWeights(VtFloatArray const &cornerWeights) {
154 _cornerWeights = cornerWeights;
155 }
157
158 typedef size_t ID;
159
161 PXOSD_API
162 ID ComputeHash() const;
163
164private:
165
166 // note: if you're going to add more members, make sure
167 // ComputeHash will be updated too.
168
169 TfToken _vtxInterpolationRule,
170 _fvarInterpolationRule,
171 _creaseMethod,
172 _trianglesSubdivision;
173
174 VtIntArray _creaseIndices,
175 _creaseLengths;
176 VtFloatArray _creaseWeights;
177
178 VtIntArray _cornerIndices;
179 VtFloatArray _cornerWeights;
180};
181
182PXOSD_API
183std::ostream& operator<<(std::ostream &out, PxOsdSubdivTags const &);
184PXOSD_API
185bool operator==(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
186PXOSD_API
187bool operator!=(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
188
189
190PXR_NAMESPACE_CLOSE_SCOPE
191
192#endif // PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:26
VtIntArray const & GetCreaseLengths() const
Returns the edge crease loop lengths.
Definition: subdivTags.h:112
VtIntArray const & GetCornerIndices() const
Returns the edge corner indices.
Definition: subdivTags.h:138
void SetCreaseIndices(VtIntArray const &creaseIndices)
Set the edge crease indices.
Definition: subdivTags.h:107
VtFloatArray const & GetCornerWeights() const
Returns the edge corner weights.
Definition: subdivTags.h:148
void SetFaceVaryingInterpolationRule(TfToken fvarInterp)
Set the face-varying boundary interpolation rule.
Definition: subdivTags.h:72
void SetVertexInterpolationRule(TfToken vtxInterp)
Set the vertex boundary interpolation rule.
Definition: subdivTags.h:62
TfToken GetFaceVaryingInterpolationRule() const
Returns the face-varying boundary interpolation rule.
Definition: subdivTags.h:67
void SetCornerWeights(VtFloatArray const &cornerWeights)
Set the edge corner weights.
Definition: subdivTags.h:153
TfToken GetTriangleSubdivision() const
Returns the triangle subdivision method.
Definition: subdivTags.h:87
VtIntArray const & GetCreaseIndices() const
Returns the edge crease indices.
Definition: subdivTags.h:102
TfToken GetCreaseMethod() const
Returns the creasing method.
Definition: subdivTags.h:77
void SetCornerIndices(VtIntArray const &cornerIndices)
Set the edge corner indices.
Definition: subdivTags.h:143
void SetCreaseMethod(TfToken creaseMethod)
Set the creasing method.
Definition: subdivTags.h:82
PXOSD_API ID ComputeHash() const
Returns the hash value of this topology to be used for instancing.
VtFloatArray const & GetCreaseWeights() const
Returns the edge crease weights.
Definition: subdivTags.h:122
void SetTriangleSubdivision(TfToken triangleSubdivision)
Set the triangle subdivision method.
Definition: subdivTags.h:92
TfToken GetVertexInterpolationRule() const
Returns the vertex boundary interpolation rule.
Definition: subdivTags.h:57
void SetCreaseWeights(VtFloatArray const &creaseWeights)
Set the edge crease weights.
Definition: subdivTags.h:127
void SetCreaseLengths(VtIntArray const &creaseLengths)
Set the edge crease loop lengths.
Definition: subdivTags.h:117
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...