Cogs.Core
TrajectorySystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4
5#include "Components/Data/TrajectoryComponent.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 class Context;
12
14 {
15 std::vector<glm::quat> frames;
16 std::vector<bool> lodSelection;
17 std::vector<glm::vec4> clipSpacePos;
18 };
19
20 class TrajectorySystem : public ComponentSystemWithDataPool<TrajectoryComponent, TrajectoryData>
21 {
22 public:
23 TrajectorySystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
24
25 void update(Context* context);
26
27 private:
28 static void generateAnchoredFramesOfReference(std::vector<glm::quat>& orientations,
29 const std::vector<float>& indices,
30 const std::vector<glm::vec3>& positions,
31 const glm::vec3& startAnchor,
32 const glm::vec3& stopAnchor,
33 const float anchorStickyness);
34
41 static void generateFramesOfReference(std::vector<glm::quat>& orientations,
42 const std::vector<glm::vec3>& positions);
43 };
44 }
45}
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
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
static void generateFramesOfReference(std::vector< glm::quat > &orientations, const std::vector< glm::vec3 > &positions)
Base allocator implementation.
Definition: Allocator.h:30
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
std::vector< glm::quat > frames
Frames of reference along trajectory with minimal torsion.
std::vector< glm::vec4 > clipSpacePos
Clip space position of trajectory stations.
std::vector< bool > lodSelection
Set of trajectory stations that should be included in current lod-situation.