diff --git a/Runtime/Graphics/CMetroidModelInstance.cpp b/Runtime/Graphics/CMetroidModelInstance.cpp index e615b43b7..c4eb70ff9 100644 --- a/Runtime/Graphics/CMetroidModelInstance.cpp +++ b/Runtime/Graphics/CMetroidModelInstance.cpp @@ -14,7 +14,7 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair modelHead : x4c_materialData(materialData), x50_surfaces(std::move(surfaces)) { { CMemoryInStream stream{modelHeader.first, modelHeader.second}; - x0_visorFlags = stream.Get(); + x0_visorFlags = stream.ReadUint32(); x4_worldXf = stream.Get(); x34_worldAABB = stream.Get(); } @@ -30,16 +30,17 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair modelHead u32 numNormals = normals.second / 6; CMemoryInStream stream{normals.first, normals.second}; for (u32 i = 0; i < numNormals; ++i) { - x64_normals.emplace_back(static_cast(stream.ReadShort()) / 16384.f, - static_cast(stream.ReadShort()) / 16384.f, - static_cast(stream.ReadShort()) / 16384.f); + const auto x = static_cast(stream.ReadInt16()) / 16384.f; + const auto y = static_cast(stream.ReadInt16()) / 16384.f; + const auto z = static_cast(stream.ReadInt16()) / 16384.f; + x64_normals.emplace_back(x, y, z); } } { u32 numColors = colors.second / 4; CMemoryInStream stream{colors.first, colors.second}; for (u32 i = 0; i < numColors; ++i) { - x68_colors.emplace_back(zeus::CColor(stream.ReadUint32())); + x68_colors.emplace_back(stream.ReadUint32()); } } { @@ -53,8 +54,9 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair modelHead u32 numPackedTexCoords = packedTexCoords.second / 4; CMemoryInStream stream{packedTexCoords.first, packedTexCoords.second}; for (u32 i = 0; i < numPackedTexCoords; ++i) { - x70_packedTexCoords.emplace_back(static_cast(stream.ReadShort()) / 32768.f, - static_cast(stream.ReadShort()) / 32768.f); + const auto u = static_cast(stream.ReadInt16()) / 32768.f; + const auto v = static_cast(stream.ReadInt16()) / 32768.f; + x70_packedTexCoords.emplace_back(u, v); } } } diff --git a/Runtime/Graphics/CModel.cpp b/Runtime/Graphics/CModel.cpp index 94ef64afb..1f1270bbd 100644 --- a/Runtime/Graphics/CModel.cpp +++ b/Runtime/Graphics/CModel.cpp @@ -75,9 +75,10 @@ CModel::CModel(std::unique_ptr in, u32 dataLen, IObjectStore* store) if ((flags & 2) == 0) { m_normals.emplace_back(normals.Get()); } else { - m_normals.emplace_back(static_cast(normals.ReadShort()) / 16384.f, - static_cast(normals.ReadShort()) / 16384.f, - static_cast(normals.ReadShort()) / 16384.f); + const auto x = static_cast(normals.ReadShort()) / 16384.f; + const auto y = static_cast(normals.ReadShort()) / 16384.f; + const auto z = static_cast(normals.ReadShort()) / 16384.f; + m_normals.emplace_back(x, y, z); } } @@ -97,8 +98,9 @@ CModel::CModel(std::unique_ptr in, u32 dataLen, IObjectStore* store) u32 numShortUVs = CBasics::SwapBytes(*secSizeCur) / 4; auto shortUVs = StreamFromPartData(dataCur, secSizeCur); for (u32 i = 0; i < numShortUVs; ++i) { - m_shortUVs.emplace_back(static_cast(shortUVs.ReadShort()) / 32768.f, - static_cast(shortUVs.ReadShort()) / 32768.f); + const auto u = static_cast(shortUVs.ReadShort()) / 32768.f; + const auto v = static_cast(shortUVs.ReadShort()) / 32768.f; + m_shortUVs.emplace_back(u, v); } } diff --git a/Runtime/Graphics/CSkinnedModel.hpp b/Runtime/Graphics/CSkinnedModel.hpp index 489a55855..cd2af77f8 100644 --- a/Runtime/Graphics/CSkinnedModel.hpp +++ b/Runtime/Graphics/CSkinnedModel.hpp @@ -52,6 +52,7 @@ public: CSkinnedModel(const TLockedToken& model, const TLockedToken& skinRules, const TLockedToken& layoutInfo /*, EDataOwnership ownership*/); CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules, CAssetId layoutInfo); + virtual ~CSkinnedModel() = default; TLockedToken& GetModel() { return x4_model; } const TLockedToken& GetModel() const { return x4_model; } @@ -79,6 +80,8 @@ class CSkinnedModelWithAvgNormals : public CSkinnedModel { public: CSkinnedModelWithAvgNormals(IObjectStore& store, CAssetId model, CAssetId skinRules, CAssetId layoutInfo); + ~CSkinnedModelWithAvgNormals() override = default; + TConstVectorRef GetAveragedNormals() const { return &x40_averagedNormals; } }; diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index dd490b89c..f27a7643b 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -104,7 +104,9 @@ if (DAWN_ENABLE_VULKAN) DAWN_ENABLE_VULKAN_VALIDATION_LAYERS DAWN_VK_DATA_DIR="vulkandata") endif () -if (NOT MSVC) +if (MSVC) + target_compile_options(dawn_native PRIVATE /bigobj) +else() target_compile_options(SPIRV-Tools-static PRIVATE -Wno-implicit-fallthrough) target_compile_options(SPIRV-Tools-opt PRIVATE -Wno-implicit-fallthrough) endif ()