diff --git a/.gitignore b/.gitignore index ca37570..8e5e5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ backup coverage coverage/* .venv +*.glb +imgui.ini diff --git a/Makefile b/Makefile index 99a8005..0e6f65d 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,10 @@ shaders: %.png: %.dot dot -Tpng $< -o $@ -build: +%.glb: %.glb.gz + gunzip $< + +build: basicmesh.glb meson compile -j 10 -C $(ROOT_DIR)/builddir release_build: diff --git a/basicmesh.glb.gz b/basicmesh.glb.gz new file mode 100644 index 0000000..5898895 Binary files /dev/null and b/basicmesh.glb.gz differ diff --git a/meson.build b/meson.build index 64df191..0346d16 100644 --- a/meson.build +++ b/meson.build @@ -69,7 +69,6 @@ elif build_machine.system() == 'darwin' endif vma = subproject('vulkan-memory-allocator').get_variable('vma_allocator_dep') -# vulkan_headers = subproject('vulkan-headers').get_variable('vulkan_headers_dep') imgui = subproject('imgui', default_options: { @@ -79,7 +78,7 @@ imgui = subproject('imgui', ).get_variable('imgui_dep') sdl2 = subproject('sdl2').get_variable('sdl2_dep') - +fastgltf = subproject('fastgltf').get_variable('fastgltf_dep') glm_opts = cmake.subproject_options() glm_opts.add_cmake_defines({ @@ -121,16 +120,21 @@ sources = [ 'vk_images.cpp', 'vk_descriptors.cpp', 'vk_pipelines.cpp', + 'vk_loader.cpp', 'vk_gui.cpp', 'main.cpp', ] +# have to force this here for...cmake reasons +include_dirs = include_directories('subprojects/fastgltf/include') + tests = [ ] executable('hellovulk', sources, cpp_args: cpp_args, link_args: link_args, + include_directories: include_dirs, win_subsystem: 'windows', override_options: exe_defaults, dependencies: dependencies) diff --git a/vk_loader.cpp b/vk_loader.cpp new file mode 100644 index 0000000..a5249f1 --- /dev/null +++ b/vk_loader.cpp @@ -0,0 +1,19 @@ +#include "vk_loader.h" +#include "vendor/stb_image.h" +#include + +#include "vk_engine.h" +#include "vk_initializers.h" +#include "vk_types.h" +#include + +#include +#include +#include + + +std::optional>> loadGltfMeshes(VulkanEngine* engine, std::filesystem::path filePath) +{ + + return std::nullopt; +} diff --git a/vk_loader.h b/vk_loader.h new file mode 100644 index 0000000..7e553f1 --- /dev/null +++ b/vk_loader.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +struct GeoSurface { + uint32_t startIndex; + uint32_t count; +}; + +struct MeshAsset { + std::string name; + + std::vector surfaces; + GPUMeshBuffers meshBuffers; +}; + +class VulkanEngine; + +std::optional>> loadGltfMeshes(VulkanEngine* engine, std::filesystem::path filePath); + diff --git a/vk_types.h b/vk_types.h index 4f93e18..d491e6f 100644 --- a/vk_types.h +++ b/vk_types.h @@ -18,6 +18,7 @@ #include +#define GLM_ENABLE_EXPERIMENTAL 1 #include #include diff --git a/wraps/fastgltf.wrap b/wraps/fastgltf.wrap new file mode 100644 index 0000000..abac338 --- /dev/null +++ b/wraps/fastgltf.wrap @@ -0,0 +1,9 @@ +[wrap-git] +directory=fastgltf +url=https://github.com/spnda/fastgltf.git +revision=v0.9.x +depth=1 +method=cmake + +[provide] +fastgltf = fastgltf_dep