Atoms Crowd  4.1.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  template <typename T> void setJointMetadata(const unsigned int jointId, const std::string &metadataName, const AtomsPtr<AtomsCore::TypedArrayMetadata<T>> &value);
75 
77  template <typename T> const AtomsPtr<AtomsCore::TypedArrayMetadata<T>> getJointMetadata(const unsigned int jointId, const std::string &metadataName) const;
78 
80  const AtomsPtr<const AtomsCore::MapMetadata> getJointMetadatas(const unsigned int jointId) const;
81 
83  template <typename T> void setJointStaticMetadata(const unsigned int jointId, const std::string &metadataName, const AtomsPtr<AtomsCore::MetadataImpl<T>> &value);
84 
86  template <typename T> const AtomsPtr<AtomsCore::MetadataImpl<T>> getJointStaticMetadata(const unsigned int jointId, const std::string &metadataName) const;
87 
89  inline void setInParentSpace(bool flag);
90 
92  inline bool inParentSpace() const;
93 
95  const AtomsPtr<const AtomsCore::MapMetadata> getJointStaticMetadatas(const unsigned int jointId) const;
96 
98  const double getFps() const;
99 
101  const unsigned int getNumJoints() const;
102 
104  const unsigned int getNumFrames() const;
105 
107  const std::vector<std::string> getJointMetadataNames(const unsigned int jointId) const;
108 
110  const std::vector<std::string> getJointStaticMetadataNames(const unsigned int jointId) const;
111 
113  bool exportToFile(const std::string &clipPath);
114 
115  private:
116 
118  double m_fps;
119 
121  unsigned int m_numFrames;
122 
124  unsigned int m_numJoints;
125 
127  bool m_inParentSpace;
128 
130  std::vector<std::string> m_jointNames;
131 
133  AtomsCore::ArrayMetadata m_jointArray;
134 
135  };
136 }
137 
138 #include "AtomsClip.impl.h"
Atoms::AtomsClip::setJointRotations
void setJointRotations(const unsigned int jointId, AtomsCore::QuaternionArrayMetadata &jointRotations)
Sets joint rotations.
Atoms::AtomsClip::getJointRotations
AtomsPtr< const AtomsCore::QuaternionArrayMetadata > getJointRotations(const unsigned int jointId) const
Gets joint rotations.
Atoms::AtomsClip::AtomsClip
AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps, const bool parentSpace)
Constructor.
Atoms::AtomsClip::getJointStaticMetadatas
const AtomsPtr< const AtomsCore::MapMetadata > getJointStaticMetadatas(const unsigned int jointId) const
Gets all joint static metadatas.
Atoms::AtomsClip::getNumJoints
const unsigned int getNumJoints() const
get the number of joints
Atoms::AtomsClip::setJointTranslations
void setJointTranslations(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata &jointTranslations)
Sets joint translations.
Atoms::AtomsClip::~AtomsClip
~AtomsClip()
Destructor.
Atoms::AtomsClip::AtomsClip
AtomsClip(const std::string &clipPath)
Constructor.
Atoms::AtomsClip::getFps
const double getFps() const
Gets fps of this clip.
Atoms::AtomsClip::exportToFile
bool exportToFile(const std::string &clipPath)
Save this clip to disk.
Atoms::AtomsClip::getJointMetadatas
const AtomsPtr< const AtomsCore::MapMetadata > getJointMetadatas(const unsigned int jointId) const
Gets all joint metadatas.
Atoms::AtomsClip::setJointName
void setJointName(const unsigned int jointId, const std::string &name)
Sets the joint name.
AtomsCore::MetadataImpl
Metadata template class.
Definition: MetadataImpl.h:155
Atoms::AtomsClip::AtomsClip
AtomsClip(const unsigned int numFrames, const unsigned int numJoints, const double fps)
Constructor.
Atoms::AtomsClip
Atoms clip.
Definition: AtomsClip.h:25
AtomsCore::TypedArrayMetadata
Metadata template class.
Definition: TypedArrayMetadata.h:148
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::AtomsClip::getJointMetadataNames
const std::vector< std::string > getJointMetadataNames(const unsigned int jointId) const
Gets joint metadata names.
Atoms::AtomsClip::getNumFrames
const unsigned int getNumFrames() const
Gets hte number of frames.
Atoms::AtomsClip::getJointScales
AtomsPtr< const AtomsCore::Vector3ArrayMetadata > getJointScales(const unsigned int jointId) const
Gets joint scales.
AtomsCore::ArrayMetadata
ArrayMetadata class.
Definition: ArrayMetadata.h:23
Atoms::AtomsClip::setJointScales
void setJointScales(const unsigned int jointId, AtomsCore::Vector3ArrayMetadata &jointScales)
Sets joint scales.
Atoms::AtomsClip::getJointTranslations
AtomsPtr< const AtomsCore::Vector3ArrayMetadata > getJointTranslations(const unsigned int jointId) const
Sets joint translations.
Atoms::AtomsClip::getJointStaticMetadataNames
const std::vector< std::string > getJointStaticMetadataNames(const unsigned int jointId) const
Gets joint static metadata names.