HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTF_AnimationData.h
Go to the documentation of this file.
1 #ifndef __GLTF_AnimationData_h__
2 #define __GLTF_AnimationData_h__
3 
4 #include "GLTFZ_API.h"
5 #include "GLTF_Channel.h"
6 #include "GLTF_Types.h"
7 
8 #include <UT/UT_Assert.h>
9 #include <UT/UT_Array.h>
10 #include <UT/UT_StringHolder.h>
11 
13 {
14 public:
15 
16  void setId(const GLTF_Index id) { myId = id; }
17  GLTF_Index getId() const { return myId; }
18 
19  void setName(const char* name) { myName = name; }
20  const UT_StringHolder& getName() const { return myName; }
21 
22  fpreal getStart() const { return myStartTime; }
23  fpreal getEnd() const { return myEndTime; }
24 
25  void setTimeRange(const fpreal begin, const fpreal end)
26  {
27  myStartTime = begin;
28  myEndTime = end;
29  }
30 
31  void setNumChannels(int num) { myChannels.entries(num); }
32  exint getNumChannels() const { return myChannels.entries(); }
34  {
35  UT_ASSERT(i < myChannels.entries());
36  return myChannels[i];
37  }
38  const GLTF_Channel& getChannel(int i) const
39  {
40  UT_ASSERT(i < myChannels.entries());
41  return myChannels[i];
42  }
43 
44  void addChannel(
45  const GLTF_Index node_target,
46  const GLTF_ChannelTarget anim_target,
47  const GLTF_Interpolation interpolation,
48  const UT_SharedPtr<GLTF_AnimChannelSource>& anim_source);
49 
50 private:
51  GLTF_Index myId;
52  UT_StringHolder myName;
53  UT_Array<GLTF_Channel> myChannels;
54 
55  fpreal myStartTime;
56  fpreal myEndTime;
57 };
58 
60 {
61 public:
62  bool hasAnimations() const
63  {
64  return myAnimations.entries() > 0;
65  }
66 
68  {
69  myAnimations.entries(count);
70  }
71 
73  {
74  return myAnimations.entries();
75  }
76 
78  {
79  UT_ASSERT(id < myAnimations.entries());
80  return myAnimations[id];
81  }
83  {
84  UT_ASSERT(id < myAnimations.entries());
85  return myAnimations[id];
86  }
87 
88  void clear() { myAnimations.clear(); }
89 
90  bool isNodeAnimated(const GLTF_Index node_id) const;
91  const GLTF_Channel* findChannel(
93  const GLTF_Index node_id) const;
94 
95 private:
96 
97  UT_Array<GLTF_Animation> myAnimations;
98 };
99 
100 #endif
int64 exint
Definition: SYS_Types.h:125
const GLTF_Channel & getChannel(int i) const
exint numAnimations() const
void setNumChannels(int num)
void setName(const char *name)
GLTF_Animation & getAnimation(GLTF_Index id)
void setId(const GLTF_Index id)
exint getNumChannels() const
const UT_StringHolder & getName() const
GLTF_Interpolation
Definition: GLTF_Channel.h:24
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
GLuint GLuint end
Definition: glcorearb.h:475
GLenum target
Definition: glcorearb.h:1667
GLuint id
Definition: glcorearb.h:655
fpreal getEnd() const
GLuint const GLchar * name
Definition: glcorearb.h:786
void setNumAnimations(GLTF_Index count)
GLTF_Channel & getChannel(int i)
std::size_t GLTF_Index
Definition: GLTF_Types.h:13
GLTF_ChannelTarget
Definition: GLTF_Channel.h:16
void setTimeRange(const fpreal begin, const fpreal end)
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:587
fpreal64 fpreal
Definition: SYS_Types.h:283
fpreal getStart() const
GLTF_Index getId() const
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
const GLTF_Animation & getAnimation(GLTF_Index id) const
bool hasAnimations() const
#define GLTFZ_API
Definition: GLTFZ_API.h:37
GLint GLsizei count
Definition: glcorearb.h:405