All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
basisCurvesTopology.h
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_HD_BASIS_CURVES_TOPOLOGY_H
25 #define PXR_IMAGING_HD_BASIS_CURVES_TOPOLOGY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hd/topology.h"
31 #include "pxr/imaging/hd/tokens.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 PXR_NAMESPACE_OPEN_SCOPE
39 
76 class HdBasisCurvesTopology : public HdTopology {
77 public:
78 
79  HD_API
81  HD_API
82  HdBasisCurvesTopology(const HdBasisCurvesTopology &src);
83 
84  HD_API
85  HdBasisCurvesTopology(const TfToken &curveType,
86  const TfToken &curveBasis,
87  const TfToken &curveWrap,
88  const VtIntArray &curveVertexCounts,
89  const VtIntArray &curveIndices);
90  HD_API
91  virtual ~HdBasisCurvesTopology();
92 
97  HD_API
98  void SetInvisiblePoints(VtIntArray const &invisiblePoints) {
99  _invisiblePoints = invisiblePoints;
100  }
101 
102  HD_API
103  VtIntArray const & GetInvisiblePoints() const {
104  return _invisiblePoints;
105  }
106 
107  HD_API
108  void SetInvisibleCurves(VtIntArray const &invisibleCurves) {
109  _invisibleCurves = invisibleCurves;
110  }
111 
112  HD_API
113  VtIntArray const & GetInvisibleCurves() const {
114  return _invisibleCurves;
115  }
117 
119  VtIntArray const &GetCurveVertexCounts() const {
120  return _curveVertexCounts;
121  }
122 
124  VtIntArray const &GetCurveIndices() const {
125  return _curveIndices;
126  }
127 
129  size_t GetNumCurves() const {
130  return _curveVertexCounts.size();
131  }
132 
134  TfToken GetCurveType() const { return _curveType; }
135  TfToken GetCurveBasis() const { return _curveBasis; }
136  TfToken GetCurveWrap() const { return _curveWrap; }
137 
139  bool HasIndices() const { return !_curveIndices.empty(); }
140 
142  HD_API
143  virtual ID ComputeHash() const;
144 
146  HD_API
147  bool operator==(HdBasisCurvesTopology const &other) const;
148  HD_API
149  bool operator!=(HdBasisCurvesTopology const &other) const;
150 
152  HD_API
154 
156  HD_API
158 
159 private:
160  TfToken _curveType;
161  TfToken _curveBasis;
162  TfToken _curveWrap;
163  VtIntArray _curveVertexCounts;
164  VtIntArray _curveIndices;
165  VtIntArray _invisiblePoints;
166  VtIntArray _invisibleCurves;
167 };
168 
169 HD_API
170 std::ostream& operator << (std::ostream &out, HdBasisCurvesTopology const &topo);
171 
172 
173 PXR_NAMESPACE_CLOSE_SCOPE
174 
175 #endif // PXR_IMAGING_HD_BASIS_CURVES_TOPOLOGY_H
size_t GetNumCurves() const
Returns the number of curves.
HD_API bool operator==(HdBasisCurvesTopology const &other) const
Equality check between two basisCurves topologies.
virtual HD_API ID ComputeHash() const
Returns the hash value of this topology to be used for instancing.
HD_API size_t CalculateNeededNumberOfControlPoints() const
Figure out how many vertices / control points this topology references.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
VtIntArray const & GetCurveIndices() const
Returns indices.
Topology data for basisCurves.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
VtIntArray const & GetCurveVertexCounts() const
Returns segment vertex counts.
bool HasIndices() const
Does the topology use an index buffer.
HD_API size_t CalculateNeededNumberOfVaryingControlPoints() const
Figure out how many control points with varying data this topology needs.
TfToken GetCurveType() const
See class documentation for valid combination of values.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...