Default Camera¶
/* Declarations */
DefaultCamera m_camera;
/* Default Creation */
Camera::Create(CameraDesc(), &m_camera);
/* Usage during rendering */
ShaderStage::SetUniformMat4f(m_vert,0,Camera::View(&m_camera));
ShaderStage::SetUniformMat4f(m_vert,1,Camera::Proj(&m_camera));
ShaderStage::SetUniformVec3f(m_vert,2,Camera::Origin(&m_camera));
/* To Move the Camera */
Camera::Update(&m_camera);
/* When window/frame is resizing */
Camera::Resize(&m_camera, IO::FrameWidth(),IO::FrameHeight());
DefaultCamera API Description¶
-
struct CameraDesc¶
Camera configuration.
Public Members
-
uint32_t mode = 0u¶
Camera update mode (First person or Arcball)
-
uint32_t proj = 0u¶
Camera projection mode (z range in [0:1] ? reverse-z ? infinite ?)
-
float yaw = 0.f¶
Camera yaw angle
-
float pitch = 0.f¶
Camera pitch matrix
-
float fovy = 0.f¶
Camera vertical fov
-
float znear = 0.f¶
Camera near plane distance
-
float zfar = 0.f¶
Camera fat plane distance
-
float speed_move = 0.f¶
Camera move speed
-
float speed_rotation = 0.f¶
Camera rotation speed
-
uint32_t key_front = 0u¶
Camera key : Move Forward
-
uint32_t key_left = 0u¶
Camera key : Move Left
-
uint32_t key_right = 0u¶
Camera key : Move Right
-
uint32_t key_back = 0u¶
Camera key : Move Backward
-
uint32_t key_up = 0u¶
Camera key : Move Up
-
uint32_t key_down = 0u¶
Camera key : Move Down
-
bool reverse_x_axis = false¶
Inverse camera horizontal rotation axis
-
bool reverse_y_axis = false¶
Inverse camera vertical rotation axis
-
uint32_t mode = 0u¶
-
struct DefaultCamera¶
Camera data structure.
-
namespace Camera¶
Functions
-
void Create(const CameraDesc &config, DefaultCamera *camera)¶
Creates a simple camera.
-
void Resize(DefaultCamera *c, int width, int height)¶
Resizes the view matrix.
-
void Update(DefaultCamera *c)¶
Updates Camera matrices using default keyboard/mouse events.
-
float *View(DefaultCamera *c)¶
Returns the view matrix float data pointer.
-
float *Proj(DefaultCamera *c)¶
Returns the projection matrix float data pointer.
-
float *Origin(DefaultCamera *c)¶
Returns the camera origin world position.
-
void Create(const CameraDesc &config, DefaultCamera *camera)¶