|
Monad Engine da02fba2
> Undercity Codex_
|
Perspective camera — provides view and projection matrices each frame. More...
#include <CameraComponent.h>
Inheritance diagram for mnd::CameraComponent:
Collaboration diagram for mnd::CameraComponent:Public Member Functions | |
| void | Update (f32 deltaTime) override |
| No per-frame logic needed; view/projection are computed on demand. | |
| mat4 | GetViewMatrix () const |
| Compute the view matrix from the owner's world transform. | |
| mat4 | GetProjectionMatrix (f32 aspect) const |
| Compute the perspective projection matrix. | |
| f32 | GetFov () const |
| f32 | GetNearPlane () const |
| f32 | GetFarPlane () const |
| void | SetFov (f32 fov) |
| void | SetNearPlane (f32 n) |
| void | SetFarPlane (f32 f) |
| virtual void | LoadProperties (const nlohmann::json &json) |
| virtual void | Init () |
| virtual size_t | GetTypeId () const =0 |
| GameObject * | GetOwner () |
Static Public Member Functions | |
| template<typename T > | |
| static size_t | StaticTypeId () |
Protected Attributes | |
| GameObject * | m_owner = nullptr |
Perspective camera — provides view and projection matrices each frame.
Works in conjunction with the owning GameObject's transform:
Definition at line 33 of file CameraComponent.h.
|
inline |
Definition at line 64 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inline |
Definition at line 60 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inline |
Definition at line 62 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inherited |
Definition at line 12 of file Component.cpp.
References mnd::Component::m_owner.
Referenced by mnd::MeshComponent::Update(), and mnd::SkinnedMeshComponent::Update().
Compute the perspective projection matrix.
Maps camera-space coordinates to clip space using glm::perspective.
| aspect | Window width / height (updated each frame by the engine). |
Definition at line 26 of file CameraComponent.cpp.
|
pure virtualinherited |
| mat4 mnd::CameraComponent::GetViewMatrix | ( | ) | const |
Compute the view matrix from the owner's world transform.
Equivalent to glm::inverse(owner->GetWorldTransform()). Converts world-space coordinates into camera-space (eye space).
Definition at line 13 of file CameraComponent.cpp.
References mnd::GameObject::GetParent(), mnd::GameObject::GetPosition(), mnd::GameObject::GetRotation(), mnd::GameObject::GetWorldTransform(), and mnd::Component::m_owner.
|
virtualinherited |
Reimplemented in mnd::PhysicsComponent, and mnd::PlayerControllerComponent.
Definition at line 10 of file Component.cpp.
Referenced by mnd::GameObject::AddComponent().
|
virtualinherited |
Reimplemented in mnd::AudioComponent, mnd::HealthComponent, mnd::LightComponent, mnd::MeshComponent, mnd::ParticleEmitterComponent, and mnd::PhysicsComponent.
Definition at line 8 of file Component.cpp.
|
inline |
Definition at line 70 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inline |
Definition at line 66 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inline |
Definition at line 68 of file CameraComponent.h.
Referenced by mnd::InspectCamera().
|
inlinestaticinherited |
Definition at line 50 of file Component.h.
|
overridevirtual |
No per-frame logic needed; view/projection are computed on demand.
Implements mnd::Component.
Definition at line 11 of file CameraComponent.cpp.
|
protectedinherited |
Definition at line 57 of file Component.h.
Referenced by mnd::GameObject::AddComponent(), mnd::HealthComponent::ApplyDamage(), mnd::Component::GetOwner(), GetViewMatrix(), mnd::PhysicsComponent::Init(), mnd::PlayerControllerComponent::Init(), mnd::PlayerControllerComponent::Update(), mnd::AudioComponent::Update(), mnd::AudioListenerComponent::Update(), and mnd::PhysicsComponent::Update().