Files
OpenAssetTools/src/ObjWriting/ObjWriter.cpp
T
moandJan Laupetin 9f49e0e31c 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]>
2026-08-05 00:32:23 +02:00

62 lines
1.7 KiB
C++

#include "ObjWriter.h"
#include "Game/IW3/ObjWriterIW3.h"
#include "Game/IW4/ObjWriterIW4.h"
#include "Game/IW5/ObjWriterIW5.h"
#include "Game/QOS/ObjWriterQOS.h"
#include "Game/T4/ObjWriterT4.h"
#include "Game/T5/ObjWriterT5.h"
#include "Game/T6/ObjWriterT6.h"
#include "ObjWriting.h"
#include <cassert>
bool IObjWriter::DumpZone(AssetDumpingContext& context)
{
m_asset_dumpers.clear();
RegisterAssetDumpers(context);
if (context.ShouldTrackProgress())
{
size_t totalProgress = 0uz;
for (const auto& dumper : m_asset_dumpers)
totalProgress += dumper->GetProgressTotalCount(context);
context.SetTotalProgress(totalProgress);
}
for (const auto& dumper : m_asset_dumpers)
dumper->Dump(context);
return true;
}
void IObjWriter::RegisterAssetDumper(std::unique_ptr<IAssetDumper> dumper)
{
const auto maybeHandlingAssetType = dumper->GetHandlingAssetType();
if (maybeHandlingAssetType.has_value() && !ObjWriting::ShouldHandleAssetType(*maybeHandlingAssetType))
return;
m_asset_dumpers.emplace_back(std::move(dumper));
}
IObjWriter* IObjWriter::GetObjWriterForGame(GameId game)
{
static IObjWriter* objWriters[]{
new IW3::ObjWriter(),
new IW4::ObjWriter(),
new IW5::ObjWriter(),
new QOS::ObjWriter(),
new T4::ObjWriter(),
new T5::ObjWriter(),
new T6::ObjWriter(),
};
static_assert(std::extent_v<decltype(objWriters)> == static_cast<unsigned>(GameId::COUNT));
assert(static_cast<unsigned>(game) < static_cast<unsigned>(GameId::COUNT));
auto* result = objWriters[static_cast<unsigned>(game)];
assert(result);
return result;
}