From 45ed7c75be547d7843416b4ae8849d8a9f14b963 Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Fri, 24 Jan 2025 09:50:51 +0100 Subject: [PATCH] setting it up for macos --- .vscode/launch.json | 20 ++++++++++++++++++++ .vscode/settings.json | 3 +++ CMakeLists.txt | 4 ++++ src/main.cpp | 2 +- src/scene/AABB.h | 2 +- src/window/Window.cpp | 5 +++-- 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5e417ba --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(lldb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/RayTracer", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/bin/", + "environment": [], + "externalConsole": false, + "MIMode": "lldb" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..66005ff --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.buildDirectory": "${workspaceFolder}/bin/" +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 27d3a91..cbb750a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,11 @@ add_executable(RayTracer "") target_include_directories(RayTracer PUBLIC src/) target_link_libraries(RayTracer PUBLIC assimp::assimp) target_link_libraries(RayTracer PUBLIC glfw) +if(APPLE) +target_link_libraries(RayTracer PUBLIC GLEW::GLEW) +else() target_link_libraries(RayTracer PUBLIC GLEW::glew) +endif() target_link_libraries(RayTracer PUBLIC glm::glm) target_link_libraries(RayTracer PUBLIC KTX::ktx) diff --git a/src/main.cpp b/src/main.cpp index bdf0afa..1075c7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ int main() { BVH bvh; - bvh.addModels(ModelLoader::loadModel("../../cube.fbx"), glm::mat4()); + bvh.addModels(ModelLoader::loadModel("../cube.fbx"), glm::mat4()); bvh.generate(); Window w(1920, 1080); std::vector texture(1920 * 1080); diff --git a/src/scene/AABB.h b/src/scene/AABB.h index 4f654e7..6aed089 100644 --- a/src/scene/AABB.h +++ b/src/scene/AABB.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include struct AABB { diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 8093b8a..7a3daf6 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -9,11 +9,12 @@ Window::Window(int width, int height) : width(width), height(height) glewExperimental = true; assert(glfwInit()); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // We don't want the old OpenGL window = glfwCreateWindow(width, height, "RayTracer", nullptr, nullptr); glfwMakeContextCurrent(window); - assert(!glewInit()); + std::cout << glewInit() <