Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
camera.h
1#ifndef OE_SCENE_COMPONENT_NODE_CAMERA_H
2#define OE_SCENE_COMPONENT_NODE_CAMERA_H
3
4#include "../../node.h"
5#include "../../manager.h"
6#include "../../camera.h"
7
8namespace oe::scene::component::node
9{
13 class Camera : public NodeComponent
14 {
15 public:
19 Camera(oe::scene::Node& node) noexcept :
20 NodeComponent(node),
21 _camera(node.getSceneManager()->getDefaultCamera())
22 {}
23
27 template <CameraProjection ProjectionSettings>
28 Camera(oe::scene::Node& node, const ProjectionSettings& projection_settings) noexcept :
29 NodeComponent(node),
30 _camera(projection_settings)
31 {}
32
36 virtual void onUpdate(const double, const int8_t = 0) override
37 {
39
40 //glm::quat rotation = node_transform.getRotation();
41
42 // Convert node space to camera space
43 // rotation = glm::rotate(rotation, glm::radians(180.f), glm::vec3(0.f, 1.f, 0.f));
44
45 //node_transform.setRotation(rotation);
46 _camera.fillFrom(node_transform);
47 }
48
53 {
54 return _camera;
55 }
56
57 private:
58 scene::Camera _camera;
59
60 };
61}
62
63#endif
The "eye of the scene".
Definition camera.h:33
Parent class of components that can be bound to a Node.
Definition node.h:15
Node & getNode() const noexcept
Get node bound to this component.
Definition node.h:31
Transform getAbsoluteTransform() const
Get Node transform relative from world origin.
Manage local Translation / Rotation / Scale of an entity in the world.
Definition transform.h:20
void fillFrom(const Transform &transform)
Fill current values from another transform.
Component that provide a Camera where movements are based on those of the attached Node.
Definition camera.h:14
Camera(oe::scene::Node &node, const ProjectionSettings &projection_settings) noexcept
Create camera with a custom projection.
Definition camera.h:28
Camera(oe::scene::Node &node) noexcept
Copy Camera settings from the default scene manager camera.
Definition camera.h:19
scene::Camera & getCamera() noexcept
Get a reference to the camera bound to this component.
Definition camera.h:52
virtual void onUpdate(const double, const int8_t=0) override
Update camera transform when node transform is updated.
Definition camera.h:36