Cogs.Core
CinematicCameraSystem.h
1#pragma once
2#include "Systems/ComponentSystem.h"
3#include "Systems/Core/DynamicComponentSystem.h"
4#include "CinematicCameraComponent.h"
5
6#include "Foundation/Platform/Timer.h"
7#include "Foundation/Geometry/Interpolator.h"
8
9#include <array>
10#include <memory>
11
12namespace Cogs
13{
14 namespace Core
15 {
16 class Context;
17
22 {
25
28
30 short currentRunningID = -1;
31
34
35 std::unique_ptr<Cogs::Interpolator<glm::vec3>> positionInterpolator;
36 std::unique_ptr<Cogs::Interpolator<glm::quat>> rotationInterpolator;
37 };
38
39
43 class COGSCORE_DLL_API CinematicCameraSystem : public ComponentSystemWithDataPool<CinematicCameraComponent,CinematicCameraData>
44 {
45 public:
46 CinematicCameraSystem(Memory::Allocator* allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
48
49 void initialize(Context* context) override;
50 void update(Context* context) override;
51 void cleanup(Context* context) override;
52
54 void addInterestPoint(const CinematicCameraComponent & targetComp);
55
57 void addInterestPoint(const CinematicCameraComponent& targetComp, glm::vec3& pos, glm::quat& rot, float time, float waitTime, CameraEasingMode mode);
58
60 void playCameraSequence(const CinematicCameraComponent& targetComp);
61
62 private:
64 bool triggerTargetPoint(const CinematicCameraComponent& targetComp, const short& id = 0);
65
67 std::array<EasingFn::Ptr, (size_t)CameraEasingMode::SIZE > easingFn = {};
68 };
69 }
70}
The cinematic camera system calculates interpolation data for cinematic components found in the scene...
Component system with parallel data per component stored in a pool similar to how the components them...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base allocator implementation.
Definition: Allocator.h:30
Old timer class.
Definition: Timer.h:37
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
Contains Interpolators that will update the camera position and rotation based on component data.
Timer timer
Used for wait times.
short currentRunningID
Wich segment of the array we are interpolating [{start,0},...,{n-1,n}].
CinematicCameraData()=default
Default constructs camera data.
CinematicCameraData(const CinematicCameraData &other)=delete
Disabled copy constructor to avoid accidental copying when referencing.