Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::SceneCamera Class Reference

Runtime camera attached to a scene entity via CameraComponent. More...

#include <SceneCamera.h>

Inherits Raven::Camera.

Public Types

enum class  Mode : u8 { Perspective = 0 , Isometric }
 Projection mode for the camera. More...

Public Member Functions

FRAMEWORK_API SceneCamera ()
 Constructs a SceneCamera with default perspective settings and recalculates the projection.
FRAMEWORK_API void SetViewportSize (u32 width, u32 height)
 Updates the projection matrix to match a new viewport resolution.
FRAMEWORK_API void SetMode (Mode mode)
 Switches between perspective and isometric projection modes.
FRAMEWORK_API Mode GetMode () const noexcept
 Returns the active projection mode.
FRAMEWORK_API void SetPerspective (f32 verticalFOV, f32 nearClip, f32 farClip)
 Configures the perspective projection parameters and recalculates the projection matrix.
FRAMEWORK_API f32 GetPerspectiveFOV () const noexcept
 Returns the vertical field of view in degrees.
FRAMEWORK_API f32 GetNearClip () const noexcept
 Returns the near clip plane distance.
FRAMEWORK_API f32 GetFarClip () const noexcept
 Returns the far clip plane distance.
FRAMEWORK_API void Update (const Crux::vec3 &position, const Crux::vec3 &rotation)
 Rebuilds the view matrix from the owning entity's world-space transform.
Public Member Functions inherited from Raven::Camera
 Camera ()=default
 Camera (const Crux::mat4 &projection)
 Constructs a Camera with a given projection matrix.
virtual ~Camera ()=default
const Crux::mat4GetProjection () const
const Crux::mat4GetViewProjection () const
const Crux::mat4GetView () const
const Crux::vec3GetPosition () const noexcept

Additional Inherited Members

Protected Attributes inherited from Raven::Camera
Crux::mat4 m_Projection = Crux::mat4(1.0f)
 Projection matrix (e.g., perspective or orthographic).
Crux::mat4 m_View = Crux::mat4(1.0f)
 View matrix representing camera position/orientation.
Crux::mat4 m_ViewProjection = Crux::mat4(1.0f)
 Cached combined view-projection matrix.
Crux::vec3 m_Position = Crux::vec3(0.0f)
 World Space Position of the Camera.

Detailed Description

Runtime camera attached to a scene entity via CameraComponent.

Extends the base Camera with scene-specific concerns: viewport management, projection recalculation, and a fixed isometric view mode.

The view matrix is rebuilt every frame from the owning entity's TransformComponent by Scene::OnUpdateRuntime.

Member Enumeration Documentation

◆ Mode

enum class Raven::SceneCamera::Mode : u8
strong

Projection mode for the camera.

Enumerator
Perspective 

Standard perspective projection driven by the entity's rotation.

Isometric 

Fixed 35.26°/45° pitch-yaw isometric view; entity rotation is ignored.

Constructor & Destructor Documentation

◆ SceneCamera()

Raven::SceneCamera::SceneCamera ( )

Constructs a SceneCamera with default perspective settings and recalculates the projection.

Member Function Documentation

◆ GetFarClip()

FRAMEWORK_API f32 Raven::SceneCamera::GetFarClip ( ) const
inlinenoexcept

Returns the far clip plane distance.

Returns
Far clip (metres).

◆ GetMode()

FRAMEWORK_API Mode Raven::SceneCamera::GetMode ( ) const
inlinenoexcept

Returns the active projection mode.

Returns
Current Mode.

◆ GetNearClip()

FRAMEWORK_API f32 Raven::SceneCamera::GetNearClip ( ) const
inlinenoexcept

Returns the near clip plane distance.

Returns
Near clip (metres).

◆ GetPerspectiveFOV()

FRAMEWORK_API f32 Raven::SceneCamera::GetPerspectiveFOV ( ) const
inlinenoexcept

Returns the vertical field of view in degrees.

Returns
Vertical FOV (degrees).

◆ SetMode()

void Raven::SceneCamera::SetMode ( Mode mode)

Switches between perspective and isometric projection modes.

Parameters
modeThe desired Mode.

◆ SetPerspective()

void Raven::SceneCamera::SetPerspective ( f32 verticalFOV,
f32 nearClip,
f32 farClip )

Configures the perspective projection parameters and recalculates the projection matrix.

Parameters
verticalFOVVertical field of view in degrees.
nearClipNear clip plane distance (metres).
farClipFar clip plane distance (metres).

◆ SetViewportSize()

void Raven::SceneCamera::SetViewportSize ( u32 width,
u32 height )

Updates the projection matrix to match a new viewport resolution.

Parameters
widthViewport width in pixels.
heightViewport height in pixels.

◆ Update()

void Raven::SceneCamera::Update ( const Crux::vec3 & position,
const Crux::vec3 & rotation )

Rebuilds the view matrix from the owning entity's world-space transform.

Called every frame by the scene update loop. In Mode::Isometric the rotation argument is ignored and the fixed isometric angles are applied.

Parameters
positionWorld-space position of the owning entity.
rotationEuler angles in radians (XYZ). Ignored in isometric mode.

The documentation for this class was generated from the following files: