feat: QOS (007: Quantum of Solace) support (#894)

* feat: QOS (007: Quantum of Solace) support

* feat: add qos localize loader

* feat: add qos stringtable loader

* chore: comment about official zones

* fix: add qos gfximage runtime fields

* chore: remove useless dev time comments

* fix: remove all `static_asserts`s from asset headers causing build fail on x64

* chore: change union ordering of qos `entryInternalData`

* chore: move qos asset type enum to qos.h

* fix: qos and t4 xsurface index buffer

* chore: implement qos MaterialInfo struct

* chore: adjust some gfxworld struct members

* chore: implement qos PhysPreset and PhysConstraints

* chore: fix and adjust slight inconsistencies with qos zone code

* chore: reorder qos ZoneCode.lua entries in order of asset type enum

* chore: remove asset types that are not actual asset types in zones

* chore: check common asset arrays with static_assert

* chore: rename qos assets

* chore: reorder qos in templates to be in alphabetical order

* chore: use function for CopyMipLevel in Dx9TextureLoader

* chore: use templates for qos MapEntsDumper

* chore: add missing braces in XModelToCommonConverter

* chore: add generic way to peek at zone data

* Qos does not use a classic ZoneHeader so code needs to be more generic

* fix: do not use raw_byte and raw_uint typedefs for qos

* fix: not being able to write clipmapmp

* chore: additional research on qos vertex property and stuff

---------

Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
mo
2026-08-05 00:32:23 +02:00
committed by GitHub
co-authored by Jan Laupetin
parent 5c0a7257fd
commit 9f49e0e31c
142 changed files with 6000 additions and 97 deletions
+29 -8
View File
@@ -2,12 +2,26 @@
#include <cstring>
namespace
{
void CopyMipLevel(image::Texture& texture, const int currentMipLevel, const int faceCount, const uint8_t*& currentDataOffset)
{
for (auto currentFace = 0; currentFace < faceCount; currentFace++)
{
const auto mipSize = texture.GetSizeOfMipLevel(currentMipLevel);
memcpy(texture.GetBufferForMipLevel(currentMipLevel, currentFace), currentDataOffset, mipSize);
currentDataOffset += mipSize;
}
}
} // namespace
namespace image
{
Dx9TextureLoader::Dx9TextureLoader()
: m_format(oat::D3DFMT_UNKNOWN),
m_type(TextureType::T_2D),
m_has_mip_maps(false),
m_mip_map_order(MipMapDataOrder::LargestToSmallest),
m_width(1u),
m_height(1u),
m_depth(1u)
@@ -43,6 +57,12 @@ namespace image
return *this;
}
Dx9TextureLoader& Dx9TextureLoader::MipMapOrder(const MipMapDataOrder mipMapOrder)
{
m_mip_map_order = mipMapOrder;
return *this;
}
Dx9TextureLoader& Dx9TextureLoader::Width(const unsigned width)
{
m_width = width;
@@ -90,16 +110,17 @@ namespace image
texture->Allocate();
const auto mipMapCount = m_has_mip_maps ? texture->GetMipMapCount() : 1;
const auto faceCount = m_type == TextureType::T_CUBE ? 6 : 1;
const void* currentDataOffset = data;
auto* currentDataOffset = static_cast<const uint8_t*>(data);
for (auto currentMipLevel = 0; currentMipLevel < mipMapCount; currentMipLevel++)
if (m_mip_map_order == MipMapDataOrder::LargestToSmallest)
{
for (auto currentFace = 0; currentFace < faceCount; currentFace++)
{
const auto mipSize = texture->GetSizeOfMipLevel(currentMipLevel);
memcpy(texture->GetBufferForMipLevel(currentMipLevel, currentFace), currentDataOffset, mipSize);
currentDataOffset = reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(currentDataOffset) + mipSize);
}
for (auto currentMipLevel = 0; currentMipLevel < mipMapCount; currentMipLevel++)
CopyMipLevel(*texture, currentMipLevel, faceCount, currentDataOffset);
}
else
{
for (auto currentMipLevel = mipMapCount - 1; currentMipLevel >= 0; currentMipLevel--)
CopyMipLevel(*texture, currentMipLevel, faceCount, currentDataOffset);
}
return texture;