Unravel Engine C++ Reference
Loading...
Searching...
No Matches
camera_component.cpp
Go to the documentation of this file.
1#include "camera_component.h"
2
3namespace unravel
4{
6{
7 pipeline_camera_.get_camera().set_viewport_size({640, 480});
8}
9
11{
12 // Release the unused fbos and textures
13 pipeline_camera_.get_camera().record_current_matrices();
14 pipeline_camera_.get_camera().look_at(t.get_position(), t.get_position() + t.z_unit_axis(), t.y_unit_axis());
15
16}
17
19{
20 rview_ = {};
21}
22
23
25{
26 pipeline_camera_.get_camera().set_viewport_size(size);
27}
28
30{
31 return pipeline_camera_.get_camera().get_viewport_size();
32}
33
35{
36 return pipeline_camera_.get_camera().get_ortho_size();
37}
38
40{
41 pipeline_camera_.get_camera().set_orthographic_size(size);
42}
43
44auto camera_component::get_ppu() const -> float
45{
46 return pipeline_camera_.get_camera().get_ppu();
47}
48
50{
51 return rview_;
52}
53
54auto camera_component::get_render_view() const -> const gfx::render_view&
55{
56 return rview_;
57}
58
60{
61 return storage_;
62}
63
65{
66 return pipeline_camera_;
67}
68
70{
71 return pipeline_camera_;
72}
73
74void camera_component::set_fov(float fov_degrees)
75{
76 pipeline_camera_.get_camera().set_fov(fov_degrees);
77}
78
80{
81 pipeline_camera_.get_camera().set_near_clip(distance);
82}
83
85{
86 pipeline_camera_.get_camera().set_far_clip(distance);
87}
88
90{
91 pipeline_camera_.get_camera().set_projection_mode(mode);
92}
93
94auto camera_component::get_fov() const -> float
95{
96 return pipeline_camera_.get_camera().get_fov();
97}
99{
100 return pipeline_camera_.get_camera().get_near_clip();
101}
103{
104 return pipeline_camera_.get_camera().get_far_clip();
105}
106
108{
109 return pipeline_camera_.get_camera().get_projection_mode();
110}
111
113{
114 return pipeline_camera_.get_camera();
115}
116
118{
119 return pipeline_camera_.get_camera();
120}
121
123{
124 return render_include_mask_;
125}
126
128{
129 render_include_mask_ = mask;
130}
131
133{
134 return render_exclude_mask_;
135}
136
138{
139 render_exclude_mask_ = mask;
140}
141
143{
144 return layer_mask{render_include_mask_.mask & ~render_exclude_mask_.mask};
145}
146} // namespace unravel
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27
auto get_far_clip() const -> float
Gets the far clipping distance.
auto get_projection_mode() const -> projection_mode
Gets the projection mode.
auto get_pipeline_data() -> pipeline_camera &
auto get_render_exclude_mask() const -> layer_mask
Gets the render exclude mask.
void set_near_clip(float distance)
Sets the near clipping distance.
auto get_render_mask() const -> layer_mask
Gets the effective render mask (include - exclude).
auto get_storage() -> camera_storage &
Gets the camera storage.
void set_viewport_size(const usize32_t &size)
Sets the viewport size.
auto get_render_view() -> gfx::render_view &
Gets the render view.
auto get_viewport_size() const -> const usize32_t &
Gets the viewport size.
auto get_camera() -> camera &
Gets the camera object.
void set_fov(float fov_degrees)
Sets the field of view (FOV).
void set_render_exclude_mask(layer_mask mask)
Sets the render exclude mask.
void set_render_include_mask(layer_mask mask)
Sets the render include mask.
auto get_ortho_size() const -> float
Gets the orthographic size.
void set_projection_mode(projection_mode mode)
Sets the projection mode.
void set_ortho_size(float size)
Sets the orthographic size.
auto get_fov() const -> float
Gets the field of view (FOV).
void release_resources()
Releases the pipeline resources.
auto get_near_clip() const -> float
Gets the near clipping distance.
auto get_render_include_mask() const -> layer_mask
Gets the render include mask.
void set_far_clip(float distance)
Sets the far clipping distance.
void update(const math::transform &t)
Updates the camera with the given transform.
camera_component()
Default constructor for camera_component.
auto get_ppu() const -> float
Gets the pixels per unit (PPU).
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:62
auto get_camera() const -> const camera &
Gets the camera object (const version).
projection_mode
Enum representing the projection mode of a camera.
Definition camera.h:16
@ mask
Hard alpha cutoff; casts cutout shadows.
Structure for storing camera related context.
Definition camera.h:52