From 3a3c06b9bcb6d98bd774d1fdb894a4aa63fc948a Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 8 Dec 2023 14:29:56 -0500 Subject: refactor vec4 ops --- src/4dvecops/vec4operations.cpp | 63 ----------------------------------------- src/4dvecops/vec4ops.cpp | 63 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 src/4dvecops/vec4operations.cpp create mode 100644 src/4dvecops/vec4ops.cpp (limited to 'src') diff --git a/src/4dvecops/vec4operations.cpp b/src/4dvecops/vec4operations.cpp deleted file mode 100644 index 1ffe673..0000000 --- a/src/4dvecops/vec4operations.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "raytracer/raytracer.h" - -// vector operations on 4d vectors, -// reference: https://hollasch.github.io/ray4/Four-Space_Visualization_of_4D_Objects.html#chapter5 - -glm::vec4 cross4( - glm::vec4 u, - glm::vec4 v, - glm::vec4 w) { - float a = (v[0] * w[1]) - (v[1] * w[0]); - float b = (v[0] * w[2]) - (v[2] * w[0]); - float c = (v[0] * w[3]) - (v[3] * w[0]); - float d = (v[1] * w[2]) - (v[2] * w[1]); - float e = (v[1] * w[3]) - (v[3] * w[1]); - float f = (v[2] * w[3]) - (v[3] * w[2]); - - glm::vec4 result; - result[0] = (u[1] * f) - (u[2] * e) + (u[3] * d); - result[1] = -(u[0] * f) + (u[2] * c) - (u[3] * b); - result[2] = (u[0] * e) - (u[1] * c) + (u[3] * a); - result[3] = -(u[0] * d) + (u[1] * b) - (u[2] * a); - - return result; -} - -glm::vec4 dot4( - glm::vec4 u, - glm::vec4 v) { - return {u[0] * v[0], u[1] * v[1], u[2] * v[2], u[3] * v[3]}; -} - -glm::mat4 getViewMatrix4( - glm::vec4 fromPoint, - glm::vec4 toPoint, - glm::vec4 upVector, - glm::vec4 lookVector) { - - // calculate e3 basis vector, the transformation col of view matrix - if (glm::distance(fromPoint, toPoint) < 0.0001f) { - throw std::runtime_error("fromPoint and toPoint are the same"); - } - glm::vec4 e3 = glm::normalize(fromPoint - toPoint); - - // calculate e2 basis vector, from the combinatory cross of up and over with e3 - glm::vec4 e2 = cross4(upVector, lookVector, e3); - e2 = glm::normalize(e2); - if (glm::distance(e2, glm::vec4{0, 0, 0, 0}) < 0.0001f) { - throw std::runtime_error("invalid up vector"); - } - - // calculate e1 basis vector, from the cross of only the over vector - glm::vec4 e1 = cross4(lookVector, e3, e2); - e1 = glm::normalize(e1); - if (glm::distance(e1, glm::vec4{0, 0, 0, 0}) < 0.0001f) { - throw std::runtime_error("invalid over vector"); - } - - // calculate e0 basis vector, the 4d orthogonal vector to the other 3 bases - glm::vec4 e0 = cross4(e3, e2, e1); - e0 = glm::normalize(e0); - - return {e2, e1, e0, e3}; -} \ No newline at end of file diff --git a/src/4dvecops/vec4ops.cpp b/src/4dvecops/vec4ops.cpp new file mode 100644 index 0000000..1ffe673 --- /dev/null +++ b/src/4dvecops/vec4ops.cpp @@ -0,0 +1,63 @@ +#include "raytracer/raytracer.h" + +// vector operations on 4d vectors, +// reference: https://hollasch.github.io/ray4/Four-Space_Visualization_of_4D_Objects.html#chapter5 + +glm::vec4 cross4( + glm::vec4 u, + glm::vec4 v, + glm::vec4 w) { + float a = (v[0] * w[1]) - (v[1] * w[0]); + float b = (v[0] * w[2]) - (v[2] * w[0]); + float c = (v[0] * w[3]) - (v[3] * w[0]); + float d = (v[1] * w[2]) - (v[2] * w[1]); + float e = (v[1] * w[3]) - (v[3] * w[1]); + float f = (v[2] * w[3]) - (v[3] * w[2]); + + glm::vec4 result; + result[0] = (u[1] * f) - (u[2] * e) + (u[3] * d); + result[1] = -(u[0] * f) + (u[2] * c) - (u[3] * b); + result[2] = (u[0] * e) - (u[1] * c) + (u[3] * a); + result[3] = -(u[0] * d) + (u[1] * b) - (u[2] * a); + + return result; +} + +glm::vec4 dot4( + glm::vec4 u, + glm::vec4 v) { + return {u[0] * v[0], u[1] * v[1], u[2] * v[2], u[3] * v[3]}; +} + +glm::mat4 getViewMatrix4( + glm::vec4 fromPoint, + glm::vec4 toPoint, + glm::vec4 upVector, + glm::vec4 lookVector) { + + // calculate e3 basis vector, the transformation col of view matrix + if (glm::distance(fromPoint, toPoint) < 0.0001f) { + throw std::runtime_error("fromPoint and toPoint are the same"); + } + glm::vec4 e3 = glm::normalize(fromPoint - toPoint); + + // calculate e2 basis vector, from the combinatory cross of up and over with e3 + glm::vec4 e2 = cross4(upVector, lookVector, e3); + e2 = glm::normalize(e2); + if (glm::distance(e2, glm::vec4{0, 0, 0, 0}) < 0.0001f) { + throw std::runtime_error("invalid up vector"); + } + + // calculate e1 basis vector, from the cross of only the over vector + glm::vec4 e1 = cross4(lookVector, e3, e2); + e1 = glm::normalize(e1); + if (glm::distance(e1, glm::vec4{0, 0, 0, 0}) < 0.0001f) { + throw std::runtime_error("invalid over vector"); + } + + // calculate e0 basis vector, the 4d orthogonal vector to the other 3 bases + glm::vec4 e0 = cross4(e3, e2, e1); + e0 = glm::normalize(e0); + + return {e2, e1, e0, e3}; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 9ac7858c1b569ef5bbbb673c5a6438baf96b3e92 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 8 Dec 2023 14:37:27 -0500 Subject: cleanup vec4 transform ops --- .../reply/codemodel-v2-d0d3fa287e29188e0354.json | 94 ++ .../reply/codemodel-v2-d8c16986ac54f14e6ad2.json | 94 -- .../v1/reply/index-2023-12-08T19-16-15-0499.json | 108 --- .../v1/reply/index-2023-12-08T19-30-06-0529.json | 108 +++ ...et-projects_ray-Debug-0c31da326cb0080f0750.json | 942 +++++++++++++++++++++ ...et-projects_ray-Debug-435ebb35886eb992308e.json | 942 --------------------- cmake-build-debug/.ninja_deps | Bin 190512 -> 174300 bytes cmake-build-debug/.ninja_log | 54 +- .../projects_ray_autogen.dir/AutogenInfo.json | 2 +- cmake-build-debug/Testing/Temporary/LastTest.log | 4 +- cmake-build-debug/build.ninja | 8 +- src/4dvecops/transform4d.cpp | 16 +- src/4dvecops/vec4ops.h | 5 + 13 files changed, 1188 insertions(+), 1189 deletions(-) create mode 100644 cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d0d3fa287e29188e0354.json delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d8c16986ac54f14e6ad2.json delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-16-15-0499.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-30-06-0529.json create mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-0c31da326cb0080f0750.json delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-435ebb35886eb992308e.json (limited to 'src') diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d0d3fa287e29188e0354.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d0d3fa287e29188e0354.json new file mode 100644 index 0000000..a00a375 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d0d3fa287e29188e0354.json @@ -0,0 +1,94 @@ +{ + "configurations" : + [ + { + "directories" : + [ + { + "build" : ".", + "childIndexes" : + [ + 1 + ], + "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", + "minimumCMakeVersion" : + { + "string" : "3.16" + }, + "projectIndex" : 0, + "source" : ".", + "targetIndexes" : + [ + 0, + 1, + 2 + ] + }, + { + "build" : "glm", + "jsonFile" : "directory-glm-Debug-2bef2a2728e6bac3f360.json", + "minimumCMakeVersion" : + { + "string" : "3.16" + }, + "parentIndex" : 0, + "projectIndex" : 0, + "source" : "glm" + } + ], + "name" : "Debug", + "projects" : + [ + { + "directoryIndexes" : + [ + 0, + 1 + ], + "name" : "projects_ray", + "targetIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "targets" : + [ + { + "directoryIndex" : 0, + "id" : "projects_ray::@6890427a1f51a3e7e1df", + "jsonFile" : "target-projects_ray-Debug-0c31da326cb0080f0750.json", + "name" : "projects_ray", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "projects_ray_autogen::@6890427a1f51a3e7e1df", + "jsonFile" : "target-projects_ray_autogen-Debug-e02ef12cced0b8364953.json", + "name" : "projects_ray_autogen", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "projects_ray_autogen_timestamp_deps::@6890427a1f51a3e7e1df", + "jsonFile" : "target-projects_ray_autogen_timestamp_deps-Debug-55dec22dd9da92fe9f6e.json", + "name" : "projects_ray_autogen_timestamp_deps", + "projectIndex" : 0 + } + ] + } + ], + "kind" : "codemodel", + "paths" : + { + "build" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug", + "source" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230" + }, + "version" : + { + "major" : 2, + "minor" : 5 + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d8c16986ac54f14e6ad2.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d8c16986ac54f14e6ad2.json deleted file mode 100644 index 234c68a..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-d8c16986ac54f14e6ad2.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "configurations" : - [ - { - "directories" : - [ - { - "build" : ".", - "childIndexes" : - [ - 1 - ], - "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", - "minimumCMakeVersion" : - { - "string" : "3.16" - }, - "projectIndex" : 0, - "source" : ".", - "targetIndexes" : - [ - 0, - 1, - 2 - ] - }, - { - "build" : "glm", - "jsonFile" : "directory-glm-Debug-2bef2a2728e6bac3f360.json", - "minimumCMakeVersion" : - { - "string" : "3.16" - }, - "parentIndex" : 0, - "projectIndex" : 0, - "source" : "glm" - } - ], - "name" : "Debug", - "projects" : - [ - { - "directoryIndexes" : - [ - 0, - 1 - ], - "name" : "projects_ray", - "targetIndexes" : - [ - 0, - 1, - 2 - ] - } - ], - "targets" : - [ - { - "directoryIndex" : 0, - "id" : "projects_ray::@6890427a1f51a3e7e1df", - "jsonFile" : "target-projects_ray-Debug-435ebb35886eb992308e.json", - "name" : "projects_ray", - "projectIndex" : 0 - }, - { - "directoryIndex" : 0, - "id" : "projects_ray_autogen::@6890427a1f51a3e7e1df", - "jsonFile" : "target-projects_ray_autogen-Debug-e02ef12cced0b8364953.json", - "name" : "projects_ray_autogen", - "projectIndex" : 0 - }, - { - "directoryIndex" : 0, - "id" : "projects_ray_autogen_timestamp_deps::@6890427a1f51a3e7e1df", - "jsonFile" : "target-projects_ray_autogen_timestamp_deps-Debug-55dec22dd9da92fe9f6e.json", - "name" : "projects_ray_autogen_timestamp_deps", - "projectIndex" : 0 - } - ] - } - ], - "kind" : "codemodel", - "paths" : - { - "build" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug", - "source" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230" - }, - "version" : - { - "major" : 2, - "minor" : 5 - } -} diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-16-15-0499.json b/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-16-15-0499.json deleted file mode 100644 index 752320c..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-16-15-0499.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/cmake", - "cpack" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/cpack", - "ctest" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/ctest", - "root" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 26, - "patch" : 4, - "string" : "3.26.4", - "suffix" : "" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-d8c16986ac54f14e6ad2.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 5 - } - }, - { - "jsonFile" : "cache-v2-14565ebda493f470ac4d.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-544cfdd119240b345b7d.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - { - "jsonFile" : "toolchains-v1-577ea0f3a8aa7156cbd5.json", - "kind" : "toolchains", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-14565ebda493f470ac4d.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-544cfdd119240b345b7d.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-d8c16986ac54f14e6ad2.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 5 - } - }, - "toolchains-v1" : - { - "jsonFile" : "toolchains-v1-577ea0f3a8aa7156cbd5.json", - "kind" : "toolchains", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - } -} diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-30-06-0529.json b/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-30-06-0529.json new file mode 100644 index 0000000..e6a9128 --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/index-2023-12-08T19-30-06-0529.json @@ -0,0 +1,108 @@ +{ + "cmake" : + { + "generator" : + { + "multiConfig" : false, + "name" : "Ninja" + }, + "paths" : + { + "cmake" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/cmake", + "cpack" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/cpack", + "ctest" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/bin/ctest", + "root" : "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26" + }, + "version" : + { + "isDirty" : false, + "major" : 3, + "minor" : 26, + "patch" : 4, + "string" : "3.26.4", + "suffix" : "" + } + }, + "objects" : + [ + { + "jsonFile" : "codemodel-v2-d0d3fa287e29188e0354.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 5 + } + }, + { + "jsonFile" : "cache-v2-14565ebda493f470ac4d.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-544cfdd119240b345b7d.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + { + "jsonFile" : "toolchains-v1-577ea0f3a8aa7156cbd5.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ], + "reply" : + { + "cache-v2" : + { + "jsonFile" : "cache-v2-14565ebda493f470ac4d.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + "cmakeFiles-v1" : + { + "jsonFile" : "cmakeFiles-v1-544cfdd119240b345b7d.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + "codemodel-v2" : + { + "jsonFile" : "codemodel-v2-d0d3fa287e29188e0354.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 5 + } + }, + "toolchains-v1" : + { + "jsonFile" : "toolchains-v1-577ea0f3a8aa7156cbd5.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + } +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-0c31da326cb0080f0750.json b/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-0c31da326cb0080f0750.json new file mode 100644 index 0000000..bcc468c --- /dev/null +++ b/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-0c31da326cb0080f0750.json @@ -0,0 +1,942 @@ +{ + "artifacts" : + [ + { + "path" : "projects_ray" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "set_target_properties", + "include", + "find_package", + "find_dependency", + "_qt_internal_find_qt_dependencies", + "add_definitions", + "target_link_libraries", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentConfig.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Xml/Qt6XmlVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Xml/Qt6XmlConfig.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsConfig.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Widgets/Qt6WidgetsVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreConfig.cmake", + "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26/Modules/CMakeFindDependencyMacro.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentDependencies.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreTargets.cmake", + "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiTargets.cmake" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 30, + "parent" : 0 + }, + { + "command" : 3, + "file" : 0, + "line" : 17, + "parent" : 0 + }, + { + "file" : 3, + "parent" : 2 + }, + { + "command" : 3, + "file" : 3, + "line" : 157, + "parent" : 3 + }, + { + "file" : 2, + "parent" : 4 + }, + { + "command" : 2, + "file" : 2, + "line" : 55, + "parent" : 5 + }, + { + "file" : 1, + "parent" : 6 + }, + { + "command" : 1, + "file" : 1, + "line" : 61, + "parent" : 7 + }, + { + "command" : 3, + "file" : 0, + "line" : 20, + "parent" : 0 + }, + { + "file" : 3, + "parent" : 9 + }, + { + "command" : 3, + "file" : 3, + "line" : 157, + "parent" : 10 + }, + { + "file" : 5, + "parent" : 11 + }, + { + "command" : 2, + "file" : 5, + "line" : 55, + "parent" : 12 + }, + { + "file" : 4, + "parent" : 13 + }, + { + "command" : 1, + "file" : 4, + "line" : 61, + "parent" : 14 + }, + { + "command" : 3, + "file" : 0, + "line" : 22, + "parent" : 0 + }, + { + "file" : 3, + "parent" : 16 + }, + { + "command" : 3, + "file" : 3, + "line" : 157, + "parent" : 17 + }, + { + "file" : 7, + "parent" : 18 + }, + { + "command" : 2, + "file" : 7, + "line" : 55, + "parent" : 19 + }, + { + "file" : 6, + "parent" : 20 + }, + { + "command" : 1, + "file" : 6, + "line" : 61, + "parent" : 21 + }, + { + "command" : 3, + "file" : 0, + "line" : 21, + "parent" : 0 + }, + { + "file" : 3, + "parent" : 23 + }, + { + "command" : 3, + "file" : 3, + "line" : 157, + "parent" : 24 + }, + { + "file" : 9, + "parent" : 25 + }, + { + "command" : 2, + "file" : 9, + "line" : 55, + "parent" : 26 + }, + { + "file" : 8, + "parent" : 27 + }, + { + "command" : 1, + "file" : 8, + "line" : 61, + "parent" : 28 + }, + { + "command" : 2, + "file" : 7, + "line" : 52, + "parent" : 19 + }, + { + "file" : 10, + "parent" : 30 + }, + { + "command" : 1, + "file" : 10, + "line" : 62, + "parent" : 31 + }, + { + "command" : 3, + "file" : 0, + "line" : 19, + "parent" : 0 + }, + { + "file" : 3, + "parent" : 33 + }, + { + "command" : 3, + "file" : 3, + "line" : 157, + "parent" : 34 + }, + { + "file" : 12, + "parent" : 35 + }, + { + "command" : 2, + "file" : 12, + "line" : 55, + "parent" : 36 + }, + { + "file" : 11, + "parent" : 37 + }, + { + "command" : 1, + "file" : 11, + "line" : 61, + "parent" : 38 + }, + { + "command" : 2, + "file" : 2, + "line" : 40, + "parent" : 5 + }, + { + "file" : 17, + "parent" : 40 + }, + { + "command" : 5, + "file" : 17, + "line" : 39, + "parent" : 41 + }, + { + "command" : 4, + "file" : 16, + "line" : 111, + "parent" : 42 + }, + { + "command" : 3, + "file" : 15, + "line" : 76, + "parent" : 43 + }, + { + "file" : 14, + "parent" : 44 + }, + { + "command" : 2, + "file" : 14, + "line" : 55, + "parent" : 45 + }, + { + "file" : 13, + "parent" : 46 + }, + { + "command" : 1, + "file" : 13, + "line" : 61, + "parent" : 47 + }, + { + "command" : 2, + "file" : 14, + "line" : 52, + "parent" : 45 + }, + { + "file" : 18, + "parent" : 49 + }, + { + "command" : 1, + "file" : 18, + "line" : 62, + "parent" : 50 + }, + { + "command" : 2, + "file" : 12, + "line" : 52, + "parent" : 36 + }, + { + "file" : 19, + "parent" : 52 + }, + { + "command" : 1, + "file" : 19, + "line" : 62, + "parent" : 53 + }, + { + "command" : 6, + "file" : 0, + "line" : 27, + "parent" : 0 + }, + { + "command" : 7, + "file" : 0, + "line" : 75, + "parent" : 0 + }, + { + "command" : 8, + "file" : 0, + "line" : 25, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-Wno-deprecated-volatile -g -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -fcolor-diagnostics" + } + ], + "defines" : + [ + { + "backtrace" : 55, + "define" : "GLM_FORCE_SWIZZLE" + }, + { + "backtrace" : 56, + "define" : "QT_CONCURRENT_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_CORE_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_GUI_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_OPENGLWIDGETS_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_OPENGL_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_WIDGETS_LIB" + }, + { + "backtrace" : 56, + "define" : "QT_XML_LIB" + } + ], + "includes" : + [ + { + "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug" + }, + { + "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230" + }, + { + "backtrace" : 0, + "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/include" + }, + { + "backtrace" : 57, + "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/mkspecs/macx-clang" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/include" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Headers" + }, + { + "backtrace" : 56, + "isSystem" : true, + "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 56, + 56 + ], + "standard" : "20" + }, + "sourceIndexes" : + [ + 0, + 1, + 2, + 5, + 6, + 7, + 8, + 9, + 10, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 32, + 34, + 35, + 36 + ] + } + ], + "dependencies" : + [ + { + "id" : "projects_ray_autogen_timestamp_deps::@6890427a1f51a3e7e1df" + }, + { + "backtrace" : 0, + "id" : "projects_ray_autogen::@6890427a1f51a3e7e1df" + } + ], + "id" : "projects_ray::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-Wno-deprecated-volatile -g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-F/Users/sotech117/Qt/6.5.2/macos/lib", + "role" : "frameworkPath" + }, + { + "fragment" : "-Wl,-rpath,/Users/sotech117/Qt/6.5.2/macos/lib", + "role" : "libraries" + }, + { + "backtrace" : 8, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Versions/A/QtConcurrent", + "role" : "libraries" + }, + { + "backtrace" : 15, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Versions/A/QtXml", + "role" : "libraries" + }, + { + "backtrace" : 22, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets", + "role" : "libraries" + }, + { + "backtrace" : 29, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets", + "role" : "libraries" + }, + { + "backtrace" : 32, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL", + "role" : "libraries" + }, + { + "backtrace" : 39, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui", + "role" : "libraries" + }, + { + "backtrace" : 48, + "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore", + "role" : "libraries" + }, + { + "backtrace" : 51, + "fragment" : "-framework IOKit", + "role" : "libraries" + }, + { + "backtrace" : 51, + "fragment" : "-framework DiskArbitration", + "role" : "libraries" + }, + { + "fragment" : "-Xlinker -framework -Xlinker OpenGL", + "role" : "libraries" + }, + { + "fragment" : "-Xlinker -framework -Xlinker AGL", + "role" : "libraries" + }, + { + "backtrace" : 54, + "fragment" : "-framework AppKit", + "role" : "libraries" + }, + { + "backtrace" : 54, + "fragment" : "-framework ImageIO", + "role" : "libraries" + }, + { + "backtrace" : 54, + "fragment" : "-framework Metal", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "projects_ray", + "nameOnDisk" : "projects_ray", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 5, + 6, + 7, + 8, + 9, + 10, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 32, + 34, + 35, + 36 + ] + }, + { + "name" : "Header Files", + "sourceIndexes" : + [ + 3, + 4, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 31, + 33, + 37 + ] + }, + { + "name" : "", + "sourceIndexes" : + [ + 38 + ] + }, + { + "name" : "CMake Rules", + "sourceIndexes" : + [ + 39 + ] + } + ], + "sources" : + [ + { + "backtrace" : 0, + "compileGroupIndex" : 0, + "isGenerated" : true, + "path" : "cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/main.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/mainwindow.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "src/mainwindow.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/settings.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/settings.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/camera/camera.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/raytracer/raytracer.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/raytracer/raytracescene.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/utils/scenefilereader.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/utils/sceneparser.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "src/camera/camera.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/raytracer/raytracer.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/raytracer/raytracescene.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/utils/rgba.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/utils/scenedata.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/utils/scenefilereader.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/utils/aspectratiowidget/aspectratiowidget.hpp", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "path" : "src/utils/sceneparser.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/intersect/intersect.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/illuminate/illuminate.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/illuminate/shadow.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/illuminate/reflect.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/texture/texture.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/intersect/normals.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/utils/raytracerutils.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/aliasing/supersample.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/aliasing/filter.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/accelerate/myqthreads.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/accelerate/myqtconcurrent.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/accelerate/kdtree.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "src/accelerate/kdtree.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/accelerate/bvh.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "src/accelerate/bvh.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/4dvecops/vec4ops.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/4dvecops/rotations4d.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/4dvecops/transform4d.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "src/4dvecops/vec4ops.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 0, + "isGenerated" : true, + "path" : "cmake-build-debug/projects_ray_autogen/timestamp", + "sourceGroupIndex" : 2 + }, + { + "backtrace" : 0, + "isGenerated" : true, + "path" : "cmake-build-debug/projects_ray_autogen/timestamp.rule", + "sourceGroupIndex" : 3 + } + ], + "type" : "EXECUTABLE" +} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-435ebb35886eb992308e.json b/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-435ebb35886eb992308e.json deleted file mode 100644 index 3ae76e6..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/target-projects_ray-Debug-435ebb35886eb992308e.json +++ /dev/null @@ -1,942 +0,0 @@ -{ - "artifacts" : - [ - { - "path" : "projects_ray" - } - ], - "backtrace" : 1, - "backtraceGraph" : - { - "commands" : - [ - "add_executable", - "set_target_properties", - "include", - "find_package", - "find_dependency", - "_qt_internal_find_qt_dependencies", - "add_definitions", - "target_link_libraries", - "include_directories" - ], - "files" : - [ - "CMakeLists.txt", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentConfig.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Xml/Qt6XmlVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Xml/Qt6XmlConfig.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsConfig.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Widgets/Qt6WidgetsVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6OpenGLWidgets/Qt6OpenGLWidgetsTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreConfig.cmake", - "/Users/sotech117/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26/Modules/CMakeFindDependencyMacro.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Concurrent/Qt6ConcurrentDependencies.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Core/Qt6CoreTargets.cmake", - "/Users/sotech117/Qt/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiTargets.cmake" - ], - "nodes" : - [ - { - "file" : 0 - }, - { - "command" : 0, - "file" : 0, - "line" : 30, - "parent" : 0 - }, - { - "command" : 3, - "file" : 0, - "line" : 17, - "parent" : 0 - }, - { - "file" : 3, - "parent" : 2 - }, - { - "command" : 3, - "file" : 3, - "line" : 157, - "parent" : 3 - }, - { - "file" : 2, - "parent" : 4 - }, - { - "command" : 2, - "file" : 2, - "line" : 55, - "parent" : 5 - }, - { - "file" : 1, - "parent" : 6 - }, - { - "command" : 1, - "file" : 1, - "line" : 61, - "parent" : 7 - }, - { - "command" : 3, - "file" : 0, - "line" : 20, - "parent" : 0 - }, - { - "file" : 3, - "parent" : 9 - }, - { - "command" : 3, - "file" : 3, - "line" : 157, - "parent" : 10 - }, - { - "file" : 5, - "parent" : 11 - }, - { - "command" : 2, - "file" : 5, - "line" : 55, - "parent" : 12 - }, - { - "file" : 4, - "parent" : 13 - }, - { - "command" : 1, - "file" : 4, - "line" : 61, - "parent" : 14 - }, - { - "command" : 3, - "file" : 0, - "line" : 22, - "parent" : 0 - }, - { - "file" : 3, - "parent" : 16 - }, - { - "command" : 3, - "file" : 3, - "line" : 157, - "parent" : 17 - }, - { - "file" : 7, - "parent" : 18 - }, - { - "command" : 2, - "file" : 7, - "line" : 55, - "parent" : 19 - }, - { - "file" : 6, - "parent" : 20 - }, - { - "command" : 1, - "file" : 6, - "line" : 61, - "parent" : 21 - }, - { - "command" : 3, - "file" : 0, - "line" : 21, - "parent" : 0 - }, - { - "file" : 3, - "parent" : 23 - }, - { - "command" : 3, - "file" : 3, - "line" : 157, - "parent" : 24 - }, - { - "file" : 9, - "parent" : 25 - }, - { - "command" : 2, - "file" : 9, - "line" : 55, - "parent" : 26 - }, - { - "file" : 8, - "parent" : 27 - }, - { - "command" : 1, - "file" : 8, - "line" : 61, - "parent" : 28 - }, - { - "command" : 2, - "file" : 7, - "line" : 52, - "parent" : 19 - }, - { - "file" : 10, - "parent" : 30 - }, - { - "command" : 1, - "file" : 10, - "line" : 62, - "parent" : 31 - }, - { - "command" : 3, - "file" : 0, - "line" : 19, - "parent" : 0 - }, - { - "file" : 3, - "parent" : 33 - }, - { - "command" : 3, - "file" : 3, - "line" : 157, - "parent" : 34 - }, - { - "file" : 12, - "parent" : 35 - }, - { - "command" : 2, - "file" : 12, - "line" : 55, - "parent" : 36 - }, - { - "file" : 11, - "parent" : 37 - }, - { - "command" : 1, - "file" : 11, - "line" : 61, - "parent" : 38 - }, - { - "command" : 2, - "file" : 2, - "line" : 40, - "parent" : 5 - }, - { - "file" : 17, - "parent" : 40 - }, - { - "command" : 5, - "file" : 17, - "line" : 39, - "parent" : 41 - }, - { - "command" : 4, - "file" : 16, - "line" : 111, - "parent" : 42 - }, - { - "command" : 3, - "file" : 15, - "line" : 76, - "parent" : 43 - }, - { - "file" : 14, - "parent" : 44 - }, - { - "command" : 2, - "file" : 14, - "line" : 55, - "parent" : 45 - }, - { - "file" : 13, - "parent" : 46 - }, - { - "command" : 1, - "file" : 13, - "line" : 61, - "parent" : 47 - }, - { - "command" : 2, - "file" : 14, - "line" : 52, - "parent" : 45 - }, - { - "file" : 18, - "parent" : 49 - }, - { - "command" : 1, - "file" : 18, - "line" : 62, - "parent" : 50 - }, - { - "command" : 2, - "file" : 12, - "line" : 52, - "parent" : 36 - }, - { - "file" : 19, - "parent" : 52 - }, - { - "command" : 1, - "file" : 19, - "line" : 62, - "parent" : 53 - }, - { - "command" : 6, - "file" : 0, - "line" : 27, - "parent" : 0 - }, - { - "command" : 7, - "file" : 0, - "line" : 75, - "parent" : 0 - }, - { - "command" : 8, - "file" : 0, - "line" : 25, - "parent" : 0 - } - ] - }, - "compileGroups" : - [ - { - "compileCommandFragments" : - [ - { - "fragment" : "-Wno-deprecated-volatile -g -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -fcolor-diagnostics" - } - ], - "defines" : - [ - { - "backtrace" : 55, - "define" : "GLM_FORCE_SWIZZLE" - }, - { - "backtrace" : 56, - "define" : "QT_CONCURRENT_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_CORE_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_GUI_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_OPENGLWIDGETS_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_OPENGL_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_WIDGETS_LIB" - }, - { - "backtrace" : 56, - "define" : "QT_XML_LIB" - } - ], - "includes" : - [ - { - "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug" - }, - { - "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230" - }, - { - "backtrace" : 0, - "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/include" - }, - { - "backtrace" : 57, - "path" : "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/mkspecs/macx-clang" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/include" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Headers" - }, - { - "backtrace" : 56, - "isSystem" : true, - "path" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework" - } - ], - "language" : "CXX", - "languageStandard" : - { - "backtraces" : - [ - 56, - 56 - ], - "standard" : "20" - }, - "sourceIndexes" : - [ - 0, - 1, - 2, - 5, - 6, - 7, - 8, - 9, - 10, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 32, - 34, - 35, - 36 - ] - } - ], - "dependencies" : - [ - { - "id" : "projects_ray_autogen_timestamp_deps::@6890427a1f51a3e7e1df" - }, - { - "backtrace" : 0, - "id" : "projects_ray_autogen::@6890427a1f51a3e7e1df" - } - ], - "id" : "projects_ray::@6890427a1f51a3e7e1df", - "link" : - { - "commandFragments" : - [ - { - "fragment" : "-Wno-deprecated-volatile -g", - "role" : "flags" - }, - { - "fragment" : "", - "role" : "flags" - }, - { - "fragment" : "-F/Users/sotech117/Qt/6.5.2/macos/lib", - "role" : "frameworkPath" - }, - { - "fragment" : "-Wl,-rpath,/Users/sotech117/Qt/6.5.2/macos/lib", - "role" : "libraries" - }, - { - "backtrace" : 8, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Versions/A/QtConcurrent", - "role" : "libraries" - }, - { - "backtrace" : 15, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Versions/A/QtXml", - "role" : "libraries" - }, - { - "backtrace" : 22, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets", - "role" : "libraries" - }, - { - "backtrace" : 29, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets", - "role" : "libraries" - }, - { - "backtrace" : 32, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL", - "role" : "libraries" - }, - { - "backtrace" : 39, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui", - "role" : "libraries" - }, - { - "backtrace" : 48, - "fragment" : "/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore", - "role" : "libraries" - }, - { - "backtrace" : 51, - "fragment" : "-framework IOKit", - "role" : "libraries" - }, - { - "backtrace" : 51, - "fragment" : "-framework DiskArbitration", - "role" : "libraries" - }, - { - "fragment" : "-Xlinker -framework -Xlinker OpenGL", - "role" : "libraries" - }, - { - "fragment" : "-Xlinker -framework -Xlinker AGL", - "role" : "libraries" - }, - { - "backtrace" : 54, - "fragment" : "-framework AppKit", - "role" : "libraries" - }, - { - "backtrace" : 54, - "fragment" : "-framework ImageIO", - "role" : "libraries" - }, - { - "backtrace" : 54, - "fragment" : "-framework Metal", - "role" : "libraries" - } - ], - "language" : "CXX" - }, - "name" : "projects_ray", - "nameOnDisk" : "projects_ray", - "paths" : - { - "build" : ".", - "source" : "." - }, - "sourceGroups" : - [ - { - "name" : "Source Files", - "sourceIndexes" : - [ - 0, - 1, - 2, - 5, - 6, - 7, - 8, - 9, - 10, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 32, - 34, - 35, - 36 - ] - }, - { - "name" : "Header Files", - "sourceIndexes" : - [ - 3, - 4, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 31, - 33, - 37 - ] - }, - { - "name" : "", - "sourceIndexes" : - [ - 38 - ] - }, - { - "name" : "CMake Rules", - "sourceIndexes" : - [ - 39 - ] - } - ], - "sources" : - [ - { - "backtrace" : 0, - "compileGroupIndex" : 0, - "isGenerated" : true, - "path" : "cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/main.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/mainwindow.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/mainwindow.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/settings.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/settings.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/camera/camera.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/raytracer/raytracer.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/raytracer/raytracescene.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/utils/scenefilereader.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/utils/sceneparser.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/camera/camera.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/raytracer/raytracer.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/raytracer/raytracescene.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/utils/rgba.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/utils/scenedata.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/utils/scenefilereader.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/utils/aspectratiowidget/aspectratiowidget.hpp", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "path" : "src/utils/sceneparser.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/intersect/intersect.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/illuminate/illuminate.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/illuminate/shadow.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/illuminate/reflect.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/texture/texture.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/intersect/normals.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/utils/raytracerutils.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/aliasing/supersample.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/aliasing/filter.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/accelerate/myqthreads.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/accelerate/myqtconcurrent.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/accelerate/kdtree.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/accelerate/kdtree.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/accelerate/bvh.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/accelerate/bvh.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/4dvecops/vec4operations.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/4dvecops/rotations4d.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/4dvecops/transform4d.cpp", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/4dvecops/vec4ops.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 0, - "isGenerated" : true, - "path" : "cmake-build-debug/projects_ray_autogen/timestamp", - "sourceGroupIndex" : 2 - }, - { - "backtrace" : 0, - "isGenerated" : true, - "path" : "cmake-build-debug/projects_ray_autogen/timestamp.rule", - "sourceGroupIndex" : 3 - } - ], - "type" : "EXECUTABLE" -} diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index d347892..e937cad 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 374ec09..674598c 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -1,44 +1,32 @@ # ninja log v5 -0 168 1702062975490968165 build.ninja 34bb77e754b05480 -5 30 1702062340090774698 projects_ray_autogen/timestamp d580242d2b9854b3 -34 269 1702062340326491140 CMakeFiles/projects_ray.dir/src/settings.cpp.o 169e2abc4ff9cc00 -5 30 1702062340090774698 projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -5 30 1702062340090774698 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/timestamp d580242d2b9854b3 -5 30 1702062340090774698 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -405 1189 1702062341245532123 CMakeFiles/projects_ray.dir/src/utils/sceneparser.cpp.o d7c5f490abfda5be -34 404 1702062340461232090 CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o a64c381fddacd090 -1 163 1702062975490968165 build.ninja 34bb77e754b05480 -5 388 1702062975885356000 projects_ray_autogen/timestamp d580242d2b9854b3 -5 388 1702062975885356000 projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -5 388 1702062975885356000 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/timestamp d580242d2b9854b3 -5 388 1702062975885356000 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -389 1124 1702062976621998218 CMakeFiles/projects_ray.dir/src/accelerate/myqthreads.cpp.o e51322a1e2833898 +1 163 1702063806513858336 build.ninja 34bb77e754b05480 +37 1002 1702063495670965252 CMakeFiles/projects_ray.dir/src/utils/scenefilereader.cpp.o 41959d435611c983 +1129 1843 1702062977342546570 CMakeFiles/projects_ray.dir/src/4dvecops/rotations4d.cpp.o ce6e3c7f960de866 +1220 1963 1702062977461615794 CMakeFiles/projects_ray.dir/src/intersect/intersect.cpp.o 46167bd837be2b2a +7 34 1702063494707727424 projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 +1153 1904 1702062977403040871 CMakeFiles/projects_ray.dir/src/illuminate/reflect.cpp.o 63ef5fb7afacbb32 +7 34 1702063494707727424 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/timestamp d580242d2b9854b3 389 1129 1702062976626800433 CMakeFiles/projects_ray.dir/src/utils/raytracerutils.cpp.o 6d0b760a9c84856a -388 1150 1702062976649649343 CMakeFiles/projects_ray.dir/src/texture/texture.cpp.o a6917eb97660581e +7 34 1702063494707727424 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 +389 1124 1702062976621998218 CMakeFiles/projects_ray.dir/src/accelerate/myqthreads.cpp.o e51322a1e2833898 +1215 1995 1702062977494482428 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 1e4b595f9246a14f +1002 1148 1702063495820276807 projects_ray 69591c53d0e17f8e 389 1153 1702062976653549225 CMakeFiles/projects_ray.dir/src/4dvecops/vec4operations.cpp.o d05a5fd3c2f1f4c4 -389 1194 1702062976692855035 CMakeFiles/projects_ray.dir/src/aliasing/supersample.cpp.o 829a155a1ffac273 390 1215 1702062976713930192 CMakeFiles/projects_ray.dir/src/accelerate/kdtree.cpp.o affe7813bf94b99f +7 34 1702063494707727424 projects_ray_autogen/timestamp d580242d2b9854b3 +389 1194 1702062976692855035 CMakeFiles/projects_ray.dir/src/aliasing/supersample.cpp.o 829a155a1ffac273 +1194 1944 1702062977443687058 CMakeFiles/projects_ray.dir/src/illuminate/shadow.cpp.o 643a1e808e96cec 389 1220 1702062976719809368 CMakeFiles/projects_ray.dir/src/aliasing/filter.cpp.o c1cad78d9998b2c4 -389 1705 1702062977200217227 CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o 5d42dc23cb8d46fc -1150 1837 1702062977336494519 CMakeFiles/projects_ray.dir/src/4dvecops/transform4d.cpp.o edbb1aa44772a316 -1129 1843 1702062977342546570 CMakeFiles/projects_ray.dir/src/4dvecops/rotations4d.cpp.o ce6e3c7f960de866 -1153 1904 1702062977403040871 CMakeFiles/projects_ray.dir/src/illuminate/reflect.cpp.o 63ef5fb7afacbb32 +1995 2884 1702062978382551338 CMakeFiles/projects_ray.dir/src/mainwindow.cpp.o 96d8c110d02a09df 1124 1934 1702062977432980500 CMakeFiles/projects_ray.dir/src/accelerate/bvh.cpp.o a8cce28f179d7603 -1194 1944 1702062977443687058 CMakeFiles/projects_ray.dir/src/illuminate/shadow.cpp.o 643a1e808e96cec -1220 1963 1702062977461615794 CMakeFiles/projects_ray.dir/src/intersect/intersect.cpp.o 46167bd837be2b2a -1215 1995 1702062977494482428 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 1e4b595f9246a14f -1963 2190 1702062977691669565 CMakeFiles/projects_ray.dir/src/settings.cpp.o 7c89207347735849 -1944 2276 1702062977776055279 CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o 9f825ee08bf53b36 1706 2503 1702062978000706958 CMakeFiles/projects_ray.dir/src/utils/sceneparser.cpp.o d9e1b1ef9f57a97a +1944 2276 1702062977776055279 CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o 9f825ee08bf53b36 +1963 2190 1702062977691669565 CMakeFiles/projects_ray.dir/src/settings.cpp.o 7c89207347735849 +1934 3161 1702062978659402142 CMakeFiles/projects_ray.dir/src/raytracer/raytracer.cpp.o 78383fd2d33d7c09 +1150 1837 1702062977336494519 CMakeFiles/projects_ray.dir/src/4dvecops/transform4d.cpp.o edbb1aa44772a316 +388 1150 1702062976649649343 CMakeFiles/projects_ray.dir/src/texture/texture.cpp.o a6917eb97660581e 1904 2623 1702062978121755687 CMakeFiles/projects_ray.dir/src/intersect/normals.cpp.o f9c9e1c96d11334b +389 1705 1702062977200217227 CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o 5d42dc23cb8d46fc 1843 2626 1702062978126233527 CMakeFiles/projects_ray.dir/src/raytracer/raytracescene.cpp.o b0ea56778abe094c -1995 2884 1702062978382551338 CMakeFiles/projects_ray.dir/src/mainwindow.cpp.o 96d8c110d02a09df 2277 3074 1702062978573573842 CMakeFiles/projects_ray.dir/projects_ray_autogen/mocs_compilation.cpp.o 75d01056e19b5cdd -1934 3161 1702062978659402142 CMakeFiles/projects_ray.dir/src/raytracer/raytracer.cpp.o 78383fd2d33d7c09 2190 3283 1702062978781768457 CMakeFiles/projects_ray.dir/src/main.cpp.o 18bcd3026e919fd3 -7 34 1702063494707727424 projects_ray_autogen/timestamp d580242d2b9854b3 -7 34 1702063494707727424 projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -7 34 1702063494707727424 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/timestamp d580242d2b9854b3 -7 34 1702063494707727424 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/mocs_compilation.cpp d580242d2b9854b3 -37 1002 1702063495670965252 CMakeFiles/projects_ray.dir/src/utils/scenefilereader.cpp.o 41959d435611c983 -1002 1148 1702063495820276807 projects_ray 69591c53d0e17f8e diff --git a/cmake-build-debug/CMakeFiles/projects_ray_autogen.dir/AutogenInfo.json b/cmake-build-debug/CMakeFiles/projects_ray_autogen.dir/AutogenInfo.json index 9acceb5..8aa0f76 100644 --- a/cmake-build-debug/CMakeFiles/projects_ray_autogen.dir/AutogenInfo.json +++ b/cmake-build-debug/CMakeFiles/projects_ray_autogen.dir/AutogenInfo.json @@ -559,7 +559,7 @@ null ], [ - "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/4dvecops/vec4operations.cpp", + "/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/4dvecops/vec4ops.cpp", "MU", null ], diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 84b844b..06ce0b3 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Dec 08 14:24 EST +Start testing: Dec 08 14:30 EST ---------------------------------------------------------- -End testing: Dec 08 14:24 EST +End testing: Dec 08 14:30 EST diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja index 85377a1..5f75f72 100644 --- a/cmake-build-debug/build.ninja +++ b/cmake-build-debug/build.ninja @@ -225,9 +225,9 @@ build CMakeFiles/projects_ray.dir/src/accelerate/bvh.cpp.o: CXX_COMPILER__projec OBJECT_DIR = CMakeFiles/projects_ray.dir OBJECT_FILE_DIR = CMakeFiles/projects_ray.dir/src/accelerate -build CMakeFiles/projects_ray.dir/src/4dvecops/vec4operations.cpp.o: CXX_COMPILER__projects_ray_unscanned_Debug /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/4dvecops/vec4operations.cpp || cmake_object_order_depends_target_projects_ray +build CMakeFiles/projects_ray.dir/src/4dvecops/vec4ops.cpp.o: CXX_COMPILER__projects_ray_unscanned_Debug /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/4dvecops/vec4ops.cpp || cmake_object_order_depends_target_projects_ray DEFINES = -DGLM_FORCE_SWIZZLE -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB - DEP_FILE = CMakeFiles/projects_ray.dir/src/4dvecops/vec4operations.cpp.o.d + DEP_FILE = CMakeFiles/projects_ray.dir/src/4dvecops/vec4ops.cpp.o.d FLAGS = -Wno-deprecated-volatile -g -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -fcolor-diagnostics INCLUDES = -I/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug -I/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230 -I/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-debug/projects_ray_autogen/include -I/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Headers -iframework /Users/sotech117/Qt/6.5.2/macos/lib -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Headers -isystem /Users/sotech117/Qt/6.5.2/macos/mkspecs/macx-clang -isystem /Users/sotech117/Qt/6.5.2/macos/include -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Headers -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Headers -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Headers -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Headers -isystem /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Headers OBJECT_DIR = CMakeFiles/projects_ray.dir @@ -257,7 +257,7 @@ build CMakeFiles/projects_ray.dir/src/4dvecops/transform4d.cpp.o: CXX_COMPILER__ ############################################# # Link the executable projects_ray -build projects_ray: CXX_EXECUTABLE_LINKER__projects_ray_Debug CMakeFiles/projects_ray.dir/projects_ray_autogen/mocs_compilation.cpp.o CMakeFiles/projects_ray.dir/src/main.cpp.o CMakeFiles/projects_ray.dir/src/mainwindow.cpp.o CMakeFiles/projects_ray.dir/src/settings.cpp.o CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o CMakeFiles/projects_ray.dir/src/raytracer/raytracer.cpp.o CMakeFiles/projects_ray.dir/src/raytracer/raytracescene.cpp.o CMakeFiles/projects_ray.dir/src/utils/scenefilereader.cpp.o CMakeFiles/projects_ray.dir/src/utils/sceneparser.cpp.o CMakeFiles/projects_ray.dir/src/intersect/intersect.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/shadow.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/reflect.cpp.o CMakeFiles/projects_ray.dir/src/texture/texture.cpp.o CMakeFiles/projects_ray.dir/src/intersect/normals.cpp.o CMakeFiles/projects_ray.dir/src/utils/raytracerutils.cpp.o CMakeFiles/projects_ray.dir/src/aliasing/supersample.cpp.o CMakeFiles/projects_ray.dir/src/aliasing/filter.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/myqthreads.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/kdtree.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/bvh.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/vec4operations.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/rotations4d.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/transform4d.cpp.o | /Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Versions/A/QtConcurrent /Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Versions/A/QtXml /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL /Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui /Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore || projects_ray_autogen projects_ray_autogen_timestamp_deps +build projects_ray: CXX_EXECUTABLE_LINKER__projects_ray_Debug CMakeFiles/projects_ray.dir/projects_ray_autogen/mocs_compilation.cpp.o CMakeFiles/projects_ray.dir/src/main.cpp.o CMakeFiles/projects_ray.dir/src/mainwindow.cpp.o CMakeFiles/projects_ray.dir/src/settings.cpp.o CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o CMakeFiles/projects_ray.dir/src/raytracer/raytracer.cpp.o CMakeFiles/projects_ray.dir/src/raytracer/raytracescene.cpp.o CMakeFiles/projects_ray.dir/src/utils/scenefilereader.cpp.o CMakeFiles/projects_ray.dir/src/utils/sceneparser.cpp.o CMakeFiles/projects_ray.dir/src/intersect/intersect.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/shadow.cpp.o CMakeFiles/projects_ray.dir/src/illuminate/reflect.cpp.o CMakeFiles/projects_ray.dir/src/texture/texture.cpp.o CMakeFiles/projects_ray.dir/src/intersect/normals.cpp.o CMakeFiles/projects_ray.dir/src/utils/raytracerutils.cpp.o CMakeFiles/projects_ray.dir/src/aliasing/supersample.cpp.o CMakeFiles/projects_ray.dir/src/aliasing/filter.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/myqthreads.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/kdtree.cpp.o CMakeFiles/projects_ray.dir/src/accelerate/bvh.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/vec4ops.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/rotations4d.cpp.o CMakeFiles/projects_ray.dir/src/4dvecops/transform4d.cpp.o | /Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Versions/A/QtConcurrent /Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Versions/A/QtXml /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL /Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui /Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore || projects_ray_autogen projects_ray_autogen_timestamp_deps FLAGS = -Wno-deprecated-volatile -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk LINK_LIBRARIES = -Wl,-rpath,/Users/sotech117/Qt/6.5.2/macos/lib /Users/sotech117/Qt/6.5.2/macos/lib/QtConcurrent.framework/Versions/A/QtConcurrent /Users/sotech117/Qt/6.5.2/macos/lib/QtXml.framework/Versions/A/QtXml /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets /Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGL.framework/Versions/A/QtOpenGL /Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui /Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore -framework IOKit -framework DiskArbitration -Xlinker -framework -Xlinker OpenGL -Xlinker -framework -Xlinker AGL -framework AppKit -framework ImageIO -framework Metal LINK_PATH = -F/Users/sotech117/Qt/6.5.2/macos/lib @@ -358,7 +358,7 @@ build projects_ray_autogen/timestamp projects_ray_autogen/mocs_compilation.cpp | ############################################# # Phony custom command for CMakeFiles/projects_ray_autogen_timestamp_deps -build CMakeFiles/projects_ray_autogen_timestamp_deps | ${cmake_ninja_workdir}CMakeFiles/projects_ray_autogen_timestamp_deps: phony /Users/sotech117/Qt/6.5.2/macos/./libexec/moc /Users/sotech117/Qt/6.5.2/macos/./libexec/uic +build CMakeFiles/projects_ray_autogen_timestamp_deps | ${cmake_ninja_workdir}CMakeFiles/projects_ray_autogen_timestamp_deps: phony /Users/sotech117/Qt/6.5.2/macos/./libexec/uic /Users/sotech117/Qt/6.5.2/macos/./libexec/moc ############################################# diff --git a/src/4dvecops/transform4d.cpp b/src/4dvecops/transform4d.cpp index 91f0d8c..5cc51f3 100644 --- a/src/4dvecops/transform4d.cpp +++ b/src/4dvecops/transform4d.cpp @@ -1,12 +1,18 @@ -#include "raytracer/raytracer.h" +#include "vec4ops.h" // this is used to transform a 4d point by a 4d matrix and its associated translation // this is motivated by the fact that glm does not support 5d matrices, so we cannot define a mat5 to encapsulate both the rotation and translation in one matrix // therefore, we break the 5d transformation into a 4d rotation and a 4d translation -glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector) { - // do the translation first - point4 -= translationPointVector; - // do the rotation and scaling +glm::vec4 Vec4Ops::transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector) { + // do the translation then direction point4 = transformDirectionMatrix * point4; + point4 += translationPointVector; + return point4; +} + +glm::vec4 Vec4Ops::inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, glm::vec4 inverseTranslationPointVector) { + // do the direction then translation + point4 += inverseTranslationPointVector; + point4 = inverseTranslationPointVector * point4; return point4; } \ No newline at end of file diff --git a/src/4dvecops/vec4ops.h b/src/4dvecops/vec4ops.h index 48d9139..09c7605 100644 --- a/src/4dvecops/vec4ops.h +++ b/src/4dvecops/vec4ops.h @@ -21,6 +21,11 @@ public: static glm::mat4 getRotationMatrix4YW(float angleRadians); static glm::mat4 getRotationMatrix4ZW(float angleRadians); + + glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector); + + glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, + glm::vec4 inverseTranslationPointVector); }; #endif //PROJECTS_RAY_VEC4OPS_H -- cgit v1.2.3-70-g09d2 From 5f6e9e34cbd6c456f013042f0441249fe16a42f6 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 8 Dec 2023 14:37:53 -0500 Subject: make static --- src/4dvecops/vec4ops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/4dvecops/vec4ops.h b/src/4dvecops/vec4ops.h index 09c7605..47a4c74 100644 --- a/src/4dvecops/vec4ops.h +++ b/src/4dvecops/vec4ops.h @@ -22,9 +22,9 @@ public: static glm::mat4 getRotationMatrix4ZW(float angleRadians); - glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector); + static glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector); - glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, + static glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, glm::vec4 inverseTranslationPointVector); }; -- cgit v1.2.3-70-g09d2 From 2d1484cbdfdb761decee18c324d12e833c6c19b4 Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Fri, 8 Dec 2023 14:39:14 -0500 Subject: Allow both 3d and 4d in scenefilereader.cpp --- src/utils/scenefilereader.cpp | 46 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/utils/scenefilereader.cpp b/src/utils/scenefilereader.cpp index de5dce4..049219e 100644 --- a/src/utils/scenefilereader.cpp +++ b/src/utils/scenefilereader.cpp @@ -638,11 +638,11 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) } QJsonArray translateArray = object["translate"].toArray(); - if (translateArray.size() != 4) { - std::cout << "group translate must have 4 elements" << std::endl; + if (translateArray.size() != 4 && translateArray.size() != 3) { + std::cout << "group translate must have 3-4 elements" << std::endl; return false; } - if (!translateArray[0].isDouble() || !translateArray[1].isDouble() || !translateArray[2].isDouble() || !translateArray[3].isDouble()) { + if (!translateArray[0].isDouble() || !translateArray[1].isDouble() || !translateArray[2].isDouble() || (translateArray.size() == 4 && !translateArray[3].isDouble())) { std::cout << "group translate must contain floating-point values" << std::endl; return false; } @@ -652,7 +652,8 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) translation->translate.x = translateArray[0].toDouble(); translation->translate.y = translateArray[1].toDouble(); translation->translate.z = translateArray[2].toDouble(); - translation->translate.w = translateArray[3].toDouble(); + if (translateArray.size() == 4) + translation->translate.w = translateArray[3].toDouble(); node->transformations.push_back(translation); } @@ -665,11 +666,11 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) } QJsonArray rotateArray = object["rotate"].toArray(); - if (rotateArray.size() != 7) { - std::cout << "group rotate must have 7 elements" << std::endl; + if (rotateArray.size() != 7 && rotateArray.size() != 4) { + std::cout << "group rotate must have 4 or 7 elements" << std::endl; return false; } - if (!rotateArray[0].isDouble() || !rotateArray[1].isDouble() || !rotateArray[2].isDouble() || !rotateArray[3].isDouble() || !rotateArray[4].isDouble() || !rotateArray[5].isDouble() || !rotateArray[6].isDouble()) { + if (!rotateArray[0].isDouble() || !rotateArray[1].isDouble() || !rotateArray[2].isDouble() || !rotateArray[3].isDouble() || (rotateArray.size() == 7 && (!rotateArray[4].isDouble() || !rotateArray[5].isDouble() || !rotateArray[6].isDouble()))) { std::cout << "group rotate must contain floating-point values" << std::endl; return false; } @@ -679,10 +680,16 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) rotation->rotate3.x = rotateArray[0].toDouble(); rotation->rotate3.y = rotateArray[1].toDouble(); rotation->rotate3.z = rotateArray[2].toDouble(); - rotation->rotateW.x = rotateArray[3].toDouble(); - rotation->rotateW.y = rotateArray[4].toDouble(); - rotation->rotateW.z = rotateArray[5].toDouble(); - rotation->angle = rotateArray[6].toDouble() * M_PI / 180.f; + if (rotateArray.size() == 7) { + rotation->rotateW.x = rotateArray[4].toDouble(); + rotation->rotateW.y = rotateArray[5].toDouble(); + rotation->rotateW.z = rotateArray[6].toDouble(); + } else { + rotation->rotateW.x = 0; + rotation->rotateW.y = 0; + rotation->rotateW.z = 0; + } + rotation->angle = rotateArray[(rotateArray.size() == 7) ? 3 : 6].toDouble() * M_PI / 180.f; node->transformations.push_back(rotation); } @@ -695,11 +702,11 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) } QJsonArray scaleArray = object["scale"].toArray(); - if (scaleArray.size() != 4) { - std::cout << "group scale must have 4 elements" << std::endl; + if (scaleArray.size() != 4 && scaleArray.size() != 3) { + std::cout << "group scale must have 3-4 elements" << std::endl; return false; } - if (!scaleArray[0].isDouble() || !scaleArray[1].isDouble() || !scaleArray[2].isDouble() || !scaleArray[3].isDouble()) { + if (!scaleArray[0].isDouble() || !scaleArray[1].isDouble() || !scaleArray[2].isDouble() || (scaleArray.size() == 4 && !scaleArray[3].isDouble())) { std::cout << "group scale must contain floating-point values" << std::endl; return false; } @@ -709,7 +716,8 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) scale->scale.x = scaleArray[0].toDouble(); scale->scale.y = scaleArray[1].toDouble(); scale->scale.z = scaleArray[2].toDouble(); - scale->scale.w = scaleArray[3].toDouble(); + if (scaleArray.size() == 4) + scale->scale.w = scaleArray[3].toDouble(); node->transformations.push_back(scale); } @@ -722,8 +730,8 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) } QJsonArray matrixArray = object["matrix"].toArray(); - if (matrixArray.size() != 5) { - std::cout << "group matrix must be 5x5" << std::endl; + if (matrixArray.size() != 5 && matrixArray.size() != 4) { + std::cout << "group matrix must be 4x4 or 5x5" << std::endl; return false; } @@ -742,8 +750,8 @@ bool ScenefileReader::parseGroupData(const QJsonObject &object, SceneNode *node) } QJsonArray rowArray = row.toArray(); - if (rowArray.size() != 5) { - std::cout << "group matrix must be 5x5" << std::endl; + if (rowArray.size() != 5 && rowArray.size() != 4) { + std::cout << "group matrix must be 4x4 or 5x5" << std::endl; return false; } -- cgit v1.2.3-70-g09d2 From 82f043dc575a8f5b817e74b38e13c0ce4f0584a2 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 8 Dec 2023 14:40:22 -0500 Subject: add new 4d ops --- src/4dvecops/vec4ops.cpp | 9 +++++---- src/4dvecops/vec4ops.h | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/4dvecops/vec4ops.cpp b/src/4dvecops/vec4ops.cpp index 1ffe673..80cebaf 100644 --- a/src/4dvecops/vec4ops.cpp +++ b/src/4dvecops/vec4ops.cpp @@ -1,9 +1,10 @@ -#include "raytracer/raytracer.h" +#include +#include "vec4ops.h" // vector operations on 4d vectors, // reference: https://hollasch.github.io/ray4/Four-Space_Visualization_of_4D_Objects.html#chapter5 -glm::vec4 cross4( +glm::vec4 Vec4Ops::cross4( glm::vec4 u, glm::vec4 v, glm::vec4 w) { @@ -23,13 +24,13 @@ glm::vec4 cross4( return result; } -glm::vec4 dot4( +glm::vec4 Vec4Ops::dot4( glm::vec4 u, glm::vec4 v) { return {u[0] * v[0], u[1] * v[1], u[2] * v[2], u[3] * v[3]}; } -glm::mat4 getViewMatrix4( +glm::mat4 Vec4Ops::getViewMatrix4( glm::vec4 fromPoint, glm::vec4 toPoint, glm::vec4 upVector, diff --git a/src/4dvecops/vec4ops.h b/src/4dvecops/vec4ops.h index 47a4c74..d1c3ac8 100644 --- a/src/4dvecops/vec4ops.h +++ b/src/4dvecops/vec4ops.h @@ -26,6 +26,12 @@ public: static glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, glm::vec4 inverseTranslationPointVector); + + static glm::vec4 cross4(glm::vec4 u, glm::vec4 v, glm::vec4 w); + + static glm::vec4 dot4(glm::vec4 u, glm::vec4 v); + + static glm::mat4 getViewMatrix4(glm::vec4 fromPoint, glm::vec4 toPoint, glm::vec4 upVector, glm::vec4 lookVector); }; #endif //PROJECTS_RAY_VEC4OPS_H -- cgit v1.2.3-70-g09d2 From 298a7f8e68ae0aa1cbe6729c6f5f4ddb6d5b5650 Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Fri, 8 Dec 2023 14:50:05 -0500 Subject: Fix struct initialization in sceneparser.cpp --- src/utils/sceneparser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/utils/sceneparser.cpp b/src/utils/sceneparser.cpp index 12f83bc..2fa1953 100644 --- a/src/utils/sceneparser.cpp +++ b/src/utils/sceneparser.cpp @@ -62,11 +62,11 @@ void initTree(SceneNode* currentNode, std::vector *shapes, std: for(auto primitive : currentNode->primitives) { // primitive->material.textureData = loadTextureFromFile(QString::fromStdString(primitive->material.textureMap.filename)); RenderShapeData rsd = { - primitive: *primitive, - ctm: currentCTM, - translation4d: currentTranslation4d, - inverseCTM: glm::inverse(currentCTM), - inverseTranslation4d: -currentTranslation4d, + .primitive = *primitive, + .ctm = currentCTM, + .translation4d = currentTranslation4d, + .inverseCTM = glm::inverse(currentCTM), + .inverseTranslation4d = -currentTranslation4d, }; shapes->push_back(rsd); } -- cgit v1.2.3-70-g09d2 From f5b9e57575cd0ab35fc3d5658e86fede76cca46b Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Fri, 8 Dec 2023 14:54:46 -0500 Subject: Refactor scale4 function to modify the currentCTM matrix --- src/utils/sceneparser.cpp | 14 +++++++------- src/utils/sceneparser.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/utils/sceneparser.cpp b/src/utils/sceneparser.cpp index 2fa1953..6d668ff 100644 --- a/src/utils/sceneparser.cpp +++ b/src/utils/sceneparser.cpp @@ -43,7 +43,7 @@ void initTree(SceneNode* currentNode, std::vector *shapes, std: SceneParser::translate4(currentTranslation4d, t->translate); break; case TransformationType::TRANSFORMATION_SCALE: - SceneParser::scale4(currentTranslation4d, t->scale); + SceneParser::scale4(currentCTM, t->scale); break; case TransformationType::TRANSFORMATION_ROTATE: currentCTM *= SceneParser::getRotationMatrix4(t->angle, t->rotate3, t->rotateW); @@ -176,11 +176,11 @@ void SceneParser::translate4( } void SceneParser::scale4( - glm::vec4 &v1, - glm::vec4 v2 + glm::mat4 &m, + glm::vec4 v ) { - v1.x *= v2.x; - v1.y *= v2.y; - v1.z *= v2.z; - v1.w *= v2.w; + m[0][0] *= v.x; + m[1][1] *= v.y; + m[2][2] *= v.z; + m[3][3] *= v.w; } \ No newline at end of file diff --git a/src/utils/sceneparser.h b/src/utils/sceneparser.h index fa8a2ac..130156a 100644 --- a/src/utils/sceneparser.h +++ b/src/utils/sceneparser.h @@ -35,5 +35,5 @@ public: static void translate4(glm::vec4 &v1, glm::vec4 v2); - static void scale4(glm::vec4 &v1, glm::vec4 v2); + static void scale4(glm::mat4 &m, glm::vec4 v); }; -- cgit v1.2.3-70-g09d2 From 3c39ba9ce8710332c87e713d0881fcc7a510b8f2 Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Fri, 8 Dec 2023 15:03:09 -0500 Subject: Fix cameraData position and up arrays to allow for 3-4 elements --- .gitignore | 3 +++ src/utils/scenefilereader.cpp | 48 ++++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/.gitignore b/.gitignore index bd423f0..bd664f2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,8 @@ *.exe *.out *.app + +# Misc build/ .vscode/ +.DS_Store diff --git a/src/utils/scenefilereader.cpp b/src/utils/scenefilereader.cpp index 049219e..ad744a5 100644 --- a/src/utils/scenefilereader.cpp +++ b/src/utils/scenefilereader.cpp @@ -447,17 +447,23 @@ bool ScenefileReader::parseCameraData(const QJsonObject &cameradata) { // Parse the camera data if (cameradata["position"].isArray()) { QJsonArray position = cameradata["position"].toArray(); - if (position.size() != 3) { - std::cout << "cameraData position must have 3 elements" << std::endl; + if (position.size() != 3 && position.size() != 4) { + std::cout << "cameraData position must have 3-4 elements" << std::endl; return false; } - if (!position[0].isDouble() || !position[1].isDouble() || !position[2].isDouble()) { + if (!position[0].isDouble() || !position[1].isDouble() || !position[2].isDouble() || (position.size() == 4 && !position[3].isDouble())) { std::cout << "cameraData position must be a floating-point value" << std::endl; return false; } m_cameraData.pos.x = position[0].toDouble(); m_cameraData.pos.y = position[1].toDouble(); m_cameraData.pos.z = position[2].toDouble(); + if (position.size() == 4) { + m_cameraData.pos.w = position[3].toDouble(); + } + else { + m_cameraData.pos.w = 1.f; + } } else { std::cout << "cameraData position must be an array" << std::endl; @@ -466,17 +472,23 @@ bool ScenefileReader::parseCameraData(const QJsonObject &cameradata) { if (cameradata["up"].isArray()) { QJsonArray up = cameradata["up"].toArray(); - if (up.size() != 3) { - std::cout << "cameraData up must have 3 elements" << std::endl; + if (up.size() != 3 && up.size() != 4) { + std::cout << "cameraData up must have 3-4 elements" << std::endl; return false; } - if (!up[0].isDouble() || !up[1].isDouble() || !up[2].isDouble()) { + if (!up[0].isDouble() || !up[1].isDouble() || !up[2].isDouble() || (up.size() == 4 && !up[3].isDouble())) { std::cout << "cameraData up must be a floating-point value" << std::endl; return false; } m_cameraData.up.x = up[0].toDouble(); m_cameraData.up.y = up[1].toDouble(); m_cameraData.up.z = up[2].toDouble(); + if (up.size() == 4) { + m_cameraData.up.w = up[3].toDouble(); + } + else { + m_cameraData.up.w = 1.f; + } } else { std::cout << "cameraData up must be an array" << std::endl; @@ -516,17 +528,23 @@ bool ScenefileReader::parseCameraData(const QJsonObject &cameradata) { if (cameradata.contains("look")) { if (cameradata["look"].isArray()) { QJsonArray look = cameradata["look"].toArray(); - if (look.size() != 3) { - std::cout << "cameraData look must have 3 elements" << std::endl; + if (look.size() != 3 && look.size() != 4) { + std::cout << "cameraData look must have 3-4 elements" << std::endl; return false; } - if (!look[0].isDouble() || !look[1].isDouble() || !look[2].isDouble()) { + if (!look[0].isDouble() || !look[1].isDouble() || !look[2].isDouble() || (look.size() == 4 && !look[3].isDouble())) { std::cout << "cameraData look must be a floating-point value" << std::endl; return false; } m_cameraData.look.x = look[0].toDouble(); m_cameraData.look.y = look[1].toDouble(); m_cameraData.look.z = look[2].toDouble(); + if (look.size() == 4) { + m_cameraData.look.w = look[3].toDouble(); + } + else { + m_cameraData.look.w = 1.f; + } } else { std::cout << "cameraData look must be an array" << std::endl; @@ -536,17 +554,23 @@ bool ScenefileReader::parseCameraData(const QJsonObject &cameradata) { else if (cameradata.contains("focus")) { if (cameradata["focus"].isArray()) { QJsonArray focus = cameradata["focus"].toArray(); - if (focus.size() != 3) { - std::cout << "cameraData focus must have 3 elements" << std::endl; + if (focus.size() != 3 && focus.size() != 4) { + std::cout << "cameraData focus must have 3-4 elements" << std::endl; return false; } - if (!focus[0].isDouble() || !focus[1].isDouble() || !focus[2].isDouble()) { + if (!focus[0].isDouble() || !focus[1].isDouble() || !focus[2].isDouble() || (focus.size() == 4 && !focus[3].isDouble())) { std::cout << "cameraData focus must be a floating-point value" << std::endl; return false; } m_cameraData.look.x = focus[0].toDouble(); m_cameraData.look.y = focus[1].toDouble(); m_cameraData.look.z = focus[2].toDouble(); + if (focus.size() == 4) { + m_cameraData.look.w = focus[3].toDouble(); + } + else { + m_cameraData.look.w = 1.f; + } } else { std::cout << "cameraData focus must be an array" << std::endl; -- cgit v1.2.3-70-g09d2 From 480c22ce9b50caad259e254d0127e99294b4c6ab Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 8 Dec 2023 15:03:20 -0500 Subject: rename src directory for vec4ops --- CMakeLists.txt | 8 ++--- src/4dvecops/rotations4d.cpp | 74 -------------------------------------------- src/4dvecops/transform4d.cpp | 18 ----------- src/4dvecops/vec4ops.cpp | 64 -------------------------------------- src/4dvecops/vec4ops.h | 37 ---------------------- src/raytracer/raytracer.cpp | 48 +++++++++++++++------------- src/vec4ops/rotations4d.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++ src/vec4ops/transform4d.cpp | 18 +++++++++++ src/vec4ops/vec4ops.cpp | 64 ++++++++++++++++++++++++++++++++++++++ src/vec4ops/vec4ops.h | 37 ++++++++++++++++++++++ 10 files changed, 223 insertions(+), 219 deletions(-) delete mode 100644 src/4dvecops/rotations4d.cpp delete mode 100644 src/4dvecops/transform4d.cpp delete mode 100644 src/4dvecops/vec4ops.cpp delete mode 100644 src/4dvecops/vec4ops.h create mode 100644 src/vec4ops/rotations4d.cpp create mode 100644 src/vec4ops/transform4d.cpp create mode 100644 src/vec4ops/vec4ops.cpp create mode 100644 src/vec4ops/vec4ops.h (limited to 'src') diff --git a/CMakeLists.txt b/CMakeLists.txt index a0db553..1891614 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,10 +63,10 @@ add_executable(${PROJECT_NAME} src/accelerate/kdtree.h src/accelerate/bvh.cpp src/accelerate/bvh.h - src/4dvecops/vec4ops.cpp - src/4dvecops/rotations4d.cpp - src/4dvecops/transform4d.cpp - src/4dvecops/vec4ops.h + src/vec4ops/vec4ops.cpp + src/vec4ops/rotations4d.cpp + src/vec4ops/transform4d.cpp + src/vec4ops/vec4ops.h ) # GLM: this creates its library and allows you to `#include "glm/..."` diff --git a/src/4dvecops/rotations4d.cpp b/src/4dvecops/rotations4d.cpp deleted file mode 100644 index 4943c7f..0000000 --- a/src/4dvecops/rotations4d.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "raytracer/raytracer.h" -#include "4dvecops/vec4ops.h" - -glm::mat4 Vec4Ops::getRotationMatrix4XY( - float angleRadians) { - glm::mat4 result; - result[0][0] = cos(angleRadians); - result[0][1] = -sin(angleRadians); - result[1][0] = sin(angleRadians); - result[1][1] = cos(angleRadians); - result[2][2] = 1; - result[3][3] = 1; - return result; -} - -glm::mat4 Vec4Ops::getRotationMatrix4YZ( - float angleRadians) { - glm::mat4 result; - result[1][1] = cos(angleRadians); - result[1][2] = -sin(angleRadians); - result[2][1] = sin(angleRadians); - result[2][2] = cos(angleRadians); - result[0][0] = 1; - result[3][3] = 1; - return result; -} - -glm::mat4 Vec4Ops::getRotationMatrix4ZX( - float angleRadians) { - glm::mat4 result; - result[2][2] = cos(angleRadians); - result[2][0] = -sin(angleRadians); - result[0][2] = sin(angleRadians); - result[0][0] = cos(angleRadians); - result[1][1] = 1; - result[3][3] = 1; - return result; -} - -glm::mat4 Vec4Ops::getRotationMatrix4XW( - float angleRadians) { - glm::mat4 result; - result[0][0] = cos(angleRadians); - result[0][3] = -sin(angleRadians); - result[3][0] = sin(angleRadians); - result[3][3] = cos(angleRadians); - result[1][1] = 1; - result[2][2] = 1; - return result; -} - -glm::mat4 Vec4Ops::getRotationMatrix4YW( - float angleRadians) { - glm::mat4 result; - result[1][1] = cos(angleRadians); - result[1][3] = -sin(angleRadians); - result[3][1] = sin(angleRadians); - result[3][3] = cos(angleRadians); - result[0][0] = 1; - result[2][2] = 1; - return result; -} - -glm::mat4 Vec4Ops::getRotationMatrix4ZW( - float angleRadians) { - glm::mat4 result; - result[2][2] = cos(angleRadians); - result[2][3] = -sin(angleRadians); - result[3][2] = sin(angleRadians); - result[3][3] = cos(angleRadians); - result[0][0] = 1; - result[1][1] = 1; - return result; -} \ No newline at end of file diff --git a/src/4dvecops/transform4d.cpp b/src/4dvecops/transform4d.cpp deleted file mode 100644 index 5cc51f3..0000000 --- a/src/4dvecops/transform4d.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "vec4ops.h" - -// this is used to transform a 4d point by a 4d matrix and its associated translation -// this is motivated by the fact that glm does not support 5d matrices, so we cannot define a mat5 to encapsulate both the rotation and translation in one matrix -// therefore, we break the 5d transformation into a 4d rotation and a 4d translation -glm::vec4 Vec4Ops::transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector) { - // do the translation then direction - point4 = transformDirectionMatrix * point4; - point4 += translationPointVector; - return point4; -} - -glm::vec4 Vec4Ops::inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, glm::vec4 inverseTranslationPointVector) { - // do the direction then translation - point4 += inverseTranslationPointVector; - point4 = inverseTranslationPointVector * point4; - return point4; -} \ No newline at end of file diff --git a/src/4dvecops/vec4ops.cpp b/src/4dvecops/vec4ops.cpp deleted file mode 100644 index 80cebaf..0000000 --- a/src/4dvecops/vec4ops.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include "vec4ops.h" - -// vector operations on 4d vectors, -// reference: https://hollasch.github.io/ray4/Four-Space_Visualization_of_4D_Objects.html#chapter5 - -glm::vec4 Vec4Ops::cross4( - glm::vec4 u, - glm::vec4 v, - glm::vec4 w) { - float a = (v[0] * w[1]) - (v[1] * w[0]); - float b = (v[0] * w[2]) - (v[2] * w[0]); - float c = (v[0] * w[3]) - (v[3] * w[0]); - float d = (v[1] * w[2]) - (v[2] * w[1]); - float e = (v[1] * w[3]) - (v[3] * w[1]); - float f = (v[2] * w[3]) - (v[3] * w[2]); - - glm::vec4 result; - result[0] = (u[1] * f) - (u[2] * e) + (u[3] * d); - result[1] = -(u[0] * f) + (u[2] * c) - (u[3] * b); - result[2] = (u[0] * e) - (u[1] * c) + (u[3] * a); - result[3] = -(u[0] * d) + (u[1] * b) - (u[2] * a); - - return result; -} - -glm::vec4 Vec4Ops::dot4( - glm::vec4 u, - glm::vec4 v) { - return {u[0] * v[0], u[1] * v[1], u[2] * v[2], u[3] * v[3]}; -} - -glm::mat4 Vec4Ops::getViewMatrix4( - glm::vec4 fromPoint, - glm::vec4 toPoint, - glm::vec4 upVector, - glm::vec4 lookVector) { - - // calculate e3 basis vector, the transformation col of view matrix - if (glm::distance(fromPoint, toPoint) < 0.0001f) { - throw std::runtime_error("fromPoint and toPoint are the same"); - } - glm::vec4 e3 = glm::normalize(fromPoint - toPoint); - - // calculate e2 basis vector, from the combinatory cross of up and over with e3 - glm::vec4 e2 = cross4(upVector, lookVector, e3); - e2 = glm::normalize(e2); - if (glm::distance(e2, glm::vec4{0, 0, 0, 0}) < 0.0001f) { - throw std::runtime_error("invalid up vector"); - } - - // calculate e1 basis vector, from the cross of only the over vector - glm::vec4 e1 = cross4(lookVector, e3, e2); - e1 = glm::normalize(e1); - if (glm::distance(e1, glm::vec4{0, 0, 0, 0}) < 0.0001f) { - throw std::runtime_error("invalid over vector"); - } - - // calculate e0 basis vector, the 4d orthogonal vector to the other 3 bases - glm::vec4 e0 = cross4(e3, e2, e1); - e0 = glm::normalize(e0); - - return {e2, e1, e0, e3}; -} \ No newline at end of file diff --git a/src/4dvecops/vec4ops.h b/src/4dvecops/vec4ops.h deleted file mode 100644 index d1c3ac8..0000000 --- a/src/4dvecops/vec4ops.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Created by Michael Foiani on 12/8/23. -// - -#ifndef PROJECTS_RAY_VEC4OPS_H -#define PROJECTS_RAY_VEC4OPS_H - -#include - -class Vec4Ops { -public: - - static glm::mat4 getRotationMatrix4XY(float angleRadians); - - static glm::mat4 getRotationMatrix4YZ(float angleRadians); - - static glm::mat4 getRotationMatrix4ZX(float angleRadians); - - static glm::mat4 getRotationMatrix4XW(float angleRadians); - - static glm::mat4 getRotationMatrix4YW(float angleRadians); - - static glm::mat4 getRotationMatrix4ZW(float angleRadians); - - static glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector); - - static glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, - glm::vec4 inverseTranslationPointVector); - - static glm::vec4 cross4(glm::vec4 u, glm::vec4 v, glm::vec4 w); - - static glm::vec4 dot4(glm::vec4 u, glm::vec4 v); - - static glm::mat4 getViewMatrix4(glm::vec4 fromPoint, glm::vec4 toPoint, glm::vec4 upVector, glm::vec4 lookVector); -}; - -#endif //PROJECTS_RAY_VEC4OPS_H diff --git a/src/raytracer/raytracer.cpp b/src/raytracer/raytracer.cpp index be31b8a..6b33150 100644 --- a/src/raytracer/raytracer.cpp +++ b/src/raytracer/raytracer.cpp @@ -7,7 +7,7 @@ #include "mainwindow.h" #include #include - +#include "vec4ops/vec4ops.h" // RayTracer::RayTracer(const Config &config) : m_config(config) {} RayTracer::RayTracer(QWidget *parent) : QWidget(parent) { @@ -23,13 +23,8 @@ RayTracer::RayTracer(QWidget *parent) : QWidget(parent) { } +// updated to use 4D void RayTracer::render(RGBA *imageData, const RayTraceScene &scene) { - if(m_enableParallelism) - { - renderParallel(imageData, scene); - return; - } - // naive rendering Camera camera = scene.getCamera(); float cameraDepth = 1.f; @@ -39,21 +34,30 @@ void RayTracer::render(RGBA *imageData, const RayTraceScene &scene) { for (int imageRow = 0; imageRow < scene.height(); imageRow++) { for (int imageCol = 0; imageCol < scene.width(); imageCol++) { - float xCameraSpace = viewplaneWidth * - (-.5f + (imageCol + .5f) / scene.width()); - float yCameraSpace = viewplaneHeight * - (-.5f + (imageRow + .5f) / scene.height()); - - glm::vec4 pixelDirCamera{xCameraSpace, -yCameraSpace, -cameraDepth, 0.f}; //w=0 for dir - glm::vec4 eyeCamera{0.f, 0.f, 0.f, 1.f}; // w=1.f for point - - // convert to world space - glm::vec4 pWorld = camera.getInverseViewMatrix() * eyeCamera; - glm::vec4 dWorld = glm::normalize(camera.getInverseViewMatrix() * pixelDirCamera); - - // cast ray! - glm::vec4 pixel = getPixelFromRay(pWorld, dWorld, scene); - imageData[imageRow * scene.width() + imageCol] = toRGBA(pixel); + // FIXME: for now, use height as depth + for (int imageDepth = 0; imageDepth < scene.height(); 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; + + glm::vec4 pCamera = + glm::vec4 pWorld = Vec4Ops::transformPoint4(camera.getvec4(x, y, z, camera4dDepth); + glm::vec4 dWorld = glm::vec4(0.f, 0.f, -1.f, 0.f); + + // get the pixel color + glm::vec4 pixelColor = getPixelFromRay(pWorld, dWorld, scene, 0); + + // set the pixel color + int index = imageRow * scene.width() + imageCol; + imageData[index] = RGBA{ + (std::uint8_t) (pixelColor.r * 255.f), + (std::uint8_t) (pixelColor.g * 255.f), + (std::uint8_t) (pixelColor.b * 255.f), + (std::uint8_t) (pixelColor.a * 255.f) + }; + } } } } diff --git a/src/vec4ops/rotations4d.cpp b/src/vec4ops/rotations4d.cpp new file mode 100644 index 0000000..4943c7f --- /dev/null +++ b/src/vec4ops/rotations4d.cpp @@ -0,0 +1,74 @@ +#include "raytracer/raytracer.h" +#include "4dvecops/vec4ops.h" + +glm::mat4 Vec4Ops::getRotationMatrix4XY( + float angleRadians) { + glm::mat4 result; + result[0][0] = cos(angleRadians); + result[0][1] = -sin(angleRadians); + result[1][0] = sin(angleRadians); + result[1][1] = cos(angleRadians); + result[2][2] = 1; + result[3][3] = 1; + return result; +} + +glm::mat4 Vec4Ops::getRotationMatrix4YZ( + float angleRadians) { + glm::mat4 result; + result[1][1] = cos(angleRadians); + result[1][2] = -sin(angleRadians); + result[2][1] = sin(angleRadians); + result[2][2] = cos(angleRadians); + result[0][0] = 1; + result[3][3] = 1; + return result; +} + +glm::mat4 Vec4Ops::getRotationMatrix4ZX( + float angleRadians) { + glm::mat4 result; + result[2][2] = cos(angleRadians); + result[2][0] = -sin(angleRadians); + result[0][2] = sin(angleRadians); + result[0][0] = cos(angleRadians); + result[1][1] = 1; + result[3][3] = 1; + return result; +} + +glm::mat4 Vec4Ops::getRotationMatrix4XW( + float angleRadians) { + glm::mat4 result; + result[0][0] = cos(angleRadians); + result[0][3] = -sin(angleRadians); + result[3][0] = sin(angleRadians); + result[3][3] = cos(angleRadians); + result[1][1] = 1; + result[2][2] = 1; + return result; +} + +glm::mat4 Vec4Ops::getRotationMatrix4YW( + float angleRadians) { + glm::mat4 result; + result[1][1] = cos(angleRadians); + result[1][3] = -sin(angleRadians); + result[3][1] = sin(angleRadians); + result[3][3] = cos(angleRadians); + result[0][0] = 1; + result[2][2] = 1; + return result; +} + +glm::mat4 Vec4Ops::getRotationMatrix4ZW( + float angleRadians) { + glm::mat4 result; + result[2][2] = cos(angleRadians); + result[2][3] = -sin(angleRadians); + result[3][2] = sin(angleRadians); + result[3][3] = cos(angleRadians); + result[0][0] = 1; + result[1][1] = 1; + return result; +} \ No newline at end of file diff --git a/src/vec4ops/transform4d.cpp b/src/vec4ops/transform4d.cpp new file mode 100644 index 0000000..5cc51f3 --- /dev/null +++ b/src/vec4ops/transform4d.cpp @@ -0,0 +1,18 @@ +#include "vec4ops.h" + +// this is used to transform a 4d point by a 4d matrix and its associated translation +// this is motivated by the fact that glm does not support 5d matrices, so we cannot define a mat5 to encapsulate both the rotation and translation in one matrix +// therefore, we break the 5d transformation into a 4d rotation and a 4d translation +glm::vec4 Vec4Ops::transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector) { + // do the translation then direction + point4 = transformDirectionMatrix * point4; + point4 += translationPointVector; + return point4; +} + +glm::vec4 Vec4Ops::inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, glm::vec4 inverseTranslationPointVector) { + // do the direction then translation + point4 += inverseTranslationPointVector; + point4 = inverseTranslationPointVector * point4; + return point4; +} \ No newline at end of file diff --git a/src/vec4ops/vec4ops.cpp b/src/vec4ops/vec4ops.cpp new file mode 100644 index 0000000..80cebaf --- /dev/null +++ b/src/vec4ops/vec4ops.cpp @@ -0,0 +1,64 @@ +#include +#include "vec4ops.h" + +// vector operations on 4d vectors, +// reference: https://hollasch.github.io/ray4/Four-Space_Visualization_of_4D_Objects.html#chapter5 + +glm::vec4 Vec4Ops::cross4( + glm::vec4 u, + glm::vec4 v, + glm::vec4 w) { + float a = (v[0] * w[1]) - (v[1] * w[0]); + float b = (v[0] * w[2]) - (v[2] * w[0]); + float c = (v[0] * w[3]) - (v[3] * w[0]); + float d = (v[1] * w[2]) - (v[2] * w[1]); + float e = (v[1] * w[3]) - (v[3] * w[1]); + float f = (v[2] * w[3]) - (v[3] * w[2]); + + glm::vec4 result; + result[0] = (u[1] * f) - (u[2] * e) + (u[3] * d); + result[1] = -(u[0] * f) + (u[2] * c) - (u[3] * b); + result[2] = (u[0] * e) - (u[1] * c) + (u[3] * a); + result[3] = -(u[0] * d) + (u[1] * b) - (u[2] * a); + + return result; +} + +glm::vec4 Vec4Ops::dot4( + glm::vec4 u, + glm::vec4 v) { + return {u[0] * v[0], u[1] * v[1], u[2] * v[2], u[3] * v[3]}; +} + +glm::mat4 Vec4Ops::getViewMatrix4( + glm::vec4 fromPoint, + glm::vec4 toPoint, + glm::vec4 upVector, + glm::vec4 lookVector) { + + // calculate e3 basis vector, the transformation col of view matrix + if (glm::distance(fromPoint, toPoint) < 0.0001f) { + throw std::runtime_error("fromPoint and toPoint are the same"); + } + glm::vec4 e3 = glm::normalize(fromPoint - toPoint); + + // calculate e2 basis vector, from the combinatory cross of up and over with e3 + glm::vec4 e2 = cross4(upVector, lookVector, e3); + e2 = glm::normalize(e2); + if (glm::distance(e2, glm::vec4{0, 0, 0, 0}) < 0.0001f) { + throw std::runtime_error("invalid up vector"); + } + + // calculate e1 basis vector, from the cross of only the over vector + glm::vec4 e1 = cross4(lookVector, e3, e2); + e1 = glm::normalize(e1); + if (glm::distance(e1, glm::vec4{0, 0, 0, 0}) < 0.0001f) { + throw std::runtime_error("invalid over vector"); + } + + // calculate e0 basis vector, the 4d orthogonal vector to the other 3 bases + glm::vec4 e0 = cross4(e3, e2, e1); + e0 = glm::normalize(e0); + + return {e2, e1, e0, e3}; +} \ No newline at end of file diff --git a/src/vec4ops/vec4ops.h b/src/vec4ops/vec4ops.h new file mode 100644 index 0000000..d1c3ac8 --- /dev/null +++ b/src/vec4ops/vec4ops.h @@ -0,0 +1,37 @@ +// +// Created by Michael Foiani on 12/8/23. +// + +#ifndef PROJECTS_RAY_VEC4OPS_H +#define PROJECTS_RAY_VEC4OPS_H + +#include + +class Vec4Ops { +public: + + static glm::mat4 getRotationMatrix4XY(float angleRadians); + + static glm::mat4 getRotationMatrix4YZ(float angleRadians); + + static glm::mat4 getRotationMatrix4ZX(float angleRadians); + + static glm::mat4 getRotationMatrix4XW(float angleRadians); + + static glm::mat4 getRotationMatrix4YW(float angleRadians); + + static glm::mat4 getRotationMatrix4ZW(float angleRadians); + + static glm::vec4 transformPoint4(glm::vec4 point4, glm::mat4 transformDirectionMatrix, glm::vec4 translationPointVector); + + static glm::vec4 inverseTransformPoint4(glm::vec4 point4, glm::mat4 inverseTransformDirectionMatrix, + glm::vec4 inverseTranslationPointVector); + + static glm::vec4 cross4(glm::vec4 u, glm::vec4 v, glm::vec4 w); + + static glm::vec4 dot4(glm::vec4 u, glm::vec4 v); + + static glm::mat4 getViewMatrix4(glm::vec4 fromPoint, glm::vec4 toPoint, glm::vec4 upVector, glm::vec4 lookVector); +}; + +#endif //PROJECTS_RAY_VEC4OPS_H -- cgit v1.2.3-70-g09d2