Files
OpenAssetTools/src/ObjCommon/XModel/JsonXModel.h.template
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

97 lines
2.2 KiB
Plaintext

#options GAME (IW3, IW4, IW5, QOS, T4, T5, T6)
#filename "Game/" + GAME + "/XModel/JsonXModel" + GAME + ".h"
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
#if GAME == "IW3"
#define FEATURE_IW3
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"
#define FEATURE_IW5
#elif GAME == "QOS"
#define FEATURE_QOS
#elif GAME == "T4"
#define FEATURE_T4
#elif GAME == "T5"
#define FEATURE_T5
#elif GAME == "T6"
#define FEATURE_T6
#endif
// This file was templated.
// See JsonXModel.h.template.
// Do not modify, changes will be lost.
#pragma once
#include "Json/JsonCommon.h"
#include <memory>
#include <optional>
#include <string>
#include <vector>
namespace GAME
{
class JsonXModelLod
{
public:
std::string file;
float distance;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModelLod, file, distance);
enum class JsonXModelType
{
RIGID,
ANIMATED,
VIEWHANDS
};
NLOHMANN_JSON_SERIALIZE_ENUM(JsonXModelType, {
{JsonXModelType::RIGID, "rigid" },
{JsonXModelType::ANIMATED, "animated" },
{JsonXModelType::VIEWHANDS, "viewhands" }
});
class JsonXModel
{
public:
std::optional<JsonXModelType> type;
std::vector<JsonXModelLod> lods;
std::optional<std::string> rootBoneName;
std::optional<int> collLod;
std::optional<std::string> physPreset;
#if defined(FEATURE_IW4) || defined(FEATURE_IW5)
std::optional<std::string> physCollmap;
#elif defined(FEATURE_QOS) || defined(FEATURE_T4) || defined(FEATURE_T5) || defined(FEATURE_T6)
std::optional<std::string> physConstraints;
#endif
#if defined(FEATURE_T6)
JsonVec3 lightingOriginOffset;
float lightingOriginRange;
#endif
unsigned flags;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(
JsonXModel,
type,
lods,
rootBoneName,
collLod,
physPreset,
#if defined(FEATURE_IW4) || defined(FEATURE_IW5)
physCollmap,
#elif defined(FEATURE_QOS) || defined(FEATURE_T4) || defined(FEATURE_T5) || defined(FEATURE_T6)
physConstraints,
#endif
#if defined(FEATURE_T6)
lightingOriginOffset,
lightingOriginRange,
#endif
flags
);
} // namespace GAME