From e2d84883f085b02a57a2999f9fffbfc907c89821 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Wed, 13 Dec 2023 00:13:37 -0500 Subject: update voxel projection into 2d --- src/accelerate/myqtconcurrent.cpp | 9 ++++++--- src/camera/camera.cpp | 6 +----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/accelerate/myqtconcurrent.cpp b/src/accelerate/myqtconcurrent.cpp index 74dbd88..de83f8a 100644 --- a/src/accelerate/myqtconcurrent.cpp +++ b/src/accelerate/myqtconcurrent.cpp @@ -67,9 +67,12 @@ void RayTracer::renderParallel(RGBA *imageData, const RayTraceScene &scene) } QList pixels = QtConcurrent::blockingMapped(l, pixelRoutine); QtConcurrent::blockingMap(l, pixelRoutine); - int index = 0; - for (RGBA p : pixels) { - imageData[index++] = p; + + // get the slice relating to z == 0 and set it into int the iamge data array + int currentSlice = 0; + int ptr = currentSlice * scene.width() * scene.height(); + for (int i = 0; i < scene.width() * scene.height(); i++) { + imageData[i] = pixels[ptr + i]; } if (m_enableAntiAliasing) diff --git a/src/camera/camera.cpp b/src/camera/camera.cpp index 1b37938..1b4cd43 100644 --- a/src/camera/camera.cpp +++ b/src/camera/camera.cpp @@ -53,8 +53,4 @@ float Camera::getFocalLength() const { float Camera::getAperture() const { // Optional TODO: implement the getter or make your own design return m_aperture; -} - -glm::vec3 Camera::getPos() const { - return m_pos; -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2