Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Animation.hpp
1/*
2Copyright (C) 2017-2019,2021,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_ANIMATION_H
17#define AEONGAMES_ANIMATION_H
18#include <cstdint>
19#include <vector>
22#include "aeongames/Resource.hpp"
23
24namespace AeonGames
25{
26 class AnimationMsg;
28 class Animation : public Resource
29 {
30 public:
31 DLL Animation();
32 DLL ~Animation();
36 DLL void LoadFromMemory ( const void* aBuffer, size_t aBufferSize ) final;
38 DLL void Unload () final;
41 DLL uint32_t GetFrameRate() const;
44 DLL double GetDuration() const;
48 DLL double GetSample ( double aTime ) const;
53 DLL double AddTimeToSample ( double aSample, double aTime ) const;
58 DLL const Transform GetTransform ( size_t aBoneIndex, double aSample ) const;
61 DLL void LoadFromPBMsg ( const AnimationMsg& aAnimationMsg );
62 private:
63 std::string mFilename;
64 uint32_t mVersion;
65 uint32_t mFrameRate;
66 double mDuration;
67 std::vector<std::vector<Transform >> mFrames;
68 };
69}
70#endif
Platform-specific macros, includes, and DLL export/import definitions.
Header for Transform component class.
DLL double AddTimeToSample(double aSample, double aTime) const
Advance a sample position by a time delta.
DLL double GetDuration() const
Get the total duration of the animation.
DLL double GetSample(double aTime) const
Get a normalized sample position for a given time.
DLL void Unload() final
Unload animation data and free resources.
Definition Animation.cpp:86
DLL void LoadFromMemory(const void *aBuffer, size_t aBufferSize) final
Load animation data from a memory buffer.
Definition Animation.cpp:42
DLL void LoadFromPBMsg(const AnimationMsg &aAnimationMsg)
Load animation data from a protobuf message.
Definition Animation.cpp:47
DLL const Transform GetTransform(size_t aBoneIndex, double aSample) const
Get the transform for a specific bone at a given sample.
DLL uint32_t GetFrameRate() const
Get the frame rate of the animation.
Definition Animation.cpp:96
Base class for loadable engine resources.
Definition Resource.hpp:33
Component class for any object that requires space transformations.
Definition Transform.hpp:34
<- This is here just for the literals
Definition AABB.hpp:31