Working fastgltf build, but had to manually include the headers.
This commit is contained in:
parent
6d29fb718b
commit
0e6d452580
8 changed files with 63 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -29,3 +29,5 @@ backup
|
||||||
coverage
|
coverage
|
||||||
coverage/*
|
coverage/*
|
||||||
.venv
|
.venv
|
||||||
|
*.glb
|
||||||
|
imgui.ini
|
||||||
|
|
|
||||||
5
Makefile
5
Makefile
|
|
@ -26,7 +26,10 @@ shaders:
|
||||||
%.png: %.dot
|
%.png: %.dot
|
||||||
dot -Tpng $< -o $@
|
dot -Tpng $< -o $@
|
||||||
|
|
||||||
build:
|
%.glb: %.glb.gz
|
||||||
|
gunzip $<
|
||||||
|
|
||||||
|
build: basicmesh.glb
|
||||||
meson compile -j 10 -C $(ROOT_DIR)/builddir
|
meson compile -j 10 -C $(ROOT_DIR)/builddir
|
||||||
|
|
||||||
release_build:
|
release_build:
|
||||||
|
|
|
||||||
BIN
basicmesh.glb.gz
Normal file
BIN
basicmesh.glb.gz
Normal file
Binary file not shown.
|
|
@ -69,7 +69,6 @@ elif build_machine.system() == 'darwin'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
vma = subproject('vulkan-memory-allocator').get_variable('vma_allocator_dep')
|
vma = subproject('vulkan-memory-allocator').get_variable('vma_allocator_dep')
|
||||||
# vulkan_headers = subproject('vulkan-headers').get_variable('vulkan_headers_dep')
|
|
||||||
|
|
||||||
imgui = subproject('imgui',
|
imgui = subproject('imgui',
|
||||||
default_options: {
|
default_options: {
|
||||||
|
|
@ -79,7 +78,7 @@ imgui = subproject('imgui',
|
||||||
).get_variable('imgui_dep')
|
).get_variable('imgui_dep')
|
||||||
|
|
||||||
sdl2 = subproject('sdl2').get_variable('sdl2_dep')
|
sdl2 = subproject('sdl2').get_variable('sdl2_dep')
|
||||||
|
fastgltf = subproject('fastgltf').get_variable('fastgltf_dep')
|
||||||
|
|
||||||
glm_opts = cmake.subproject_options()
|
glm_opts = cmake.subproject_options()
|
||||||
glm_opts.add_cmake_defines({
|
glm_opts.add_cmake_defines({
|
||||||
|
|
@ -121,16 +120,21 @@ sources = [
|
||||||
'vk_images.cpp',
|
'vk_images.cpp',
|
||||||
'vk_descriptors.cpp',
|
'vk_descriptors.cpp',
|
||||||
'vk_pipelines.cpp',
|
'vk_pipelines.cpp',
|
||||||
|
'vk_loader.cpp',
|
||||||
'vk_gui.cpp',
|
'vk_gui.cpp',
|
||||||
'main.cpp',
|
'main.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# have to force this here for...cmake reasons
|
||||||
|
include_dirs = include_directories('subprojects/fastgltf/include')
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
]
|
]
|
||||||
|
|
||||||
executable('hellovulk', sources,
|
executable('hellovulk', sources,
|
||||||
cpp_args: cpp_args,
|
cpp_args: cpp_args,
|
||||||
link_args: link_args,
|
link_args: link_args,
|
||||||
|
include_directories: include_dirs,
|
||||||
win_subsystem: 'windows',
|
win_subsystem: 'windows',
|
||||||
override_options: exe_defaults,
|
override_options: exe_defaults,
|
||||||
dependencies: dependencies)
|
dependencies: dependencies)
|
||||||
|
|
|
||||||
19
vk_loader.cpp
Normal file
19
vk_loader.cpp
Normal 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
22
vk_loader.h
Normal 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);
|
||||||
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <print>
|
#include <print>
|
||||||
|
|
||||||
|
#define GLM_ENABLE_EXPERIMENTAL 1
|
||||||
#include <glm/mat4x4.hpp>
|
#include <glm/mat4x4.hpp>
|
||||||
#include <glm/vec4.hpp>
|
#include <glm/vec4.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
9
wraps/fastgltf.wrap
Normal file
9
wraps/fastgltf.wrap
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue