From 61e353164bc3fe9aed6f1df550d2c5743054104e Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Sat, 1 Oct 2022 23:57:26 +0800 Subject: [PATCH] Fixed all asset related warnings --- .../src/Assets/Asset Types/SHTextureAsset.h | 6 +++-- .../src/Assets/Libraries/SHMeshLoader.cpp | 4 +-- .../src/Assets/Libraries/SHTextureLoader.cpp | 8 +++--- SHADE_Engine/src/Assets/SHAssetManager.cpp | 26 ++++++++++--------- .../src/Assets/SHAssetMetaHandler.cpp | 2 +- .../MiddleEnd/Textures/SHTextureLibrary.h | 2 +- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/SHADE_Engine/src/Assets/Asset Types/SHTextureAsset.h b/SHADE_Engine/src/Assets/Asset Types/SHTextureAsset.h index 634d9a9a..07cebea9 100644 --- a/SHADE_Engine/src/Assets/Asset Types/SHTextureAsset.h +++ b/SHADE_Engine/src/Assets/Asset Types/SHTextureAsset.h @@ -17,7 +17,8 @@ namespace SHADE SHTexture::PixelChannel const * pixelData; SHTextureAsset() - : numBytes{ 0 }, + : compiled{ false }, + numBytes{ 0 }, width{ 0 }, height{ 0 }, format{ SHTexture::TextureFormat::eUndefined }, @@ -25,7 +26,8 @@ namespace SHADE {} SHTextureAsset(SHTextureAsset const& rhs) - : numBytes{ rhs.numBytes }, + : compiled{ false }, + numBytes{ rhs.numBytes }, width{ rhs.width }, height{ rhs.height }, format{ rhs.format }, diff --git a/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp b/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp index b77d429d..3a5fb9ec 100644 --- a/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp +++ b/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp @@ -91,8 +91,8 @@ namespace SHADE } } - result.header.vertexCount = result.vertexPosition.size(); - result.header.indexCount = result.indices.size(); + result.header.vertexCount = static_cast(result.vertexPosition.size()); + result.header.indexCount = static_cast(result.indices.size()); result.header.meshName = mesh.mName.C_Str(); return result; diff --git a/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp b/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp index 1047cdc6..47501d42 100644 --- a/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp +++ b/SHADE_Engine/src/Assets/Libraries/SHTextureLoader.cpp @@ -83,10 +83,10 @@ namespace SHADE std::vector mipOff(file.GetMipCount()); - for (auto i{0}; i < file.GetMipCount(); ++i) + for (size_t i{0}; i < file.GetMipCount(); ++i) { - mipOff[i] = totalBytes; - totalBytes += file.GetImageData(i, 0)->m_memSlicePitch; + mipOff[i] = static_cast(totalBytes); + totalBytes += file.GetImageData(static_cast(i), 0)->m_memSlicePitch; } SHTexture::PixelChannel* pixel = new SHTexture::PixelChannel[totalBytes]; @@ -94,7 +94,7 @@ namespace SHADE //pixel = std::move(reinterpret_cast(file.GetDDSData())); asset.compiled = false; - asset.numBytes = totalBytes; + asset.numBytes = static_cast(totalBytes); asset.width = file.GetWidth(); asset.height = file.GetHeight(); asset.format = ddsLoaderToVkFormat(file.GetFormat(), true); diff --git a/SHADE_Engine/src/Assets/SHAssetManager.cpp b/SHADE_Engine/src/Assets/SHAssetManager.cpp index 989cd2ad..430b8c79 100644 --- a/SHADE_Engine/src/Assets/SHAssetManager.cpp +++ b/SHADE_Engine/src/Assets/SHAssetManager.cpp @@ -72,12 +72,13 @@ namespace SHADE AssetType type = SHAssetMetaHandler::GetTypeFromExtension(path.extension().string().c_str()); std::string folder; - switch (type) - { - default: - //TODO:ASSERT UNSUPPORTED FILE TYPE - return std::filesystem::path(); - } + //TODO Implement asset type generation + //switch (type) + //{ + //default: + // //TODO:ASSERT UNSUPPORTED FILE TYPE + // return std::filesystem::path(); + //} return std::filesystem::path(ASSET_ROOT + folder + path.filename().string()); } @@ -108,12 +109,13 @@ namespace SHADE meta.type = type; std::string folder; - switch (type) - { - default: - folder = ""; - break; - } + //TODO implement folder choosing + //switch (type) + //{ + //default: + // folder = ""; + // break; + //} AssetPath path{ ASSET_ROOT + folder + name + SHAssetMetaHandler::GetExtensionFromType(type) }; SHAssetMetaHandler::WriteMetaData(meta); diff --git a/SHADE_Engine/src/Assets/SHAssetMetaHandler.cpp b/SHADE_Engine/src/Assets/SHAssetMetaHandler.cpp index 35d167d2..6554a3e4 100644 --- a/SHADE_Engine/src/Assets/SHAssetMetaHandler.cpp +++ b/SHADE_Engine/src/Assets/SHAssetMetaHandler.cpp @@ -122,7 +122,7 @@ namespace SHADE break; default: - void; + break; } metaFile.close(); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.h b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.h index 660d93eb..c2eb85ec 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.h @@ -37,7 +37,7 @@ namespace SHADE class SHVkDescriptorSetLayout; class SHVkDescriptorSetGroup; class SHVkSampler; - class SHTextureAsset; + struct SHTextureAsset; /*---------------------------------------------------------------------------------*/ /* Type Definitions */