mirror of https://github.com/AxioDL/metaforce.git
More Windows fixes & virtual destructor for CSkinnedModel
This commit is contained in:
parent
c01152e23a
commit
5a4b5bb38d
|
@ -14,7 +14,7 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair<const u8*, u32> modelHead
|
|||
: x4c_materialData(materialData), x50_surfaces(std::move(surfaces)) {
|
||||
{
|
||||
CMemoryInStream stream{modelHeader.first, modelHeader.second};
|
||||
x0_visorFlags = stream.Get<u32>();
|
||||
x0_visorFlags = stream.ReadUint32();
|
||||
x4_worldXf = stream.Get<zeus::CTransform>();
|
||||
x34_worldAABB = stream.Get<zeus::CAABox>();
|
||||
}
|
||||
|
@ -30,16 +30,17 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair<const u8*, u32> 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<float>(stream.ReadShort()) / 16384.f,
|
||||
static_cast<float>(stream.ReadShort()) / 16384.f,
|
||||
static_cast<float>(stream.ReadShort()) / 16384.f);
|
||||
const auto x = static_cast<float>(stream.ReadInt16()) / 16384.f;
|
||||
const auto y = static_cast<float>(stream.ReadInt16()) / 16384.f;
|
||||
const auto z = static_cast<float>(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<const u8*, u32> 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<float>(stream.ReadShort()) / 32768.f,
|
||||
static_cast<float>(stream.ReadShort()) / 32768.f);
|
||||
const auto u = static_cast<float>(stream.ReadInt16()) / 32768.f;
|
||||
const auto v = static_cast<float>(stream.ReadInt16()) / 32768.f;
|
||||
x70_packedTexCoords.emplace_back(u, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,9 +75,10 @@ CModel::CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store)
|
|||
if ((flags & 2) == 0) {
|
||||
m_normals.emplace_back(normals.Get<zeus::CVector3f>());
|
||||
} else {
|
||||
m_normals.emplace_back(static_cast<float>(normals.ReadShort()) / 16384.f,
|
||||
static_cast<float>(normals.ReadShort()) / 16384.f,
|
||||
static_cast<float>(normals.ReadShort()) / 16384.f);
|
||||
const auto x = static_cast<float>(normals.ReadShort()) / 16384.f;
|
||||
const auto y = static_cast<float>(normals.ReadShort()) / 16384.f;
|
||||
const auto z = static_cast<float>(normals.ReadShort()) / 16384.f;
|
||||
m_normals.emplace_back(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,8 +98,9 @@ CModel::CModel(std::unique_ptr<u8[]> 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<float>(shortUVs.ReadShort()) / 32768.f,
|
||||
static_cast<float>(shortUVs.ReadShort()) / 32768.f);
|
||||
const auto u = static_cast<float>(shortUVs.ReadShort()) / 32768.f;
|
||||
const auto v = static_cast<float>(shortUVs.ReadShort()) / 32768.f;
|
||||
m_shortUVs.emplace_back(u, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
CSkinnedModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules,
|
||||
const TLockedToken<CCharLayoutInfo>& layoutInfo /*, EDataOwnership ownership*/);
|
||||
CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules, CAssetId layoutInfo);
|
||||
virtual ~CSkinnedModel() = default;
|
||||
|
||||
TLockedToken<CModel>& GetModel() { return x4_model; }
|
||||
const TLockedToken<CModel>& 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; }
|
||||
};
|
||||
|
||||
|
|
|
@ -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 ()
|
||||
|
|
Loading…
Reference in New Issue