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>
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{
34 APP_SCOPE_PERF("Camera/System Before Render");
36 [&](auto e, auto&& transform, auto&& camera)
37 {
38 if(!scn.registry->all_of<active_component>(e))
39 {
40 camera.release_resources();
41 }
42 camera.update(transform.get_transform_global());
43 });
44}
45
46
47void camera_system::on_play_begin(hpp::span<const entt::handle> entities, delta_t dt)
48{
49 for(auto e : entities)
50 {
51 if(auto camera_comp = e.try_get<camera_component>())
52 {
53 auto& transform_comp = e.get<transform_component>();
54 camera_comp->update(transform_comp.get_transform_global());
55 }
56 }
57}
58
59
60} // 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:62
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
#define APP_SCOPE_PERF(name_literal)
Create a scoped performance timer that records to the timeline profiler. Only accepts string literals...
Definition profiler.h:675
Represents a scene in the ACE framework, managing entities and their relationships.
Definition scene.h:70
std::unique_ptr< entt::registry > registry
The registry that manages all entities in the scene.
Definition scene.h:187