Loading...
Searching...
No Matches
dataSourceResolvedPointsBasedPrim.h
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_DATA_SOURCE_RESOLVED_POINTS_BASED_PRIM_H
9#define PXR_USD_IMAGING_USD_SKEL_IMAGING_DATA_SOURCE_RESOLVED_POINTS_BASED_PRIM_H
10
11#include "pxr/usdImaging/usdSkelImaging/api.h"
12#include "pxr/usdImaging/usdSkelImaging/dataSourceUtils.h"
14#include "pxr/usdImaging/usdSkelImaging/xformResolver.h"
15
17#include "pxr/imaging/hd/sceneIndexObserver.h"
18
20
21PXR_NAMESPACE_OPEN_SCOPE
22
26
39 , public std::enable_shared_from_this<
40 UsdSkelImagingDataSourceResolvedPointsBasedPrim>
41{
42public:
44
53 USDSKELIMAGING_API
54 static
55 Handle New(
56 HdSceneIndexBaseRefPtr const &sceneIndex,
57 SdfPath primPath,
58 HdContainerDataSourceHandle primSource);
59
60 USDSKELIMAGING_API
62
63 USDSKELIMAGING_API
65
66 USDSKELIMAGING_API
67 HdDataSourceBaseHandle Get(const TfToken &name) override;
68
70 const SdfPath &GetPrimPath() const { return _primPath; }
71
73 const SdfPath &GetSkeletonPath() const { return _skeletonPath; }
74
77 return _blendShapeTargetPaths;
78 }
79
86 return _xformResolver.GetInstancerPaths();
87 }
88
90 const HdPrimvarsSchema &GetPrimvars() const { return _primvars; }
91
94 return _resolvedSkeletonSchema;
95 }
96
97 USDSKELIMAGING_API
98 HdMatrix4fArrayDataSourceHandle GetSkinningTransforms();
99
101 USDSKELIMAGING_API
102 HdMatrix3fArrayDataSourceHandle GetSkinningScaleTransforms();
103
105 USDSKELIMAGING_API
106 HdVec4fArrayDataSourceHandle GetSkinningDualQuats();
107
108 USDSKELIMAGING_API
109 HdFloatArrayDataSourceHandle GetBlendShapeWeights();
110
114 USDSKELIMAGING_API
115 HdMatrixDataSourceHandle GetCommonSpaceToPrimLocal() const;
116
117 USDSKELIMAGING_API
118 HdSampledDataSourceHandle GetPoints();
119
120 USDSKELIMAGING_API
121 HdDataSourceBaseHandle GetGeomBindTransform();
122
123 USDSKELIMAGING_API
124 HdDataSourceBaseHandle GetHasConstantInfluences();
125
126 USDSKELIMAGING_API
127 HdDataSourceBaseHandle GetNumInfluencesPerComponent();
128
129 USDSKELIMAGING_API
130 HdDataSourceBaseHandle GetInfluences();
131
132 USDSKELIMAGING_API
133 HdDataSourceBaseHandle GetBlendShapeOffsets();
134
135 USDSKELIMAGING_API
136 HdDataSourceBaseHandle GetBlendShapeOffsetRanges();
137
138 USDSKELIMAGING_API
139 HdDataSourceBaseHandle GetNumBlendShapeOffsetRanges();
140
141 USDSKELIMAGING_API
142 HdSampledDataSourceHandle GetNormals();
143
144 USDSKELIMAGING_API
145 HdSampledDataSourceHandle GetFaceVertexIndices();
146
147 USDSKELIMAGING_API
148 HdDataSourceBaseHandle GetHasFaceVaryingNormals();
149
151 USDSKELIMAGING_API
152 std::shared_ptr<UsdSkelImagingBlendShapeData> GetBlendShapeData();
153
155 USDSKELIMAGING_API
156 std::shared_ptr<UsdSkelImagingJointInfluencesData> GetJointInfluencesData();
157
159 const TfToken &GetSkinningMethod() const {
160 return _skinningMethod;
161 }
162
165 bool HasExtComputations() const;
166
175 USDSKELIMAGING_API
176 static const HdDataSourceLocatorSet &
178
187 USDSKELIMAGING_API
189 const TfToken &dirtiedPrimType,
190 const HdDataSourceLocatorSet &dirtyLocators,
192
193private:
194 USDSKELIMAGING_API
196 HdSceneIndexBaseRefPtr const &sceneIndex,
197 SdfPath primPath,
198 HdContainerDataSourceHandle primSource,
199 bool hasSkelRoot,
200 VtArray<SdfPath> blendShapeTargetPaths,
201 SdfPath skelPath,
202 HdContainerDataSourceHandle skeletonPrimSource,
203 UsdSkelImagingResolvedSkeletonSchema resolvedSkeletonSchema);
204
205 bool
206 _ProcessDirtyLocators(
207 const HdDataSourceLocatorSet &dirtyLocators,
208 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
209 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
210 TfTokenVector * dirtyPrimvars);
211
212 bool
213 _ProcessDirtySkeletonLocators(
214 const HdDataSourceLocatorSet &dirtyLocators,
215 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
216 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
217 TfTokenVector * dirtyPrimvars);
218
219 bool
220 _ProcessDirtySkelBlendShapeLocators(
221 const HdDataSourceLocatorSet &dirtyLocators,
222 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
223 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
224 TfTokenVector * dirtyPrimvars);
225
226 bool
227 _ProcessDirtyInstancerLocators(
228 const HdDataSourceLocatorSet &dirtyLocators,
229 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
230 HdDataSourceLocatorSet * dirtyLocatorsForComputation);
231
232 // Input scene.
233 HdSceneIndexBaseRefPtr const _sceneIndex;
234 // Path of prim in the input scene.
235 const SdfPath _primPath;
236 // Data source for _primPath from input scene _sceneIndex.
237 HdContainerDataSourceHandle const _primSource;
238 const bool _hasSkelRoot;
239 // From prim at _primPath in input scene _sceneIndex.
240 HdPrimvarsSchema const _primvars;
241 const TfToken _skinningMethod;
242 VtArray<SdfPath> _blendShapeTargetPaths;
243 const SdfPath _skeletonPath;
244 HdContainerDataSourceHandle const _skeletonPrimSource;
245 const UsdSkelImagingResolvedSkeletonSchema _resolvedSkeletonSchema;
246
247 class _BlendShapeDataCache
248 : public UsdSkelImagingSharedPtrThunk<UsdSkelImagingBlendShapeData>
249 {
250 public:
251 _BlendShapeDataCache(
252 HdSceneIndexBaseRefPtr const &sceneIndex,
253 const SdfPath &primPath);
254 protected:
255 Handle _Compute() override;
256 private:
257 HdSceneIndexBaseRefPtr const _sceneIndex;
258 const SdfPath _primPath;
259 };
260 _BlendShapeDataCache _blendShapeDataCache;
261
262 class _JointInfluencesDataCache
263 : public UsdSkelImagingSharedPtrThunk<UsdSkelImagingJointInfluencesData>
264 {
265 public:
266 _JointInfluencesDataCache(
267 HdContainerDataSourceHandle const &primSource,
268 HdContainerDataSourceHandle const &skeletonPrimSource);
269 protected:
270 Handle _Compute() override;
271 private:
272 HdContainerDataSourceHandle const _primSource;
273 HdContainerDataSourceHandle const _skeletonPrimSource;
274 };
275 _JointInfluencesDataCache _jointInfluencesDataCache;
276
277 // Serves GetPrimWorldToLocal - taking instancing into account.
279};
280
281HD_DECLARE_DATASOURCE_HANDLES(UsdSkelImagingDataSourceResolvedPointsBasedPrim);
282
283PXR_NAMESPACE_CLOSE_SCOPE
284
285#endif
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
Represents a set of data source locators closed under descendancy.
Abstract interface to scene data.
Definition: sceneIndex.h:54
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A prim data source providing resolved data for a points based prim (mesh, basisCurves,...
USDSKELIMAGING_API std::shared_ptr< UsdSkelImagingBlendShapeData > GetBlendShapeData()
Blend shape data computed from primvars, skel bindings and skeleton.
USDSKELIMAGING_API HdMatrix3fArrayDataSourceHandle GetSkinningScaleTransforms()
Only valid if GetSkinningMethod() == UsdSkelTokens->dualQuaternion.
bool HasExtComputations() const
Should the points for this primvar be given by an ext computation or from the primvars schema.
USDSKELIMAGING_API std::shared_ptr< UsdSkelImagingJointInfluencesData > GetJointInfluencesData()
Joint influences data computed from primvars.
const UsdSkelImagingResolvedSkeletonSchema & GetResolvedSkeletonSchema()
Resolved skeleton of prim in the input scene.
static USDSKELIMAGING_API Handle New(HdSceneIndexBaseRefPtr const &sceneIndex, SdfPath primPath, HdContainerDataSourceHandle primSource)
C'tor.
USDSKELIMAGING_API HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the child datasource of the given name.
const HdPrimvarsSchema & GetPrimvars() const
Primvars of prim in the input scene.
static USDSKELIMAGING_API const HdDataSourceLocatorSet & GetDependendendOnDataSourceLocators()
Data source locators (on this prim) that this prim depends on.
USDSKELIMAGING_API HdMatrixDataSourceHandle GetCommonSpaceToPrimLocal() const
Transfrom to go from common space (as defined by UsdSkelImagingDataSourceXformResolver) to the local ...
USDSKELIMAGING_API bool ProcessDirtyLocators(const TfToken &dirtiedPrimType, const HdDataSourceLocatorSet &dirtyLocators, HdSceneIndexObserver::DirtiedPrimEntries *entries)
Dirty internal structures in response to dirty locators for the target (resolved) skeleton prim (dirt...
const VtArray< SdfPath > & GetBlendShapeTargetPaths() const
Paths to BlendShape prims.
const SdfPath & GetPrimPath() const
Path of prim in input scene (and for prim this data source is for).
USDSKELIMAGING_API TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
const SdfPath & GetSkeletonPath() const
Path of bound skeleton.
const VtArray< SdfPath > & GetInstancerPaths() const
Paths to instancers instancing this prim - not including ones outside the skel root.
const TfToken & GetSkinningMethod() const
Skinning method computed from corresponding primvar.
USDSKELIMAGING_API HdVec4fArrayDataSourceHandle GetSkinningDualQuats()
Only valid if GetSkinningMethod() == UsdSkelTokens->dualQuaternion.
Given a prim, computes transform from prim local space to a space common to all descendants of a skel...
Definition: xformResolver.h:42
const VtArray< SdfPath > & GetInstancerPaths() const
Paths of instancer contributing to the transform.
Definition: xformResolver.h:58
Resolved data for a skeleton and the targeted skelAnim.
A thunk for shared pointers computing the result only once and using atomic operations to store the c...
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:213
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Data for skinned prim to compute the skel ext computation inputs related to blend shapes.
Some of the data feeding into the ext computations to skin a prim.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440