This commit is contained in:
RedShip
2025-01-28 18:35:46 +01:00
parent 7b81995724
commit ff9ab9251f
5 changed files with 12 additions and 8 deletions

View File

@ -24,8 +24,8 @@ pl 0 -2 0 0 1 0 2 // floor
qu -1 1.999 -1 2 0 0 0 0 2 6 qu -1 1.999 -1 2 0 0 0 0 2 6
OBJ scenes/obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0 OBJ obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
OBJ scenes/obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0 OBJ obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
# OBJ obj/Model.obj # OBJ obj/Model.obj

View File

@ -60,6 +60,10 @@ struct GPUTriangle
vec3 vertex2; vec3 vertex2;
vec3 normal; vec3 normal;
vec2 texture_vertex1;
vec2 texture_vertex2;
vec2 texture_vertex3;
int mat_index; int mat_index;
}; };
layout(std430, binding = 2) buffer TriangleBuffer layout(std430, binding = 2) buffer TriangleBuffer

View File

@ -89,8 +89,8 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit)
hit.t = t; hit.t = t;
hit.position = ray.origin + ray.direction * t; hit.position = ray.origin + ray.direction * t;
// hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping
hit.normal = obj.normal * sign(-dot(ray.direction, obj.normal)); // hit.normal = obj.normal * sign(-dot(ray.direction, obj.normal));
return (valid); return (valid);
} }

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */ /* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/27 14:51:49 by TheRed #+# #+# */ /* Created: 2024/09/27 14:51:49 by TheRed #+# #+# */
/* Updated: 2025/01/27 19:07:49 by ycontre ### ########.fr */ /* Updated: 2025/01/28 18:34:10 by ycontre ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -20,9 +20,9 @@ int main(int argc, char **argv)
return (1); return (1);
Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0); Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0);
Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl"); // Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl");
// Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/debug.glsl"); Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/debug.glsl");
GLint max_gpu_size; GLint max_gpu_size;
glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_gpu_size); glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_gpu_size);

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */ /* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */ /* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */
/* Updated: 2025/01/24 18:49:42 by ycontre ### ########.fr */ /* Updated: 2025/01/28 18:30:33 by ycontre ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */