9#ifndef PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
10#define PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
17PXR_NAMESPACE_OPEN_SCOPE
102 class _OptionalInvalidationVector {
103 std::unique_ptr<std::vector<Invalidation>> _value;
106 _OptionalInvalidationVector() =
default;
107 _OptionalInvalidationVector(_OptionalInvalidationVector&&) =
default;
108 _OptionalInvalidationVector& operator=(_OptionalInvalidationVector&&) =
110 _OptionalInvalidationVector(_OptionalInvalidationVector
const& other)
113 _value.reset(
new std::vector<Invalidation>(*other._value));
116 _OptionalInvalidationVector& operator=(
117 _OptionalInvalidationVector
const& other) {
120 _value.reset(
new std::vector<Invalidation>(*other._value));
124 void emplace() { _value.reset(
new std::vector<Invalidation>); }
125 explicit operator bool()
const {
return _value !=
nullptr; }
126 std::vector<Invalidation>& value() {
130 std::vector<Invalidation>
const& value()
const {
136 _OptionalInvalidationVector _invalidations;
139 const char* name,
const TfToken& token,
140 const std::array<TfToken, S>& validTokens);
142 void _AppendInvalidation(
const Invalidation& invalidation) {
143 if (!_invalidations) {
144 _invalidations.emplace();
146 _invalidations.value().push_back(invalidation);
161 explicit operator bool()
const {
162 return !_invalidations || _invalidations.value().empty();
165 using iterator = std::vector<Invalidation>::const_iterator;
166 using const_iterator = std::vector<Invalidation>::const_iterator;
171 return _invalidations ? _invalidations.value().cbegin()
176 const_iterator
end()
const {
177 return _invalidations ? _invalidations.value().cend()
184 return _invalidations ? _invalidations.value().cbegin()
190 return _invalidations ? _invalidations.value().cend()
206PXR_NAMESPACE_CLOSE_SCOPE
Topology data for meshes.
Utility to help validate an OpenSubdiv Mesh topology.
const_iterator begin() const
Returns an iterator for the beginning of the invalidation vector if it has been initialized.
const_iterator cbegin() const
Returns an iterator for the beginning of the invalidation vector if it has been initialized.
const_iterator cend() const
Returns an iterator for the end of the invalidation vector if it has been initialized.
const_iterator end() const
Returns an iterator for the end of the invalidation vector if it has been initialized.
Code
Codes for various invalid states for PxOsdMeshTopology.
@ InvalidCreaseIndicesSize
Encodes crease indices size not matching the sum of the lengths array.
@ InvalidCreaseWeightsSize
Encodes if crease weights is the size of the number of creases or the number of crease edges.
@ InvalidVertexInterpolationRule
Encodes invalid vertex interpolation rule token value.
@ InvalidFaceVertexCountsElement
Encodes if a vertex count is less than 3.
@ InvalidHoleIndicesElement
Encodes if the hole indices are negative or greater than the maximum face index (face count - 1)
@ InvalidFaceVertexIndicesSize
Encodes if the indices size does not match the sum of the face vertex counts array.
@ InvalidCreaseLengthElement
Encodes crease lengths element less than 2.
@ InvalidOrientation
Encodes invalid orientation token value.
@ InvalidFaceVaryingInterpolationRule
Encodes invalid face varying interpolation rule token value.
@ NegativeCreaseWeights
Encodes if crease weights are negative.
@ InvalidCreaseMethod
Encodes invalid crease method token value.
@ NegativeCornerWeights
Encodes if corner weights are negative.
@ InvalidCornerIndicesElement
Encodes corner indices element is not in the face vertex indices vector.
@ InvalidScheme
Encodes invalid scheme token value.
@ InvalidFaceVertexIndicesElement
Encodes if the element is negative.
@ InvalidCreaseIndicesElement
Encodes crease indices element is not in the face vertex indices vector.
@ InvalidTriangleSubdivision
Encodes invalid triangle subdivision token value.
@ InvalidCornerWeightsSize
Encodes if corner weights is not the size of the number of corner indices.
A tuple containing a code describing an invalidation and a descriptive message.
Token for efficient comparison, assignment, and hashing of known strings.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.