Unravel Engine C++ Reference
Loading...
Searching...
No Matches
camera_system.cpp
Go to the documentation of this file.
1#include "camera_system.h"
2
5#include <engine/ecs/ecs.h>
6
7#include <logging/logging.h>
8
9namespace unravel
10{
11
13{
14 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
15
16 return true;
17}
18
20{
21 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
22
23 return true;
24}
25
30
31
33{
35 [&](auto e, auto&& transform, auto&& camera)
36 {
37 camera.update(transform.get_transform_global());
38 });
39}
40
41
42void camera_system::on_play_begin(hpp::span<const entt::handle> entities, delta_t dt)
43{
44 for(auto e : entities)
45 {
46 if(auto camera_comp = e.try_get<camera_component>())
47 {
48 auto& transform_comp = e.get<transform_component>();
49 camera_comp->update(transform_comp.get_transform_global());
50 }
51 }
52}
53
54
55} // namespace unravel
Class that contains core camera data, used for rendering and other purposes.
auto deinit(rtti::context &ctx) -> bool
void on_frame_before_render(scene &scn, delta_t dt)
void on_play_begin(hpp::span< const entt::handle > entities, delta_t dt)
void on_frame_update(scene &scn, delta_t dt)
auto init(rtti::context &ctx) -> bool
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:35
Component that handles transformations (position, rotation, scale, etc.) in the ACE framework.
std::chrono::duration< float > delta_t
#define APPLOG_TRACE(...)
Definition logging.h:17
Represents a scene in the ACE framework, managing entities and their relationships.
Definition scene.h:21
std::unique_ptr< entt::registry > registry
The registry that manages all entities in the scene.
Definition scene.h:117