2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-06-03 07:12:33 +00:00
Files
OpenAssetTools/src/ObjWriting/Game/IW3/ObjWriterIW3.cpp
T
mo 0c22dddd0e feat: IW3 xanim dumping/loading in CoD4 Mod Tools raw binary format (#768)
* feat: IW3 dump xanim to cod4 mod tools compatible binary

* chore: add XAnimPartType enum to game headers

* chore: use XAnimPartType in XAnimDumperIW3

* chore: extract xanim filename into XAnimCommon

* chore: prefer emplace_back over push_back

* chore: small code style improvements

* chore: use proper unsigned types for XAnimParts structs

* chore: use better understandable calculations for bitfields

* chore: use game names for parts

* chore: rename method to WriteNoteTracks

* chore: adds comments and improve clearity of what the game does

* chore: extract stream writing methods into StreamUtils

* chore: use vec3 for XAnimPartTransFrames mins and size

* chore: properly differ between XQuat and XQuat2 structs

* chore: use constants for xanim flags

* chore: use optional for delta track quats and trans

* chore: split delta track writing methods into quat and trans

* chore: add assertion for bDelta

* chore: simplify quat frame encoding indexing

* chore: simplify float to int bit casting

* chore: do not throw exception on failing to reconstruct bone tracks

* feat: add xanim loader for iw3

* fix: make sure to sort quats and trans like the game

* chore: prevent empty dumped files on bad xanim data

* chore: ensure no exception on zero frames in xanim notifies

* test: add system test for iw3 xanims

---------

Co-authored-by: Jan Laupetin <jan@laupetin.net>
2026-06-01 22:52:49 +02:00

54 lines
2.2 KiB
C++

#include "ObjWriterIW3.h"
#include "Game/IW3/Image/ImageDumperIW3.h"
#include "Game/IW3/Material/MaterialJsonDumperIW3.h"
#include "Game/IW3/Techset/TechsetDumperIW3.h"
#include "Game/IW3/XModel/XModelDumperIW3.h"
#include "LightDef/LightDefDumperIW3.h"
#include "Localize/LocalizeDumperIW3.h"
#include "Maps/MapEntsDumperIW3.h"
#include "PhysPreset/PhysPresetInfoStringDumperIW3.h"
#include "RawFile/RawFileDumperIW3.h"
#include "Sound/LoadedSoundDumperIW3.h"
#include "Sound/SndCurveDumperIW3.h"
#include "StringTable/StringTableDumperIW3.h"
#include "XAnim/XAnimDumperIW3.h"
using namespace IW3;
void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
{
RegisterAssetDumper(std::make_unique<phys_preset::InfoStringDumperIW3>());
RegisterAssetDumper(std::make_unique<xanim::DumperIW3>());
RegisterAssetDumper(std::make_unique<xmodel::DumperIW3>());
RegisterAssetDumper(std::make_unique<material::JsonDumperIW3>());
RegisterAssetDumper(std::make_unique<techset::DumperIW3>(
#ifdef TECHSET_DEBUG
true
#else
false
#endif
));
RegisterAssetDumper(std::make_unique<image::DumperIW3>());
// REGISTER_DUMPER(AssetDumpersnd_alias_list_t)
RegisterAssetDumper(std::make_unique<sound_curve::DumperIW3>());
RegisterAssetDumper(std::make_unique<sound::LoadedSoundDumperIW3>());
// REGISTER_DUMPER(AssetDumperClipMap)
// REGISTER_DUMPER(AssetDumperComWorld)
// REGISTER_DUMPER(AssetDumperGameWorldSp)
// REGISTER_DUMPER(AssetDumperGameWorldMp)
RegisterAssetDumper(std::make_unique<map_ents::DumperIW3>());
// REGISTER_DUMPER(AssetDumperGfxWorld)
RegisterAssetDumper(std::make_unique<light_def::DumperIW3>());
// REGISTER_DUMPER(AssetDumperFont_s)
// REGISTER_DUMPER(AssetDumperMenuList)
// REGISTER_DUMPER(AssetDumpermenuDef_t)
RegisterAssetDumper(std::make_unique<localize::DumperIW3>());
// REGISTER_DUMPER(AssetDumperWeapon)
// REGISTER_DUMPER(AssetDumperSndDriverGlobals)
// REGISTER_DUMPER(AssetDumperFxEffectDef)
// REGISTER_DUMPER(AssetDumperFxImpactTable)
RegisterAssetDumper(std::make_unique<raw_file::DumperIW3>());
RegisterAssetDumper(std::make_unique<string_table::DumperIW3>());
}