24#ifndef PXR_USD_USD_SKEL_UTILS_H
25#define PXR_USD_USD_SKEL_UTILS_H
33#include "pxr/usd/usdSkel/api.h"
46#include "pxr/usd/sdf/path.h"
51#include "pxr/usd/usdSkel/bakeSkinning.h"
54PXR_NAMESPACE_OPEN_SCOPE
142 const VtMatrix4dArray& xforms,
143 const VtMatrix4dArray& inverseXforms,
144 VtMatrix4dArray* jointLocalXforms,
155 const VtMatrix4dArray& xforms,
156 VtMatrix4dArray* jointLocalXforms,
204 const VtMatrix4dArray& jointLocalXforms,
205 VtMatrix4dArray* xforms,
223template <
typename Matrix4>
229 const Matrix4* rootXform=
nullptr);
238 VtVec3fArray* extent,
249 VtVec3fArray* extent,
265template <
typename Matrix4>
274template <
typename Matrix4>
306 VtVec3fArray* translations,
307 VtQuatfArray* rotations,
308 VtVec3hArray* scales);
324template <
typename Matrix4>
333template <
typename Matrix4>
365 const VtQuatfArray& rotations,
366 const VtVec3hArray& scales,
367 VtMatrix4dArray* xforms);
396 float eps = std::numeric_limits<float>::epsilon());
410 int numInfluencesPerComponent);
417 int numInfluencesPerComponent);
444 int srcNumInfluencesPerComponent,
445 int newNumInfluencesPerComponent);
451 int srcNumInfluencesPerComponent,
452 int newNumInfluencesPerComponent);
484 int numInfluencesPerPoint,
486 bool inSerial=
false);
497 int numInfluencesPerPoint,
499 bool inSerial=
false);
509 int numInfluencesPerPoint,
511 bool inSerial=
false);
521 int numInfluencesPerPoint,
523 bool inSerial=
false);
532 const VtMatrix4dArray& jointXforms,
533 const VtIntArray& jointIndices,
534 const VtFloatArray& jointWeights,
535 int numInfluencesPerPoint,
536 VtVec3fArray* points);
547 const int* jointIndices,
548 const float* jointWeights,
549 size_t numInfluences,
550 int numInfluencesPerPoint,
553 bool inSerial=
false);
558UsdSkelSkinPointsLBS(
const GfMatrix4d& geomBindTransform,
562 int numInfluencesPerPoint,
564 bool inSerial=
false);
573 int numInfluencesPerPoint,
575 bool inSerial=
false);
584 int numInfluencesPerPoint,
586 bool inSerial=
false);
594 int numInfluencesPerPoint,
596 bool inSerial=
false);
604 const VtMatrix4dArray& jointXforms,
605 const VtIntArray& jointIndices,
606 const VtFloatArray& jointWeights,
607 int numInfluencesPerPoint,
608 VtVec3fArray* points);
618 const int* jointIndices,
619 const float* jointWeights,
620 size_t numInfluences,
621 int numInfluencesPerPoint,
624 bool inSerial=
false);
644 int numInfluencesPerPoint,
646 bool inSerial=
false);
657 int numInfluencesPerPoint,
659 bool inSerial=
false);
669 int numInfluencesPerPoint,
671 bool inSerial=
false);
681 int numInfluencesPerPoint,
683 bool inSerial=
false);
694 int numInfluencesPerPoint,
697 bool inSerial=
false);
707 int numInfluencesPerPoint,
710 bool inSerial=
false);
715UsdSkelSkinNormalsLBS(
const GfMatrix3d& geomBindTransform,
719 int numInfluencesPerPoint,
721 bool inSerial=
false);
731 int numInfluencesPerPoint,
733 bool inSerial=
false);
742 int numInfluencesPerPoint,
744 bool inSerial=
false);
753 int numInfluencesPerPoint,
755 bool inSerial=
false);
764 int numInfluencesPerPoint,
767 bool inSerial=
false);
776 int numInfluencesPerPoint,
779 bool inSerial=
false);
833 const int* jointIndices,
834 const float* jointWeights,
835 size_t numInfluences,
841UsdSkelSkinTransformLBS(
const GfMatrix4d& geomBindTransform,
880 const int* jointIndices,
881 const float* jointWeights,
882 size_t numInfluences,
899PXR_NAMESPACE_CLOSE_SCOPE
Defines all the types "TYPED" for which Vt creates a VtTYPEDArray typedef.
Stores a 3x3 matrix of double elements.
Stores a 3x3 matrix of float elements.
Stores a 4x4 matrix of double elements.
Stores a 4x4 matrix of float elements.
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Basic type: 3-dimensional floating point range.
Basic type: 3-space rotation specification.
Basic type for a vector of 3 float components.
Basic type for a vector of 3 GfHalf components.
Represents a range of contiguous elements.
Token for efficient comparison, assignment, and hashing of known strings.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Boundable prim type used to identify a scope beneath which skeletally-posed primitives are defined.
Object holding information describing skeleton topology.
USDSKEL_API bool UsdSkelResizeInfluences(VtIntArray *indices, int srcNumInfluencesPerComponent, int newNumInfluencesPerComponent)
Resize the number of influences per component in a weight or indices array, which initially has srcNu...
USDSKEL_API bool UsdSkelInterleaveInfluences(const TfSpan< const int > &indices, const TfSpan< const float > &weights, TfSpan< GfVec2f > interleavedInfluences)
Combine arrays of joint indices and weights into interleaved (index,weight) vectors.
USDSKEL_API bool UsdSkelExpandConstantInfluencesToVarying(VtIntArray *indices, size_t size)
Convert an array of constant influences (joint weights or indices) to an array of varying influences.
USDSKEL_API bool UsdSkelNormalizeWeights(TfSpan< float > weights, int numInfluencesPerComponent, float eps=std::numeric_limits< float >::epsilon())
Helper method to normalize weight values across each consecutive run of numInfluencesPerComponent ele...
USDSKEL_API bool UsdSkelSortInfluences(TfSpan< int > indices, TfSpan< float > weights, int numInfluencesPerComponent)
Sort joint influences such that highest weight values come first.
USDSKEL_API bool UsdSkelSkinFaceVaryingNormalsLBS(const GfMatrix3d &geomBindTransform, TfSpan< const GfMatrix3d > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< const int > faceVertexIndices, TfSpan< GfVec3f > normals, bool inSerial=false)
Skin normals with faceVarying interpolation using linear blend skinning.
USDSKEL_API bool UsdSkelApplyBlendShape(const float weight, const TfSpan< const GfVec3f > offsets, const TfSpan< const int > indices, TfSpan< GfVec3f > points)
Apply a single blend shape to points.
USDSKEL_API bool UsdSkelSkinTransform(const TfToken &skinningMethod, const GfMatrix4d &geomBindTransform, TfSpan< const GfMatrix4d > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, GfMatrix4d *xform)
Skin a transform using linear blend skinning (LBS) or dual quaternion skinning (DQS).
USDSKEL_API bool UsdSkelSkinNormals(const TfToken &skinningMethod, const GfMatrix3d &geomBindTransform, TfSpan< const GfMatrix3d > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< GfVec3f > normals, bool inSerial=false)
Skin normals using linear blend skinning (LBS) or dual quaternion skinning (DQS), for normals with ve...
USDSKEL_API bool UsdSkelSkinPoints(const TfToken &skinningMethod, const GfMatrix4d &geomBindTransform, TfSpan< const GfMatrix4d > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< GfVec3f > points, bool inSerial=false)
Skin points using linear blend skinning (LBS) or dual quaternion skinning (DQS).
USDSKEL_API bool UsdSkelSkinFaceVaryingNormals(const TfToken &skinningMethod, const GfMatrix3d &geomBindTransform, TfSpan< const GfMatrix3d > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< const int > faceVertexIndices, TfSpan< GfVec3f > normals, bool inSerial=false)
Skin normals with faceVarying interpolation using LBS or DQS.
USDSKEL_API bool UsdSkelIsSkinnablePrim(const UsdPrim &prim)
Returns true if prim is considered to be a skinnable primitive.
USDSKEL_API bool UsdSkelIsSkelAnimationPrim(const UsdPrim &prim)
Returns true if prim is a valid skel animation source.