PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
animation_evaluation.h
1#pragma once
2
3#include "pixelbullet/scene/components/morph_weights_animation_component.h"
4#include "pixelbullet/scene/components/transform_animation_component.h"
5#include "pixelbullet/scene/entity_id.h"
6
7#include <optional>
8#include <unordered_map>
9#include <vector>
10
11namespace pixelbullet
12{
13class Scene;
14
16{
17 std::unordered_map<EntityId::ValueType, Transform> values;
18
19 [[nodiscard]] bool Empty() const noexcept
20 {
21 return values.empty();
22 }
23
24 [[nodiscard]] const Transform* Find(EntityId entity) const noexcept
25 {
26 if (!entity)
27 {
28 return nullptr;
29 }
30
31 const auto it = values.find(entity.Raw());
32 return it != values.end() ? &it->second : nullptr;
33 }
34};
35
37{
38public:
39 [[nodiscard]] static SceneTransformOverrides Evaluate(const Scene& scene, float time_seconds);
40 [[nodiscard]] static std::optional<Transform> Evaluate(const TransformAnimationComponent& component, float time_seconds);
41 [[nodiscard]] static std::optional<Transform> Evaluate(const TransformAnimationComponent& component,
42 const AnimationStateComponent* state, float time_seconds);
43};
44
46{
47 std::unordered_map<EntityId::ValueType, std::vector<float>> values;
48
49 [[nodiscard]] bool Empty() const noexcept
50 {
51 return values.empty();
52 }
53
54 [[nodiscard]] const std::vector<float>* Find(EntityId entity) const noexcept
55 {
56 if (!entity)
57 {
58 return nullptr;
59 }
60
61 const auto it = values.find(entity.Raw());
62 return it != values.end() ? &it->second : nullptr;
63 }
64};
65
67{
68public:
69 [[nodiscard]] static SceneMorphWeightOverrides Evaluate(const Scene& scene, float time_seconds);
70 [[nodiscard]] static std::optional<std::vector<float>> Evaluate(const MorphWeightsAnimationComponent& component,
71 float time_seconds);
72 [[nodiscard]] static std::optional<std::vector<float>> Evaluate(const MorphWeightsAnimationComponent& component,
73 const AnimationStateComponent* state, float time_seconds);
74};
75} // namespace pixelbullet
Definition entity_id.h:11
Definition animation_evaluation.h:67
Definition scene.h:23
Definition animation_evaluation.h:37
Definition animation_state_component.h:10
Definition morph_weights_animation_component.h:100
Definition animation_evaluation.h:46
Definition animation_evaluation.h:16
Definition transform_animation_component.h:91
Definition transform.h:14