From dcf6e72f963ddb7517bab58972997314310e0a51 Mon Sep 17 00:00:00 2001 From: ohyzha Date: Sat, 3 Aug 2024 15:41:59 +0300 Subject: [PATCH] minor fixes --- 3rdParty/msdf/CMakeLists.txt | 9 ++++----- cmake/SetCompilerSettings.cmake | 1 + openVulkanoCpp/Host/Linux/ResourceLoaderAppDirLinux.cpp | 2 +- openVulkanoCpp/Host/ResourceLoader.hpp | 4 ++-- .../Host/Windows/ResourceLoaderAppDirWindows.cpp | 2 +- openVulkanoCpp/Scene/Geometry.cpp | 7 +++---- openVulkanoCpp/Scene/Geometry.hpp | 2 +- openVulkanoCpp/Scene/TextDrawable.cpp | 2 +- openVulkanoCpp/Vulkan/Scene/VulkanTexture.hpp | 1 - 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/3rdParty/msdf/CMakeLists.txt b/3rdParty/msdf/CMakeLists.txt index ce75190..7a2317f 100644 --- a/3rdParty/msdf/CMakeLists.txt +++ b/3rdParty/msdf/CMakeLists.txt @@ -34,12 +34,12 @@ endif() if (WIN32) set(TRIPLET x64-windows-static-md-release CACHE INTERNAL "triplet") -elseif(UNIX) +elseif(UNIX AND NOT APPLE) set(TRIPLET x64-linux CACHE INTERNAL "triplet") elseif(APPLE) - set(TRIPLET x64-osx CACHE INTERNAL "triplet") -else() - message(FATAL_ERROR "Unknown OS, can't build msdfgen") + set(TRIPLET arm64-osx CACHE INTERNAL "triplet") +elseif(IOS) + set(TRIPLET arm64-ios CACHE INTERNAL "triplet") endif() execute_process(COMMAND ${VCPKG_EXECUTABLE} install freetype:${TRIPLET} libpng:${TRIPLET}) @@ -92,4 +92,3 @@ function(LinkMsdf TARGET) endif() endforeach() endfunction() - diff --git a/cmake/SetCompilerSettings.cmake b/cmake/SetCompilerSettings.cmake index 4fd20bd..5e2260d 100644 --- a/cmake/SetCompilerSettings.cmake +++ b/cmake/SetCompilerSettings.cmake @@ -17,6 +17,7 @@ function(SetWarningSettings TARGET) target_compile_options(${TARGET} PRIVATE -Wall -Wno-unknown-pragmas) elseif (WIN32) if (MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/wd4068") set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/ignore:4099") endif() diff --git a/openVulkanoCpp/Host/Linux/ResourceLoaderAppDirLinux.cpp b/openVulkanoCpp/Host/Linux/ResourceLoaderAppDirLinux.cpp index 3d36b73..9a0943e 100644 --- a/openVulkanoCpp/Host/Linux/ResourceLoaderAppDirLinux.cpp +++ b/openVulkanoCpp/Host/Linux/ResourceLoaderAppDirLinux.cpp @@ -47,6 +47,6 @@ namespace OpenVulkano Array ResourceLoaderAppDirLinux::GetResource(const std::string& resourceName) { - return Utils::ReadFile(resourceName, true); + return Utils::ReadFile(GetAppDir() + resourceName, true); } } \ No newline at end of file diff --git a/openVulkanoCpp/Host/ResourceLoader.hpp b/openVulkanoCpp/Host/ResourceLoader.hpp index 54cc0f7..7b8000a 100644 --- a/openVulkanoCpp/Host/ResourceLoader.hpp +++ b/openVulkanoCpp/Host/ResourceLoader.hpp @@ -15,9 +15,9 @@ namespace OpenVulkano public: virtual ~ResourceLoader() = default; - virtual Array GetResource(const std::string& resourceName) = 0; + [[nodiscard]] virtual Array GetResource(const std::string& resourceName) = 0; - virtual std::string GetResourcePath(const std::string& resourceName) { return ""; } + [[nodiscard]] virtual std::string GetResourcePath(const std::string& resourceName) { return ""; } static ResourceLoader& GetInstance(); diff --git a/openVulkanoCpp/Host/Windows/ResourceLoaderAppDirWindows.cpp b/openVulkanoCpp/Host/Windows/ResourceLoaderAppDirWindows.cpp index 65190d0..76b9c94 100644 --- a/openVulkanoCpp/Host/Windows/ResourceLoaderAppDirWindows.cpp +++ b/openVulkanoCpp/Host/Windows/ResourceLoaderAppDirWindows.cpp @@ -45,6 +45,6 @@ namespace OpenVulkano Array ResourceLoaderAppDirWindows::GetResource(const std::string& resourceName) { - return Utils::ReadFile(resourceName); + return Utils::ReadFile(GetAppDir() + resourceName); } } \ No newline at end of file diff --git a/openVulkanoCpp/Scene/Geometry.cpp b/openVulkanoCpp/Scene/Geometry.cpp index 24dab8d..3d277d3 100644 --- a/openVulkanoCpp/Scene/Geometry.cpp +++ b/openVulkanoCpp/Scene/Geometry.cpp @@ -188,17 +188,16 @@ namespace OpenVulkano::Scene #endif } - void Geometry::SetIndices(const uint32_t* data, uint32_t size, uint32_t indicesOffset) const + void Geometry::SetIndices(const uint32_t* data, uint32_t size, uint32_t dstOffset) const { for(uint32_t i = 0; i < size; i++) { if (indexType == VertexIndexType::UINT16) { - static_cast(indices)[i + indicesOffset] = static_cast(data[i]); + static_cast(indices)[i + dstOffset] = static_cast(data[i]); } else - { - static_cast(indices)[i + indicesOffset] = data[i]; + { static_cast(indices)[i + dstOffset] = data[i]; } } } diff --git a/openVulkanoCpp/Scene/Geometry.hpp b/openVulkanoCpp/Scene/Geometry.hpp index 769bf52..37582c0 100644 --- a/openVulkanoCpp/Scene/Geometry.hpp +++ b/openVulkanoCpp/Scene/Geometry.hpp @@ -60,7 +60,7 @@ namespace OpenVulkano void Init(aiMesh* mesh); - void SetIndices(const uint32_t* data, uint32_t size, uint32_t indicesOffset = 0) const; + void SetIndices(const uint32_t* data, uint32_t size, uint32_t dstOffset = 0) const; void Close() override; diff --git a/openVulkanoCpp/Scene/TextDrawable.cpp b/openVulkanoCpp/Scene/TextDrawable.cpp index 6e3206d..ff3cfc3 100644 --- a/openVulkanoCpp/Scene/TextDrawable.cpp +++ b/openVulkanoCpp/Scene/TextDrawable.cpp @@ -124,7 +124,7 @@ namespace OpenVulkano::Scene else { // throw ? replace with ? character (if available) ? - Logger::RENDER->error(fmt::format("Could not find glyph for character {}", c)); + Logger::RENDER->error("Could not find glyph for character {}", c); } } } diff --git a/openVulkanoCpp/Vulkan/Scene/VulkanTexture.hpp b/openVulkanoCpp/Vulkan/Scene/VulkanTexture.hpp index 9fd6da4..5a079d4 100644 --- a/openVulkanoCpp/Vulkan/Scene/VulkanTexture.hpp +++ b/openVulkanoCpp/Vulkan/Scene/VulkanTexture.hpp @@ -19,7 +19,6 @@ namespace OpenVulkano::Vulkan class VulkanTexture : public Scene::RenderTexture, public IRecordable, public Image { public: - static inline vk::SamplerCreateInfo DEFAULT_SAMPLER_CONFIG { {}, vk::Filter::eLinear, vk::Filter::eLinear }; vk::Sampler m_sampler; vk::DescriptorSet m_descriptorSet;