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 HD_BASIS_CURVES_TOPOLOGY_H
25 #define 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 #include <boost/shared_ptr.hpp>
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 
43 typedef boost::shared_ptr<class HdBasisCurvesTopology> HdBasisCurvesTopologySharedPtr;
44 
45 
82 class HdBasisCurvesTopology : public HdTopology {
83 public:
84 
85  HD_API
87  HD_API
88  HdBasisCurvesTopology(const HdBasisCurvesTopology &src);
89 
90  HD_API
91  HdBasisCurvesTopology(const TfToken &curveType,
92  const TfToken &curveBasis,
93  const TfToken &curveWrap,
94  const VtIntArray &curveVertexCounts,
95  const VtIntArray &curveIndices);
96  HD_API
97  virtual ~HdBasisCurvesTopology();
98 
99 
101  VtIntArray const &GetCurveVertexCounts() const {
102  return _curveVertexCounts;
103  }
104 
106  VtIntArray const &GetCurveIndices() const {
107  return _curveIndices;
108  }
109 
111  TfToken GetCurveType() const { return _curveType; }
112  TfToken GetCurveBasis() const { return _curveBasis; }
113  TfToken GetCurveWrap() const { return _curveWrap; }
114 
116  bool HasIndices() const { return !_curveIndices.empty(); }
117 
119  HD_API
120  virtual ID ComputeHash() const;
121 
123  HD_API
124  bool operator==(HdBasisCurvesTopology const &other) const;
125  HD_API
126  bool operator!=(HdBasisCurvesTopology const &other) const;
127 
129  HD_API
131 
133  HD_API
135 
136 private:
137  TfToken _curveType;
138  TfToken _curveBasis;
139  TfToken _curveWrap;
140  VtIntArray _curveVertexCounts;
141  VtIntArray _curveIndices;
142 };
143 
144 HD_API
145 std::ostream& operator << (std::ostream &out, HdBasisCurvesTopology const &topo);
146 
147 
148 PXR_NAMESPACE_CLOSE_SCOPE
149 
150 #endif // HD_BASIS_CURVES_TOPOLOGY_H
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:89
VtIntArray const & GetCurveIndices() const
Returns indicies.
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.