15 #ifndef SCENE_LAB_BASIC_CAMERA_H_
16 #define SCENE_LAB_BASIC_CAMERA_H_
18 #include "corgi_component_library/camera_interface.h"
19 #include "mathfu/constants.h"
20 #include "mathfu/glsl_mappings.h"
24 static const mathfu::vec3 kCameraForward = mathfu::kAxisY3f;
25 static const mathfu::vec3 kCameraSide = mathfu::kAxisX3f;
26 static const mathfu::vec3 kCameraUp = mathfu::kAxisZ3f;
75 virtual mathfu::vec3
position(int32_t index)
const {
82 virtual mathfu::vec3
position()
const {
return position_; }
86 assert(facing.LengthSquared() != 0);
91 virtual const mathfu::vec3&
facing()
const {
return facing_; }
95 assert(up.LengthSquared() != 0);
99 virtual const mathfu::vec3&
up()
const {
return up_; }
104 return mathfu::vec3::CrossProduct(facing_, up_);
120 return viewport_resolution_;
147 virtual const mathfu::vec4i&
viewport(int32_t index)
const {
154 virtual const mathfu::vec4i&
viewport()
const {
return viewport_; }
173 MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE
176 mathfu::vec3 position_;
177 mathfu::vec3 facing_;
179 float viewport_angle_;
180 mathfu::vec2 viewport_resolution_;
181 float viewport_near_plane_;
182 float viewport_far_plane_;
183 mathfu::vec4i viewport_;
188 #endif // SCENE_LAB_BASIC_CAMERA_H_
virtual float viewport_angle() const
Get the camera's viewport angle, in radians.
Definition: basic_camera.h:112
virtual mathfu::mat4 GetTransformMatrix(int32_t index) const
Returns the View/Projection matrix. index must be 0.
Definition: basic_camera.h:43
virtual mathfu::mat4 GetViewMatrix() const
Returns just the View matrix.
virtual void set_position(int32_t index, const mathfu::vec3 &position)
Set the camera's world position. index must be 0.
Definition: basic_camera.h:63
virtual mathfu::mat4 GetViewMatrix(int32_t index) const
Returns just View matrix. index must be 0.
Definition: basic_camera.h:53
virtual bool IsStereo() const
Returns false, since this camera is not stereoscopic by design.
Definition: basic_camera.h:157
virtual void set_facing(const mathfu::vec3 &facing)
Set the camera's forward direction.
Definition: basic_camera.h:85
virtual void set_viewport(const mathfu::vec4i &viewport)
Set the camera's viewport.
Definition: basic_camera.h:137
void Initialize(float viewport_angle, mathfu::vec2 viewport_resolution, float viewport_near_plane, float viewport_far_plane)
Initialize the camera's viewport settings.
Definition: basic_camera.h:165
virtual mathfu::vec3 position(int32_t index) const
Get the camera's world position. index must be 0.
Definition: basic_camera.h:75
virtual const mathfu::vec3 & facing() const
Get the camera's forward direction.
Definition: basic_camera.h:91
mathfu::vec3 Right() const
Get the camera's right direction, calculated via cross product of its forward and up directions...
Definition: basic_camera.h:103
virtual float viewport_near_plane() const
Get the distance to the near clipping plane.
Definition: basic_camera.h:127
virtual void set_up(const mathfu::vec3 &up)
Set the camera's up direction.
Definition: basic_camera.h:94
virtual const mathfu::vec4i & viewport(int32_t index) const
Get the camera's viewport. index must be 0.
Definition: basic_camera.h:147
virtual const mathfu::vec4i & viewport() const
Get the camera's viewport settings.
Definition: basic_camera.h:154
virtual void set_viewport_near_plane(float viewport_near_plane)
Set the distance to the near clipping plane.
Definition: basic_camera.h:123
virtual void set_viewport(int32_t index, const mathfu::vec4i &viewport)
Set the camera's viewport. index must be 0.
Definition: basic_camera.h:141
virtual void set_stereo(bool is_stereo)
Fails if you try to set stereoscopic mode to anything but false.
Definition: basic_camera.h:159
void set_viewport_angle(float viewport_angle)
Set the camera's viewport angle, in radians.
Definition: basic_camera.h:108
virtual mathfu::vec3 position() const
Get the camera's world position.
Definition: basic_camera.h:82
virtual void set_viewport_resolution(mathfu::vec2 viewport_resolution)
Set the camera's viewport resolution.
Definition: basic_camera.h:115
virtual mathfu::mat4 GetTransformMatrix() const
Returns the View/Projection matrix.
virtual void set_position(const mathfu::vec3 &position)
Set the camera's world position.
Definition: basic_camera.h:70
virtual float viewport_far_plane() const
Get the distance to the far clipping plane.
Definition: basic_camera.h:134
virtual void set_viewport_far_plane(float viewport_far_plane)
Set the distance to the far clipping plane.
Definition: basic_camera.h:130
virtual mathfu::vec2 viewport_resolution() const
Get the camera's viewport resolution.
Definition: basic_camera.h:119
Definition: basic_camera.h:37
virtual const mathfu::vec3 & up() const
Get the camera's up direction.
Definition: basic_camera.h:99