From ab3beaaa6c60c849d3f64f04dd3c5b0edf935853 Mon Sep 17 00:00:00 2001 From: harrand Date: Tue, 4 Jul 2023 01:45:46 +0100 Subject: [PATCH] + Added some objectively awful code in an effort to make msvc shut the hell up \o/ --- src/tz/io/gltf.hpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/tz/io/gltf.hpp b/src/tz/io/gltf.hpp index d62238c7d3..2465aa6da0 100644 --- a/src/tz/io/gltf.hpp +++ b/src/tz/io/gltf.hpp @@ -8,6 +8,11 @@ namespace tz::io { + namespace detail + { + // i hate msvc so damn much. + constexpr std::size_t badzu = static_cast(-1); + } using json = nlohmann::json; enum class gltf_resource_type @@ -37,8 +42,8 @@ namespace tz::io struct gltf_header { - std::size_t version = -1; - std::size_t size = -1; + std::size_t version = detail::badzu; + std::size_t size = detail::badzu; }; enum class gltf_buffer_view_type @@ -126,8 +131,8 @@ namespace tz::io { gltf_attributes attributes = {}; accessor_ref accessors = {}; - std::size_t indices_accessor = -1; - std::size_t material_id = -1; + std::size_t indices_accessor = detail::badzu; + std::size_t material_id = detail::badzu; gltf_primitive_mode mode; }; @@ -150,16 +155,16 @@ namespace tz::io struct gltf_material { std::string name = "Null Material"; - std::size_t color_texture_id = -1; - std::size_t color_texcoord_id = -1; - std::size_t normal_texture_id = -1; - std::size_t normal_texcoord_id = -1; + std::size_t color_texture_id = detail::badzu; + std::size_t color_texcoord_id = detail::badzu; + std::size_t normal_texture_id = detail::badzu; + std::size_t normal_texcoord_id = detail::badzu; float normal_scale = 1.0f; - std::size_t occlusion_texture_id = -1; - std::size_t occlusion_texcoord_id = -1; + std::size_t occlusion_texture_id = detail::badzu; + std::size_t occlusion_texcoord_id = detail::badzu; float occlusion_strength = 1.0f; - std::size_t emissive_texture_id = -1; - std::size_t emissive_texcoord_id = -1; + std::size_t emissive_texture_id = detail::badzu; + std::size_t emissive_texcoord_id = detail::badzu; }; struct gltf_vertex_data