diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2026-05-14 23:30:06 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2026-05-14 23:33:31 +0200 |
| commit | 8f137322da4220aeb3863ff79724644e7e5152a0 (patch) | |
| tree | cceba996b5c78b35190592ba72e5c2643544e57e | |
| parent | f745ba47651664048a4641676453d06f2319c3d1 (diff) | |
Remove usage of PathFindExtensionA and shlwapi include
Fix input bug due to a switch to main fiber in message handler
| -rw-r--r-- | include/gltf.hpp | 4 | ||||
| -rw-r--r-- | src/gltf.cpp | 16 | ||||
| -rw-r--r-- | src/main.cpp | 1 | ||||
| -rw-r--r-- | src/scene.cpp | 4 | ||||
| -rw-r--r-- | src/window.cpp | 2 |
5 files changed, 9 insertions, 18 deletions
diff --git a/include/gltf.hpp b/include/gltf.hpp index 72d757c..7e7c33f 100644 --- a/include/gltf.hpp +++ b/include/gltf.hpp @@ -27,7 +27,7 @@ struct buffer { class gltf {
public:
- gltf(const char* filepath);
+ gltf(const char* filepath, bool is_glb = false);
void deinit();
std::vector<u32> root_nodes;
@@ -53,7 +53,7 @@ class gltf { u32 length;
};
std::vector<struct glb_chunk*> chunks;
- glb_header* header;
+ glb_header* header = nullptr;
// TODO: remove
bool is_glb;
diff --git a/src/gltf.cpp b/src/gltf.cpp index 2ddf16a..3e0af7d 100644 --- a/src/gltf.cpp +++ b/src/gltf.cpp @@ -166,12 +166,11 @@ static void load_textures(char* path, std::vector<handle<device_texture>>& textu vkdevice& device = vkdevice::get(); constexpr auto buffers_count = 2U; - auto total_size = images.size() * 4096U * 4096 * sizeof(uint32_t); + size_t total_size = images.size() * 4096U * 4096 * sizeof(uint32_t); // TODO: Fix nasty stuff going on - // Crash on buffer destruction - // Load wrong images - // auto buffer_size = total_size / 32U; - auto buffer_size = total_size / 2U; + // Crash on buffer destruction and load wrong images + // size_t buffer_size = total_size / 32U; + size_t buffer_size = total_size / 4U; handle<device_buffer> staging_buffers_handle[buffers_count] = { device.create_buffer({ @@ -289,23 +288,18 @@ static void load_materials(std::vector<material>& materials, std::vector<handle< } } -gltf::gltf(const char* filepath) { +gltf::gltf(const char* filepath, bool is_glb) { BEGIN_MARKER(LOAD_GLTF); ondemand::parser parser; padded_string json; ondemand::document doc; - const char* ext = PathFindExtensionA(filepath); - char buffer_path[2048U] = { 0U }; char* filename = nullptr; GetFullPathNameA( filepath, 2048U, buffer_path, &filename); size_t parent_dir_len = filename - buffer_path; - // TODO: Remove - is_glb = strcmp(ext, ".glb") == 0; - if (is_glb) { size_t filesize = 0U; size_t read = 0U; diff --git a/src/main.cpp b/src/main.cpp index 4d56a3c..74bb655 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,7 +12,6 @@ #include <winuser.h> #include <winnls.h> #include <fileapi.h> - #include <shlwapi.h> #include <handleapi.h> #include <errhandlingapi.h> #endif // _WIN32 diff --git a/src/scene.cpp b/src/scene.cpp index 9369eae..d8533f9 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -55,13 +55,13 @@ metadata::metadata(const camera &cam, uint32_t width, uint32_t height) : cam(cam), width(width), height(height) {}
scene::scene(const camera& cam, uint32_t width, uint32_t height)
- // :model("../models/sponza/Sponza.gltf"), meta(cam, width, height) {
+ :model("../models/sponza/Sponza.gltf"), meta(cam, width, height) {
// :model("../models/BistroInterior/BistroInterior.gltf"), meta(cam, width, height) {
// :model("../models/BistroExterior/BistroExterior.gltf"), meta(cam, width, height) {
// :model("../models/sponza-avif-hi.glb"), meta(cam, width, height) {
// :model("../models/main_sponza/NewSponza_Main_glTF_003.gltf"), meta(cam, width, height) {
// :model("../models/pkg_a_curtains/NewSponza_Curtains_glTF.gltf"), meta(cam, width, height) {
- :model("../models/sponza.glb"), meta(cam, width, height) {
+ // :model("../models/sponza.glb", true), meta(cam, width, height) {
auto& device = vkdevice::get();
diff --git a/src/window.cpp b/src/window.cpp index 38c9765..b2c25fd 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -425,8 +425,6 @@ LRESULT window::message_handler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lpar } } - SwitchToFiber(main_fiber); - return 0; } |
