demotool/camera.hh

44 lines
756 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
{
glm::vec3 lookAt;
glm::vec3 angles;
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(
__rd__ ImVec2 const& move ,
__rd__ const bool hasCtrl ,
__rd__ const bool hasShift ,
__rd__ const bool lmb // Left mouse button
);
void handleWheel(
__rd__ const float wheel ,
__rd__ const bool hasCtrl ,
__rd__ const bool hasShift
);
void makeUI( );
private:
glm::mat3x3 rotMat;
float rotationMatrix[ 9 ];
void update( );
};