Skip to main content

PerspectiveCameraUpdateSystem Class Template

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

Declaration​

template <typename TMemberHandle> class helios::engine::scene::systems::PerspectiveCameraUpdateSystem<TMemberHandle> { ... }

Public Member Typedefs Index​

template <typename TMemberHandle>
usingEngineRoleTag = TypedSystemRole

Role tag used for runtime registration as a system. More...

Public Member Functions Index​

template <typename TMemberHandle>
voidupdate (UpdateContext &updateContext) noexcept

Executes the camera update pass for all active camera entities. More...

Description​

Updates camera transforms for active perspective cameras.

Recomputes LookAt and Perspective matrices only when the respective target components are marked as dirty.

Template Parameters
TMemberHandle

Camera entity handle type.

info

Although this system could be separated into to concurrently running systems, the regular use case for this system is that it only has to consider few camera entities per frames.

Definition at line 40 of file PerspectiveCameraUpdateSystem.ixx.

Public Member Typedefs​

EngineRoleTag​

template <typename TMemberHandle>
using helios::engine::scene::systems::PerspectiveCameraUpdateSystem< TMemberHandle >::EngineRoleTag = TypedSystemRole

Role tag used for runtime registration as a system.

Definition at line 47 of file PerspectiveCameraUpdateSystem.ixx.

Public Member Functions​

update()​

template <typename TMemberHandle>
void helios::engine::scene::systems::PerspectiveCameraUpdateSystem< TMemberHandle >::update (UpdateContext & updateContext)
inline noexcept

Executes the camera update pass for all active camera entities.

Parameters
updateContext

Frame-local update context with ECS access.

Definition at line 54 of file PerspectiveCameraUpdateSystem.ixx.

55
56
57 for (auto [entity, tcw, vmc] : updateContext.view<
61 >().withActive()
62
63 .template whereAnyDirty<
66 >()) {
67
68 const auto mat = tcw->value();
69
70 const auto eye = tcw->value().translation();
71 const auto center = eye + mat.column(2).toVec3().normalize();
72 const auto up = mat.column(1).toVec3().normalize();
73
74 entity.setTrackedValue(vmc, helios::math::lookAt(eye, center, up));
75 }
76
77 for (auto [entity, pcc, pmc] : updateContext.view<
81 >().withActive()
82 .template whereAnyDirty<
85 >()) {
86
87 entity.setTrackedValue(pmc, helios::math::perspective(
88 pcc->fovY(),
89 pcc->aspectRatio(),
90 pcc->zNear(),
91 pcc->zFar()
92 ));
93 }
94
95
96 }

Reference helios::engine::scene::registerComponents.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.