add usd-21-05-win64_py37

This commit is contained in:
Sébastien Albert committed 2021-12-07 17:16:25 +01:00
1 parent 41d23e71ba
commit 66bc054336
15675 files changed
+3061008

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
//
// Copyright 2017 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_API_H
#define PXR_IMAGING_PX_OSD_API_H
#include "pxr/base/arch/export.h"
#if defined(PXR_STATIC)
# define PXOSD_API
# define PXOSD_API_TEMPLATE_CLASS(...)
# define PXOSD_API_TEMPLATE_STRUCT(...)
# define PXOSD_LOCAL
#else
# if defined(PXOSD_EXPORTS)
# define PXOSD_API ARCH_EXPORT
# define PXOSD_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
# define PXOSD_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
# else
# define PXOSD_API ARCH_IMPORT
# define PXOSD_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
# define PXOSD_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
# endif
# define PXOSD_LOCAL ARCH_HIDDEN
#endif
#endif // PXR_IMAGING_PX_OSD_API_H
+269
View File
@@ -0,0 +1,269 @@
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_H
#define PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_H
/// \file pxOsd/meshTopology.h
#include "pxr/pxr.h"
#include "pxr/imaging/pxOsd/api.h"
#include "pxr/imaging/pxOsd/subdivTags.h"
#include "pxr/imaging/pxOsd/meshTopologyValidation.h"
#include "pxr/base/vt/array.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/tf/token.h"
PXR_NAMESPACE_OPEN_SCOPE
/// \class PxOsdMeshTopology
///
/// Topology data for meshes.
///
/// Once constructed, this class is immutable (except when assigned
/// or moved).
///
/// To make changing certain properties easier, several methods are
/// provided. WithScheme, WithHoleIndices, and WithSubdivTags will
/// return copies of the object with certain specific properites changed.
///
/// \code{.cpp}
/// PxOsdMeshTopology otherTopology =
/// originalTopology.WithScheme(PxOsdOpenSubdivTokens->catmullClark);
/// TF_VERIFY(otherTopology.GetScheme() ==
/// PxOsdOpenSubdivTokens->catmullClark);
/// TF_VERIFY(otherTopology.GetOrientation() ==
/// originalTopology.GetOrientation());
/// TF_VERIFY(otherTopology.GetSubdivTags() ==
/// originalTopology.GetSubdivTags());
/// TF_VERIFY(otherTopology.GetFaceVertexCounts() ==
/// originalTopology.GetFaceVertexCounts());
/// TF_VERIFY(otherTopology.GetFaceVertexIndices() ==
/// originalTopology.GetFaceVertexIndices());
/// \endcode
///
/// The cost of copying should be mitigated by the copy semantics of VtArray and
/// TfToken.
class PxOsdMeshTopology {
public:
typedef uint64_t ID;
PXOSD_API
PxOsdMeshTopology();
PxOsdMeshTopology& operator=(const PxOsdMeshTopology &) = default;
PxOsdMeshTopology(const PxOsdMeshTopology &) = default;
PxOsdMeshTopology(PxOsdMeshTopology&&) = default;
PxOsdMeshTopology& operator=(PxOsdMeshTopology&&) = default;
~PxOsdMeshTopology() = default;
/// Construct a topology without holes or subdiv tags
PXOSD_API
PxOsdMeshTopology(
TfToken const& scheme,
TfToken const& orientation,
VtIntArray const& faceVertexCounts,
VtIntArray const& faceVertexIndices);
/// Construct a topology with holes
PXOSD_API
PxOsdMeshTopology(
TfToken const& scheme,
TfToken const& orientation,
VtIntArray const& faceVertexCounts,
VtIntArray const& faceVertexIndices,
VtIntArray const& holeIndices);
/// Construct a topology with holes and subdiv tags
PXOSD_API
PxOsdMeshTopology(
TfToken const& scheme,
TfToken const& orientation,
VtIntArray const& faceVertexCounts,
VtIntArray const& faceVertexIndices,
VtIntArray const& holeIndices,
PxOsdSubdivTags const& subdivTags);
/// Construct a topology with subdiv tags
PXOSD_API
PxOsdMeshTopology(
TfToken const& scheme,
TfToken const& orientation,
VtIntArray const& faceVertexCounts,
VtIntArray const& faceVertexIndices,
PxOsdSubdivTags const& subdivTags);
public:
/// Returns the subdivision scheme
TfToken const GetScheme() const {
return _scheme;
}
/// Returns face vertex counts.
VtIntArray const &GetFaceVertexCounts() const {
return _faceVertexCounts;
}
/// Returns face vertex indices.
VtIntArray const &GetFaceVertexIndices() const {
return _faceVertexIndices;
}
/// Returns orientation.
TfToken const &GetOrientation() const {
return _orientation;
}
///
/// \name Holes
/// @{
/// Returns the hole face indices.
VtIntArray const &GetHoleIndices() const {
return _holeIndices;
}
/// @}
///
/// \name Tags
/// @{
/// Returns subdivision tags
PxOsdSubdivTags const & GetSubdivTags() const {
return _subdivTags;
}
/// @}
/// Return a copy of the topology, changing only the scheme.
/// Valid values include: catmullClark, loop, bilinear.
///
/// Note that the token "catmark" is also supported for backward
/// compatibility, but has been deprecated.
PXOSD_API PxOsdMeshTopology WithScheme(TfToken const& scheme) const {
return PxOsdMeshTopology(scheme, GetOrientation(),
GetFaceVertexCounts(), GetFaceVertexIndices(),
GetHoleIndices(), GetSubdivTags());
}
/// Return a copy of the topology, changing only the subdiv tags.
PXOSD_API PxOsdMeshTopology WithSubdivTags(PxOsdSubdivTags const& tags) const {
return PxOsdMeshTopology(GetScheme(), GetOrientation(),
GetFaceVertexCounts(), GetFaceVertexIndices(),
GetHoleIndices(), tags);
}
/// Return a copy of the topology, changing only the hole indices.
PXOSD_API PxOsdMeshTopology WithHoleIndices(VtIntArray const& holeIndices) const {
return PxOsdMeshTopology(GetScheme(), GetOrientation(),
GetFaceVertexCounts(), GetFaceVertexIndices(),
holeIndices, GetSubdivTags());
}
public:
/// Returns the hash value of this topology to be used for instancing.
PXOSD_API
ID ComputeHash() const;
/// Equality check between two mesh topologies.
PXOSD_API
bool operator==(PxOsdMeshTopology const &other) const;
/// Returns a validation object which is empty if the topology is valid
///
/// \code{.cpp}
/// // Validation with minimal reporting
/// if (!topology.Validate()) TF_CODING_ERROR("Invalid topology.");
/// \endcode
///
/// \code{.cpp}
/// {
/// PxOsdMeshTopologyValidation validation = topology.Validate();
/// if (!validation){
/// for (auto const& elem: validation){
/// TF_WARN(elem.message);
/// }
/// }
/// }
/// \endcode
///
/// \note Internally caches the result of the validation if the topology is
/// valid
PXOSD_API
PxOsdMeshTopologyValidation Validate() const;
private:
// note: if you're going to add more members, make sure
// ComputeHash will be updated too.
TfToken _scheme,
_orientation;
VtIntArray _faceVertexCounts;
VtIntArray _faceVertexIndices;
VtIntArray _holeIndices;
PxOsdSubdivTags _subdivTags;
struct _Validated {
std::atomic<bool> value;
_Validated() : value(false) {}
_Validated(const _Validated& other) : value(other.value.load()) {}
_Validated(_Validated&& other) : value(other.value.load()) {
other.value = false;
}
_Validated& operator=(const _Validated& other) {
value.store(other.value.load());
return *this;
}
_Validated& operator=(_Validated&& other) {
value.store(other.value.load());
other.value = false;
return *this;
}
};
// This should NOT be included in the hash
// This evaluates to true if the topology has been successfully
// pre-validated. If this is false, the topology is either invalid
// or it hasn't been validated yet.
mutable _Validated _validated;
};
PXOSD_API
std::ostream& operator << (std::ostream &out, PxOsdMeshTopology const &);
PXOSD_API
bool operator!=(const PxOsdMeshTopology& lhs, const PxOsdMeshTopology& rhs);
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_H
@@ -0,0 +1,225 @@
//
// Copyright 2020 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
#define PXR_IMAGING_PX_OSD_MESH_TOPOLOGY_VALIDATION_H
#include "pxr/imaging/pxOsd/tokens.h"
#include <array>
#include <memory>
PXR_NAMESPACE_OPEN_SCOPE
class PxOsdMeshTopology;
/// Utility to help validate an OpenSubdiv Mesh topology.
///
/// This class is created by PxOsdMeshTopology's Validate method.
///
/// Internally, this will avoid dynamic allocations as long as
/// the topology is valid (currently using std::unique_ptr but
/// targeting std::optional for C++17).
///
/// This class does a set of basic validation tests on
/// the topology of a mesh. This set of tests isn't necessarily
/// complete. There are other cases like invalid primvar size
/// that this will not check for.
///
/// Topology is considered valid if it passes a series of checks
/// enumerated by the Code class enum.
///
/// \warn This doesn't currently validate that the topology of crease
/// indices match valid edges.
///
/// \note This class is convertable to bool and converts to true if the
/// the topology is valid and false if any invalidations were found.
/// That is to say, a conversion to true implies an empty invalidation
/// vector and false implies a non-empty invalidation vector.
class PxOsdMeshTopologyValidation {
public:
friend class PxOsdMeshTopology;
/// Codes for various invalid states for PxOsdMeshTopology
enum class Code {
/// Encodes invalid scheme token value
InvalidScheme,
/// Encodes invalid orientation token value
InvalidOrientation,
/// Encodes invalid triangle subdivision token value
InvalidTriangleSubdivision,
/// Encodes invalid vertex interpolation rule token value
InvalidVertexInterpolationRule,
/// Encodes invalid face varying interpolation rule token value
InvalidFaceVaryingInterpolationRule,
/// Encodes invalid crease method token value
InvalidCreaseMethod,
/// Encodes crease lengths element less than 2
InvalidCreaseLengthElement,
/// Encodes crease indices size not matching the sum of the lengths
/// array
InvalidCreaseIndicesSize,
/// Encodes crease indices element is not in the face vertex indices
/// vector
InvalidCreaseIndicesElement,
/// Encodes if crease weights is the size of the number of creases or
/// the number of crease edges
InvalidCreaseWeightsSize,
/// Encodes if crease weights are negative
NegativeCreaseWeights,
/// Encodes corner indices element is not in the face vertex indices
/// vector
InvalidCornerIndicesElement,
/// Encodes if corner weights are negative
NegativeCornerWeights,
/// Encodes if corner weights is not the size of the number of corner
/// indices
InvalidCornerWeightsSize,
/// Encodes if the hole indices are negative or greater than the maximum
/// face index (face count - 1)
InvalidHoleIndicesElement,
/// Encodes if a vertex count is less than 3
InvalidFaceVertexCountsElement,
/// Encodes if the element is negative
InvalidFaceVertexIndicesElement,
/// Encodes if the indices size does not match the sum of the face
/// vertex counts array
InvalidFaceVertexIndicesSize,
};
/// A tuple containing a code describing an invalidation and a descriptive
/// message
struct Invalidation {
Code code;
std::string message;
};
private:
// TODO: In C++17, this class is uncessary and should be replaced with
// std::optional<std::vector<Invalidation>>
class _OptionalInvalidationVector {
std::unique_ptr<std::vector<Invalidation>> _value;
public:
_OptionalInvalidationVector() = default;
_OptionalInvalidationVector(_OptionalInvalidationVector&&) = default;
_OptionalInvalidationVector& operator=(_OptionalInvalidationVector&&) =
default;
_OptionalInvalidationVector(_OptionalInvalidationVector const& other)
: _value(nullptr) {
if (other._value) {
_value.reset(new std::vector<Invalidation>(*other._value));
}
}
_OptionalInvalidationVector& operator=(
_OptionalInvalidationVector const& other) {
_value = nullptr;
if (other._value) {
_value.reset(new std::vector<Invalidation>(*other._value));
}
return *this;
}
void emplace() { _value.reset(new std::vector<Invalidation>); }
explicit operator bool() const { return _value != nullptr; }
std::vector<Invalidation>& value() {
TF_DEV_AXIOM(*this);
return *_value;
}
std::vector<Invalidation> const& value() const {
TF_DEV_AXIOM(*this);
return *_value;
}
};
_OptionalInvalidationVector _invalidations;
template <size_t S>
void _ValidateToken(PxOsdMeshTopologyValidation::Code code,
const char* name, const TfToken& token,
const std::array<TfToken, S>& validTokens);
/// initializes the vector if necessary
void _AppendInvalidation(const Invalidation& invalidation) {
if (!_invalidations) {
_invalidations.emplace();
}
_invalidations.value().push_back(invalidation);
}
PxOsdMeshTopologyValidation(PxOsdMeshTopology const&);
public:
PxOsdMeshTopologyValidation() = default;
PxOsdMeshTopologyValidation(PxOsdMeshTopologyValidation&&) = default;
PxOsdMeshTopologyValidation& operator=(PxOsdMeshTopologyValidation&&) =
default;
PxOsdMeshTopologyValidation(PxOsdMeshTopologyValidation const& other) =
default;
PxOsdMeshTopologyValidation& operator=(
PxOsdMeshTopologyValidation const& other) = default;
/// Return true if the topology is valid
explicit operator bool() const {
return !_invalidations || _invalidations.value().empty();
}
using iterator = std::vector<Invalidation>::const_iterator;
using const_iterator = std::vector<Invalidation>::const_iterator;
/// Returns an iterator for the beginning of the invalidation vector
/// if it has been initialized. Otherwise, returns an empty iterator.
const_iterator begin() const {
return _invalidations ? _invalidations.value().cbegin()
: const_iterator();
}
/// Returns an iterator for the end of the invalidation vector
/// if it has been initialized. Otherwise, returns an empty iterator.
const_iterator end() const {
return _invalidations ? _invalidations.value().cend()
: const_iterator();
}
/// Returns an iterator for the beginning of the invalidation vector
/// if it has been initialized. Otherwise, returns an empty iterator.
const_iterator cbegin() const {
return _invalidations ? _invalidations.value().cbegin()
: const_iterator();
}
/// Returns an iterator for the end of the invalidation vector
/// if it has been initialized. Otherwise, returns an empty iterator.
const_iterator cend() const {
return _invalidations ? _invalidations.value().cend()
: const_iterator();
}
private:
void _ValidateScheme(PxOsdMeshTopology const&);
void _ValidateOrientation(PxOsdMeshTopology const&);
void _ValidateTriangleSubdivision(PxOsdMeshTopology const&);
void _ValidateVertexInterpolation(PxOsdMeshTopology const&);
void _ValidateFaceVaryingInterpolation(PxOsdMeshTopology const&);
void _ValidateCreaseMethod(PxOsdMeshTopology const&);
void _ValidateCreasesAndCorners(PxOsdMeshTopology const&);
void _ValidateHoles(PxOsdMeshTopology const&);
void _ValidateFaceVertexCounts(PxOsdMeshTopology const&);
void _ValidateFaceVertexIndices(PxOsdMeshTopology const&);
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
@@ -0,0 +1,66 @@
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_REFINER_FACTORY_H
#define PXR_IMAGING_PX_OSD_REFINER_FACTORY_H
/// \file pxOsd/refinerFactory.h
#include "pxr/pxr.h"
#include "pxr/imaging/pxOsd/api.h"
#include "pxr/imaging/pxOsd/meshTopology.h"
#include "pxr/base/vt/array.h"
#include <opensubdiv/far/topologyRefiner.h>
#include <memory>
#include <vector>
PXR_NAMESPACE_OPEN_SCOPE
typedef std::shared_ptr<class OpenSubdiv::Far::TopologyRefiner>
PxOsdTopologyRefinerSharedPtr;
class PxOsdRefinerFactory {
public:
/// Returns an OpenSubdiv TopologyRefiner
PXOSD_API
static PxOsdTopologyRefinerSharedPtr Create(
PxOsdMeshTopology const & topology, TfToken name=TfToken());
/// Returns an OpenSubdiv TopologyRefiner with faceVarying topology
PXOSD_API
static PxOsdTopologyRefinerSharedPtr Create(
PxOsdMeshTopology const & topology,
std::vector<VtIntArray> const &fvarTopologies,
TfToken name=TfToken());
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_IMAGING_PX_OSD_REFINER_FACTORY_H
+207
View File
@@ -0,0 +1,207 @@
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
#define PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
/// \file pxOsd/subdivTags.h
#include "pxr/pxr.h"
#include "pxr/imaging/pxOsd/api.h"
#include "pxr/base/vt/array.h"
#include "pxr/base/tf/token.h"
PXR_NAMESPACE_OPEN_SCOPE
/// \class PxOsdSubdivTags
///
/// Tags for non-hierarchial subdiv surfaces.
///
class PxOsdSubdivTags {
public:
PxOsdSubdivTags() = default;
PxOsdSubdivTags(PxOsdSubdivTags const&) = default;
PxOsdSubdivTags(PxOsdSubdivTags&&) = default;
PxOsdSubdivTags& operator=(PxOsdSubdivTags const&) = default;
PxOsdSubdivTags& operator=(PxOsdSubdivTags&&) = default;
PxOsdSubdivTags(
const TfToken& vertexInterpolationRule,
const TfToken& faceVaryingInterpolationRule,
const TfToken& creaseMethod,
const TfToken& triangleSubdivision,
const VtIntArray& creaseIndices,
const VtIntArray& creaseLengths,
const VtFloatArray& creaseWeights,
const VtIntArray& cornerIndices,
const VtFloatArray& cornerWeights)
: _vtxInterpolationRule(vertexInterpolationRule)
, _fvarInterpolationRule(faceVaryingInterpolationRule)
, _creaseMethod(creaseMethod)
, _trianglesSubdivision(triangleSubdivision)
, _creaseIndices(creaseIndices)
, _creaseLengths(creaseLengths)
, _creaseWeights(creaseWeights)
, _cornerIndices(cornerIndices)
, _cornerWeights(cornerWeights) {}
/// Returns the vertex boundary interpolation rule
TfToken GetVertexInterpolationRule() const {
return _vtxInterpolationRule;
}
/// Set the vertex boundary interpolation rule
void SetVertexInterpolationRule(TfToken vtxInterp) {
_vtxInterpolationRule = vtxInterp;
}
/// Returns the face-varying boundary interpolation rule
TfToken GetFaceVaryingInterpolationRule() const {
return _fvarInterpolationRule;
}
/// Set the face-varying boundary interpolation rule
void SetFaceVaryingInterpolationRule(TfToken fvarInterp) {
_fvarInterpolationRule = fvarInterp;
}
/// Returns the creasing method
TfToken GetCreaseMethod() const {
return _creaseMethod;
}
/// Set the creasing method
void SetCreaseMethod(TfToken creaseMethod) {
_creaseMethod = creaseMethod;
}
/// Returns the triangle subdivision method
TfToken GetTriangleSubdivision() const {
return _trianglesSubdivision;
}
/// Set the triangle subdivision method
void SetTriangleSubdivision(TfToken triangleSubdivision) {
_trianglesSubdivision = triangleSubdivision;
}
///
/// \name Crease
/// @{
/// Returns the edge crease indices
VtIntArray const &GetCreaseIndices() const {
return _creaseIndices;
}
/// Set the edge crease indices
void SetCreaseIndices(VtIntArray const &creaseIndices) {
_creaseIndices = creaseIndices;
}
/// Returns the edge crease loop lengths
VtIntArray const &GetCreaseLengths() const {
return _creaseLengths;
}
/// Set the edge crease loop lengths
void SetCreaseLengths(VtIntArray const &creaseLengths) {
_creaseLengths = creaseLengths;
}
/// Returns the edge crease weights
VtFloatArray const &GetCreaseWeights() const {
return _creaseWeights;
}
/// Set the edge crease weights
void SetCreaseWeights(VtFloatArray const &creaseWeights) {
_creaseWeights = creaseWeights;
}
/// @}
///
/// \name Corner
/// @{
/// Returns the edge corner indices
VtIntArray const &GetCornerIndices() const {
return _cornerIndices;
}
/// Set the edge corner indices
void SetCornerIndices(VtIntArray const &cornerIndices) {
_cornerIndices = cornerIndices;
}
/// Returns the edge corner weights
VtFloatArray const &GetCornerWeights() const {
return _cornerWeights;
}
/// Set the edge corner weights
void SetCornerWeights(VtFloatArray const &cornerWeights) {
_cornerWeights = cornerWeights;
}
/// @}
typedef size_t ID;
/// Returns the hash value of this topology to be used for instancing.
PXOSD_API
ID ComputeHash() const;
private:
// note: if you're going to add more members, make sure
// ComputeHash will be updated too.
TfToken _vtxInterpolationRule,
_fvarInterpolationRule,
_creaseMethod,
_trianglesSubdivision;
VtIntArray _creaseIndices,
_creaseLengths;
VtFloatArray _creaseWeights;
VtIntArray _cornerIndices;
VtFloatArray _cornerWeights;
};
PXOSD_API
std::ostream& operator<<(std::ostream &out, PxOsdSubdivTags const &);
PXOSD_API
bool operator==(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
PXOSD_API
bool operator!=(const PxOsdSubdivTags& lhs, const PxOsdSubdivTags& rhs);
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_IMAGING_PX_OSD_SUBDIV_TAGS_H
+60
View File
@@ -0,0 +1,60 @@
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_IMAGING_PX_OSD_TOKENS_H
#define PXR_IMAGING_PX_OSD_TOKENS_H
/// \file pxOsd/tokens.h
#include "pxr/pxr.h"
#include "pxr/imaging/pxOsd/api.h"
#include "pxr/base/tf/staticTokens.h"
PXR_NAMESPACE_OPEN_SCOPE
#define PXOSD_OPENSUBDIV_TOKENS \
(all) \
(none) \
(cornersOnly) \
(cornersPlus1) \
(cornersPlus2) \
(boundaries) \
(bilinear) \
(catmullClark) \
(loop) \
(edgeOnly) \
(edgeAndCorner) \
(uniform) \
(chaikin) \
(leftHanded) \
(rightHanded) \
(smooth)
TF_DECLARE_PUBLIC_TOKENS(PxOsdOpenSubdivTokens,
PXOSD_API, PXOSD_OPENSUBDIV_TOKENS);
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXOSD_REFINER_FACTORY_H