From dec129f28084f9192cdf786a503e0c37e35715df Mon Sep 17 00:00:00 2001 From: bailehuni Date: Sun, 2 Jun 2024 12:55:04 +0100 Subject: [PATCH] Finish organising libraries --- CMakeLists.txt | 31 ++++++++++++------- include/component_mesh.h | 4 +-- include/input_manager.h | 4 +-- include/renderer.h | 2 +- include/resource_manager.h | 2 +- include/resource_material.h | 4 +-- include/scene.h | 2 +- include/system_collisions.h | 2 +- include/vulkan_allocator.h | 5 ++- include/window.h | 4 +-- src/application.cpp | 28 ++++++++--------- src/file_dialog.cpp | 2 +- src/files.cpp | 4 +-- src/gen_tangents.cpp | 8 ++--- src/gfx_device_vulkan.cpp | 18 +++++------ src/gltf_loader.cpp | 16 +++++----- src/renderer.cpp | 6 ++-- src/resource_font.cpp | 6 ++-- src/resource_material.cpp | 4 +-- src/resource_mesh.cpp | 2 +- src/resource_shader.cpp | 2 +- src/resource_texture.cpp | 6 ++-- src/scene.cpp | 20 +++++------- src/scene_manager.cpp | 2 +- src/system_collisions.cpp | 6 ++-- src/system_custom_behaviour.cpp | 6 ++-- src/system_mesh_render.cpp | 6 ++-- src/system_transform.cpp | 4 +-- src/vulkan_allocator.cpp | 4 +-- src/vulkan_device.cpp | 4 +-- src/vulkan_instance.cpp | 4 +-- src/vulkan_swapchain.cpp | 8 ++--- src/window.cpp | 2 +- test/src/camera_controller.cpp | 6 ++-- test/src/camera_controller.hpp | 2 +- test/src/game.cpp | 20 ++++++------ test/src/meshgen.cpp | 4 +-- test/src/meshgen.hpp | 2 +- vendor/imgui/CMakeLists.txt | 4 ++- vendor/imgui/src/imgui_internal.h | 2 +- vendor/json/CMakeLists.txt | 4 ++- vendor/mikktspace/CMakeLists.txt | 23 ++++++++++++++ .../mikktspace/include}/mikktspace.h | 0 .../mikktspace/src}/mikktspace.c | 0 vendor/stb/CMakeLists.txt | 10 +++--- vendor/stb/src/{stb_impl.cpp => stb_impl.c} | 0 vendor/tinygltf/CMakeLists.txt | 26 ++++++++++++++++ .../tinygltf/include}/tiny_gltf.h | 0 .../tinygltf/src}/tiny_gltf_impl.cpp | 2 +- vendor/weldmesh/CMakeLists.txt | 23 ++++++++++++++ .../weldmesh/include}/weldmesh.h | 0 {src/libs => vendor/weldmesh/src}/weldmesh.c | 0 52 files changed, 219 insertions(+), 137 deletions(-) create mode 100644 vendor/mikktspace/CMakeLists.txt rename {src/libs => vendor/mikktspace/include}/mikktspace.h (100%) rename {src/libs => vendor/mikktspace/src}/mikktspace.c (100%) rename vendor/stb/src/{stb_impl.cpp => stb_impl.c} (100%) create mode 100644 vendor/tinygltf/CMakeLists.txt rename {src/libs => vendor/tinygltf/include}/tiny_gltf.h (100%) rename {src/libs => vendor/tinygltf/src}/tiny_gltf_impl.cpp (54%) create mode 100644 vendor/weldmesh/CMakeLists.txt rename {src/libs => vendor/weldmesh/include}/weldmesh.h (100%) rename {src/libs => vendor/weldmesh/src}/weldmesh.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24d316f..4db7068 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,12 +21,6 @@ set(SRC_FILES "src/ecs.cpp" "src/gfx_device_vulkan.cpp" "src/input_manager.cpp" - "src/libs/mikktspace.c" - "src/libs/mikktspace.h" - "src/libs/tiny_gltf.h" - "src/libs/tiny_gltf_impl.cpp" - "src/libs/weldmesh.c" - "src/libs/weldmesh.h" "src/renderer.cpp" "src/resource_font.cpp" "src/resource_material.cpp" @@ -168,10 +162,6 @@ else() target_link_libraries(${PROJECT_NAME} PUBLIC shaderc_shared) endif() -# stb -add_subdirectory(vendor/stb) -target_link_libraries(${PROJECT_NAME} PUBLIC stb) - # SDL2: set(SDL2_DISABLE_INSTALL ON CACHE INTERNAL "" FORCE) set(SDL_SHARED ON CACHE INTERNAL "" FORCE) @@ -187,6 +177,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2main) set(BUILD_SHARED_LIBS OFF) add_subdirectory(vendor/glm) target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC vendor/glm) +target_compile_definitions(${PROJECT_NAME} PUBLIC GLM_ENABLE_EXPERIMENTAL) # spdlog set(SPDLOG_BUILD_SHARED OFF CACHE INTERNAL "" FORCE) @@ -195,10 +186,26 @@ set(BUILD_SHARED_LIBS OFF) add_subdirectory(vendor/spdlog) # automatically calls target_include_directories target_link_libraries(${PROJECT_NAME} PUBLIC spdlog) -# imgui (depends on volk and SDL2) +# stb +add_subdirectory(vendor/stb) +target_link_libraries(${PROJECT_NAME} PUBLIC stb) + +# imgui (depends on volk, SDL2, and stb) add_subdirectory(vendor/imgui) target_link_libraries(${PROJECT_NAME} PUBLIC imgui) # json add_subdirectory(vendor/json) -target_link_libraries(${PROJECT_NAME} PUBLIC json) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} PUBLIC json) + +# tinygltf (depends on json and stb) +add_subdirectory(vendor/tinygltf) +target_link_libraries(${PROJECT_NAME} PUBLIC tinygltf) + +# mikktspace +add_subdirectory(vendor/mikktspace) +target_link_libraries(${PROJECT_NAME} PUBLIC mikktspace) + +# weldmesh +add_subdirectory(vendor/weldmesh) +target_link_libraries(${PROJECT_NAME} PUBLIC weldmesh) \ No newline at end of file diff --git a/include/component_mesh.h b/include/component_mesh.h index d94b467..da83e95 100644 --- a/include/component_mesh.h +++ b/include/component_mesh.h @@ -2,8 +2,8 @@ #include -#include "resources/material.h" -#include "resources/mesh.h" +#include "resource_material.h" +#include "resource_mesh.h" namespace engine { diff --git a/include/input_manager.h b/include/input_manager.h index 38f216c..d8e1484 100644 --- a/include/input_manager.h +++ b/include/input_manager.h @@ -4,8 +4,8 @@ #include #include -#include "inputs/keyboard.h" -#include "inputs/mouse.h" +#include "input_keys.h" +#include "input_mouse.h" #include "window.h" namespace engine { diff --git a/include/renderer.h b/include/renderer.h index ca6a55e..d5fd082 100644 --- a/include/renderer.h +++ b/include/renderer.h @@ -8,7 +8,7 @@ #include "application_component.h" #include "gfx_device.h" -#include "systems/mesh_render_system.h" +#include "system_mesh_render.h" namespace engine { diff --git a/include/resource_manager.h b/include/resource_manager.h index 1c94b31..a81ab31 100644 --- a/include/resource_manager.h +++ b/include/resource_manager.h @@ -9,7 +9,7 @@ #include "log.h" -#include "resources/mesh.h" +#include "resource_mesh.h" namespace engine { diff --git a/include/resource_material.h b/include/resource_material.h index d3bb774..ad64984 100644 --- a/include/resource_material.h +++ b/include/resource_material.h @@ -2,8 +2,8 @@ #include -#include "resources/shader.h" -#include "resources/texture.h" +#include "resource_shader.h" +#include "resource_texture.h" // a material is just a shader with assigned textures/parameters diff --git a/include/scene.h b/include/scene.h index 1a2f843..6b81b7c 100644 --- a/include/scene.h +++ b/include/scene.h @@ -11,7 +11,7 @@ #include "ecs.h" #include "event_system.h" -#include "components/transform.h" +#include "component_transform.h" namespace engine { diff --git a/include/system_collisions.h b/include/system_collisions.h index 7d54c20..047e4cb 100644 --- a/include/system_collisions.h +++ b/include/system_collisions.h @@ -5,7 +5,7 @@ #include -#include "components/collider.h" +#include "component_collider.h" #include "ecs.h" namespace engine { diff --git a/include/vulkan_allocator.h b/include/vulkan_allocator.h index 87dc3a3..b406025 100644 --- a/include/vulkan_allocator.h +++ b/include/vulkan_allocator.h @@ -1,7 +1,10 @@ #pragma once + +#include + #include -#include "device.h" +#include "vulkan_device.h" namespace engine { diff --git a/include/window.h b/include/window.h index f47551f..7dc9065 100644 --- a/include/window.h +++ b/include/window.h @@ -6,8 +6,8 @@ #include #include -#include "inputs/keyboard.h" -#include "inputs/mouse.h" +#include "input_keys.h" +#include "input_mouse.h" namespace engine { diff --git a/src/application.cpp b/src/application.cpp index 818c6b7..4cb0d09 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -9,27 +9,27 @@ #include -#include "imgui/imgui.h" -#include "imgui/imgui_impl_sdl2.h" -#include "imgui/imgui_impl_vulkan.h" +#include +#include +#include -#include "components/collider.h" -#include "components/transform.h" +#include "component_collider.h" +#include "component_transform.h" #include "gfx.h" #include "gfx_device.h" #include "input_manager.h" #include "log.h" -#include "resources/font.h" -#include "resources/material.h" -#include "resources/mesh.h" -#include "resources/shader.h" -#include "resources/texture.h" +#include "resource_font.h" +#include "resource_material.h" +#include "resource_mesh.h" +#include "resource_shader.h" +#include "resource_texture.h" #include "scene.h" #include "scene_manager.h" -#include "systems/collisions.h" -#include "systems/mesh_render_system.h" -#include "util/file_dialog.h" -#include "util/gltf_loader.h" +#include "system_collisions.h" +#include "system_mesh_render.h" +#include "file_dialog.h" +#include "gltf_loader.h" #include "window.h" static struct ImGuiThings { diff --git a/src/file_dialog.cpp b/src/file_dialog.cpp index 670e51b..772efb5 100644 --- a/src/file_dialog.cpp +++ b/src/file_dialog.cpp @@ -1,4 +1,4 @@ -#include "util/file_dialog.h" +#include "file_dialog.h" #ifdef _WIN32 #include diff --git a/src/files.cpp b/src/files.cpp index a8c04e3..7b67633 100644 --- a/src/files.cpp +++ b/src/files.cpp @@ -1,11 +1,11 @@ -#include "util/files.h" +#include "files.h" #include #include #include "stb_image.h" -namespace engine::util { +namespace engine { std::unique_ptr> ReadTextFile(const std::string& path) { diff --git a/src/gen_tangents.cpp b/src/gen_tangents.cpp index c5bfdee..5ea98cf 100644 --- a/src/gen_tangents.cpp +++ b/src/gen_tangents.cpp @@ -1,11 +1,11 @@ -#include "util/gen_tangents.h" +#include "gen_tangents.h" #include -#include "libs/mikktspace.h" -#include "libs/weldmesh.h" +#include +#include -#include "resources/mesh.h" +#include "resource_mesh.h" namespace engine::util { diff --git a/src/gfx_device_vulkan.cpp b/src/gfx_device_vulkan.cpp index b7f4b15..d02e09a 100644 --- a/src/gfx_device_vulkan.cpp +++ b/src/gfx_device_vulkan.cpp @@ -37,18 +37,18 @@ #include -#include "imgui/imgui.h" -#include "imgui/imgui_impl_vulkan.h" +#include "imgui.h" +#include "imgui_impl_vulkan.h" #include "gfx_device.h" -#include "vulkan/instance.h" -#include "vulkan/device.h" -#include "vulkan/gpu_allocator.h" -#include "vulkan/swapchain.h" +#include "vulkan_instance.h" +#include "vulkan_device.h" +#include "vulkan_allocator.h" +#include "vulkan_swapchain.h" #include "util.h" #include "config.h" #include "log.h" -#include "util/files.h" +#include "files.h" static constexpr bool flip_viewport = false; @@ -1275,11 +1275,11 @@ gfx::Pipeline* GFXDevice::CreatePipeline(const gfx::PipelineInfo& info) VkShaderModule fragShaderModule; // be careful with these .c_str() calls. It is OK here because 'info' exists for the duration of CreatePipeline() { - auto vertShaderCode = util::ReadTextFile(info.vert_shader_path.c_str()); + auto vertShaderCode = ReadTextFile(info.vert_shader_path.c_str()); vertShaderModule = compileShader(pimpl->device.device, shaderc_vertex_shader, vertShaderCode->data(), info.vert_shader_path.c_str()); } { - auto fragShaderCode = util::ReadTextFile(info.frag_shader_path.c_str()); + auto fragShaderCode = ReadTextFile(info.frag_shader_path.c_str()); fragShaderModule = compileShader(pimpl->device.device, shaderc_fragment_shader, fragShaderCode->data(), info.frag_shader_path.c_str()); } diff --git a/src/gltf_loader.cpp b/src/gltf_loader.cpp index 517294d..5745437 100644 --- a/src/gltf_loader.cpp +++ b/src/gltf_loader.cpp @@ -1,15 +1,15 @@ -#include "util/gltf_loader.h" +#include "gltf_loader.h" #include "log.h" -#include "util/files.h" +#include "files.h" -#include "libs/mikktspace.h" -#include "libs/weldmesh.h" -#include "libs/tiny_gltf.h" +#include +#include +#include -#include "components/mesh_renderable.h" -#include "components/transform.h" -#include "components/collider.h" +#include "component_mesh.h" +#include "component_transform.h" +#include "component_collider.h" struct Color { uint8_t r, g, b, a; diff --git a/src/renderer.cpp b/src/renderer.cpp index 9e22229..591989c 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -3,14 +3,14 @@ #include #include "application_component.h" -#include "util/files.h" +#include "files.h" #include "log.h" #include #include #include -#include "imgui/imgui.h" +#include namespace engine { @@ -97,7 +97,7 @@ Renderer::Renderer(Application& app, gfx::GraphicsSettings settings) : Applicati for (int face = 0; face < 6; ++face) { std::string path = std::string("engine/textures/skybox") + std::to_string(face) + std::string(".jpg"); - face_unq_ptrs[face] = util::ReadImageFile(GetResourcePath(path), w, h); + face_unq_ptrs[face] = ReadImageFile(GetResourcePath(path), w, h); if (cubemap_w != w || cubemap_h != h) throw std::runtime_error("Skybox textures must be 512x512!"); face_unsafe_ptrs[face] = face_unq_ptrs[face]->data(); } diff --git a/src/resource_font.cpp b/src/resource_font.cpp index 879d70d..48894ab 100644 --- a/src/resource_font.cpp +++ b/src/resource_font.cpp @@ -1,4 +1,4 @@ -#include "resources/font.h" +#include "resource_font.h" #include #include @@ -6,13 +6,13 @@ #include #include "log.h" -#include "util/files.h" +#include "files.h" namespace engine { Font::Font(const std::string& path) { - m_font_buffer = util::ReadBinaryFile(path); + m_font_buffer = ReadBinaryFile(path); m_font_info = std::make_unique(); if (stbtt_InitFont(m_font_info.get(), m_font_buffer->data(), 0) == 0) { diff --git a/src/resource_material.cpp b/src/resource_material.cpp index 9c206bf..1d830dc 100644 --- a/src/resource_material.cpp +++ b/src/resource_material.cpp @@ -1,6 +1,6 @@ -#include "resources/material.h" +#include "resource_material.h" -#include "resources/shader.h" +#include "resource_shader.h" namespace engine { diff --git a/src/resource_mesh.cpp b/src/resource_mesh.cpp index 63e0948..10b497b 100644 --- a/src/resource_mesh.cpp +++ b/src/resource_mesh.cpp @@ -1,4 +1,4 @@ -#include "resources/mesh.h" +#include "resource_mesh.h" #include "log.h" #include "gfx_device.h" diff --git a/src/resource_shader.cpp b/src/resource_shader.cpp index f1fa1dd..36a60f2 100644 --- a/src/resource_shader.cpp +++ b/src/resource_shader.cpp @@ -1,4 +1,4 @@ -#include "resources/shader.h" +#include "resource_shader.h" #include "application.h" #include "gfx_device.h" diff --git a/src/resource_texture.cpp b/src/resource_texture.cpp index 15825a9..d287c5e 100644 --- a/src/resource_texture.cpp +++ b/src/resource_texture.cpp @@ -1,7 +1,7 @@ -#include "resources/texture.h" +#include "resource_texture.h" #include "application.h" -#include "util/files.h" +#include "files.h" #include "log.h" #include @@ -31,7 +31,7 @@ Texture::~Texture() std::unique_ptr LoadTextureFromFile(const std::string& path, gfx::SamplerInfo samplerInfo, Renderer* renderer, bool srgb) { int width, height; - auto bitmap = util::ReadImageFile(path, width, height); + auto bitmap = ReadImageFile(path, width, height); return std::make_unique(renderer, bitmap->data(), width, height, samplerInfo, srgb); } diff --git a/src/scene.cpp b/src/scene.cpp index 93f5db2..11eebcb 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,15 +1,13 @@ #include "scene.h" -#include "components/transform.h" -#include "components/collider.h" -#include "components/custom.h" -#include "components/mesh_renderable.h" -#include "components/ui_renderable.h" -#include "systems/transform.h" -#include "systems/mesh_render_system.h" -#include "systems/ui_render_system.h" -#include "systems/collisions.h" -#include "systems/custom_behaviour.h" +#include "component_transform.h" +#include "component_collider.h" +#include "component_custom.h" +#include "component_mesh.h" +#include "system_transform.h" +#include "system_mesh_render.h" +#include "system_collisions.h" +#include "system_custom_behaviour.h" namespace engine { @@ -23,14 +21,12 @@ Scene::Scene(Application* app) : app_(app) { RegisterComponent(); RegisterComponent(); RegisterComponent(); - RegisterComponent(); // Order here matters: RegisterSystem(); // potentially modifies transforms RegisterSystem(); RegisterSystem(); // depends on transformed world matrix RegisterSystem(); // depends on transformed world matrix - RegisterSystem(); // does nothing as of now } Scene::~Scene() {} diff --git a/src/scene_manager.cpp b/src/scene_manager.cpp index d926995..5027338 100644 --- a/src/scene_manager.cpp +++ b/src/scene_manager.cpp @@ -1,7 +1,7 @@ #include "scene_manager.h" #include "scene.h" -#include "resources/texture.h" +#include "resource_texture.h" #include diff --git a/src/system_collisions.cpp b/src/system_collisions.cpp index 4cb1529..d808825 100644 --- a/src/system_collisions.cpp +++ b/src/system_collisions.cpp @@ -1,7 +1,7 @@ -#include "systems/collisions.h" +#include "system_collisions.h" -#include "components/transform.h" -#include "components/collider.h" +#include "component_transform.h" +#include "component_collider.h" #include "scene.h" #include "log.h" diff --git a/src/system_custom_behaviour.cpp b/src/system_custom_behaviour.cpp index 6b788c5..0ac607b 100644 --- a/src/system_custom_behaviour.cpp +++ b/src/system_custom_behaviour.cpp @@ -1,9 +1,9 @@ -#include "systems/custom_behaviour.h" +#include "system_custom_behaviour.h" #include -#include "components/custom.h" -#include "components/transform.h" +#include "component_custom.h" +#include "component_transform.h" #include "scene.h" namespace engine { diff --git a/src/system_mesh_render.cpp b/src/system_mesh_render.cpp index 5025c04..b006433 100644 --- a/src/system_mesh_render.cpp +++ b/src/system_mesh_render.cpp @@ -1,9 +1,9 @@ -#include "systems/mesh_render_system.h" +#include "system_mesh_render.h" #include -#include "components/transform.h" -#include "components/mesh_renderable.h" +#include "component_transform.h" +#include "component_mesh.h" #include "log.h" namespace engine { diff --git a/src/system_transform.cpp b/src/system_transform.cpp index 9ea05e6..9a93928 100644 --- a/src/system_transform.cpp +++ b/src/system_transform.cpp @@ -1,7 +1,7 @@ -#include "systems/transform.h" +#include "system_transform.h" #include "scene.h" -#include "components/transform.h" +#include "component_transform.h" #include diff --git a/src/vulkan_allocator.cpp b/src/vulkan_allocator.cpp index 190d61f..7ccb1f5 100644 --- a/src/vulkan_allocator.cpp +++ b/src/vulkan_allocator.cpp @@ -1,3 +1,5 @@ +#include "vulkan_allocator.h" + #include #include // snprintf for vma @@ -10,8 +12,6 @@ #define VMA_IMPLEMENTATION #include -#include "gpu_allocator.h" - namespace engine { VmaAllocator createAllocator(VkInstance instance, const Device& device) diff --git a/src/vulkan_device.cpp b/src/vulkan_device.cpp index ee242ac..38fe1d4 100644 --- a/src/vulkan_device.cpp +++ b/src/vulkan_device.cpp @@ -1,3 +1,5 @@ +#include "vulkan_device.h" + #include #include #include @@ -7,8 +9,6 @@ #include "log.h" -#include "device.h" - namespace engine { static bool checkQueueFamilySupportsPresent(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t familyIndex) diff --git a/src/vulkan_instance.cpp b/src/vulkan_instance.cpp index e5b802c..8a780f1 100644 --- a/src/vulkan_instance.cpp +++ b/src/vulkan_instance.cpp @@ -1,3 +1,5 @@ +#include "vulkan_instance.h" + #include #include #include @@ -9,8 +11,6 @@ #include "config.h" #include "log.h" -#include "instance.h" - namespace engine { static std::vector getWindowExtensions(SDL_Window* window) diff --git a/src/vulkan_swapchain.cpp b/src/vulkan_swapchain.cpp index 6808ab4..fb1de1c 100644 --- a/src/vulkan_swapchain.cpp +++ b/src/vulkan_swapchain.cpp @@ -1,16 +1,16 @@ +#include "vulkan_swapchain.h" + #include #include #include #include #include -#include +#include +#include #include "log.h" -#include "swapchain.h" -#include - namespace engine { void createSwapchain(Swapchain* sc, const SwapchainInfo& info) diff --git a/src/window.cpp b/src/window.cpp index aa83def..9ebe5a4 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "log.h" diff --git a/test/src/camera_controller.cpp b/test/src/camera_controller.cpp index 49dd8fa..7e9adc0 100644 --- a/test/src/camera_controller.cpp +++ b/test/src/camera_controller.cpp @@ -6,15 +6,15 @@ #include #include "application.h" -#include "components/transform.h" +#include "component_transform.h" #include "ecs.h" #include "input_manager.h" #include "log.h" #include "scene.h" #include "scene_manager.h" #include "window.h" -#include -#include +#include "system_collisions.h" +#include "component_mesh.h" CameraControllerSystem::CameraControllerSystem(engine::Scene* scene) : System(scene, {typeid(engine::TransformComponent).hash_code(), typeid(CameraControllerComponent).hash_code()}) diff --git a/test/src/camera_controller.hpp b/test/src/camera_controller.hpp index 54c274c..de9dedc 100644 --- a/test/src/camera_controller.hpp +++ b/test/src/camera_controller.hpp @@ -2,7 +2,7 @@ #include -#include "components/transform.h" +#include "component_transform.h" #include "application.h" #include "ecs.h" diff --git a/test/src/game.cpp b/test/src/game.cpp index 3c0836e..26a6444 100644 --- a/test/src/game.cpp +++ b/test/src/game.cpp @@ -2,20 +2,20 @@ #include "application.h" #include "camera_controller.hpp" -#include "components/collider.h" -#include "components/custom.h" -#include "components/mesh_renderable.h" -#include "components/transform.h" +#include "component_collider.h" +#include "component_custom.h" +#include "component_mesh.h" +#include "component_transform.h" #include "input_manager.h" #include "meshgen.hpp" -#include "resources/font.h" -#include "resources/material.h" -#include "resources/texture.h" +#include "resource_font.h" +#include "resource_material.h" +#include "resource_texture.h" #include "scene.h" #include "scene_manager.h" -#include "systems/mesh_render_system.h" -#include "systems/transform.h" -#include "util/gltf_loader.h" +#include "system_mesh_render.h" +#include "system_transform.h" +#include "gltf_loader.h" #include "log.h" #include "window.h" diff --git a/test/src/meshgen.cpp b/test/src/meshgen.cpp index 2ff2997..1250403 100644 --- a/test/src/meshgen.cpp +++ b/test/src/meshgen.cpp @@ -6,8 +6,8 @@ #include #include -#include "resources/mesh.h" -#include "util/gen_tangents.h" +#include "resource_mesh.h" +#include "gen_tangents.h" std::unique_ptr GenSphereMesh(engine::GFXDevice* gfx, float r, int detail, bool wind_inside, bool flip_normals) { diff --git a/test/src/meshgen.hpp b/test/src/meshgen.hpp index c9e32d1..72b4a41 100644 --- a/test/src/meshgen.hpp +++ b/test/src/meshgen.hpp @@ -2,7 +2,7 @@ #include -#include "resources/mesh.h" +#include "resource_mesh.h" std::unique_ptr GenSphereMesh(engine::GFXDevice* gfx, float r, int detail, bool wind_inside = false, bool flip_normals = false); diff --git a/vendor/imgui/CMakeLists.txt b/vendor/imgui/CMakeLists.txt index b06531a..146e727 100644 --- a/vendor/imgui/CMakeLists.txt +++ b/vendor/imgui/CMakeLists.txt @@ -33,4 +33,6 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PRIVATE src) -# libraries go here \ No newline at end of file +target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2) +target_link_libraries(${PROJECT_NAME} PRIVATE stb) +target_link_libraries(${PROJECT_NAME} PRIVATE volk::volk) \ No newline at end of file diff --git a/vendor/imgui/src/imgui_internal.h b/vendor/imgui/src/imgui_internal.h index 1b360f1..672f7eb 100644 --- a/vendor/imgui/src/imgui_internal.h +++ b/vendor/imgui/src/imgui_internal.h @@ -208,7 +208,7 @@ namespace ImStb #define STB_TEXTEDIT_GETWIDTH_NEWLINE (-1.0f) #define STB_TEXTEDIT_UNDOSTATECOUNT 99 #define STB_TEXTEDIT_UNDOCHARCOUNT 999 -#include "stb_textedit.h" +#include "imstb_textedit.h" } // namespace ImStb diff --git a/vendor/json/CMakeLists.txt b/vendor/json/CMakeLists.txt index 809a043..602e7ed 100644 --- a/vendor/json/CMakeLists.txt +++ b/vendor/json/CMakeLists.txt @@ -8,4 +8,6 @@ set(INCLUDE_FILES add_library(${PROJECT_NAME} INTERFACE ${INCLUDE_FILES} -) \ No newline at end of file +) + +target_include_directories(${PROJECT_NAME} INTERFACE include) \ No newline at end of file diff --git a/vendor/mikktspace/CMakeLists.txt b/vendor/mikktspace/CMakeLists.txt new file mode 100644 index 0000000..be4eb8f --- /dev/null +++ b/vendor/mikktspace/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.24) + +project(mikktspace LANGUAGES C) + +set(SRC_FILES + "src/mikktspace.c" +) + +set(INCLUDE_FILES + "include/mikktspace.h" +) + +add_library(${PROJECT_NAME} STATIC + ${SRC_FILES} + ${INCLUDE_FILES} +) + +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_EXTENSIONS OFF) + +target_include_directories(${PROJECT_NAME} PUBLIC include) +target_include_directories(${PROJECT_NAME} PRIVATE src) \ No newline at end of file diff --git a/src/libs/mikktspace.h b/vendor/mikktspace/include/mikktspace.h similarity index 100% rename from src/libs/mikktspace.h rename to vendor/mikktspace/include/mikktspace.h diff --git a/src/libs/mikktspace.c b/vendor/mikktspace/src/mikktspace.c similarity index 100% rename from src/libs/mikktspace.c rename to vendor/mikktspace/src/mikktspace.c diff --git a/vendor/stb/CMakeLists.txt b/vendor/stb/CMakeLists.txt index a815dbe..16da678 100644 --- a/vendor/stb/CMakeLists.txt +++ b/vendor/stb/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.24) -project(stb LANGUAGES C CXX) +project(stb LANGUAGES C) set(SRC_FILES - "src/stb_impl.cpp" + "src/stb_impl.c" ) set(INCLUDE_FILES @@ -18,9 +18,9 @@ add_library(${PROJECT_NAME} STATIC ${INCLUDE_FILES} ) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_EXTENSIONS OFF) target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PRIVATE src) \ No newline at end of file diff --git a/vendor/stb/src/stb_impl.cpp b/vendor/stb/src/stb_impl.c similarity index 100% rename from vendor/stb/src/stb_impl.cpp rename to vendor/stb/src/stb_impl.c diff --git a/vendor/tinygltf/CMakeLists.txt b/vendor/tinygltf/CMakeLists.txt new file mode 100644 index 0000000..bd59a42 --- /dev/null +++ b/vendor/tinygltf/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.24) + +project(tinygltf LANGUAGES CXX) + +set(SRC_FILES + "src/tiny_gltf_impl.cpp" +) + +set(INCLUDE_FILES + "include/tiny_gltf.h" +) + +add_library(${PROJECT_NAME} STATIC + ${SRC_FILES} + ${INCLUDE_FILES} +) + +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) + +target_include_directories(${PROJECT_NAME} PUBLIC include) +target_include_directories(${PROJECT_NAME} PRIVATE src) + +target_link_libraries(${PROJECT_NAME} PRIVATE json) +target_link_libraries(${PROJECT_NAME} PRIVATE stb) \ No newline at end of file diff --git a/src/libs/tiny_gltf.h b/vendor/tinygltf/include/tiny_gltf.h similarity index 100% rename from src/libs/tiny_gltf.h rename to vendor/tinygltf/include/tiny_gltf.h diff --git a/src/libs/tiny_gltf_impl.cpp b/vendor/tinygltf/src/tiny_gltf_impl.cpp similarity index 54% rename from src/libs/tiny_gltf_impl.cpp rename to vendor/tinygltf/src/tiny_gltf_impl.cpp index ab239e8..59710bf 100644 --- a/src/libs/tiny_gltf_impl.cpp +++ b/vendor/tinygltf/src/tiny_gltf_impl.cpp @@ -1,2 +1,2 @@ #define TINYGLTF_IMPLEMENTATION -#include "libs/tiny_gltf.h" \ No newline at end of file +#include "tiny_gltf.h" \ No newline at end of file diff --git a/vendor/weldmesh/CMakeLists.txt b/vendor/weldmesh/CMakeLists.txt new file mode 100644 index 0000000..e6ffc0f --- /dev/null +++ b/vendor/weldmesh/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.24) + +project(weldmesh LANGUAGES C) + +set(SRC_FILES + "src/weldmesh.c" +) + +set(INCLUDE_FILES + "include/weldmesh.h" +) + +add_library(${PROJECT_NAME} STATIC + ${SRC_FILES} + ${INCLUDE_FILES} +) + +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_EXTENSIONS OFF) + +target_include_directories(${PROJECT_NAME} PUBLIC include) +target_include_directories(${PROJECT_NAME} PRIVATE src) \ No newline at end of file diff --git a/src/libs/weldmesh.h b/vendor/weldmesh/include/weldmesh.h similarity index 100% rename from src/libs/weldmesh.h rename to vendor/weldmesh/include/weldmesh.h diff --git a/src/libs/weldmesh.c b/vendor/weldmesh/src/weldmesh.c similarity index 100% rename from src/libs/weldmesh.c rename to vendor/weldmesh/src/weldmesh.c