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
18#include "pxr/imaging/hd/sceneIndexObserver.h"
19
21
22PXR_NAMESPACE_OPEN_SCOPE
23
27
41 , public std::enable_shared_from_this<
42 UsdSkelImagingDataSourceResolvedPointsBasedPrim>
43{
44public:
46
55 USDSKELIMAGING_API
56 static
57 Handle New(
58 HdSceneIndexBaseRefPtr const &sceneIndex,
59 SdfPath primPath,
60 HdContainerDataSourceHandle primSource);
61
62 USDSKELIMAGING_API
64
65 USDSKELIMAGING_API
67
68 USDSKELIMAGING_API
69 HdDataSourceBaseHandle Get(const TfToken &name) override;
70
72 const SdfPath &GetPrimPath() const { return _primPath; }
73
75 const SdfPath &GetSkeletonPath() const { return _skeletonPath; }
76
79 return _blendShapeTargetPaths;
80 }
81
88 return _xformResolver.GetInstancerPaths();
89 }
90
92 const HdPrimvarsSchema &GetPrimvars() const { return _primvars; }
93
96 return _resolvedSkeletonSchema;
97 }
98
99 USDSKELIMAGING_API
100 HdMatrix4fArrayDataSourceHandle GetSkinningTransforms();
101
103 USDSKELIMAGING_API
104 HdMatrix3fArrayDataSourceHandle GetSkinningScaleTransforms();
105
107 USDSKELIMAGING_API
108 HdVec4fArrayDataSourceHandle GetSkinningDualQuats();
109
110 USDSKELIMAGING_API
111 HdFloatArrayDataSourceHandle GetBlendShapeWeights();
112
116 USDSKELIMAGING_API
117 HdMatrixDataSourceHandle GetCommonSpaceToPrimLocal() const;
118
119 USDSKELIMAGING_API
120 HdSampledDataSourceHandle GetPoints();
121
122 USDSKELIMAGING_API
123 HdDataSourceBaseHandle GetGeomBindTransform();
124
125 USDSKELIMAGING_API
126 HdDataSourceBaseHandle GetHasConstantInfluences();
127
128 USDSKELIMAGING_API
129 HdDataSourceBaseHandle GetNumInfluencesPerComponent();
130
131 USDSKELIMAGING_API
132 HdDataSourceBaseHandle GetInfluences();
133
134 USDSKELIMAGING_API
135 HdDataSourceBaseHandle GetBlendShapeOffsets();
136
137 USDSKELIMAGING_API
138 HdDataSourceBaseHandle GetBlendShapeOffsetRanges();
139
140 USDSKELIMAGING_API
141 HdDataSourceBaseHandle GetNumBlendShapeOffsetRanges();
142
143 USDSKELIMAGING_API
144 HdSampledDataSourceHandle GetNormals() const;
145
146 USDSKELIMAGING_API
147 HdSampledDataSourceHandle GetFaceVertexIndices();
148
149 USDSKELIMAGING_API
150 HdDataSourceBaseHandle GetHasFaceVaryingNormals();
151
153 USDSKELIMAGING_API
154 std::shared_ptr<UsdSkelImagingBlendShapeData> GetBlendShapeData();
155
157 USDSKELIMAGING_API
158 std::shared_ptr<UsdSkelImagingJointInfluencesData> GetJointInfluencesData();
159
161 const TfToken &GetSkinningMethod() const {
162 return _skinningMethod;
163 }
164
167 bool HasExtComputations() const;
168
171
180 USDSKELIMAGING_API
181 static const HdDataSourceLocatorSet &
183
192 USDSKELIMAGING_API
194 const TfToken &dirtiedPrimType,
195 const HdDataSourceLocatorSet &dirtyLocators,
197
198private:
199 USDSKELIMAGING_API
201 HdSceneIndexBaseRefPtr const &sceneIndex,
202 SdfPath primPath,
203 HdContainerDataSourceHandle primSource,
204 bool hasSkelRoot,
205 VtArray<SdfPath> blendShapeTargetPaths,
206 SdfPath skelPath,
207 HdContainerDataSourceHandle skeletonPrimSource,
208 UsdSkelImagingResolvedSkeletonSchema resolvedSkeletonSchema);
209
210 bool
211 _ProcessDirtyLocators(
212 const HdDataSourceLocatorSet &dirtyLocators,
213 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
214 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
215 TfTokenVector * dirtyPrimvars);
216
217 bool
218 _ProcessDirtySkeletonLocators(
219 const HdDataSourceLocatorSet &dirtyLocators,
220 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
221 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
222 TfTokenVector * dirtyPrimvars);
223
224 bool
225 _ProcessDirtySkelBlendShapeLocators(
226 const HdDataSourceLocatorSet &dirtyLocators,
227 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
228 HdDataSourceLocatorSet * dirtyLocatorsForComputation,
229 TfTokenVector * dirtyPrimvars);
230
231 bool
232 _ProcessDirtyInstancerLocators(
233 const HdDataSourceLocatorSet &dirtyLocators,
234 HdDataSourceLocatorSet * dirtyLocatorsForAggregatorComputation,
235 HdDataSourceLocatorSet * dirtyLocatorsForComputation);
236
237 // Input scene.
238 HdSceneIndexBaseRefPtr const _sceneIndex;
239 // Path of prim in the input scene.
240 const SdfPath _primPath;
241 // Data source for _primPath from input scene _sceneIndex.
242 HdContainerDataSourceHandle const _primSource;
243 const bool _hasSkelRoot;
244 // From prim at _primPath in input scene _sceneIndex.
245 HdPrimvarsSchema const _primvars;
246 HdMeshSchema const _mesh;
247 const TfToken _skinningMethod;
248 VtArray<SdfPath> _blendShapeTargetPaths;
249 const SdfPath _skeletonPath;
250 HdContainerDataSourceHandle const _skeletonPrimSource;
251 const UsdSkelImagingResolvedSkeletonSchema _resolvedSkeletonSchema;
252
253 class _BlendShapeDataCache
254 : public UsdSkelImagingSharedPtrThunk<UsdSkelImagingBlendShapeData>
255 {
256 public:
257 _BlendShapeDataCache(
258 HdSceneIndexBaseRefPtr const &sceneIndex,
259 const SdfPath &primPath);
260 protected:
261 Handle _Compute() override;
262 private:
263 HdSceneIndexBaseRefPtr const _sceneIndex;
264 const SdfPath _primPath;
265 };
266 _BlendShapeDataCache _blendShapeDataCache;
267
268 class _JointInfluencesDataCache
269 : public UsdSkelImagingSharedPtrThunk<UsdSkelImagingJointInfluencesData>
270 {
271 public:
272 _JointInfluencesDataCache(
273 HdContainerDataSourceHandle const &primSource,
274 HdContainerDataSourceHandle const &skeletonPrimSource);
275 protected:
276 Handle _Compute() override;
277 private:
278 HdContainerDataSourceHandle const _primSource;
279 HdContainerDataSourceHandle const _skeletonPrimSource;
280 };
281 _JointInfluencesDataCache _jointInfluencesDataCache;
282
283 // Serves GetPrimWorldToLocal - taking instancing into account.
285};
286
287HD_DECLARE_DATASOURCE_HANDLES(UsdSkelImagingDataSourceResolvedPointsBasedPrim);
288
289PXR_NAMESPACE_CLOSE_SCOPE
290
291#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:281
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 ...
bool HasNormalsExtComputations() const
Should the normals for this primvar be given by an ext computation.
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