ultimatepp/bazaar/SurfaceCtrl/MagicCamera.h
xemuth a0cee6d856 SurfaceCtrl: working demo
git-svn-id: svn://ultimatepp.org/upp/trunk@14881 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-08-22 17:17:23 +00:00

37 lines
1.5 KiB
C++

#ifndef _SurfaceCtrl_MagicCamera_h_
#define _SurfaceCtrl_MagicCamera_h_
#include "UOGL_Camera.h"
#include "Object3D.h"
namespace Upp{
class MagicCamera : public UOGL_Camera{
private:
bool OnObject = false;
glm::vec3 focus;
glm::vec3 UnProject2(float winX, float winY,float winZ)const noexcept;
public:
MagicCamera(){}
MagicCamera& Init(){transform.SetPosition(0, 0, 20); focus = glm::vec3(0.0f,0.0f,0.0f); return *this;}
glm::mat4 GetProjectionMatrix()const noexcept;
glm::mat4 GetViewMatrix()const noexcept;
glm::vec3 GetFocus(){return focus;}
MagicCamera& SetFocus(glm::vec3 f){focus = f; return *this;}
int Pick(float x, float y,const Upp::Vector<Object3D>& allObjects)const noexcept; //Return Picked object ID between a vector of object
MagicCamera& DetermineRotationPoint(Point& p,const Upp::Vector<Object3D>& allObjects)noexcept; //Find a new focus point depending on cursor position and all Object3D
MagicCamera& ProcessMouseWheelTranslation(float xoffset,float yoffset); //Move the camera depending on X and Y offset
MagicCamera& MouseWheelMouvement(float xoffset,float yoffset)noexcept; //Rotate arround axis
MagicCamera& ProcessMouseScroll(float zdelta)noexcept; //Zoom or move via MouseWheel depending on OnObject Boolean
MagicCamera& ProcessKeyboardMouvement(Camera_Movement direction){return *this;} //Handler for keyboard, Useless in this kind of camera
bool ProcessKeyBoard(unsigned long Key,int count)noexcept{return true;} //Handler for keyboard, Useless in this kind of camera
};
}
#endif