+ | Small opti

This commit is contained in:
RedShip
2025-01-24 19:54:14 +01:00
parent c050caa789
commit 6378ed0737
17 changed files with 119432 additions and 676 deletions

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/16 21:48:48 by TheRed #+# #+# */
/* Updated: 2025/01/23 18:30:20 by ycontre ### ########.fr */
/* Updated: 2025/01/24 19:36:07 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -146,7 +146,6 @@ GPUBvh BVH::toGPUBvh()
{
GPUBvh bvh;
bvh.is_leaf = _is_leaf;
bvh.first_primitive = _first_primitive;
bvh.primitive_count = _primitive_count;
bvh.max = _aabb.max;

View File

@ -6,15 +6,15 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */
/* Updated: 2025/01/21 16:02:48 by tomoron ### ########.fr */
/* Updated: 2025/01/24 18:49:42 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
#include "RT.hpp"
ObjParser::ObjParser(std::string &filename, std::string &scene_filename)
ObjParser::ObjParser(std::string &filename, std::string &scene_filename, int mat)
{
_mat = 0;
_mat = mat;
_filename = getFilePath(scene_filename) + filename;
std::cout << _filename << std::endl;
_file.open(_filename);

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/26 21:43:51 by TheRed #+# #+# */
/* Updated: 2025/01/21 15:57:42 by tomoron ### ########.fr */
/* Updated: 2025/01/24 18:50:33 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -107,15 +107,18 @@ void SceneParser::parseObj(std::stringstream &line)
float xtransform = 0.;
float ytransform = 0.;
float ztransform = 0.;
int mat = 0;
line >> name;
line >> x >> y >> z;
line >> scale;
line >> xtransform >> ytransform >> ztransform;
line >> mat;
glm::mat4 transform = glm::eulerAngleXYZ(glm::radians(xtransform), glm::radians(ytransform), glm::radians(ztransform));
ObjParser obj(name, _filename);
ObjParser obj(name, _filename, mat);
obj.parse(*_scene, glm::vec3(x, y, z), (1.0 / scale), transform);
}

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/13 20:21:13 by ycontre #+# #+# */
/* Updated: 2025/01/23 18:46:34 by ycontre ### ########.fr */
/* Updated: 2025/01/24 19:13:13 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -67,7 +67,7 @@ Shader::Shader(std::string vertexPath, std::string fragmentPath, std::string com
const char *fragmentCode = loadFileWithIncludes(fragmentPath);
const char *computeCode = loadFileWithIncludes(computePath);
// printWithLineNumbers(computeCode);
printWithLineNumbers(computeCode);
_vertex = glCreateShader(GL_VERTEX_SHADER);