PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
PixelBullet::Camera Class Reference

A base 3D camera class with perspective projection. More...

#include <Camera.hpp>

Public Member Functions

 Camera (float fov=glm::radians(45.0f), float nearPlane=0.1f, float farPlane=1000.0f)
 Constructs a camera with a perspective projection.
 
virtual void Start ()
 
virtual void Update ()
 
void SetPosition (const glm::vec3 &pos)
 Sets world position and recalculates the view matrix.
 
void SetRotation (const glm::vec3 &rotEuler)
 Sets rotation in Euler angles (degrees), recalculates view matrix.
 
void SetPerspective (float fov, float aspect, float nearPlane, float farPlane)
 Sets the perspective projection matrix.
 
float GetFOV () const
 
float GetNearPlane () const
 
float GetFarPlane () const
 
const glm::vec3 & GetPosition () const
 
const glm::vec3 & GetRotationEuler () const
 
const glm::mat4 & GetViewMatrix () const
 
const glm::mat4 & GetProjectionMatrix () const
 
glm::vec3 GetForward () const
 
glm::vec3 GetRight () const
 
glm::vec3 GetUp () const
 

Protected Member Functions

glm::quat GetRotationQuat () const
 
void RecalculateView ()
 

Protected Attributes

float m_FOV
 Field of view in radians.
 
float m_Near
 Near clipping plane.
 
float m_Far
 Far clipping plane.
 
glm::vec3 m_Position
 World-space position.
 
glm::vec3 m_RotationEuler
 Rotation in degrees (pitch, yaw, roll).
 
glm::mat4 m_ViewMatrix
 View matrix.
 
glm::mat4 m_ProjectionMatrix
 Projection matrix.
 

Detailed Description

A base 3D camera class with perspective projection.

Stores transform data (position + rotation), and calculates view/projection matrices. Extend this class to implement specific behaviors like FPS or orbital cameras.

Constructor & Destructor Documentation

◆ Camera()

PixelBullet::Camera::Camera ( float fov = glm::radians(45.0f),
float nearPlane = 0.1f,
float farPlane = 1000.0f )
inlineexplicit

Constructs a camera with a perspective projection.

Parameters
fovField of view in radians.
nearPlaneNear clipping distance.
farPlaneFar clipping distance.

Member Function Documentation

◆ SetPerspective()

void PixelBullet::Camera::SetPerspective ( float fov,
float aspect,
float nearPlane,
float farPlane )
inline

Sets the perspective projection matrix.

Parameters
fovField of view in radians.
aspectAspect ratio (width / height).
nearPlaneNear clipping plane.
farPlaneFar clipping plane.

◆ SetPosition()

void PixelBullet::Camera::SetPosition ( const glm::vec3 & pos)
inline

Sets world position and recalculates the view matrix.

◆ SetRotation()

void PixelBullet::Camera::SetRotation ( const glm::vec3 & rotEuler)
inline

Sets rotation in Euler angles (degrees), recalculates view matrix.

Member Data Documentation

◆ m_Far

float PixelBullet::Camera::m_Far
protected

Far clipping plane.

◆ m_FOV

float PixelBullet::Camera::m_FOV
protected

Field of view in radians.

◆ m_Near

float PixelBullet::Camera::m_Near
protected

Near clipping plane.

◆ m_Position

glm::vec3 PixelBullet::Camera::m_Position
protected

World-space position.

◆ m_ProjectionMatrix

glm::mat4 PixelBullet::Camera::m_ProjectionMatrix
protected

Projection matrix.

◆ m_RotationEuler

glm::vec3 PixelBullet::Camera::m_RotationEuler
protected

Rotation in degrees (pitch, yaw, roll).

◆ m_ViewMatrix

glm::mat4 PixelBullet::Camera::m_ViewMatrix
protected

View matrix.


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