mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Starting camera handling
This commit is contained in:
31
includes/Camera.hpp
Normal file
31
includes/Camera.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Camera.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: TheRed <TheRed@students.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 13:59:57 by TheRed #+# #+# */
|
||||
/* Updated: 2024/10/15 13:59:57 by TheRed ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef RT_CAMERA__HPP
|
||||
# define RT_CAMERA__HPP
|
||||
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
|
||||
Camera(void);
|
||||
Camera(Camera const &src);
|
||||
~Camera(void);
|
||||
|
||||
Camera &operator=(Camera const &rhs);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -39,6 +39,8 @@ class Window
|
||||
private:
|
||||
GLFWwindow *_window;
|
||||
RT::Vec2i _mousePos;
|
||||
RT::Vec2i _prevMousePos;
|
||||
RT::Vec2i _mouseDelta;
|
||||
|
||||
float _fps;
|
||||
|
||||
|
34
srcs/Camera.cpp
Normal file
34
srcs/Camera.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Camera.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: TheRed <TheRed@students.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 14:00:38 by TheRed #+# #+# */
|
||||
/* Updated: 2024/10/15 14:00:38 by TheRed ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Camera.hpp"
|
||||
|
||||
Camera::Camera(void)
|
||||
{
|
||||
}
|
||||
|
||||
Camera::Camera(Camera const &src)
|
||||
{
|
||||
*this = src;
|
||||
}
|
||||
|
||||
Camera::~Camera(void)
|
||||
{
|
||||
}
|
||||
|
||||
Camera &Camera::operator=(Camera const &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
}
|
||||
return (*this);
|
||||
}
|
@ -72,7 +72,10 @@ void Window::mouseMoveCallback(GLFWwindow* window, double xpos, double ypos)
|
||||
Window* win = static_cast<Window*>(glfwGetWindowUserPointer(window));
|
||||
(void) win; (void) xpos; (void) ypos;
|
||||
|
||||
win->_prevMousePos = win->_mousePos;
|
||||
win->_mousePos = RT::Vec2i(xpos, ypos);
|
||||
|
||||
win->_mouseDelta = win->_mousePos - win->_prevMousePos;
|
||||
}
|
||||
void Window::mouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
|
Reference in New Issue
Block a user