demotool/camera.hh

44 lines
741 B
C++
Raw Normal View History

2017-10-02 10:12:27 +02:00
#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
/*= T_Camera =================================================================*/
struct T_Camera
{
2017-10-06 20:38:08 +02:00
glm::vec3 lookAt = glm::vec3( 0 );
glm::vec3 angles = glm::vec3( 0 );
2017-10-02 10:12:27 +02:00
float distance = 10;
float fov = 90;
// Everything below is updated by update()
glm::vec3 dir;
glm::vec3 up;
glm::vec3 pos;
float np;
T_Camera()
{ update( ); }
void handleDND(
2017-11-03 11:55:26 +01:00
ImVec2 const& move ,
const bool hasCtrl ,
const bool hasShift ,
const bool lmb // Left mouse button
2017-10-02 10:12:27 +02:00
);
void handleWheel(
2017-11-03 11:55:26 +01:00
const float wheel ,
const bool hasCtrl ,
const bool hasShift
2017-10-02 10:12:27 +02:00
);
void makeUI( );
private:
glm::mat3x3 rotMat;
float rotationMatrix[ 9 ];
void update( );
};