Hymn to Beauty
C++ 3D Engine
Camera.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "SuperComponent.hpp"
4#include <glm/glm.hpp>
5
6namespace Component {
8class Camera : public SuperComponent {
9 public:
11 Camera();
12
13 void Serialize(Json::Value& node, bool load) override;
14
16
20 glm::mat4 GetProjection(const glm::vec2& screenSize) const;
21
23 bool orthographic = false;
24
26
30 float fieldOfView = 45.f;
31
33
37 float size = 10.0f;
38
40
43 float zNear = 0.1f;
44
46
49 float zFar = 100.f;
50
52 int32_t order = 0;
53
55 bool overlay = false;
56
58 glm::vec4 viewport = glm::vec4(0.0f, 0.0f, 1.0f, 1.0f);
59
61 uint32_t layerMask = 1u;
62
66 bool fxaa = true;
67
69 bool ditherApply = true;
70
72 bool tonemapping = true;
73
75 float gamma = 2.2f;
76
78 bool bloom = false;
79
81 float bloomIntensity = 1.0f;
82
84 float bloomThreshold = 1.0f;
85
87 float bloomScatter = 0.7f;
88 };
89
92};
93} // namespace Component
Component handling a camera through which the world can be rendered.
Definition: Camera.hpp:8
Camera()
Create new camera.
Definition: Camera.cpp:9
int32_t order
The order in the camera stack.
Definition: Camera.hpp:52
FilterSettings filterSettings
Filter settings.
Definition: Camera.hpp:91
uint32_t layerMask
Bitmask of which layers the camera should show.
Definition: Camera.hpp:61
glm::vec4 viewport
Viewport.
Definition: Camera.hpp:58
float size
The size of the view volume.
Definition: Camera.hpp:37
bool overlay
Whether the camera should be rendered with a transparent background.
Definition: Camera.hpp:55
void Serialize(Json::Value &node, bool load) override
Save or load component values to/from JSON.
Definition: Camera.cpp:11
bool orthographic
Whether the camera should use an orthographic projection, otherwise perspective projection.
Definition: Camera.hpp:23
float zNear
Near plane.
Definition: Camera.hpp:43
float fieldOfView
Field of view, in degrees.
Definition: Camera.hpp:30
glm::mat4 GetProjection(const glm::vec2 &screenSize) const
Get the projection matrix.
Definition: Camera.cpp:33
float zFar
Far plane.
Definition: Camera.hpp:49
Component which all components inherit.
Definition: SuperComponent.hpp:9
Definition: BoxShapeEditor.hpp:5
Filter settings.
Definition: Camera.hpp:64
float bloomThreshold
Threshold for the bloom effect.
Definition: Camera.hpp:84
float bloomIntensity
Intensity of the bloom effect.
Definition: Camera.hpp:81
float bloomScatter
How scattered the bloom effect should be.
Definition: Camera.hpp:87
bool ditherApply
Whether to enable dithering.
Definition: Camera.hpp:69
float gamma
Gamma correction value.
Definition: Camera.hpp:75
bool fxaa
Whether to enable FXAA.
Definition: Camera.hpp:66
bool bloom
Whether to enable bloom.
Definition: Camera.hpp:78
bool tonemapping
Whether to apply tonemapping.
Definition: Camera.hpp:72