24#ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
25#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
28#include "pxr/usdImaging/usdImaging/instanceablePrimAdapter.h"
29#include "pxr/usdImaging/usdSkelImaging/api.h"
31#include "pxr/imaging/hd/meshTopology.h"
39#include <unordered_map>
42PXR_NAMESPACE_OPEN_SCOPE
54 UsdSkelImagingSkeletonAdapter()
59 virtual ~UsdSkelImagingSkeletonAdapter();
66 instancerContext=
nullptr)
override;
79 HdDirtyBits* timeVaryingBits,
81 instancerContext =
nullptr)
const override;
88 HdDirtyBits requestedBits,
90 instancerContext=
nullptr)
const override;
99 const TfToken& propertyName)
override;
110 void MarkDirty(
const UsdPrim& prim,
116 void MarkRefineLevelDirty(
UsdPrim const& prim,
121 void MarkReprDirty(
UsdPrim const& prim,
126 void MarkCullStyleDirty(
UsdPrim const& prim,
131 void MarkRenderTagDirty(
UsdPrim const& prim,
136 void MarkTransformDirty(
const UsdPrim& prim,
141 void MarkVisibilityDirty(
const UsdPrim& prim,
146 void MarkMaterialDirty(
const UsdPrim& prim,
154 void InvokeComputation(
SdfPath const& cachePath,
186 TfToken const& instanceInheritablePurpose)
203 SdfPath const& cachePath)
const override;
206 HdExtComputationInputDescriptorVector
207 GetExtComputationInputs(
UsdPrim const& prim,
212 HdExtComputationOutputDescriptorVector
213 GetExtComputationOutputs(
UsdPrim const& prim,
218 HdExtComputationPrimvarDescriptorVector
219 GetExtComputationPrimvars(
222 HdInterpolation interpolation,
227 GetExtComputationInput(
236 SampleExtComputationInput(
242 size_t maxSampleCount,
244 VtValue *sampleValues)
override;
248 GetExtComputationKernel(
259 VtIntArray *outIndices)
const override;
265 void _RemovePrim(
const SdfPath& cachePath,
272 bool _IsCallbackForSkeleton(
const UsdPrim& prim)
const;
281 float _GetSkeletonDisplayOpacity(
const UsdPrim& prim,
284 void _TrackBoneMeshVariability(
287 HdDirtyBits* timeVaryingBits,
289 instancerContext =
nullptr)
const;
291 void _UpdateBoneMeshForTime(
295 HdDirtyBits requestedBits,
301 bool _IsAffectedByTimeVaryingSkelAnim(
const SdfPath& skinnedPrimPath)
304 void _RemoveSkinnedPrimAndComputations(
const SdfPath& cachePath,
310 bool _IsSkinningComputationPath(
const SdfPath& cachePath)
const;
313 _IsSkinningInputAggregatorComputationPath(
const SdfPath& cachePath)
const;
315 void _TrackSkinningComputationVariability(
317 const SdfPath& computationPath,
318 HdDirtyBits* timeVaryingBits,
320 instancerContext =
nullptr)
const;
322 VtVec3fArray _GetSkinnedPrimPoints(
const UsdPrim& skinnedPrim,
323 const SdfPath& skinnedPrimCachePath,
326 SdfPath _GetSkinningComputationPath(
const SdfPath& skinnedPrimPath)
const;
328 SdfPath _GetSkinningInputAggregatorComputationPath(
329 const SdfPath& skinnedPrimPath)
const;
333 std::string _LoadSkinningComputeKernel(
const TfToken& kernelKey);
336 const std::string& _GetLBSSkinningComputeKernel();
339 const std::string& _GetDQSSkinningComputeKernel();
344 bool _IsSkinnedPrimPath(
const SdfPath& cachePath)
const;
346 void _TrackSkinnedPrimVariability(
349 HdDirtyBits* timeVaryingBits,
351 instancerContext =
nullptr)
const;
353 void _UpdateSkinnedPrimForTime(
357 HdDirtyBits requestedBits,
365 _GetExtComputationInputForSkinningComputation(
373 _GetExtComputationInputForInputAggregator(
381 _SampleExtComputationInputForSkinningComputation(
387 size_t maxSampleCount,
392 _SampleExtComputationInputForInputAggregator(
398 size_t maxSampleCount,
410 SdfPathSet skelRootPaths;
417 VtVec3fArray ComputePoints(
UsdTimeCode time)
const;
421 TfToken ComputePurpose()
const;
426 VtVec3fArray _boneMeshPoints;
427 VtIntArray _boneMeshJointIndices;
431 _SkelData* _GetSkelData(
const SdfPath& cachePath)
const;
435 std::unordered_map<SdfPath, std::shared_ptr<_SkelData>, SdfPath::Hash>;
436 _SkelDataMap _skelDataCache;
439 struct _SkinnedPrimData {
440 _SkinnedPrimData() =
default;
445 _SkinnedPrimData(
const SdfPath& skelPath,
450 std::shared_ptr<UsdSkelBlendShapeQuery> blendShapeQuery;
453 SdfPath skelPath, skelRootPath;
454 bool hasJointInfluences =
false;
457 const _SkinnedPrimData* _GetSkinnedPrimData(
const SdfPath& cachePath)
const;
459 using _SkinnedPrimDataMap =
460 std::unordered_map<SdfPath, _SkinnedPrimData, SdfPath::Hash>;
461 _SkinnedPrimDataMap _skinnedPrimDataCache;
468 using _SkelBindingMap =
469 std::unordered_map<SdfPath, UsdSkelBinding, SdfPath::Hash>;
470 _SkelBindingMap _skelBindingMap;
474PXR_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.
An abstract adapter class for prims that are instanceable.
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.