Botcraft 1.21.5
Loading...
Searching...
No Matches
Botcraft::Renderer::Camera Class Reference

#include <Camera.hpp>

Public Member Functions

 Camera (glm::vec3 position_=glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up_=glm::vec3(0.0f, 1.0f, 0.0f), float yaw_=0.0f, float pitch_=0.0f)
 
const glm::mat4 & GetViewMatrix () const
 
const glm::vec3 & GetPosition () const
 
const glm::vec3 & GetFront () const
 
const std::array< glm::vec4, 6 > & GetFrustumPlanes () const
 
float GetYaw () const
 
float GetPitch () const
 
void SetPosition (const float x, const float y, const float z)
 
void SetRotation (const float pitch_, const float yaw_)
 
void SetProjection (const glm::mat4 &projection)
 
bool GetHasChangedPosition () const
 
bool GetHasChangedOrientation () const
 
void ResetHasChangedPosition ()
 
void ResetHasChangedOrientation ()
 
float GetDistance (const float x_, const float y_, const float z_) const
 

Private Member Functions

void UpdateCameraViewMatrix ()
 
void ComputeFrustumPlanes ()
 

Private Attributes

glm::vec3 worldUp
 
glm::vec3 position
 
glm::vec3 front
 
float yaw
 
float pitch
 
glm::mat4 projection_matrix
 
glm::mat4 view_matrix
 
std::array< glm::vec4, 6 > frustum
 
bool has_changed_position
 
bool has_changed_orientation
 

Detailed Description

Definition at line 14 of file Camera.hpp.

Constructor & Destructor Documentation

◆ Camera()

Botcraft::Renderer::Camera::Camera ( glm::vec3  position_ = glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3  up_ = glm::vec3(0.0f, 1.0f, 0.0f),
float  yaw_ = 0.0f,
float  pitch_ = 0.0f 
)

Definition at line 7 of file Camera.cpp.

References pitch, position, UpdateCameraViewMatrix(), worldUp, and yaw.

Member Function Documentation

◆ ComputeFrustumPlanes()

void Botcraft::Renderer::Camera::ComputeFrustumPlanes ( )
private

Definition at line 121 of file Camera.cpp.

References frustum, projection_matrix, and view_matrix.

Referenced by SetProjection(), and UpdateCameraViewMatrix().

◆ GetDistance()

float Botcraft::Renderer::Camera::GetDistance ( const float  x_,
const float  y_,
const float  z_ 
) const

Definition at line 21 of file Camera.cpp.

References position.

◆ GetFront()

const glm::vec3 & Botcraft::Renderer::Camera::GetFront ( ) const

Definition at line 43 of file Camera.cpp.

References front.

◆ GetFrustumPlanes()

const std::array< glm::vec4, 6 > & Botcraft::Renderer::Camera::GetFrustumPlanes ( ) const

Definition at line 48 of file Camera.cpp.

References frustum.

◆ GetHasChangedOrientation()

bool Botcraft::Renderer::Camera::GetHasChangedOrientation ( ) const

Definition at line 90 of file Camera.cpp.

References has_changed_orientation.

◆ GetHasChangedPosition()

bool Botcraft::Renderer::Camera::GetHasChangedPosition ( ) const

Definition at line 85 of file Camera.cpp.

References has_changed_position.

◆ GetPitch()

float Botcraft::Renderer::Camera::GetPitch ( ) const

Definition at line 58 of file Camera.cpp.

References pitch.

◆ GetPosition()

const glm::vec3 & Botcraft::Renderer::Camera::GetPosition ( ) const

Definition at line 38 of file Camera.cpp.

References position.

◆ GetViewMatrix()

const glm::mat4 & Botcraft::Renderer::Camera::GetViewMatrix ( ) const

Definition at line 16 of file Camera.cpp.

References view_matrix.

◆ GetYaw()

float Botcraft::Renderer::Camera::GetYaw ( ) const

