diff --git a/scenes/dragon.rt b/scenes/dragon.rt index 84bbb1c..a0ed4e7 100644 --- a/scenes/dragon.rt +++ b/scenes/dragon.rt @@ -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 -OBJ 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 scenes/obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0 # OBJ obj/Model.obj diff --git a/shaders/intersect.glsl b/shaders/intersect.glsl index 207fdac..b57f50b 100644 --- a/shaders/intersect.glsl +++ b/shaders/intersect.glsl @@ -91,8 +91,8 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit) hit.v = v; hit.t = t; hit.position = ray.origin + ray.direction * t; - // hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping hit.normal = obj.normal * sign(-dot(ray.direction, obj.normal)); + // hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping return (valid); } diff --git a/shaders/light.glsl b/shaders/light.glsl index e780d85..81f8f12 100644 --- a/shaders/light.glsl +++ b/shaders/light.glsl @@ -113,9 +113,7 @@ vec3 getTextureColor(int texture_index, hitInfo hit) void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state) { - if (mat.texture_index != -1) - color *= getTextureColor(mat.texture_index, hit); - + color *= mat.texture_index == -1 ? vec3(1.0) : getTextureColor(mat.texture_index, hit); color *= mat.color; light += mat.emission * mat.color; // light += sampleLights(hit.position, rng_state); diff --git a/shaders/scatter.glsl b/shaders/scatter.glsl index 30357ec..f03342c 100644 --- a/shaders/scatter.glsl +++ b/shaders/scatter.glsl @@ -80,10 +80,8 @@ Ray transparencyRay(hitInfo hit, Ray ray, GPUMaterial mat, inout uint rng_state) Ray newRay(hitInfo hit, Ray ray, inout uint rng_state) { - GPUObject obj; GPUMaterial mat; - obj = objects[hit.obj_index]; mat = materials[hit.mat_index]; if (mat.type == 0) diff --git a/srcs/class/Shader.cpp b/srcs/class/Shader.cpp index f9335f9..0c529cc 100644 --- a/srcs/class/Shader.cpp +++ b/srcs/class/Shader.cpp @@ -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);