Tweaked help messages, and model loading
This commit is contained in:
parent
87e7db0c87
commit
b25c3d8360
@ -1,5 +1,5 @@
|
||||
{
|
||||
"date": "2026-08-25T23:21:08.955141949+02:00",
|
||||
"date": "2026-08-26T14:26:46.281424105+02:00",
|
||||
"data": {
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/cmake/CLI11GeneratePkgConfig.cmake": [
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt"
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
{
|
||||
"date": "2026-08-25T23:21:08.955046741+02:00",
|
||||
"date": "2026-08-26T14:26:46.281337341+02:00",
|
||||
"data": {
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/docs/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/src/modules/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/src/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/single-include/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/src/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/examples/subcom_in_files/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/examples/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/examples/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/fuzz/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/single-include/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/tests/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/src/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/docs/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/book/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt",
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/examples/subcom_in_files/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/examples/CMakeLists.txt"
|
||||
"/home/alex/Developer/Code/Vulkan-Git/include/CLI11/book/CMakeLists.txt": "/home/alex/Developer/Code/Vulkan-Git/include/CLI11/CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
@ -221,6 +221,18 @@ endfunction()
|
||||
|
||||
|
||||
# Adds the main binary
|
||||
|
||||
list(
|
||||
APPEND
|
||||
lib_list
|
||||
# Libs used
|
||||
glfw
|
||||
fmt
|
||||
vk-bootstrap
|
||||
vulkan
|
||||
CLI11::CLI11
|
||||
fastgltf
|
||||
)
|
||||
addBinary (
|
||||
engine
|
||||
SOURCE Engine/main
|
||||
@ -229,9 +241,9 @@ addBinary (
|
||||
LICENSE
|
||||
|
||||
SHADERS shaders/*
|
||||
MODELS assets/models*
|
||||
MODELS *
|
||||
|
||||
LIBS glfw fmt vk-bootstrap vulkan CLI11::CLI11
|
||||
LIBS ${lib_list}
|
||||
)
|
||||
|
||||
addBinary (
|
||||
|
||||
@ -130,7 +130,7 @@ class Engine {
|
||||
GPUMeshBuffers rectangle;
|
||||
|
||||
// Model
|
||||
std::string _modelPath { "models/default.gltf" };
|
||||
std::string _modelPath { "models/basicmesh.glb" };
|
||||
|
||||
|
||||
void parseConfig(
|
||||
@ -221,6 +221,7 @@ class Engine {
|
||||
#define ENGINE_IMPL_H
|
||||
//========== Implementation ==========
|
||||
// Implementation defines
|
||||
#define LOADER_IMPL
|
||||
#define IMAGES_IMPL
|
||||
#define INITIALIZERS_IMPL
|
||||
#define DESCRIPTORS_IMPL
|
||||
@ -237,6 +238,7 @@ class Engine {
|
||||
#include "callbacks.h"
|
||||
#include "descriptors.h"
|
||||
#include "pipelines.h"
|
||||
#include "loader.h"
|
||||
#include "Common/Types.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/Logger.h"
|
||||
@ -292,7 +294,6 @@ void Engine::parseConfig(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Engine::init() {
|
||||
#ifdef DEBUG
|
||||
std::ifstream infile("LICENSE");
|
||||
|
||||
@ -14,13 +14,69 @@ struct GeoSurface {
|
||||
uint32_t count;
|
||||
};
|
||||
|
||||
struct MeshAsset {
|
||||
std::string name;
|
||||
|
||||
std::vector<GeoSurface> surfaces;
|
||||
GPUMeshBuffers meshBuffers;
|
||||
};
|
||||
|
||||
// Forward declaration
|
||||
|
||||
class Engine;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LOADER_IMPL
|
||||
#ifndef LOADER_IMPL_H
|
||||
#define LOADER_IMPL_H
|
||||
// Main code file
|
||||
// Includes
|
||||
#include <fastgltf/core.hpp>
|
||||
#include <fastgltf/types.hpp>
|
||||
#include <fastgltf/glm_element_traits.hpp>
|
||||
#include <fastgltf/tools.hpp>
|
||||
|
||||
|
||||
std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
|
||||
Engine* engine,
|
||||
std::filesystem::path filePath
|
||||
) {
|
||||
auto& logger = engine->_logger; // Uses the main logger
|
||||
logger.logAll(LogModule::ENGINE, LogLevel::EINFO, "Loading GLTF: {}", filePath.string());
|
||||
|
||||
fastgltf::Parser parser;
|
||||
fastgltf::Asset gltf;
|
||||
auto data = fastgltf::GltfDataBuffer::FromPath(filePath);
|
||||
|
||||
constexpr auto gltfOptions {
|
||||
fastgltf::Options::LoadExternalBuffers
|
||||
};
|
||||
|
||||
auto load = parser.loadGltf(
|
||||
data.get(),
|
||||
filePath.parent_path(),
|
||||
gltfOptions
|
||||
);
|
||||
|
||||
if(load) {
|
||||
gltf = std::move(load.get());
|
||||
} else {
|
||||
logger.logFatal(LogModule::ENGINE, "Failed to load gltf: {}", fastgltf::to_underlying(load.error()));
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<MeshAsset>> meshes;
|
||||
// Use the same vectors for all meshes
|
||||
// so that the memory doesn't reallocate
|
||||
// as often
|
||||
|
||||
std::vector<uint32_t> indices;
|
||||
std::vector<Vertex> vertices;
|
||||
|
||||
|
||||
// Debug things
|
||||
return meshes;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -20,10 +20,16 @@ class ArgHandler {
|
||||
void buildArgs() {
|
||||
// Setup
|
||||
// Subcommands
|
||||
_run = _app.add_subcommand("run", "Starts the Engine");
|
||||
_run = _app.add_subcommand("run");
|
||||
|
||||
// Main options/flags
|
||||
_app.add_flag("--list-gpu", _listGPU, "Lists available Graphics cards, useful for debugging");
|
||||
_app.add_flag("--list-gpu, -l", _listGPU, "Lists available Graphics cards, useful for debugging");
|
||||
_app.set_version_flag("--version, -v", BUILD_ID);
|
||||
|
||||
// Help
|
||||
//_app.set_help_all_flag("--help-all", "Expand all help");
|
||||
_app.set_help_flag();
|
||||
_app.set_help_all_flag("--help, -h", "Print help for all subcommands");
|
||||
|
||||
// Subcommand options/flags
|
||||
// Run
|
||||
@ -59,6 +65,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
if (argc == 1) {
|
||||
handler.printHelp();
|
||||
fmt::println("Please use -h or --help to see all available options.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user