❖
Monad Engine
da02fba2
>
Undercity Codex
_
Loading...
Searching...
No Matches
CameraComponent.cpp
Go to the documentation of this file.
1
#include "scene/components/CameraComponent.h"
2
#include "scene/GameObject.h"
3
#include <glm/gtc/matrix_transform.hpp>
4
5
namespace
eng
6
{
7
void
CameraComponent::Update
(
float
deltaTime)
8
{
9
}
10
11
glm::mat4
CameraComponent::GetViewMatrix
()
const
12
{
13
glm::mat4 mat = glm::mat4(1.0f);
14
mat = glm::mat4_cast(
m_owner
->
GetRotation
());
15
16
mat[3] = glm::vec4(
m_owner
->
GetPosition
(), 1.0f);
17
18
if
(
m_owner
->
GetParent
())
19
{
20
mat =
m_owner
->
GetParent
()->
GetWorldTransform
() * mat;
21
}
22
23
return
glm::inverse(mat);
24
}
25
26
glm::mat4
CameraComponent::GetProjectionMatrix
(
float
aspect)
const
27
{
28
return
glm::perspective(glm::radians(m_fov), aspect, m_nearPlane, m_farPlane);
29
}
30
}
eng::CameraComponent::GetProjectionMatrix
glm::mat4 GetProjectionMatrix(float aspect) const
Definition
CameraComponent.cpp:26
eng::CameraComponent::GetViewMatrix
glm::mat4 GetViewMatrix() const
Definition
CameraComponent.cpp:11
eng::CameraComponent::Update
void Update(float deltaTime) override
Definition
CameraComponent.cpp:7
eng::Component::m_owner
GameObject * m_owner
Definition
Component.h:33
eng::GameObject::GetRotation
const glm::quat & GetRotation() const
Definition
GameObject.cpp:181
eng::GameObject::GetPosition
const glm::vec3 & GetPosition() const
Definition
GameObject.cpp:134
eng::GameObject::GetParent
GameObject * GetParent()
Definition
GameObject.cpp:65
eng::GameObject::GetWorldTransform
glm::mat4 GetWorldTransform() const
Definition
GameObject.cpp:282
eng
Definition
Application.cpp:4
docs
GD-Engine-lesson-5-2
engine
source
scene
components
CameraComponent.cpp
Generated by
1.9.8