minor fixes

This commit is contained in:
ohyzha
2024-08-03 15:41:59 +03:00
parent 837861d6f2
commit dcf6e72f96
9 changed files with 14 additions and 16 deletions

View File

@@ -34,12 +34,12 @@ endif()
if (WIN32) if (WIN32)
set(TRIPLET x64-windows-static-md-release CACHE INTERNAL "triplet") set(TRIPLET x64-windows-static-md-release CACHE INTERNAL "triplet")
elseif(UNIX) elseif(UNIX AND NOT APPLE)
set(TRIPLET x64-linux CACHE INTERNAL "triplet") set(TRIPLET x64-linux CACHE INTERNAL "triplet")
elseif(APPLE) elseif(APPLE)
set(TRIPLET x64-osx CACHE INTERNAL "triplet") set(TRIPLET arm64-osx CACHE INTERNAL "triplet")
else() elseif(IOS)
message(FATAL_ERROR "Unknown OS, can't build msdfgen") set(TRIPLET arm64-ios CACHE INTERNAL "triplet")
endif() endif()
execute_process(COMMAND ${VCPKG_EXECUTABLE} install freetype:${TRIPLET} libpng:${TRIPLET}) execute_process(COMMAND ${VCPKG_EXECUTABLE} install freetype:${TRIPLET} libpng:${TRIPLET})
@@ -92,4 +92,3 @@ function(LinkMsdf TARGET)
endif() endif()
endforeach() endforeach()
endfunction() endfunction()

View File

@@ -17,6 +17,7 @@ function(SetWarningSettings TARGET)
target_compile_options(${TARGET} PRIVATE -Wall -Wno-unknown-pragmas) target_compile_options(${TARGET} PRIVATE -Wall -Wno-unknown-pragmas)
elseif (WIN32) elseif (WIN32)
if (MSVC) if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/wd4068") set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/wd4068")
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/ignore:4099") set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/ignore:4099")
endif() endif()

View File

@@ -47,6 +47,6 @@ namespace OpenVulkano
Array<char> ResourceLoaderAppDirLinux::GetResource(const std::string& resourceName) Array<char> ResourceLoaderAppDirLinux::GetResource(const std::string& resourceName)
{ {
return Utils::ReadFile(resourceName, true); return Utils::ReadFile(GetAppDir() + resourceName, true);
} }
} }

View File

@@ -15,9 +15,9 @@ namespace OpenVulkano
public: public:
virtual ~ResourceLoader() = default; virtual ~ResourceLoader() = default;
virtual Array<char> GetResource(const std::string& resourceName) = 0; [[nodiscard]] virtual Array<char> 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(); static ResourceLoader& GetInstance();

View File

@@ -45,6 +45,6 @@ namespace OpenVulkano
Array<char> ResourceLoaderAppDirWindows::GetResource(const std::string& resourceName) Array<char> ResourceLoaderAppDirWindows::GetResource(const std::string& resourceName)
{ {
return Utils::ReadFile(resourceName); return Utils::ReadFile(GetAppDir() + resourceName);
} }
} }

View File

@@ -188,17 +188,16 @@ namespace OpenVulkano::Scene
#endif #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++) for(uint32_t i = 0; i < size; i++)
{ {
if (indexType == VertexIndexType::UINT16) if (indexType == VertexIndexType::UINT16)
{ {
static_cast<uint16_t*>(indices)[i + indicesOffset] = static_cast<uint16_t>(data[i]); static_cast<uint16_t*>(indices)[i + dstOffset] = static_cast<uint16_t>(data[i]);
} }
else else
{ { static_cast<uint32_t*>(indices)[i + dstOffset] = data[i];
static_cast<uint32_t*>(indices)[i + indicesOffset] = data[i];
} }
} }
} }

View File

@@ -60,7 +60,7 @@ namespace OpenVulkano
void Init(aiMesh* mesh); 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; void Close() override;

View File

@@ -124,7 +124,7 @@ namespace OpenVulkano::Scene
else else
{ {
// throw ? replace with ? character (if available) ? // 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);
} }
} }
} }

View File

@@ -19,7 +19,6 @@ namespace OpenVulkano::Vulkan
class VulkanTexture : public Scene::RenderTexture, public IRecordable, public Image class VulkanTexture : public Scene::RenderTexture, public IRecordable, public Image
{ {
public: public:
static inline vk::SamplerCreateInfo DEFAULT_SAMPLER_CONFIG { {}, vk::Filter::eLinear, vk::Filter::eLinear };
vk::Sampler m_sampler; vk::Sampler m_sampler;
vk::DescriptorSet m_descriptorSet; vk::DescriptorSet m_descriptorSet;