add usd-21-11-win64_py39

This commit is contained in:
Sébastien Albert committed 2021-12-07 17:43:55 +01:00
1 parent 41d23e71ba
commit ba5e1f7e67
15684 files changed
+3069957

No files matched your search

@@ -0,0 +1,47 @@
//
// Copyright 2018 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_USD_IMAGING_USD_SKEL_IMAGING_API_H
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_API_H
#include "pxr/base/arch/export.h"
#if defined(PXR_STATIC)
# define USDSKELIMAGING_API
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...)
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...)
# define USDSKELIMAGING_LOCAL
#else
# if defined(USDSKELIMAGING_EXPORTS)
# define USDSKELIMAGING_API ARCH_EXPORT
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
# else
# define USDSKELIMAGING_API ARCH_IMPORT
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
# endif
# define USDSKELIMAGING_LOCAL ARCH_HIDDEN
#endif
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_API_H
@@ -0,0 +1,38 @@
//
// Copyright 2019 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_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
#include "pxr/pxr.h"
#include "pxr/usdImaging/usdSkelImaging/api.h"
#include "pxr/base/tf/token.h"
PXR_NAMESPACE_OPEN_SCOPE
USDSKELIMAGING_API
TfToken UsdSkelImagingPackageSkinningShader();
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
@@ -0,0 +1,115 @@
//
// Copyright 2019 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_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
#include "pxr/pxr.h"
#include "pxr/usdImaging/usdImaging/primAdapter.h"
#include "pxr/usdImaging/usdSkelImaging/api.h"
PXR_NAMESPACE_OPEN_SCOPE
/// \class UsdImagingSkelRootAdapter
///
/// The SkelRoot adapter exists for two reasons:
/// (a) Registering the SkeletonAdapter to handle processing of any skinned
/// prim under a SkelRoot prim.
/// The UsdSkel schema requires that ANY skinned prim lives under a
/// SkelRoot.
/// (b) Getting the skeleton that deforms each skinned prim, which is stored
/// in the SkeletonAdapter (the latter is stateful).
/// Both of these happen during Populate(..)
///
class UsdSkelImagingSkelRootAdapter : public UsdImagingPrimAdapter {
public:
using BaseAdapter = UsdImagingPrimAdapter;
UsdSkelImagingSkelRootAdapter()
: BaseAdapter()
{}
USDSKELIMAGING_API
virtual ~UsdSkelImagingSkelRootAdapter();
// ---------------------------------------------------------------------- //
/// \name Initialization
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
SdfPath
Populate(const UsdPrim& prim,
UsdImagingIndexProxy* index,
const UsdImagingInstancerContext*
instancerContext=nullptr) override;
USDSKELIMAGING_API
bool CanPopulateUsdInstance() const override { return true; }
bool ShouldIgnoreNativeInstanceSubtrees() const override;
// ---------------------------------------------------------------------- //
/// \name Parallel Setup and Resolve
// ---------------------------------------------------------------------- //
/// Thread Safe.
USDSKELIMAGING_API
void TrackVariability(const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits* timeVaryingBits,
const UsdImagingInstancerContext*
instancerContext = nullptr) const override;
/// Thread Safe.
USDSKELIMAGING_API
void UpdateForTime(const UsdPrim& prim,
const SdfPath& cachePath,
UsdTimeCode time,
HdDirtyBits requestedBits,
const UsdImagingInstancerContext*
instancerContext=nullptr) const override;
// ---------------------------------------------------------------------- //
/// \name Change Processing
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
HdDirtyBits ProcessPropertyChange(const UsdPrim& prim,
const SdfPath& cachePath,
const TfToken& propertyName) override;
USDSKELIMAGING_API
void MarkDirty(const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits dirty,
UsdImagingIndexProxy* index) override;
protected:
USDSKELIMAGING_API
void _RemovePrim(const SdfPath& cachePath,
UsdImagingIndexProxy* index) override;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
@@ -0,0 +1,473 @@
//
// Copyright 2018 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_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
#include "pxr/pxr.h"
#include "pxr/usdImaging/usdImaging/primAdapter.h"
#include "pxr/usdImaging/usdSkelImaging/api.h"
#include "pxr/imaging/hd/meshTopology.h"
#include "pxr/usd/usdSkel/binding.h"
#include "pxr/usd/usdSkel/blendShapeQuery.h"
#include "pxr/usd/usdSkel/cache.h"
#include "pxr/usd/usdSkel/skeleton.h"
#include "pxr/usd/usdSkel/skeletonQuery.h"
#include <boost/unordered_map.hpp>
#include <unordered_map>
PXR_NAMESPACE_OPEN_SCOPE
/// \class UsdImagingSkeletonAdapter
///
/// Support for drawing bones of a UsdSkelSkeleton.
///
class UsdSkelImagingSkeletonAdapter : public UsdImagingPrimAdapter
{
public:
using BaseAdapter = UsdImagingPrimAdapter;
UsdSkelImagingSkeletonAdapter()
: BaseAdapter()
{}
USDSKELIMAGING_API
virtual ~UsdSkelImagingSkeletonAdapter();
USDSKELIMAGING_API
SdfPath
Populate(const UsdPrim& prim,
UsdImagingIndexProxy* index,
const UsdImagingInstancerContext*
instancerContext=nullptr) override;
USDSKELIMAGING_API
bool IsSupported(const UsdImagingIndexProxy* index) const override;
// ---------------------------------------------------------------------- //
/// \name Parallel Setup and Resolve
// ---------------------------------------------------------------------- //
/// Thread Safe.
USDSKELIMAGING_API
void TrackVariability(const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits* timeVaryingBits,
const UsdImagingInstancerContext*
instancerContext = nullptr) const override;
/// Thread Safe.
USDSKELIMAGING_API
void UpdateForTime(const UsdPrim& prim,
const SdfPath& cachePath,
UsdTimeCode time,
HdDirtyBits requestedBits,
const UsdImagingInstancerContext*
instancerContext=nullptr) const override;
// ---------------------------------------------------------------------- //
/// \name Change Processing API (public)
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
HdDirtyBits ProcessPropertyChange(const UsdPrim& prim,
const SdfPath& cachePath,
const TfToken& propertyName) override;
USDSKELIMAGING_API
void ProcessPrimResync(SdfPath const& primPath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void ProcessPrimRemoval(SdfPath const& primPath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkDirty(const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits dirty,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkRefineLevelDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkReprDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkCullStyleDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkRenderTagDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkTransformDirty(const UsdPrim& prim,
const SdfPath& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkVisibilityDirty(const UsdPrim& prim,
const SdfPath& cachePath,
UsdImagingIndexProxy* index) override;
USDSKELIMAGING_API
void MarkMaterialDirty(const UsdPrim& prim,
const SdfPath& cachePath,
UsdImagingIndexProxy* index) override;
// ---------------------------------------------------------------------- //
/// \name Computation API
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
void InvokeComputation(SdfPath const& cachePath,
HdExtComputationContext* context) override;
// ---------------------------------------------------------------------- //
/// \name Non-virtual public API
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
void RegisterSkelBinding(UsdSkelBinding const& binding);
// ---------------------------------------------------------------------- //
/// \name Virtual public API
// ---------------------------------------------------------------------- //
USDSKELIMAGING_API
PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const override;
USDSKELIMAGING_API
VtValue GetTopology(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time) const override;
USDSKELIMAGING_API
GfRange3d GetExtent(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time) const override;
USDSKELIMAGING_API
TfToken GetPurpose(UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& instanceInheritablePurpose)
const override;
USDSKELIMAGING_API
bool GetDoubleSided(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time) const override;
USDSKELIMAGING_API
SdfPath GetMaterialId(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time) const override;
USDSKELIMAGING_API
const TfTokenVector &GetExtComputationSceneInputNames(
SdfPath const& cachePath) const override;
USDSKELIMAGING_API
HdExtComputationInputDescriptorVector
GetExtComputationInputs(UsdPrim const& prim,
SdfPath const& cachePath,
const UsdImagingInstancerContext *instancerContext)
const override;
HdExtComputationOutputDescriptorVector
GetExtComputationOutputs(UsdPrim const& prim,
SdfPath const& cachePath,
const UsdImagingInstancerContext* instancerContext)
const override;
HdExtComputationPrimvarDescriptorVector
GetExtComputationPrimvars(
UsdPrim const& prim,
SdfPath const& cachePath,
HdInterpolation interpolation,
const UsdImagingInstancerContext* instancerContext) const override;
USDIMAGING_API
VtValue
GetExtComputationInput(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext) const override;
USDIMAGING_API
size_t
SampleExtComputationInput(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext,
size_t maxSampleCount,
float *sampleTimes,
VtValue *sampleValues) override;
USDIMAGING_API
std::string
GetExtComputationKernel(
UsdPrim const& prim,
SdfPath const& cachePath,
const UsdImagingInstancerContext* instancerContext) const override;
USDSKELIMAGING_API
VtValue Get(UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& key,
UsdTimeCode time,
VtIntArray *outIndices) const override;
protected:
// ---------------------------------------------------------------------- //
/// \name Change Processing API (protected)
// ---------------------------------------------------------------------- //
void _RemovePrim(const SdfPath& cachePath,
UsdImagingIndexProxy* index) override;
private:
// ---------------------------------------------------------------------- //
/// Handlers for the Bone Mesh
// ---------------------------------------------------------------------- //
bool _IsCallbackForSkeleton(const UsdPrim& prim) const;
/// Returns a value holding color for \p prim,
/// taking into account explicitly authored color on the prim.
GfVec3f _GetSkeletonDisplayColor(const UsdPrim& prim,
UsdTimeCode time) const;
/// Returns a value holding opacity for \p prim,
/// taking into account explicitly authored opacity on the prim.
float _GetSkeletonDisplayOpacity(const UsdPrim& prim,
UsdTimeCode time) const;
void _TrackBoneMeshVariability(
const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits* timeVaryingBits,
const UsdImagingInstancerContext*
instancerContext = nullptr) const;
void _UpdateBoneMeshForTime(
const UsdPrim& prim,
const SdfPath& cachePath,
UsdTimeCode time,
HdDirtyBits requestedBits,
const UsdImagingInstancerContext* instancerContext=nullptr) const;
// ---------------------------------------------------------------------- //
/// Common utitily methods for skinning computations & skinned prims
// ---------------------------------------------------------------------- //
bool _IsAffectedByTimeVaryingSkelAnim(const SdfPath& skinnedPrimPath)
const;
void _RemoveSkinnedPrimAndComputations(const SdfPath& cachePath,
UsdImagingIndexProxy* index);
// ---------------------------------------------------------------------- //
/// Handlers for the skinning computations
// ---------------------------------------------------------------------- //
bool _IsSkinningComputationPath(const SdfPath& cachePath) const;
bool
_IsSkinningInputAggregatorComputationPath(const SdfPath& cachePath)const;
void _TrackSkinningComputationVariability(
const UsdPrim& skinnedPrim,
const SdfPath& computationPath,
HdDirtyBits* timeVaryingBits,
const UsdImagingInstancerContext*
instancerContext = nullptr) const;
VtVec3fArray _GetSkinnedPrimPoints(const UsdPrim& skinnedPrim,
const SdfPath& skinnedPrimCachePath,
UsdTimeCode time) const;
SdfPath _GetSkinningComputationPath(const SdfPath& skinnedPrimPath) const;
SdfPath _GetSkinningInputAggregatorComputationPath(
const SdfPath& skinnedPrimPath) const;
// Static helper methods
static
std::string _LoadSkinningComputeKernel();
static
const std::string& _GetSkinningComputeKernel();
// ---------------------------------------------------------------------- //
/// Handlers for the skinned prim
// ---------------------------------------------------------------------- //
bool _IsSkinnedPrimPath(const SdfPath& cachePath) const;
void _TrackSkinnedPrimVariability(
const UsdPrim& prim,
const SdfPath& cachePath,
HdDirtyBits* timeVaryingBits,
const UsdImagingInstancerContext*
instancerContext = nullptr) const;
void _UpdateSkinnedPrimForTime(
const UsdPrim& prim,
const SdfPath& cachePath,
UsdTimeCode time,
HdDirtyBits requestedBits,
const UsdImagingInstancerContext* instancerContext=nullptr) const;
// ---------------------------------------------------------------------- //
/// GetExtComputationInput() helpers
// ---------------------------------------------------------------------- //
VtValue
_GetExtComputationInputForSkinningComputation(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext) const;
VtValue
_GetExtComputationInputForInputAggregator(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext) const;
size_t
_SampleExtComputationInputForSkinningComputation(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext,
size_t maxSampleCount,
float *sampleTimes,
VtValue *sampleValues);
size_t
_SampleExtComputationInputForInputAggregator(
UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* instancerContext,
size_t maxSampleCount,
float *sampleTimes,
VtValue *sampleValues);
// ---------------------------------------------------------------------- //
/// Populated skeleton state
// ---------------------------------------------------------------------- //
/// Data for a skel instance.
struct _SkelData {
UsdSkelSkeletonQuery skelQuery;
SdfPathSet skelRootPaths;
/// Compute bone mesh topology, and intiailize
/// other rest-state data for imaging bones.
HdMeshTopology ComputeTopologyAndRestState();
/// Compute animated bone mesh points.
VtVec3fArray ComputePoints(UsdTimeCode time) const;
TfToken ComputePurpose() const;
private:
// Cache of a mesh for a skeleton (at rest)
// TODO: Dedupe this infromation across UsdSkelSkeleton instances.
VtVec3fArray _boneMeshPoints;
VtIntArray _boneMeshJointIndices;
size_t _numJoints;
};
_SkelData* _GetSkelData(const SdfPath& cachePath) const;
UsdSkelCache _skelCache;
using _SkelDataMap =
std::unordered_map<SdfPath, std::shared_ptr<_SkelData>, SdfPath::Hash>;
_SkelDataMap _skelDataCache;
// Data for each skinned prim.
struct _SkinnedPrimData {
_SkinnedPrimData() = default;
/// Construct skinned prim, referencing the skeleton at \p skelPath.
/// XXX: We cannot extract the skel path from the skelQuery because
/// the skelQuery might refer to a prim within an instance master.
_SkinnedPrimData(const SdfPath& skelPath,
const UsdSkelSkeletonQuery& skelQuery,
const UsdSkelSkinningQuery& skinningQuery,
const SdfPath& skelRootPath);
std::shared_ptr<UsdSkelBlendShapeQuery> blendShapeQuery;
UsdSkelSkinningQuery skinningQuery;
UsdSkelAnimQuery animQuery;
SdfPath skelPath, skelRootPath;
bool hasJointInfluences = false;
};
const _SkinnedPrimData* _GetSkinnedPrimData(const SdfPath& cachePath) const;
using _SkinnedPrimDataMap =
std::unordered_map<SdfPath, _SkinnedPrimData, SdfPath::Hash>;
_SkinnedPrimDataMap _skinnedPrimDataCache;
// ---------------------------------------------------------------------- //
/// Skeleton -> Skinned Prim(s) state
/// (Populated via UsdSkelImagingSkelRootAdapter::Populate)
// ---------------------------------------------------------------------- //
using _SkelBindingMap =
std::unordered_map<SdfPath, UsdSkelBinding, SdfPath::Hash>;
_SkelBindingMap _skelBindingMap;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif // USDSKELIMAGING_SKELETONADAPTER
@@ -0,0 +1,103 @@
//
// Copyright 2018 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_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H
/// \file usdSkelImaging/utils.h
///
/// Collection of utility methods for imaging skels.
///
#include "pxr/pxr.h"
#include "pxr/usdImaging/usdSkelImaging/api.h"
#include "pxr/base/vt/array.h"
PXR_NAMESPACE_OPEN_SCOPE
class HdMeshTopology;
class UsdSkelTopology;
/// \defgroup UsdSkelImaging_BoneUtils Bone Utilities
/// Utilities for constructing bone meshes.
/// @{
/// Compute mesh topology for imaging \p skelTopology.
/// The number of points that the mesh is expected to have are return in
/// \p numPoints.
USDSKELIMAGING_API
bool
UsdSkelImagingComputeBoneTopology(const UsdSkelTopology& skelTopology,
HdMeshTopology* meshTopology,
size_t* numPoints);
/// Compute mesh points for imaging a skeleton, given the
/// \p topology of the skeleton and \p skelXforms.
/// The \p numPoints corresponds to the number of points computed by
/// UsdSkelImagingComputeBoneTopology.
USDSKELIMAGING_API
bool
UsdSkelImagingComputeBonePoints(const UsdSkelTopology& topology,
const VtMatrix4dArray& jointSkelXforms,
size_t numPoints,
VtVec3fArray* points);
/// \overload
USDSKELIMAGING_API
bool
UsdSkelImagingComputeBonePoints(const UsdSkelTopology& topology,
const GfMatrix4d* jointSkelXforms,
GfVec3f* points, size_t numPoints);
/// Compute joint indices corresponding to each point in a bone mesh.
/// This can be used to animate a bone mesh using normal skinning algos.
/// This does not compute joint weights (they would all be 1s).
/// The \p numPoints corresponds to the number of points computed by
/// UsdSkelImagingComputeBoneTopology.
USDSKELIMAGING_API
bool
UsdSkelImagingComputeBoneJointIndices(const UsdSkelTopology& topology,
VtIntArray* jointIndices,
size_t numPoints);
/// \overload
USDSKELIMAGING_API
bool
UsdSkelImagingComputeBoneJointIndices(const UsdSkelTopology& topology,
int* jointIndices, size_t numPoints);
/// @}
PXR_NAMESPACE_CLOSE_SCOPE
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H