HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_Channel.h
Go to the documentation of this file.
1 #ifndef __GLTF_Channel_h__
2 #define __GLTF_Channel_h__
3 
4 #include "GLTFZ_API.h"
5 #include "GLTF_Types.h"
6 
7 #include <CL/CL_SimpleChannel.h>
8 #include <UT/UT_Array.h>
9 #include <UT/UT_Quaternion.h>
10 #include <UT/UT_Set.h>
11 #include <UT/UT_SharedPtr.h>
12 #include <UT/UT_Vector3.h>
13 
14 class OBJ_Node;
15 
17 {
19  Rotation,
20  Scale,
21  Weight
22 };
23 
25 {
26  Constant,
27  Linear,
28  Cubic
29 };
30 
32 {
33 public:
34 
35  GLTF_AnimChannelSource() = default;
36  virtual ~GLTF_AnimChannelSource() = default;
37  GLTF_AnimChannelSource(const GLTF_AnimChannelSource& other) = default;
40 
41  virtual GLTF_AnimChannelSource*
42  clone() = 0;
43 
44  bool hasTarget(GLTF_ChannelTarget target);
45 
46  virtual bool getTranslation(
47  fpreal time,
48  UT_Vector3F& trans) = 0;
49  virtual bool getRotation(
50  fpreal time,
51  UT_Quaternion& rot) = 0;
52  virtual bool getScale(
53  fpreal time,
54  UT_Vector3F& scale) = 0;
55  virtual bool getWeight(
56  fpreal time,
57  float& weight) = 0;
58 
59  virtual UT_XformOrder getXformOrder(fpreal time) const = 0;
60 
61 protected:
62 
64 };
65 
67 {
68 public:
70  ~GLTF_ObjectSource() override = default;
71  GLTF_ObjectSource(const GLTF_ObjectSource&) = default;
74 
76 
77  GLTF_AnimChannelSource* clone() override;
78 
79  bool getTranslation(
80  fpreal time,
81  UT_Vector3F& trans) override;
82  bool getRotation(
83  fpreal time,
84  UT_Quaternion& rot) override;
85  bool getScale(
86  fpreal time,
87  UT_Vector3F& scale) override;
88  bool getWeight(
89  fpreal time,
90  float& weight) override;
91 
92  UT_XformOrder getXformOrder(fpreal time) const override;
93 
94 private:
95 
96  OBJ_Node* myNode = nullptr;
97 };
98 
100 {
101  GLTF_Channel() = default;
102  ~GLTF_Channel() = default;
103 
104  GLTF_Channel(const GLTF_Channel&);
106 
108 
109  void setChannelTarget(GLTF_ChannelTarget target);
110  void setInterpolation(GLTF_Interpolation interp) { myInterpolation = interp; }
111  void fillChannelComponents();
112 
116 
118 
119  // This can be a Vec3 or a Vec4 depending on myChannelTarget
121 
123 
125 };
126 
127 #endif
UT_Array< float > myKeyframes
Definition: GLTF_Channel.h:117
virtual bool getTranslation(fpreal time, UT_Vector3F &trans)=0
virtual bool getRotation(fpreal time, UT_Quaternion &rot)=0
GT_API const UT_StringHolder time
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
GA_API const UT_StringHolder rot
virtual GLTF_AnimChannelSource * clone()=0
void setInterpolation(GLTF_Interpolation interp)
Definition: GLTF_Channel.h:110
virtual bool getWeight(fpreal time, float &weight)=0
GA_API const UT_StringHolder scale
GLTF_AnimChannelSource & operator=(const GLTF_AnimChannelSource &other)=default
GLTF_Interpolation
Definition: GLTF_Channel.h:24
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
GA_API const UT_StringHolder trans
UT_SharedPtr< GLTF_AnimChannelSource > mySource
Definition: GLTF_Channel.h:124
GLenum target
Definition: glcorearb.h:1667
virtual UT_XformOrder getXformOrder(fpreal time) const =0
std::size_t GLTF_Index
Definition: GLTF_Types.h:13
virtual bool getScale(fpreal time, UT_Vector3F &scale)=0
GLTF_ChannelTarget
Definition: GLTF_Channel.h:16
fpreal64 fpreal
Definition: SYS_Types.h:283
LeafData & operator=(const LeafData &)=delete
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3×3's rows.
Definition: Mat.h:633
GLTF_ChannelTarget myChannelTarget
Definition: GLTF_Channel.h:114
#define GLTFZ_API
Definition: GLTFZ_API.h:37
UT_Set< GLTF_ChannelTarget > myTargets
Definition: GLTF_Channel.h:63
UT_Array< CL_SimpleChannel > myChannelComponents
Definition: GLTF_Channel.h:122
GLTF_Interpolation myInterpolation
Definition: GLTF_Channel.h:115
UT_Array< float > myValues
Definition: GLTF_Channel.h:120
GLTF_Index myNodeTarget
Definition: GLTF_Channel.h:113