26#ifndef PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
27#define PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
34PXR_NAMESPACE_OPEN_SCOPE
119 class _OptionalInvalidationVector {
120 std::unique_ptr<std::vector<Invalidation>> _value;
123 _OptionalInvalidationVector() =
default;
124 _OptionalInvalidationVector(_OptionalInvalidationVector&&) =
default;
125 _OptionalInvalidationVector& operator=(_OptionalInvalidationVector&&) =
127 _OptionalInvalidationVector(_OptionalInvalidationVector
const& other)
130 _value.reset(
new std::vector<Invalidation>(*other._value));
133 _OptionalInvalidationVector& operator=(
134 _OptionalInvalidationVector
const& other) {
137 _value.reset(
new std::vector<Invalidation>(*other._value));
141 void emplace() { _value.reset(
new std::vector<Invalidation>); }
142 explicit operator bool()
const {
return _value !=
nullptr; }
143 std::vector<Invalidation>& value() {
147 std::vector<Invalidation>
const& value()
const {
153 _OptionalInvalidationVector _invalidations;
156 const char* name,
const TfToken& token,
157 const std::array<TfToken, S>& validTokens);
159 void _AppendInvalidation(
const Invalidation& invalidation) {
160 if (!_invalidations) {
161 _invalidations.emplace();
163 _invalidations.value().push_back(invalidation);
178 explicit operator bool()
const {
179 return !_invalidations || _invalidations.value().empty();
182 using iterator = std::vector<Invalidation>::const_iterator;
183 using const_iterator = std::vector<Invalidation>::const_iterator;
188 return _invalidations ? _invalidations.value().cbegin()
193 const_iterator
end()
const {
194 return _invalidations ? _invalidations.value().cend()
201 return _invalidations ? _invalidations.value().cbegin()
207 return _invalidations ? _invalidations.value().cend()
223PXR_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.