Skip to main content

PerspectiveCameraUpdateSystem.ixx File

System that updates view and projection matrices for active perspective cameras. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespacescene
namespacesystems

Classes Index

classPerspectiveCameraUpdateSystem<TMemberHandle>

Updates camera transforms for active perspective cameras. More...

Description

System that updates view and projection matrices for active perspective cameras.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7export module helios.engine.scene.systems.PerspectiveCameraUpdateSystem;
8
9import helios.engine.runtime.world.tags.SystemRole;
10
11import helios.engine.runtime.world.UpdateContext;
12
13import helios.ecs.components;
14import helios.engine.scene.components;
15import helios.engine.spatial.components;
16
17import helios.math;
18import helios.engine.core.types.ComponentTypeTags;
19
20using namespace helios::engine::core::types;
21using namespace helios::ecs::components;
27
36 template<typename TMemberHandle>
38
39 public:
40
45
52
53
54 for (auto [entity, tcw, tp3c, pcc, pmc, vmc, active] : updateContext.view<
62 >().whereEnabled()) {
63
64 if (tcw->isDirty() || tp3c->isDirty()) {
65 vmc->setValue(helios::math::lookAt(
66 tcw->value().translation(),
67 tp3c->value(),
68 tcw->value().column(1).toVec3().normalize()
69 ));
70 }
71
72
73 if (pcc->isDirty()) {
74 pmc->setValue(helios::math::perspective(
75 pcc->fovY(),
76 pcc->aspectRatio(),
77 pcc->zNear(),
78 pcc->zFar()
79 ));
80 }
81
82 }
83
84 }
85
86
87 };
88
89
90}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.