Definition at line 53 of file Camera.cpp.

References yaw.

◆ ResetHasChangedOrientation()

void Botcraft::Renderer::Camera::ResetHasChangedOrientation ( )

Definition at line 100 of file Camera.cpp.

References has_changed_orientation.

◆ ResetHasChangedPosition()

void Botcraft::Renderer::Camera::ResetHasChangedPosition ( )

Definition at line 95 of file Camera.cpp.

References has_changed_position.

◆ SetPosition()

void Botcraft::Renderer::Camera::SetPosition ( const float  x,
const float  y,
const float  z 
)

Definition at line 30 of file Camera.cpp.

References has_changed_position, position, and UpdateCameraViewMatrix().

◆ SetProjection()

void Botcraft::Renderer::Camera::SetProjection ( const glm::mat4 &  projection)

Definition at line 79 of file Camera.cpp.

References ComputeFrustumPlanes(), and projection_matrix.

◆ SetRotation()

void Botcraft::Renderer::Camera::SetRotation ( const float  pitch_,
const float  yaw_ 
)

Definition at line 63 of file Camera.cpp.

References has_changed_orientation, pitch, UpdateCameraViewMatrix(), and yaw.

◆ UpdateCameraViewMatrix()

void Botcraft::Renderer::Camera::UpdateCameraViewMatrix ( )
private

Definition at line 105 of file Camera.cpp.

References ComputeFrustumPlanes(), front, pitch, position, view_matrix, worldUp, and yaw.

Referenced by Camera(), SetPosition(), and SetRotation().

Member Data Documentation

◆ front

glm::vec3 Botcraft::Renderer::Camera::front
private

Definition at line 54 of file Camera.hpp.

Referenced by GetFront(), and UpdateCameraViewMatrix().

◆ frustum

std::array<glm::vec4, 6> Botcraft::Renderer::Camera::frustum
private

Definition at line 65 of file Camera.hpp.

Referenced by ComputeFrustumPlanes(), and GetFrustumPlanes().

◆ has_changed_orientation

bool Botcraft::Renderer::Camera::has_changed_orientation
private

Definition at line 68 of file Camera.hpp.

Referenced by GetHasChangedOrientation(), ResetHasChangedOrientation(), and SetRotation().

◆ has_changed_position

bool Botcraft::Renderer::Camera::has_changed_position
private

Definition at line 67 of file Camera.hpp.

Referenced by GetHasChangedPosition(), ResetHasChangedPosition(), and SetPosition().

◆ pitch

float Botcraft::Renderer::Camera::pitch
private

Definition at line 58 of file Camera.hpp.

Referenced by Camera(), GetPitch(), SetRotation(), and UpdateCameraViewMatrix().

◆ position

glm::vec3 Botcraft::Renderer::Camera::position
private

Definition at line 53 of file Camera.hpp.

Referenced by Camera(), GetDistance(), GetPosition(), SetPosition(), and UpdateCameraViewMatrix().

◆ projection_matrix

glm::mat4 Botcraft::Renderer::Camera::projection_matrix
private

Definition at line 61 of file Camera.hpp.

Referenced by ComputeFrustumPlanes(), and SetProjection().

◆ view_matrix

glm::mat4 Botcraft::Renderer::Camera::view_matrix
private

Definition at line 62 of file Camera.hpp.

Referenced by ComputeFrustumPlanes(), GetViewMatrix(), and UpdateCameraViewMatrix().

◆ worldUp

glm::vec3 Botcraft::Renderer::Camera::worldUp
private

Definition at line 50 of file Camera.hpp.

Referenced by Camera(), and UpdateCameraViewMatrix().

◆ yaw

float Botcraft::Renderer::Camera::yaw
private

Definition at line 57 of file Camera.hpp.

Referenced by Camera(), GetYaw(), SetRotation(), and UpdateCameraViewMatrix().


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