7 #ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
8 #define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
22 #include <unordered_map>
47 instancerContext=
nullptr)
override;
62 instancerContext =
nullptr)
const override;
71 instancerContext=
nullptr)
const override;
80 const TfToken& propertyName)
override;
167 TfToken const& instanceInheritablePurpose)
184 SdfPath const& cachePath)
const override;
225 size_t maxSampleCount,
227 VtValue *sampleValues)
override;
242 VtIntArray *outIndices)
const override;
253 TfToken const &subprim)
override;
276 enum class _ComputationType : uint8_t {
284 bool _IsCallbackForSkeleton(
const UsdPrim& prim)
const;
293 float _GetSkeletonDisplayOpacity(
const UsdPrim& prim,
296 void _TrackBoneMeshVariability(
301 instancerContext =
nullptr)
const;
303 void _UpdateBoneMeshForTime(
313 bool _IsAffectedByTimeVaryingSkelAnim(
const SdfPath& skinnedPrimPath)
316 void _RemoveSkinnedPrimAndComputations(
const SdfPath& cachePath,
322 bool _IsSkinningPointsComputationPath(
const SdfPath& cachePath)
const;
324 bool _IsSkinningNormalsComputationPath(
const SdfPath& cachePath)
const;
326 _ComputationType _GetSkinningComputationType(
327 const SdfPath& cachePath)
const;
329 bool _IsSkinningPointsInputAggregatorComputationPath(
330 const SdfPath& cachePath)
const;
332 bool _IsSkinningNormalsInputAggregatorComputationPath(
333 const SdfPath& cachePath)
const;
335 void _TrackSkinningComputationVariability(
337 const SdfPath& computationPath,
340 instancerContext =
nullptr)
const;
342 VtVec3fArray _GetSkinnedPrimPoints(
const UsdPrim& skinnedPrim,
343 const SdfPath& skinnedPrimCachePath,
346 VtVec3fArray _GetSkinnedPrimNormals(
const UsdPrim& skinnedPrim,
347 const SdfPath& skinnedPrimCachePath,
350 VtIntArray _GetSkinnedPrimFaceVertexIndices(
const UsdPrim& skinnedPrim,
351 const SdfPath& skinnedPrimCachePath,
354 SdfPath _GetSkinningComputationPath(
355 const SdfPath& skinnedPrimPath,
356 _ComputationType computationType)
const;
358 SdfPath _GetSkinningInputAggregatorComputationPath(
359 const SdfPath& skinnedPrimPath,
360 _ComputationType computationType)
const;
364 std::string _LoadSkinningComputeKernel(
const TfToken& kernelKey);
367 const std::string& _GetLBSSkinningComputeKernel(
368 _ComputationType computationType);
371 const std::string& _GetDQSSkinningComputeKernel(
372 _ComputationType computationType);
377 bool _IsSkinnedPrimPath(
const SdfPath& cachePath)
const;
379 void _TrackSkinnedPrimVariability(
384 instancerContext =
nullptr)
const;
386 void _UpdateSkinnedPrimForTime(
398 _GetExtComputationInputForSkinningComputation(
406 _GetExtComputationInputForInputAggregator(
414 _SampleExtComputationInputForSkinningComputation(
420 size_t maxSampleCount,
425 _SampleExtComputationInputForInputAggregator(
431 size_t maxSampleCount,
444 _ExtractSkinningScaleXforms(
445 const VtMatrix4fArray& skinningXforms,
446 _ComputationType computationType,
447 VtMatrix3fArray* skinningScaleXforms);
451 _ExtractSkinningDualQuats(
452 const VtMatrix4fArray& skinningXforms,
453 _ComputationType computationType,
454 VtVec4fArray* skinningDualQuats);
474 TfToken ComputePurpose()
const;
479 VtVec3fArray _boneMeshPoints;
480 VtIntArray _boneMeshJointIndices;
484 _SkelData* _GetSkelData(
const SdfPath& cachePath)
const;
488 std::unordered_map<SdfPath, std::shared_ptr<_SkelData>,
SdfPath::Hash>;
489 _SkelDataMap _skelDataCache;
492 struct _SkinnedPrimData {
493 _SkinnedPrimData() =
default;
498 _SkinnedPrimData(
const SdfPath& skelPath,
504 std::shared_ptr<UsdSkelBlendShapeQuery> blendShapeQuery;
507 SdfPath skelPath, skelRootPath;
508 bool hasJointInfluences =
false;
512 const _SkinnedPrimData* _GetSkinnedPrimData(
const SdfPath& cachePath)
const;
514 using _SkinnedPrimDataMap =
515 std::unordered_map<SdfPath, _SkinnedPrimData, SdfPath::Hash>;
516 _SkinnedPrimDataMap _skinnedPrimDataCache;
523 using _SkelBindingMap =
524 std::unordered_map<SdfPath, UsdSkelBinding, SdfPath::Hash>;
525 _SkelBindingMap _skelBindingMap;
531 #endif // USDSKELIMAGING_SKELETONADAPTER
USDSKELIMAGING_API HdDataSourceLocatorSet InvalidateImagingSubprim(UsdPrim const &prim, TfToken const &subprim, TfTokenVector const &properties, UsdImagingPropertyInvalidationType invalidationType) override
GT_API const UT_StringHolder time
USDSKELIMAGING_API void MarkDirty(const UsdPrim &prim, const SdfPath &cachePath, HdDirtyBits dirty, UsdImagingIndexProxy *index) override
#define PXR_NAMESPACE_OPEN_SCOPE
USDSKELIMAGING_API void TrackVariability(const UsdPrim &prim, const SdfPath &cachePath, HdDirtyBits *timeVaryingBits, const UsdImagingInstancerContext *instancerContext=nullptr) const override
Thread Safe.
USDSKELIMAGING_API bool IsSupported(const UsdImagingIndexProxy *index) const override
Returns true if the adapter can be populated into the target index.
std::vector< HdExtComputationInputDescriptor > HdExtComputationInputDescriptorVector
virtual USDSKELIMAGING_API ~UsdSkelImagingSkeletonAdapter()
USDSKELIMAGING_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvars(UsdPrim const &prim, SdfPath const &cachePath, HdInterpolation interpolation, const UsdImagingInstancerContext *instancerContext) const override
USDSKELIMAGING_API VtValue GetExtComputationInput(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &name, UsdTimeCode time, const UsdImagingInstancerContext *instancerContext) const override
std::vector< HdExtComputationOutputDescriptor > HdExtComputationOutputDescriptorVector
USDSKELIMAGING_API void ProcessPrimRemoval(SdfPath const &primPath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API void MarkMaterialDirty(const UsdPrim &prim, const SdfPath &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API TfToken GetImagingSubprimType(UsdPrim const &prim, TfToken const &subprim) override
USDSKELIMAGING_API SdfPath Populate(const UsdPrim &prim, UsdImagingIndexProxy *index, const UsdImagingInstancerContext *instancerContext=nullptr) override
USDSKELIMAGING_API void MarkRefineLevelDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) 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 void InvokeComputation(SdfPath const &cachePath, HdExtComputationContext *context) override
USDSKELIMAGING_API std::string GetExtComputationKernel(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
void _RemovePrim(const SdfPath &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API HdContainerDataSourceHandle GetImagingSubprimData(UsdPrim const &prim, TfToken const &subprim, const UsdImagingDataSourceStageGlobals &stageGlobals) override
std::vector< TfToken > TfTokenVector
Convenience types.
GLuint const GLchar * name
USDSKELIMAGING_API void MarkRenderTagDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API SdfPath GetMaterialId(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
The root transform provided by the delegate.
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
USDSKELIMAGING_API void MarkVisibilityDirty(const UsdPrim &prim, const SdfPath &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API HdDirtyBits ProcessPropertyChange(const UsdPrim &prim, const SdfPath &cachePath, const TfToken &propertyName) override
USDSKELIMAGING_API void MarkTransformDirty(const UsdPrim &prim, const SdfPath &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API TfTokenVector GetImagingSubprims(UsdPrim const &prim) override
#define USDSKELIMAGING_API
USDSKELIMAGING_API VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const override
USDSKELIMAGING_API void ProcessPrimResync(SdfPath const &primPath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API HdExtComputationInputDescriptorVector GetExtComputationInputs(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
USDSKELIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
UsdSkelImagingSkeletonAdapter()
USDSKELIMAGING_API void MarkReprDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDSKELIMAGING_API bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
USDSKELIMAGING_API void RegisterSkelBinding(UsdSkelBinding const &binding)
USDSKELIMAGING_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
USDSKELIMAGING_API void UpdateForTime(const UsdPrim &prim, const SdfPath &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, const UsdImagingInstancerContext *instancerContext=nullptr) const override
Thread Safe.
USDSKELIMAGING_API TfToken GetPurpose(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
USDSKELIMAGING_API HdExtComputationOutputDescriptorVector GetExtComputationOutputs(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
USDSKELIMAGING_API const TfTokenVector & GetExtComputationSceneInputNames(SdfPath const &cachePath) const override
UsdImagingPropertyInvalidationType
USDSKELIMAGING_API void MarkCullStyleDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
std::vector< HdExtComputationPrimvarDescriptor > HdExtComputationPrimvarDescriptorVector