utils.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_USD_SKEL_UTILS_H
25 #define PXR_USD_USD_SKEL_UTILS_H
26 
31 
32 #include "pxr/pxr.h"
33 #include "pxr/usd/usdSkel/api.h"
34 
35 #include "pxr/base/gf/quatf.h"
36 #include "pxr/base/gf/matrix3d.h"
37 #include "pxr/base/gf/matrix3f.h"
38 #include "pxr/base/gf/matrix4d.h"
39 #include "pxr/base/gf/matrix4f.h"
40 #include "pxr/base/gf/vec3h.h"
41 #include "pxr/base/gf/vec3h.h"
42 #include "pxr/base/tf/span.h"
43 #include "pxr/base/vt/array.h"
44 #include "pxr/base/vt/types.h"
45 
46 #include "pxr/usd/sdf/path.h"
47 
48 #include <cstddef>
49 
50 // XXX: Included for backwards compatibility.
51 #include "pxr/usd/usdSkel/bakeSkinning.h"
52 
53 
54 PXR_NAMESPACE_OPEN_SCOPE
55 
56 
57 class GfMatrix3f;
58 class GfRange3f;
59 class GfRotation;
60 class UsdPrim;
61 class UsdPrimRange;
62 class UsdRelationship;
63 class UsdSkelRoot;
64 class UsdSkelTopology;
65 
66 
69 
70 
72 USDSKEL_API
73 bool
75 
76 
80 USDSKEL_API
81 bool
82 UsdSkelIsSkinnablePrim(const UsdPrim& prim);
83 
84 
88 
89 
102 USDSKEL_API
103 bool
106  TfSpan<const GfMatrix4d> inverseXforms,
107  TfSpan<GfMatrix4d> jointLocalXforms,
108  const GfMatrix4d* rootInverseXform=nullptr);
109 
111 USDSKEL_API
112 bool
115  TfSpan<const GfMatrix4f> inverseXforms,
116  TfSpan<GfMatrix4f> jointLocalXforms,
117  const GfMatrix4f* rootInverseXform=nullptr);
118 
122 USDSKEL_API
123 bool
126  TfSpan<GfMatrix4d> jointLocalXforms,
127  const GfMatrix4d* rootInverseXform=nullptr);
128 
129 USDSKEL_API
130 bool
133  TfSpan<GfMatrix4f> jointLocalXforms,
134  const GfMatrix4f* rootInverseXform=nullptr);
135 
136 
139 USDSKEL_API
140 bool
142  const VtMatrix4dArray& xforms,
143  const VtMatrix4dArray& inverseXforms,
144  VtMatrix4dArray* jointLocalXforms,
145  const GfMatrix4d* rootInverseXform=nullptr);
146 
147 
148 
149 
152 USDSKEL_API
153 bool
155  const VtMatrix4dArray& xforms,
156  VtMatrix4dArray* jointLocalXforms,
157  const GfMatrix4d* rootInverseXform=nullptr);
158 
159 
162 USDSKEL_API
163 bool
165  const GfMatrix4d* xforms,
166  const GfMatrix4d* inverseXforms,
167  GfMatrix4d* jointLocalXforms,
168  const GfMatrix4d* rootInverseXform=nullptr);
169 
170 
171 
181 USDSKEL_API
182 bool
184  TfSpan<const GfMatrix4d> jointLocalXforms,
185  TfSpan<GfMatrix4d> xforms,
186  const GfMatrix4d* rootXform=nullptr);
187 
188 
190 USDSKEL_API
191 bool
193  TfSpan<const GfMatrix4f> jointLocalXforms,
194  TfSpan<GfMatrix4f> xforms,
195  const GfMatrix4f* rootXform=nullptr);
196 
197 
198 
201 USDSKEL_API
202 bool
204  const VtMatrix4dArray& jointLocalXforms,
205  VtMatrix4dArray* xforms,
206  const GfMatrix4d* rootXform=nullptr);
207 
208 
211 USDSKEL_API
212 bool
214  const GfMatrix4d* jointLocalXforms,
215  GfMatrix4d* xforms,
216  const GfMatrix4d* rootXform=nullptr);
217 
218 
223 template <typename Matrix4>
224 USDSKEL_API
225 bool
227  GfRange3f* extent,
228  float pad=0.0f,
229  const Matrix4* rootXform=nullptr);
230 
231 
232 
235 USDSKEL_API
236 bool
237 UsdSkelComputeJointsExtent(const VtMatrix4dArray& joints,
238  VtVec3fArray* extent,
239  float pad=0.0f,
240  const GfMatrix4d* rootXform=nullptr);
241 
242 
245 USDSKEL_API
246 bool
248  size_t numXforms,
249  VtVec3fArray* extent,
250  float pad=0.0f,
251  const GfMatrix4d* rootXform=nullptr);
252 
253 
255 
256 
261 
262 
265 template <typename Matrix4>
266 USDSKEL_API
267 bool
268 UsdSkelDecomposeTransform(const Matrix4& xform,
269  GfVec3f* translate,
270  GfRotation* rotate,
271  GfVec3h* scale);
272 
274 template <typename Matrix4>
275 USDSKEL_API
276 bool
277 UsdSkelDecomposeTransform(const Matrix4& xform,
278  GfVec3f* translate,
279  GfQuatf* rotate,
280  GfVec3h* scale);
281 
282 
285 USDSKEL_API
286 bool
288  TfSpan<GfVec3f> translations,
289  TfSpan<GfQuatf> rotations,
290  TfSpan<GfVec3h> scales);
291 
293 USDSKEL_API
294 bool
296  TfSpan<GfVec3f> translations,
297  TfSpan<GfQuatf> rotations,
298  TfSpan<GfVec3h> scales);
299 
300 
303 USDSKEL_API
304 bool
305 UsdSkelDecomposeTransforms(const VtMatrix4dArray& xforms,
306  VtVec3fArray* translations,
307  VtQuatfArray* rotations,
308  VtVec3hArray* scales);
309 
310 
313 USDSKEL_API
314 bool
316  GfVec3f* translations,
317  GfQuatf* rotations,
318  GfVec3h* scales,
319  size_t count);
320 
321 
324 template <typename Matrix4>
325 USDSKEL_API
326 void
327 UsdSkelMakeTransform(const GfVec3f& translate,
328  const GfMatrix3f& rotate,
329  const GfVec3h& scale,
330  Matrix4* xform);
331 
333 template <typename Matrix4>
334 USDSKEL_API
335 void
336 UsdSkelMakeTransform(const GfVec3f& translate,
337  const GfQuatf& rotate,
338  const GfVec3h& scale,
339  Matrix4* xform);
340 
343 USDSKEL_API
344 bool
346  TfSpan<const GfQuatf> rotations,
347  TfSpan<const GfVec3h> scales,
348  TfSpan<GfMatrix4d> xforms);
349 
350 
352 USDSKEL_API
353 bool
355  TfSpan<const GfQuatf> rotations,
356  TfSpan<const GfVec3h> scales,
357  TfSpan<GfMatrix4f> xforms);
358 
359 
362 USDSKEL_API
363 bool
364 UsdSkelMakeTransforms(const VtVec3fArray& translations,
365  const VtQuatfArray& rotations,
366  const VtVec3hArray& scales,
367  VtMatrix4dArray* xforms);
368 
371 USDSKEL_API
372 bool
373 UsdSkelMakeTransforms(const GfVec3f* translations,
374  const GfQuatf* rotations,
375  const GfVec3h* scales,
376  GfMatrix4d* xforms,
377  size_t count);
378 
379 
381 
382 
387 
388 
393 USDSKEL_API
394 bool
395 UsdSkelNormalizeWeights(TfSpan<float> weights, int numInfluencesPerComponent,
396  float eps = std::numeric_limits<float>::epsilon());
397 
398 
401 USDSKEL_API
402 bool
403 UsdSkelNormalizeWeights(VtFloatArray* weights, int numInfluencesPerComponent);
404 
405 
407 USDSKEL_API
408 bool
410  int numInfluencesPerComponent);
411 
414 USDSKEL_API
415 bool
416 UsdSkelSortInfluences(VtIntArray* indices, VtFloatArray* weights,
417  int numInfluencesPerComponent);
418 
419 
426 USDSKEL_API
427 bool
428 UsdSkelExpandConstantInfluencesToVarying(VtIntArray* indices, size_t size);
429 
431 USDSKEL_API
432 bool
433 UsdSkelExpandConstantInfluencesToVarying(VtFloatArray* weights, size_t size);
434 
441 USDSKEL_API
442 bool
443 UsdSkelResizeInfluences(VtIntArray* indices,
444  int srcNumInfluencesPerComponent,
445  int newNumInfluencesPerComponent);
446 
448 USDSKEL_API
449 bool
450 UsdSkelResizeInfluences(VtFloatArray* weights,
451  int srcNumInfluencesPerComponent,
452  int newNumInfluencesPerComponent);
453 
456 USDSKEL_API
457 bool
459  const TfSpan<const float>& weights,
460  TfSpan<GfVec2f> interleavedInfluences);
461 
462 
464 
465 
469 
470 
477 USDSKEL_API
478 bool
479 UsdSkelSkinPoints(const TfToken& skinningMethod,
480  const GfMatrix4d& geomBindTransform,
481  TfSpan<const GfMatrix4d> jointXforms,
482  TfSpan<const int> jointIndices,
483  TfSpan<const float> jointWeights,
484  int numInfluencesPerPoint,
485  TfSpan<GfVec3f> points,
486  bool inSerial=false);
487 
488 
490 USDSKEL_API
491 bool
492 UsdSkelSkinPoints(const TfToken& skinningMethod,
493  const GfMatrix4f& geomBindTransform,
494  TfSpan<const GfMatrix4f> jointXforms,
495  TfSpan<const int> jointIndices,
496  TfSpan<const float> jointWeights,
497  int numInfluencesPerPoint,
498  TfSpan<GfVec3f> points,
499  bool inSerial=false);
500 
501 
503 USDSKEL_API
504 bool
505 UsdSkelSkinPoints(const TfToken& skinningMethod,
506  const GfMatrix4d& geomBindTransform,
507  TfSpan<const GfMatrix4d> jointXforms,
508  TfSpan<const GfVec2f> influences,
509  int numInfluencesPerPoint,
510  TfSpan<GfVec3f> points,
511  bool inSerial=false);
512 
513 
515 USDSKEL_API
516 bool
517 UsdSkelSkinPoints(const TfToken& skinningMethod,
518  const GfMatrix4f& geomBindTransform,
519  TfSpan<const GfMatrix4f> jointXforms,
520  TfSpan<const GfVec2f> influences,
521  int numInfluencesPerPoint,
522  TfSpan<GfVec3f> points,
523  bool inSerial=false);
524 
525 
528 USDSKEL_API
529 bool
530 UsdSkelSkinPoints(const TfToken& skinningMethod,
531  const GfMatrix4d& geomBindTransform,
532  const VtMatrix4dArray& jointXforms,
533  const VtIntArray& jointIndices,
534  const VtFloatArray& jointWeights,
535  int numInfluencesPerPoint,
536  VtVec3fArray* points);
537 
538 
541 USDSKEL_API
542 bool
543 UsdSkelSkinPoints(const TfToken& skinningMethod,
544  const GfMatrix4d& geomBindTransform,
545  const GfMatrix4d* jointXforms,
546  size_t numJoints,
547  const int* jointIndices,
548  const float* jointWeights,
549  size_t numInfluences,
550  int numInfluencesPerPoint,
551  GfVec3f* points,
552  size_t numPoints,
553  bool inSerial=false);
554 
555 
556 USDSKEL_API
557 bool
558 UsdSkelSkinPointsLBS(const GfMatrix4d& geomBindTransform,
559  TfSpan<const GfMatrix4d> jointXforms,
560  TfSpan<const int> jointIndices,
561  TfSpan<const float> jointWeights,
562  int numInfluencesPerPoint,
563  TfSpan<GfVec3f> points,
564  bool inSerial=false);
565 
567 USDSKEL_API
568 bool
569 UsdSkelSkinPointsLBS(const GfMatrix4f& geomBindTransform,
570  TfSpan<const GfMatrix4f> jointXforms,
571  TfSpan<const int> jointIndices,
572  TfSpan<const float> jointWeights,
573  int numInfluencesPerPoint,
574  TfSpan<GfVec3f> points,
575  bool inSerial=false);
576 
577 
579 USDSKEL_API
580 bool
581 UsdSkelSkinPointsLBS(const GfMatrix4d& geomBindTransform,
582  TfSpan<const GfMatrix4d> jointXforms,
583  TfSpan<const GfVec2f> influences,
584  int numInfluencesPerPoint,
585  TfSpan<GfVec3f> points,
586  bool inSerial=false);
587 
589 USDSKEL_API
590 bool
591 UsdSkelSkinPointsLBS(const GfMatrix4f& geomBindTransform,
592  TfSpan<const GfMatrix4f> jointXforms,
593  TfSpan<const GfVec2f> influences,
594  int numInfluencesPerPoint,
595  TfSpan<GfVec3f> points,
596  bool inSerial=false);
597 
598 
601 USDSKEL_API
602 bool
603 UsdSkelSkinPointsLBS(const GfMatrix4d& geomBindTransform,
604  const VtMatrix4dArray& jointXforms,
605  const VtIntArray& jointIndices,
606  const VtFloatArray& jointWeights,
607  int numInfluencesPerPoint,
608  VtVec3fArray* points);
609 
610 
613 USDSKEL_API
614 bool
615 UsdSkelSkinPointsLBS(const GfMatrix4d& geomBindTransform,
616  const GfMatrix4d* jointXforms,
617  size_t numJoints,
618  const int* jointIndices,
619  const float* jointWeights,
620  size_t numInfluences,
621  int numInfluencesPerPoint,
622  GfVec3f* points,
623  size_t numPoints,
624  bool inSerial=false);
625 
626 
637 USDSKEL_API
638 bool
639 UsdSkelSkinNormals(const TfToken& skinningMethod,
640  const GfMatrix3d& geomBindTransform,
641  TfSpan<const GfMatrix3d> jointXforms,
642  TfSpan<const int> jointIndices,
643  TfSpan<const float> jointWeights,
644  int numInfluencesPerPoint,
645  TfSpan<GfVec3f> normals,
646  bool inSerial=false);
647 
648 
650 USDSKEL_API
651 bool
652 UsdSkelSkinNormals(const TfToken& skinningMethod,
653  const GfMatrix3f& geomBindTransform,
654  TfSpan<const GfMatrix3f> jointXforms,
655  TfSpan<const int> jointIndices,
656  TfSpan<const float> jointWeights,
657  int numInfluencesPerPoint,
658  TfSpan<GfVec3f> normals,
659  bool inSerial=false);
660 
661 
663 USDSKEL_API
664 bool
665 UsdSkelSkinNormals(const TfToken& skinningMethod,
666  const GfMatrix3d& geomBindTransform,
667  TfSpan<const GfMatrix3d> jointXforms,
668  TfSpan<const GfVec2f> influences,
669  int numInfluencesPerPoint,
670  TfSpan<GfVec3f> normals,
671  bool inSerial=false);
672 
673 
675 USDSKEL_API
676 bool
677 UsdSkelSkinNormals(const TfToken& skinningMethod,
678  const GfMatrix3f& geomBindTransform,
679  TfSpan<const GfMatrix3f> jointXforms,
680  TfSpan<const GfVec2f> influences,
681  int numInfluencesPerPoint,
682  TfSpan<GfVec3f> normals,
683  bool inSerial=false);
684 
685 
687 USDSKEL_API
688 bool
689 UsdSkelSkinFaceVaryingNormals(const TfToken& skinningMethod,
690  const GfMatrix3d& geomBindTransform,
691  TfSpan<const GfMatrix3d> jointXforms,
692  TfSpan<const int> jointIndices,
693  TfSpan<const float> jointWeights,
694  int numInfluencesPerPoint,
695  TfSpan<const int> faceVertexIndices,
696  TfSpan<GfVec3f> normals,
697  bool inSerial=false);
698 
700 USDSKEL_API
701 bool
702 UsdSkelSkinFaceVaryingNormals(const TfToken& skinningMethod,
703  const GfMatrix3f& geomBindTransform,
704  TfSpan<const GfMatrix3f> jointXforms,
705  TfSpan<const int> jointIndices,
706  TfSpan<const float> jointWeights,
707  int numInfluencesPerPoint,
708  TfSpan<const int> faceVertexIndices,
709  TfSpan<GfVec3f> normals,
710  bool inSerial=false);
711 
712 
713 USDSKEL_API
714 bool
715 UsdSkelSkinNormalsLBS(const GfMatrix3d& geomBindTransform,
716  TfSpan<const GfMatrix3d> jointXforms,
717  TfSpan<const int> jointIndices,
718  TfSpan<const float> jointWeights,
719  int numInfluencesPerPoint,
720  TfSpan<GfVec3f> normals,
721  bool inSerial=false);
722 
723 
725 USDSKEL_API
726 bool
727 UsdSkelSkinNormalsLBS(const GfMatrix3f& geomBindTransform,
728  TfSpan<const GfMatrix3f> jointXforms,
729  TfSpan<const int> jointIndices,
730  TfSpan<const float> jointWeights,
731  int numInfluencesPerPoint,
732  TfSpan<GfVec3f> normals,
733  bool inSerial=false);
734 
735 
737 USDSKEL_API
738 bool
739 UsdSkelSkinNormalsLBS(const GfMatrix3d& geomBindTransform,
740  TfSpan<const GfMatrix3d> jointXforms,
741  TfSpan<const GfVec2f> influences,
742  int numInfluencesPerPoint,
743  TfSpan<GfVec3f> normals,
744  bool inSerial=false);
745 
746 
748 USDSKEL_API
749 bool
750 UsdSkelSkinNormalsLBS(const GfMatrix3f& geomBindTransform,
751  TfSpan<const GfMatrix3f> jointXforms,
752  TfSpan<const GfVec2f> influences,
753  int numInfluencesPerPoint,
754  TfSpan<GfVec3f> normals,
755  bool inSerial=false);
756 
758 USDSKEL_API
759 bool
760 UsdSkelSkinFaceVaryingNormalsLBS(const GfMatrix3d& geomBindTransform,
761  TfSpan<const GfMatrix3d> jointXforms,
762  TfSpan<const int> jointIndices,
763  TfSpan<const float> jointWeights,
764  int numInfluencesPerPoint,
765  TfSpan<const int> faceVertexIndices,
766  TfSpan<GfVec3f> normals,
767  bool inSerial=false);
768 
770 USDSKEL_API
771 bool
772 UsdSkelSkinFaceVaryingNormalsLBS(const GfMatrix3f& geomBindTransform,
773  TfSpan<const GfMatrix3f> jointXforms,
774  TfSpan<const int> jointIndices,
775  TfSpan<const float> jointWeights,
776  int numInfluencesPerPoint,
777  TfSpan<const int> faceVertexIndices,
778  TfSpan<GfVec3f> normals,
779  bool inSerial=false);
780 
781 
787 USDSKEL_API
788 bool
789 UsdSkelSkinTransform(const TfToken& skinningMethod,
790  const GfMatrix4d& geomBindTransform,
791  TfSpan<const GfMatrix4d> jointXforms,
792  TfSpan<const int> jointIndices,
793  TfSpan<const float> jointWeights,
794  GfMatrix4d* xform);
795 
797 USDSKEL_API
798 bool
799 UsdSkelSkinTransform(const TfToken& skinningMethod,
800  const GfMatrix4f& geomBindTransform,
801  TfSpan<const GfMatrix4f> jointXforms,
802  TfSpan<const int> jointIndices,
803  TfSpan<const float> jointWeights,
804  GfMatrix4f* xform);
805 
808 USDSKEL_API
809 bool
810 UsdSkelSkinTransform(const TfToken& skinningMethod,
811  const GfMatrix4d& geomBindTransform,
812  TfSpan<const GfMatrix4d> jointXforms,
813  TfSpan<const GfVec2f> influences,
814  GfMatrix4d* xform);
815 
817 USDSKEL_API
818 bool
819 UsdSkelSkinTransform(const TfToken& skinningMethod,
820  const GfMatrix4f& geomBindTransform,
821  TfSpan<const GfMatrix4f> jointXforms,
822  TfSpan<const GfVec2f> influences,
823  GfMatrix4f* xform);
824 
827 USDSKEL_API
828 bool
829 UsdSkelSkinTransform(const TfToken& skinningMethod,
830  const GfMatrix4d& geomBindTransform,
831  const GfMatrix4d* jointXforms,
832  size_t numJoints,
833  const int* jointIndices,
834  const float* jointWeights,
835  size_t numInfluences,
836  GfMatrix4d* xform);
837 
838 
839 USDSKEL_API
840 bool
841 UsdSkelSkinTransformLBS(const GfMatrix4d& geomBindTransform,
842  TfSpan<const GfMatrix4d> jointXforms,
843  TfSpan<const int> jointIndices,
844  TfSpan<const float> jointWeights,
845  GfMatrix4d* xform);
846 
848 USDSKEL_API
849 bool
850 UsdSkelSkinTransformLBS(const GfMatrix4f& geomBindTransform,
851  TfSpan<const GfMatrix4f> jointXforms,
852  TfSpan<const int> jointIndices,
853  TfSpan<const float> jointWeights,
854  GfMatrix4f* xform);
855 
858 USDSKEL_API
859 bool
860 UsdSkelSkinTransformLBS(const GfMatrix4d& geomBindTransform,
861  TfSpan<const GfMatrix4d> jointXforms,
862  TfSpan<const GfVec2f> influences,
863  GfMatrix4d* xform);
864 
866 USDSKEL_API
867 bool
868 UsdSkelSkinTransformLBS(const GfMatrix4f& geomBindTransform,
869  TfSpan<const GfMatrix4f> jointXforms,
870  TfSpan<const GfVec2f> influences,
871  GfMatrix4f* xform);
872 
875 USDSKEL_API
876 bool
877 UsdSkelSkinTransformLBS(const GfMatrix4d& geomBindTransform,
878  const GfMatrix4d* jointXforms,
879  size_t numJoints,
880  const int* jointIndices,
881  const float* jointWeights,
882  size_t numInfluences,
883  GfMatrix4d* xform);
884 
885 
891 USDSKEL_API
892 bool
893 UsdSkelApplyBlendShape(const float weight,
894  const TfSpan<const GfVec3f> offsets,
895  const TfSpan<const int> indices,
896  TfSpan<GfVec3f> points);
897 
898 
899 PXR_NAMESPACE_CLOSE_SCOPE
900 
901 
902 #endif // PXR_USD_USD_SKEL_UTILS_H
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 UsdSkelComputeJointLocalTransforms(const UsdSkelTopology &topology, TfSpan< const GfMatrix4d > xforms, TfSpan< const GfMatrix4d > inverseXforms, TfSpan< GfMatrix4d > jointLocalXforms, const GfMatrix4d *rootInverseXform=nullptr)
Compute joint transforms in joint-local space.
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.
Stores a 4x4 matrix of float elements.
Definition: matrix4f.h:87
Object holding information describing skeleton topology.
Definition: topology.h:45
USDSKEL_API bool UsdSkelDecomposeTransforms(TfSpan< const GfMatrix4d > xforms, TfSpan< GfVec3f > translations, TfSpan< GfQuatf > rotations, TfSpan< GfVec3h > scales)
Decompose an array of transforms into translate/rotate/scale components.
Basic type for a vector of 3 float components.
Definition: vec3f.h:62
USDSKEL_API bool UsdSkelConcatJointTransforms(const UsdSkelTopology &topology, TfSpan< const GfMatrix4d > jointLocalXforms, TfSpan< GfMatrix4d > xforms, const GfMatrix4d *rootXform=nullptr)
Compute concatenated joint transforms.
USDSKEL_API bool UsdSkelIsSkinnablePrim(const UsdPrim &prim)
Returns true if prim is considered to be a skinnable primitive.
USDSKEL_API bool UsdSkelSkinPointsLBS(const GfMatrix4f &geomBindTransform, TfSpan< const GfMatrix4f > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< GfVec3f > points, bool inSerial=false)
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Definition: quatf.h:59
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 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 UsdSkelResizeInfluences(VtIntArray *indices, int srcNumInfluencesPerComponent, int newNumInfluencesPerComponent)
Resize the number of influences per component in a weight or indices array, which initially has srcNu...
Stores a 3x3 matrix of float elements.
Definition: matrix3f.h:81
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
USDSKEL_API void UsdSkelMakeTransform(const GfVec3f &translate, const GfMatrix3f &rotate, const GfVec3h &scale, Matrix4 *xform)
Create a transform from translate/rotate/scale components.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:87
Represents a range of contiguous elements.
Definition: span.h:87
Basic type: 3-dimensional floating point range.
Definition: range3f.h:63
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:135
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 UsdSkelDecomposeTransform(const Matrix4 &xform, GfVec3f *translate, GfRotation *rotate, GfVec3h *scale)
Decompose a transform into translate/rotate/scale components.
USDSKEL_API bool UsdSkelSkinNormalsLBS(const GfMatrix3f &geomBindTransform, TfSpan< const GfMatrix3f > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, int numInfluencesPerPoint, TfSpan< GfVec3f > normals, bool inSerial=false)
USDSKEL_API bool UsdSkelComputeJointsExtent(TfSpan< const Matrix4 > joints, GfRange3f *extent, float pad=0.0f, const Matrix4 *rootXform=nullptr)
Compute an extent from a set of skel-space joint transform.
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
Defines all the types "TYPED" for which Vt creates a VtTYPEDArray typedef.
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.
Boundable prim type used to identify a scope beneath which skeletally-posed primitives are defined.
Definition: root.h:63
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Definition: primRange.h:118
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 UsdSkelMakeTransforms(TfSpan< const GfVec3f > translations, TfSpan< const GfQuatf > rotations, TfSpan< const GfVec3h > scales, TfSpan< GfMatrix4d > xforms)
Create transforms from arrays of components.
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).
Stores a 3x3 matrix of double elements.
Definition: matrix3d.h:81
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 UsdSkelSkinTransformLBS(const GfMatrix4f &geomBindTransform, TfSpan< const GfMatrix4f > jointXforms, TfSpan< const int > jointIndices, TfSpan< const float > jointWeights, GfMatrix4f *xform)
USDSKEL_API bool UsdSkelIsSkelAnimationPrim(const UsdPrim &prim)
Returns true if prim is a valid skel animation source.
Basic type: 3-space rotation specification.
Definition: rotation.h:54
Basic type for a vector of 3 GfHalf components.
Definition: vec3h.h:63
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...