Working fastgltf build, but had to manually include the headers.

This commit is contained in:
Zed A. Shaw 2025-12-15 11:04:17 -05:00
parent 6d29fb718b
commit 0e6d452580
8 changed files with 63 additions and 3 deletions

2
.gitignore vendored
View file

@ -29,3 +29,5 @@ backup
coverage
coverage/*
.venv
*.glb
imgui.ini

View file

@ -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:

BIN
basicmesh.glb.gz Normal file

Binary file not shown.

View file

@ -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)

19
vk_loader.cpp Normal file
View file

@ -0,0 +1,19 @@
#include "vk_loader.h"
#include "vendor/stb_image.h"
#include <iostream>
#include "vk_engine.h"
#include "vk_initializers.h"
#include "vk_types.h"
#include <glm/gtx/quaternion.hpp>
#include <fastgltf/glm_element_traits.hpp>
#include <fastgltf/core.hpp>
#include <fastgltf/tools.hpp>
std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(VulkanEngine* engine, std::filesystem::path filePath)
{
return std::nullopt;
}

22
vk_loader.h Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <vk_types.h>
#include <unordered_map>
#include <filesystem>
struct GeoSurface {
uint32_t startIndex;
uint32_t count;
};
struct MeshAsset {
std::string name;
std::vector<GeoSurface> surfaces;
GPUMeshBuffers meshBuffers;
};
class VulkanEngine;
std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(VulkanEngine* engine, std::filesystem::path filePath);

View file

@ -18,6 +18,7 @@
#include <print>
#define GLM_ENABLE_EXPERIMENTAL 1
#include <glm/mat4x4.hpp>
#include <glm/vec4.hpp>

9
wraps/fastgltf.wrap Normal file
View file

@ -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