1#include "TrajectoryLayoutSystem.h"
4#include "Components/Core/TransformComponent.h"
5#include "Components/Core/CameraComponent.h"
6#include "Components/Data/TrajectoryComponent.h"
8#include "Systems/Core/TransformSystem.h"
9#include "Systems/Core/CameraSystem.h"
11#include "Foundation/Geometry/Glm.hpp"
12#include "Foundation/Geometry/SampleListGenerator.hpp"
13#include "Foundation/Geometry/PathGenerator.hpp"
17 for (
auto & layout :
pool) {
20 if (layout.layoutTrajectory && layout.entities.size()) {
23 const size_t count = layout.entities.size();
25 std::vector<glm::vec3> positions(count);
26 std::vector<glm::vec3> directions(count);
28 Cogs::Geometry::PathGenerator::generateLinearPath(
31 trajectory->indexes.data(),
32 trajectory->positions.data(),
33 static_cast<int>(trajectory->positions.size()),
37 for (
size_t e = 0; e < count; ++e) {
38 auto entity = layout.entities[e].lock();
40 if (!entity)
continue;
44 transform->
coordinates = layoutTransform->coordinates;
45 transform->position = positions[e] + layout.offset;
ComponentType * getComponent() const
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
ComponentPool< TrajectoryLayoutComponent > pool
Pool of components managed by the system.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Data component defining a 3D trajectory, for example a Well trajectory.