Add ortho camera function to set view bounding box. Add some debug printouts
This commit is contained in:
@@ -85,7 +85,7 @@ namespace egn{
|
||||
|
||||
void set_projection_width(GLfloat w);
|
||||
void set_projection_height(GLfloat h);
|
||||
|
||||
void set_projection_box(GLfloat w, GLfloat h);
|
||||
protected:
|
||||
void recalc_projection_matrix()override;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "engine/camera.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
namespace egn{
|
||||
|
||||
@@ -63,6 +64,7 @@ namespace egn{
|
||||
}
|
||||
|
||||
void camera_iface::recalc_view_matrix(){
|
||||
debug_print_verbose("Rebuilding view matrix\n");
|
||||
m_view_matrix = m_orientation.to_mat4();
|
||||
m_view_matrix.get(3, 0) = -m_position[0];
|
||||
m_view_matrix.get(3, 1) = -m_position[1];
|
||||
@@ -89,8 +91,14 @@ namespace egn{
|
||||
m_update_flag |= PROJ_UPDATE;
|
||||
m_height = h;
|
||||
}
|
||||
void ortho_camera::set_projection_box(GLfloat w, GLfloat h){
|
||||
m_update_flag |= PROJ_UPDATE;
|
||||
m_width = w;
|
||||
m_height = h;
|
||||
}
|
||||
|
||||
void ortho_camera::recalc_projection_matrix(){
|
||||
debug_print_verbose("Rebuilding orthographic projection matrix\n");
|
||||
m_projection_matrix = math::ortho_projection(m_width, m_height, m_near, m_far);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "engine/object.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
namespace egn{
|
||||
|
||||
@@ -65,6 +66,7 @@ namespace egn{
|
||||
return m_model_matrix;
|
||||
}
|
||||
void object::recalc_model_matrix(){
|
||||
debug_print_verbose("Rebuilding model matrix\n");
|
||||
m_model_matrix = m_orientation.to_mat4();
|
||||
m_model_matrix.get(3, 0) = m_position[0];
|
||||
m_model_matrix.get(3, 1) = m_position[1];
|
||||
|
||||
Reference in New Issue
Block a user