24#ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
25#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
29#include "pxr/usdImaging/usdSkelImaging/api.h"
31#include "pxr/imaging/hd/meshTopology.h"
39#include <boost/unordered_map.hpp>
40#include <unordered_map>
43PXR_NAMESPACE_OPEN_SCOPE
55 UsdSkelImagingSkeletonAdapter()
60 virtual ~UsdSkelImagingSkeletonAdapter();
67 instancerContext=
nullptr)
override;
80 HdDirtyBits* timeVaryingBits,
82 instancerContext =
nullptr)
const override;
89 HdDirtyBits requestedBits,
91 instancerContext=
nullptr)
const override;
100 const TfToken& propertyName)
override;
111 void MarkDirty(
const UsdPrim& prim,
117 void MarkRefineLevelDirty(
UsdPrim const& prim,
122 void MarkReprDirty(
UsdPrim const& prim,
127 void MarkCullStyleDirty(
UsdPrim const& prim,
132 void MarkRenderTagDirty(
UsdPrim const& prim,
137 void MarkTransformDirty(
const UsdPrim& prim,
142 void MarkVisibilityDirty(
const UsdPrim& prim,
147 void MarkMaterialDirty(
const UsdPrim& prim,
155 void InvokeComputation(
SdfPath const& cachePath,
187 TfToken const& instanceInheritablePurpose)
204 SdfPath const& cachePath)
const override;
207 HdExtComputationInputDescriptorVector
208 GetExtComputationInputs(
UsdPrim const& prim,
213 HdExtComputationOutputDescriptorVector
214 GetExtComputationOutputs(
UsdPrim const& prim,
219 HdExtComputationPrimvarDescriptorVector
220 GetExtComputationPrimvars(
223 HdInterpolation interpolation,
228 GetExtComputationInput(
237 SampleExtComputationInput(
243 size_t maxSampleCount,
245 VtValue *sampleValues)
override;
249 GetExtComputationKernel(
260 VtIntArray *outIndices)
const override;
266 void _RemovePrim(
const SdfPath& cachePath,
273 bool _IsCallbackForSkeleton(
const UsdPrim& prim)
const;
282 float _GetSkeletonDisplayOpacity(
const UsdPrim& prim,
285 void _TrackBoneMeshVariability(
288 HdDirtyBits* timeVaryingBits,
290 instancerContext =
nullptr)
const;
292 void _UpdateBoneMeshForTime(
296 HdDirtyBits requestedBits,
302 bool _IsAffectedByTimeVaryingSkelAnim(
const SdfPath& skinnedPrimPath)
305 void _RemoveSkinnedPrimAndComputations(
const SdfPath& cachePath,
311 bool _IsSkinningComputationPath(
const SdfPath& cachePath)
const;
314 _IsSkinningInputAggregatorComputationPath(
const SdfPath& cachePath)
const;
316 void _TrackSkinningComputationVariability(
318 const SdfPath& computationPath,
319 HdDirtyBits* timeVaryingBits,
321 instancerContext =
nullptr)
const;
323 VtVec3fArray _GetSkinnedPrimPoints(
const UsdPrim& skinnedPrim,
324 const SdfPath& skinnedPrimCachePath,
327 SdfPath _GetSkinningComputationPath(
const SdfPath& skinnedPrimPath)
const;
329 SdfPath _GetSkinningInputAggregatorComputationPath(
330 const SdfPath& skinnedPrimPath)
const;
334 std::string _LoadSkinningComputeKernel(
const TfToken& kernelKey);
337 const std::string& _GetLBSSkinningComputeKernel();
340 const std::string& _GetDQSSkinningComputeKernel();
345 bool _IsSkinnedPrimPath(
const SdfPath& cachePath)
const;
347 void _TrackSkinnedPrimVariability(
350 HdDirtyBits* timeVaryingBits,
352 instancerContext =
nullptr)
const;
354 void _UpdateSkinnedPrimForTime(
358 HdDirtyBits requestedBits,
366 _GetExtComputationInputForSkinningComputation(
374 _GetExtComputationInputForInputAggregator(
382 _SampleExtComputationInputForSkinningComputation(
388 size_t maxSampleCount,
393 _SampleExtComputationInputForInputAggregator(
399 size_t maxSampleCount,
411 SdfPathSet skelRootPaths;
418 VtVec3fArray ComputePoints(
UsdTimeCode time)
const;
422 TfToken ComputePurpose()
const;
427 VtVec3fArray _boneMeshPoints;
428 VtIntArray _boneMeshJointIndices;
432 _SkelData* _GetSkelData(
const SdfPath& cachePath)
const;
436 std::unordered_map<SdfPath, std::shared_ptr<_SkelData>, SdfPath::Hash>;
437 _SkelDataMap _skelDataCache;
440 struct _SkinnedPrimData {
441 _SkinnedPrimData() =
default;
446 _SkinnedPrimData(
const SdfPath& skelPath,
451 std::shared_ptr<UsdSkelBlendShapeQuery> blendShapeQuery;
454 SdfPath skelPath, skelRootPath;
455 bool hasJointInfluences =
false;
458 const _SkinnedPrimData* _GetSkinnedPrimData(
const SdfPath& cachePath)
const;
460 using _SkinnedPrimDataMap =
461 std::unordered_map<SdfPath, _SkinnedPrimData, SdfPath::Hash>;
462 _SkinnedPrimDataMap _skinnedPrimDataCache;
469 using _SkelBindingMap =
470 std::unordered_map<SdfPath, UsdSkelBinding, SdfPath::Hash>;
471 _SkelBindingMap _skelBindingMap;
475PXR_NAMESPACE_CLOSE_SCOPE
Basic type: 3-dimensional floating point range.
Basic type for a vector of 3 float components.
Interface class that defines the execution environment for the client to run a computation.
Topology data for meshes.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
Base class for all PrimAdapters.
virtual USDIMAGING_API void ProcessPrimResync(SdfPath const &cachePath, UsdImagingIndexProxy *index)
When a PrimResync event occurs, the prim may have been deleted entirely, adapter plug-ins should over...
virtual USDIMAGING_API VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const
Gets the value of the parameter named key for the given prim (which has the given cache path) and giv...
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName)=0
Returns a bit mask of attributes to be updated, or HdChangeTracker::AllDirty if the entire prim must ...
virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr)=0
Called to populate the RenderIndex for this UsdPrim.
virtual void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=nullptr) const =0
For the given prim, variability is detected and stored in timeVaryingBits.
virtual USDIMAGING_API void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index)
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
virtual USDIMAGING_API VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const
Gets the topology object of a specific Usd prim.
virtual USDIMAGING_API TfToken GetPurpose(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const
Returns the purpose token for prim.
virtual bool IsSupported(UsdImagingIndexProxy const *index) const
Returns true if the adapter can be populated into the target index.
virtual USDIMAGING_API GfRange3d GetExtent(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const
Reads the extent from the given prim.
virtual void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=nullptr) const =0
Populates the cache for the given prim, time and requestedBits.
virtual USDIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const
Get the subdiv tags for this prim.
virtual USDIMAGING_API bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const
Reads double-sided from the given prim. If not authored, returns false.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Class providing efficient queries of primitives that provide skel animation.
Helper object that describes the binding of a skeleton to a set of skinnable objects.
Thread-safe cache for accessing query objects for evaluating skeletal data.
Primary interface to reading bound skeleton data.
Object used for querying resolved bindings for skinning.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...
std::vector< TfToken > TfTokenVector
Convenience types.