From 256a50ddd591223cb2cab00cc4c2be62993077da Mon Sep 17 00:00:00 2001 From: sotech117 Date: Wed, 13 Dec 2023 02:49:03 -0500 Subject: experiment with scene files --- src/accelerate/myqtconcurrent.cpp | 2 +- src/illuminate/illuminate.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/accelerate/myqtconcurrent.cpp b/src/accelerate/myqtconcurrent.cpp index 08248f4..4d0cb1e 100644 --- a/src/accelerate/myqtconcurrent.cpp +++ b/src/accelerate/myqtconcurrent.cpp @@ -52,7 +52,7 @@ void RayTracer::renderParallel(RGBA *imageData, const RayTraceScene &scene) float z = (imageDepth - scene.depth()/2.f) * viewplaneDepth / scene.depth(); glm::vec4 pWorld = Vec4Ops::transformPoint4(glm::vec4(0.f), camera.getViewMatrix(), camera.getTranslationVector()); - glm::vec4 dWorld = Vec4Ops::transformDir4(glm::vec4(x, y, z, -1.0), camera.getViewMatrix()); + glm::vec4 dWorld = glm::normalize(Vec4Ops::transformDir4(glm::vec4(x, y, z, -1.0), camera.getViewMatrix())); pixelRoutineArgs args{ pWorld, diff --git a/src/illuminate/illuminate.cpp b/src/illuminate/illuminate.cpp index 641f06d..a651924 100644 --- a/src/illuminate/illuminate.cpp +++ b/src/illuminate/illuminate.cpp @@ -87,10 +87,10 @@ glm::vec4 RayTracer::illuminatePixel( } } - // auto incidentDir = -directionToCamera; + auto incidentDir = -directionToCamera; // recursive raytracing for the reflection and refraction (see reflect.cpp) - // illumination += refract(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1); - // illumination += reflect(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1); + illumination += refract(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1); + illumination += reflect(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1); return illumination; } \ No newline at end of file -- cgit v1.2.3-70-g09d2