diff options
| author | David Doan <daviddoan@Davids-MacBook-Pro-100.local> | 2023-12-12 22:29:39 -0500 |
|---|---|---|
| committer | David Doan <daviddoan@Davids-MacBook-Pro-100.local> | 2023-12-12 22:29:39 -0500 |
| commit | 3f6fd615a96a3cf347557f6f82b5daee767039a0 (patch) | |
| tree | f8b23b4ca16669c4cd4b3c7348e07e674cc34f6e /src/accelerate | |
| parent | 018c2504879f3a585a3f6f0921c9aba22f6a9b76 (diff) | |
isHit
Diffstat (limited to 'src/accelerate')
| -rw-r--r-- | src/accelerate/bvh.cpp | 6 | ||||
| -rw-r--r-- | src/accelerate/kdtree.cpp | 6 | ||||
| -rw-r--r-- | src/accelerate/myqtconcurrent.cpp | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/accelerate/bvh.cpp b/src/accelerate/bvh.cpp index 19f9390..2949cbe 100644 --- a/src/accelerate/bvh.cpp +++ b/src/accelerate/bvh.cpp @@ -114,8 +114,8 @@ float RayTracer::traverseBVH( for (const auto &shape: current.shapes) { glm::vec4 pObject = shape.shape.inverseCTM * p; glm::vec4 dObject = glm::normalize(shape.shape.inverseCTM * d); - - glm::vec4 intersection = findIntersection(pObject, dObject, shape.shape); + bool isHit = false; + glm::vec4 intersection = findIntersection(pObject, dObject, shape.shape, isHit); if (intersection.w == 0.f) { continue; } @@ -148,4 +148,4 @@ float RayTracer::traverseBVH( } return minT; -}
\ No newline at end of file +} diff --git a/src/accelerate/kdtree.cpp b/src/accelerate/kdtree.cpp index 4156c98..f025b0a 100644 --- a/src/accelerate/kdtree.cpp +++ b/src/accelerate/kdtree.cpp @@ -218,8 +218,8 @@ float RayTracer::traverse( for (const auto &shape: tree->shapesWithinBounds) { glm::vec4 pObject = shape.shape.inverseCTM * p; glm::vec4 dObject = glm::normalize(shape.shape.inverseCTM * d); - - glm::vec4 intersection = findIntersection(pObject, dObject, shape.shape); + bool isHit = false; + glm::vec4 intersection = findIntersection(pObject, dObject, shape.shape, isHit); if (intersection.w == 0.f) { continue; } @@ -270,4 +270,4 @@ float RayTracer::traverse( } return traverse(p, d, t, tEnd, testShape, tree->rightChild); } -}
\ No newline at end of file +} diff --git a/src/accelerate/myqtconcurrent.cpp b/src/accelerate/myqtconcurrent.cpp index 1e95436..7bfc879 100644 --- a/src/accelerate/myqtconcurrent.cpp +++ b/src/accelerate/myqtconcurrent.cpp @@ -50,7 +50,7 @@ void RayTracer::renderParallel(RGBA *imageData, const RayTraceScene &scene) float camera4dDepth = 1; glm::vec4 pWorld = Vec4Ops::transformPoint4(glm::vec4(0.f), camera.getViewMatrix(), camera.getTranslationVector()); - glm::vec4 dWorld = Vec4Ops::transformVector4(glm::vec4(x, y, z, cameraDepth), camera.getViewMatrix()); + glm::vec4 dWorld = Vec4Ops::transformDir4(glm::vec4(x, y, z, cameraDepth), camera.getViewMatrix()); // get the pixel color glm::vec4 pixelColor = getPixelFromRay(pWorld, dWorld, scene, 0); |
