7#ifndef PXR_USD_USD_SKEL_UTILS_H
8#define PXR_USD_USD_SKEL_UTILS_H
16#include "pxr/usd/usdSkel/api.h"
29#include "pxr/usd/sdf/path.h"
34#include "pxr/usd/usdSkel/bakeSkinning.h"
37PXR_NAMESPACE_OPEN_SCOPE
125 const VtMatrix4dArray& xforms,
126 const VtMatrix4dArray& inverseXforms,
127 VtMatrix4dArray* jointLocalXforms,
138 const VtMatrix4dArray& xforms,
139 VtMatrix4dArray* jointLocalXforms,
187 const VtMatrix4dArray& jointLocalXforms,
188 VtMatrix4dArray* xforms,
206template <
typename Matrix4>
212 const Matrix4* rootXform=
nullptr);
221 VtVec3fArray* extent,
232 VtVec3fArray* extent,
248template <
typename Matrix4>
257template <
typename Matrix4>
289 VtVec3fArray* translations,
290 VtQuatfArray* rotations,
291 VtVec3hArray* scales);
307template <
typename Matrix4>
316template <
typename Matrix4>
348 const VtQuatfArray& rotations,
349 const VtVec3hArray& scales,
350 VtMatrix4dArray* xforms);
379 float eps = std::numeric_limits<float>::epsilon());
393 int numInfluencesPerComponent);
400 int numInfluencesPerComponent);
427 int srcNumInfluencesPerComponent,
428 int newNumInfluencesPerComponent);
434 int srcNumInfluencesPerComponent,
435 int newNumInfluencesPerComponent);
467 int numInfluencesPerPoint,
469 bool inSerial=
false);
480 int numInfluencesPerPoint,
482 bool inSerial=
false);
492 int numInfluencesPerPoint,
494 bool inSerial=
false);
504 int numInfluencesPerPoint,
506 bool inSerial=
false);
515 const VtMatrix4dArray& jointXforms,
516 const VtIntArray& jointIndices,
517 const VtFloatArray& jointWeights,
518 int numInfluencesPerPoint,
519 VtVec3fArray* points);
530 const int* jointIndices,
531 const float* jointWeights,
532 size_t numInfluences,
533 int numInfluencesPerPoint,
536 bool inSerial=
false);
541UsdSkelSkinPointsLBS(
const GfMatrix4d& geomBindTransform,
545 int numInfluencesPerPoint,
547 bool inSerial=
false);
556 int numInfluencesPerPoint,
558 bool inSerial=
false);
567 int numInfluencesPerPoint,
569 bool inSerial=
false);
577 int numInfluencesPerPoint,
579 bool inSerial=
false);
587 const VtMatrix4dArray& jointXforms,
588 const VtIntArray& jointIndices,
589 const VtFloatArray& jointWeights,
590 int numInfluencesPerPoint,
591 VtVec3fArray* points);
601 const int* jointIndices,
602 const float* jointWeights,
603 size_t numInfluences,
604 int numInfluencesPerPoint,
607 bool inSerial=
false);
627 int numInfluencesPerPoint,
629 bool inSerial=
false);
640 int numInfluencesPerPoint,
642 bool inSerial=
false);
652 int numInfluencesPerPoint,
654 bool inSerial=
false);
664 int numInfluencesPerPoint,
666 bool inSerial=
false);
677 int numInfluencesPerPoint,
680 bool inSerial=
false);
690 int numInfluencesPerPoint,
693 bool inSerial=
false);
698UsdSkelSkinNormalsLBS(
const GfMatrix3d& geomBindTransform,
702 int numInfluencesPerPoint,
704 bool inSerial=
false);
714 int numInfluencesPerPoint,
716 bool inSerial=
false);
725 int numInfluencesPerPoint,
727 bool inSerial=
false);
736 int numInfluencesPerPoint,
738 bool inSerial=
false);
747 int numInfluencesPerPoint,
750 bool inSerial=
false);
759 int numInfluencesPerPoint,
762 bool inSerial=
false);
816 const int* jointIndices,
817 const float* jointWeights,
818 size_t numInfluences,
824UsdSkelSkinTransformLBS(
const GfMatrix4d& geomBindTransform,
863 const int* jointIndices,
864 const float* jointWeights,
865 size_t numInfluences,
885PXR_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.