mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
fix compilation error unused variable, make getFilePath work on windows (yavin, you should still install linux), add error callback to glfw
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 14:00:38 by TheRed #+# #+# */
|
||||
/* Updated: 2025/02/05 20:09:58 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/02/06 02:07:47 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -38,7 +38,7 @@ void Camera::updateCameraVectors()
|
||||
|
||||
void Camera::updateCameraDirections()
|
||||
{
|
||||
glm::vec3 forward_xz = glm::normalize(glm::vec3(_forward.x, 0.0f, _forward.z));
|
||||
// glm::vec3 forward_xz = glm::normalize(glm::vec3(_forward.x, 0.0f, _forward.z));
|
||||
_pitch = glm::degrees(asin(_forward.y));
|
||||
|
||||
_yaw = glm::degrees(atan2(-_forward.x, _forward.z));
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */
|
||||
/* Updated: 2025/02/03 19:01:06 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/02/06 02:19:50 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -32,10 +32,10 @@ std::string ObjParser::getFilePath(std::string &file)
|
||||
{
|
||||
int index;
|
||||
|
||||
if(file.find("/") == std::string::npos)
|
||||
if(file.find("/") == std::string::npos && file.find("\\") == std::string::npos)
|
||||
return("");
|
||||
index = file.length() - 1;
|
||||
while(index && file[index] != '/')
|
||||
while(index && file[index] != '/' && file[index] != '\\')
|
||||
index--;
|
||||
return(file.substr(0, index + 1));
|
||||
}
|
||||
|
@ -6,12 +6,17 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/13 16:16:24 by TheRed #+# #+# */
|
||||
/* Updated: 2025/02/05 20:01:29 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/02/06 02:57:16 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Window.hpp"
|
||||
|
||||
void GLFWErrorCallback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "GLFW Error (%d): %s\n", error, description);
|
||||
}
|
||||
|
||||
Window::Window(Scene *scene, int width, int height, const char *title, int sleep, Arguments &args)
|
||||
{
|
||||
_scene = scene;
|
||||
@ -19,7 +24,7 @@ Window::Window(Scene *scene, int width, int height, const char *title, int sleep
|
||||
_frameCount = 0;
|
||||
_pixelisation = 0;
|
||||
_renderer = new Renderer(scene, this, args);
|
||||
|
||||
glfwSetErrorCallback(GLFWErrorCallback);
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf( stderr, "Failed to initialize GLFW\n" );
|
||||
@ -143,9 +148,6 @@ void Window::updateDeltaTime()
|
||||
|
||||
lastTime = currentTime;
|
||||
_fps = 1.0f / _delta;
|
||||
|
||||
if (accumulate)
|
||||
_frameCount++;
|
||||
}
|
||||
|
||||
void Window::display()
|
||||
|
Reference in New Issue
Block a user