diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-12-12 22:59:21 -0500 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-12-12 23:15:46 -0500 |
commit | cb25af3547e469e2296d5d7621331db54c4fe362 (patch) | |
tree | 5858e227a3cefe485e7375b11ceac4ecb099051e /src/accelerate/myqtconcurrent.cpp | |
parent | 27304e9b491b39fbcef915838b95deaf7fe8d92a (diff) |
updat ray tracer to include depth
Diffstat (limited to 'src/accelerate/myqtconcurrent.cpp')
-rw-r--r-- | src/accelerate/myqtconcurrent.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/accelerate/myqtconcurrent.cpp b/src/accelerate/myqtconcurrent.cpp index 686d28f..74dbd88 100644 --- a/src/accelerate/myqtconcurrent.cpp +++ b/src/accelerate/myqtconcurrent.cpp @@ -43,15 +43,14 @@ void RayTracer::renderParallel(RGBA *imageData, const RayTraceScene &scene) for (int imageRow = 0; imageRow < scene.height(); imageRow++) { for (int imageCol = 0; imageCol < scene.width(); imageCol++) { // FIXME: for now, use height as depth - for (int imageDepth = 0; imageDepth < scene.height(); imageDepth++) { + for (int imageDepth = 0; imageDepth < scene.depth(); imageDepth++) { // compute the ray float x = (imageCol - scene.width()/2.f) * viewplaneWidth / scene.width(); float y = (imageRow - scene.height()/2.f) * viewplaneHeight / scene.height(); - float z = (imageDepth - scene.height()/2.f) * viewplaneHeight / scene.height(); - float camera4dDepth = 1; + float z = (imageDepth - scene.width()/2.f) * viewplaneDepth / scene.width(); glm::vec4 pWorld = Vec4Ops::transformPoint4(glm::vec4(0.f), camera.getViewMatrix(), camera.getTranslationVector()); - glm::vec4 dWorld = Vec4Ops::inverseTransformDir4(glm::vec4(x, y, z, cameraDepth), camera.getViewMatrix()); + glm::vec4 dWorld = Vec4Ops::inverseTransformDir4(glm::vec4(x, y, z, -1.0), camera.getViewMatrix()); // get the pixel color glm::vec4 pixelColor = getPixelFromRay(pWorld, dWorld, scene, 0); |