Atoms Crowd  7.0.0
AtomsClip.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 
12 #include <AtomsCore/Metadata/Vector3ArrayMetadata.h>
13 #include <AtomsCore/Metadata/QuaternionArrayMetadata.h>
14 #include <AtomsCore/Metadata/TypedArrayMetadata.h>
15 #include <AtomsCore/Metadata/ArrayMetadata.h>
16 #include <AtomsCore/Metadata/MapMetadata.h>
17 
18 #define JOINT_META "jMeta"
19 #define JOINT_STATIC_META "jStMeta"
20 
21 namespace Atoms
22 {
24  class ATOMS_EXPORT AtomsClip
25  {
26  public:
27 
29  /*
30  \param clipPath clip file path
31  */
32  AtomsClip(const std::string& clipPath);
33 
35  /*
36  \param clipPath clip file path
37  */
38  AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps);
39 
41  /*
42  \param clipPath clip file path
43  */
44  AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps, const bool parentSpace);
45 
48 
50  void setJointName(const unsigned int jointId, const std::string &name);
51 
52  // Gets the joint name
53  const std::string& getJointName(const unsigned int jointId);
54 
56  void setJointTranslations(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata& jointTranslations);
57 
59  void setJointRotations(const unsigned int jointId, AtomsCore::QuaternionArrayMetadata& jointRotations);
60 
62  void setJointScales(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata& jointScales);
63 
65  AtomsPtr<const AtomsCore::Vector3ArrayMetadata> getJointTranslations(const unsigned int jointId) const;
66 
68  AtomsPtr<const AtomsCore::QuaternionArrayMetadata> getJointRotations(const unsigned int jointId) const;
69 
71  AtomsPtr<const AtomsCore::Vector3ArrayMetadata> getJointScales(const unsigned int jointId) const;
72 
74  void setJointMetadataBase(const unsigned int jointId, const std::string& metadataName, const AtomsPtr<AtomsCore::BaseTypedArrayMetadata>& value);
75 
77  template <typename T> void setJointMetadata(const unsigned int jointId, const std::string &metadataName, const AtomsPtr<AtomsCore::TypedArrayMetadata<T>> &value);
78 
80  template <typename T> const AtomsPtr<AtomsCore::TypedArrayMetadata<T>> getJointMetadata(const unsigned int jointId, const std::string &metadataName) const;
81 
83  const AtomsPtr<const AtomsCore::MapMetadata> getJointMetadatas(const unsigned int jointId) const;
84 
86  void setJointStaticMetadataBase(const unsigned int jointId, const std::string& metadataName, const AtomsPtr<AtomsCore::Metadata>& value);
87 
89  template <typename T> void setJointStaticMetadata(const unsigned int jointId, const std::string &metadataName, const AtomsPtr<AtomsCore::MetadataImpl<T>> &value);
90 
92  template <typename T> const AtomsPtr<AtomsCore::MetadataImpl<T>> getJointStaticMetadata(const unsigned int jointId, const std::string &metadataName) const;
93 
95  inline void setInParentSpace(bool flag);
96 
98  inline bool inParentSpace() const;
99 
101  const AtomsPtr<const AtomsCore::MapMetadata> getJointStaticMetadatas(const unsigned int jointId) const;
102 
104  const double getFps() const;
105 
107  const unsigned int getNumJoints() const;
108 
110  const unsigned int getNumFrames() const;
111 
113  const std::vector<std::string> getJointMetadataNames(const unsigned int jointId) const;
114 
116  const std::vector<std::string> getJointStaticMetadataNames(const unsigned int jointId) const;
117 
119  bool exportToFile(const std::string &clipPath);
120 
121  private:
122 
124  double m_fps;
125 
127  unsigned int m_numFrames;
128 
130  unsigned int m_numJoints;
131 
133  bool m_inParentSpace;
134 
136  std::vector<std::string> m_jointNames;
137 
139  AtomsCore::ArrayMetadata m_jointArray;
140 
141  };
142 }
143 
144 #include "AtomsClip.impl.h"
Atoms clip.
Definition: AtomsClip.h:25
void setJointMetadataBase(const unsigned int jointId, const std::string &metadataName, const AtomsPtr< AtomsCore::BaseTypedArrayMetadata > &value)
Sets joint animated metadata.
void setJointScales(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata &jointScales)
Sets joint scales.
void setJointRotations(const unsigned int jointId, AtomsCore::QuaternionArrayMetadata &jointRotations)
Sets joint rotations.
AtomsClip(const std::string &clipPath)
Constructor.
const std::vector< std::string > getJointMetadataNames(const unsigned int jointId) const
Gets joint metadata names.
const std::vector< std::string > getJointStaticMetadataNames(const unsigned int jointId) const
Gets joint static metadata names.
void setJointName(const unsigned int jointId, const std::string &name)
Sets the joint name.
const AtomsPtr< const AtomsCore::MapMetadata > getJointMetadatas(const unsigned int jointId) const
Gets all joint metadatas.
const AtomsPtr< const AtomsCore::MapMetadata > getJointStaticMetadatas(const unsigned int jointId) const
Gets all joint static metadatas.
const double getFps() const
Gets fps of this clip.
const unsigned int getNumJoints() const
get the number of joints
AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps)
Constructor.
bool exportToFile(const std::string &clipPath)
Save this clip to disk.
const unsigned int getNumFrames() const
Gets hte number of frames.
~AtomsClip()
Destructor.
void setJointTranslations(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata &jointTranslations)
Sets joint translations.
AtomsPtr< const AtomsCore::Vector3ArrayMetadata > getJointScales(const unsigned int jointId) const
Gets joint scales.
AtomsPtr< const AtomsCore::QuaternionArrayMetadata > getJointRotations(const unsigned int jointId) const
Gets joint rotations.
void setJointStaticMetadataBase(const unsigned int jointId, const std::string &metadataName, const AtomsPtr< AtomsCore::Metadata > &value)
Sets joint static metadata.
AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps, const bool parentSpace)
Constructor.
AtomsPtr< const AtomsCore::Vector3ArrayMetadata > getJointTranslations(const unsigned int jointId) const
Sets joint translations.
ArrayMetadata class.
Definition: ArrayMetadata.h:23
Metadata template class.
Definition: MetadataImpl.h:158
Metadata template class.
Definition: TypedArrayMetadata.h:160
Atoms namespace.
Definition: Agent.h:29