17 dataOut << evaluator._name;
19 dataOut << evaluator._duration;
21 dataOut << evaluator._ticksPerSecond;
23 dataOut << static_cast<uint32_t>(evaluator.
_channels.size());
30 uint32_t nsize =
static_cast<uint32_t
>(
channel._positionKeys.size());
33 for (
size_t i = 0; i < nsize; i++) {
35 dataOut <<
channel._positionKeys[i].mTime;
37 dataOut <<
channel._positionKeys[i].mValue.x;
38 dataOut <<
channel._positionKeys[i].mValue.y;
39 dataOut <<
channel._positionKeys[i].mValue.z;
42 nsize =
static_cast<uint32_t
>(
channel._rotationKeys.size());
46 for (
size_t i = 0; i < nsize; i++) {
48 dataOut <<
channel._rotationKeys[i].mTime;
50 dataOut <<
channel._rotationKeys[i].mValue.x;
51 dataOut <<
channel._rotationKeys[i].mValue.y;
52 dataOut <<
channel._rotationKeys[i].mValue.z;
53 dataOut <<
channel._rotationKeys[i].mValue.w;
56 nsize =
static_cast<uint32_t
>(
channel._scalingKeys.size());
60 for (
size_t i = 0; i < nsize; i++) {
62 dataOut <<
channel._scalingKeys[i].mTime;
64 dataOut <<
channel._scalingKeys[i].mValue.x;
65 dataOut <<
channel._scalingKeys[i].mValue.y;
66 dataOut <<
channel._scalingKeys[i].mValue.z;
78 dataIn >> evaluator._name;
80 dataIn >> evaluator._duration;
82 dataIn >> evaluator._ticksPerSecond;
95 channel._positionKeys.resize(nsize);
97 for (
size_t i = 0; i < nsize; i++) {
98 aiVectorKey& pos =
channel._positionKeys[i];
102 dataIn >> pos.mValue.x;
103 dataIn >> pos.mValue.y;
104 dataIn >> pos.mValue.z;
109 channel._rotationKeys.resize(nsize);
111 for (
size_t i = 0; i < nsize; i++) {
112 aiQuatKey& rot =
channel._rotationKeys[i];
116 dataIn >> rot.mValue.x;
117 dataIn >> rot.mValue.y;
118 dataIn >> rot.mValue.z;
119 dataIn >> rot.mValue.w;
124 channel._scalingKeys.resize(nsize);
126 for (
size_t i = 0; i < nsize; i++) {
127 aiVectorKey& scale =
channel._scalingKeys[i];
129 dataIn >> scale.mTime;
131 dataIn >> scale.mValue.x;
132 dataIn >> scale.mValue.y;
133 dataIn >> scale.mValue.z;
151 dataOut << bone->name();
155 const uint32_t nsize =
static_cast<uint32_t
>(
_animations.size());
158 for (uint32_t i(0); i < nsize; i++) {
178 for (uint32_t i(0); i < nsize; i++) {
187 for (uint32_t idx = 0; idx < nsize; ++idx)
189 _animations[idx] = std::make_unique<AnimEvaluator>();
205 dataOut <<
parent->name();
207 dataOut <<
parent->offsetMatrix();
209 dataOut <<
parent->originalLocalTransform();
212 const uint32_t nsize =
static_cast<uint32_t
>(
parent->_children.size());
228 dataIn >> tempString;
230 Bone* internalNode =
new Bone(tempString);
235 dataIn >> temp; internalNode->offsetMatrix(temp);
237 dataIn >> temp; internalNode->originalLocalTransform(temp);
240 internalNode->localTransform(internalNode->originalLocalTransform());
248 for (
U32 a = 0u; a < nsize; a++) {
static void save(const AnimEvaluator &evaluator, ByteBuffer &dataOut)
vector< AnimationChannel > _channels
vector that holds all bone channels
static void load(AnimEvaluator &evaluator, ByteBuffer &dataIn)
vector< vec3< U32 > > _lastPositions
Bone * find(const string &name)
vector< Bone * > _children
vector< std::unique_ptr< AnimEvaluator > > _animations
A vector that holds each animation.
bool init(PlatformContext &context, Bone *skeleton, const vector< Bone * > &bones)
This will build the skeleton based on the scene passed to it and CLEAR EVERYTHING.
void save(PlatformContext &context, ByteBuffer &dataOut) const
Bone * loadSkeleton(ByteBuffer &dataIn, Bone *parent)
void release(bool releaseAnimations)
Frees all memory and initializes everything to a default state.
hashMap< U64, U32 > _animationNameToID
find animations quickly
void saveSkeleton(ByteBuffer &dataOut, Bone *parent) const
I/O operations.
void load(PlatformContext &context, ByteBuffer &dataIn)
Bone * _skeleton
Root node of the internal scene structure.
Handle console commands that start with a forward slash.
constexpr U16 BYTE_BUFFER_VERSION_EVALUATOR
constexpr U32 to_U32(const T value)
void insert(eastl::vector< T, A1 > &target, const eastl::vector< T, A2 > &source)
constexpr U16 BYTE_BUFFER_VERSION_ANIMATOR
void CalculateBoneToWorldTransform(Bone *pInternalNode) noexcept
Calculates the global transformation matrix for the given internal node.
constexpr U64 _ID(const char *const str, const U64 value=val_64_const) noexcept
constexpr I16 to_I16(const T value)
constexpr U16 BYTE_BUFFER_VERSION_SKELETON
static NO_INLINE void d_printfn(const char *format, T &&... args)