mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-05 16:27:27 +00:00
refactor: template remaining xmodel files for iw5,t5,t6
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Json/JsonCommon.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class JsonXModelLod
|
||||
{
|
||||
public:
|
||||
std::string file;
|
||||
float distance;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModelLod, file, distance);
|
||||
|
||||
class JsonXModel
|
||||
{
|
||||
public:
|
||||
std::vector<JsonXModelLod> lods;
|
||||
std::optional<int> collLod;
|
||||
std::optional<std::string> physPreset;
|
||||
std::optional<std::string> physCollmap;
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModel, lods, collLod, physPreset, physCollmap, flags);
|
||||
} // namespace IW5
|
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IW5/IW5.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
inline const char* HITLOC_NAMES[]{
|
||||
// clang-format off
|
||||
"none",
|
||||
"helmet",
|
||||
"head",
|
||||
"neck",
|
||||
"torso_upper",
|
||||
"torso_lower",
|
||||
"right_arm_upper",
|
||||
"left_arm_upper",
|
||||
"right_arm_lower",
|
||||
"left_arm_lower",
|
||||
"right_hand",
|
||||
"left_hand",
|
||||
"right_leg_upper",
|
||||
"left_leg_upper",
|
||||
"right_leg_lower",
|
||||
"left_leg_lower",
|
||||
"right_foot",
|
||||
"left_foot",
|
||||
"gun",
|
||||
"shield",
|
||||
// clang-format on
|
||||
};
|
||||
static_assert(std::extent_v<decltype(HITLOC_NAMES)> == HITLOC_COUNT);
|
||||
} // namespace IW5
|
@@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Json/JsonCommon.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace T5
|
||||
{
|
||||
class JsonXModelLod
|
||||
{
|
||||
public:
|
||||
std::string file;
|
||||
float distance;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModelLod, file, distance);
|
||||
|
||||
class JsonXModel
|
||||
{
|
||||
public:
|
||||
std::vector<JsonXModelLod> lods;
|
||||
std::optional<int> collLod;
|
||||
std::optional<std::string> physPreset;
|
||||
std::optional<std::string> physConstraints;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModel, lods, collLod, physPreset, physConstraints, flags);
|
||||
} // namespace T5
|
@@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/T5/T5.h"
|
||||
|
||||
namespace T5
|
||||
{
|
||||
inline const char* HITLOC_NAMES[]{
|
||||
// clang-format off
|
||||
"none",
|
||||
"helmet",
|
||||
"head",
|
||||
"neck",
|
||||
"torso_upper",
|
||||
"torso_lower",
|
||||
"right_arm_upper",
|
||||
"left_arm_upper",
|
||||
"right_arm_lower",
|
||||
"left_arm_lower",
|
||||
"right_hand",
|
||||
"left_hand",
|
||||
"right_leg_upper",
|
||||
"left_leg_upper",
|
||||
"right_leg_lower",
|
||||
"left_leg_lower",
|
||||
"right_foot",
|
||||
"left_foot",
|
||||
"gun",
|
||||
// clang-format on
|
||||
};
|
||||
static_assert(std::extent_v<decltype(HITLOC_NAMES)> == HITLOC_COUNT);
|
||||
} // namespace T5
|
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Json/JsonCommon.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class JsonXModelLod
|
||||
{
|
||||
public:
|
||||
std::string file;
|
||||
float distance;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModelLod, file, distance);
|
||||
|
||||
class JsonXModel
|
||||
{
|
||||
public:
|
||||
std::vector<JsonXModelLod> lods;
|
||||
std::optional<int> collLod;
|
||||
std::optional<std::string> physPreset;
|
||||
std::optional<std::string> physConstraints;
|
||||
unsigned flags;
|
||||
JsonVec3 lightingOriginOffset;
|
||||
float lightingOriginRange;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonXModel, lods, collLod, physPreset, physConstraints, flags, lightingOriginOffset, lightingOriginRange);
|
||||
} // namespace T6
|
71
src/ObjCommon/XModel/JsonXModel.h.template
Normal file
71
src/ObjCommon/XModel/JsonXModel.h.template
Normal file
@@ -0,0 +1,71 @@
|
||||
#options GAME (IW5, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/XModel/JsonXModel" + GAME + ".h"
|
||||
|
||||
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
|
||||
|
||||
#if GAME == "IW5"
|
||||
#define FEATURE_IW5
|
||||
#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);
|
||||
|
||||
class JsonXModel
|
||||
{
|
||||
public:
|
||||
std::vector<JsonXModelLod> lods;
|
||||
std::optional<int> collLod;
|
||||
std::optional<std::string> physPreset;
|
||||
#if defined(FEATURE_IW5)
|
||||
std::optional<std::string> physCollmap;
|
||||
#elif 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,
|
||||
lods,
|
||||
collLod,
|
||||
physPreset,
|
||||
#if defined(FEATURE_IW5)
|
||||
physCollmap,
|
||||
#elif defined(FEATURE_T5) || defined(FEATURE_T6)
|
||||
physConstraints,
|
||||
#endif
|
||||
#if defined(FEATURE_T6)
|
||||
lightingOriginOffset,
|
||||
lightingOriginRange,
|
||||
#endif
|
||||
flags
|
||||
);
|
||||
} // namespace GAME
|
@@ -1,17 +1,36 @@
|
||||
#options GAME (IW5, T5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/XModel/XModelConstants" + GAME + ".h"
|
||||
|
||||
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
|
||||
|
||||
#if GAME == "IW5"
|
||||
#define FEATURE_IW5
|
||||
#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 "Game/T6/T6.h"
|
||||
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
|
||||
#include GAME_HEADER
|
||||
|
||||
namespace T6
|
||||
namespace GAME
|
||||
{
|
||||
inline const char* HITLOC_NAMES[]{
|
||||
// clang-format off
|
||||
"none",
|
||||
"helmet",
|
||||
"head",
|
||||
"neck",
|
||||
"torso_upper",
|
||||
#if defined(FEATURE_T6)
|
||||
"torso_middle",
|
||||
#endif
|
||||
"torso_lower",
|
||||
"right_arm_upper",
|
||||
"left_arm_upper",
|
||||
@@ -26,8 +45,9 @@ namespace T6
|
||||
"right_foot",
|
||||
"left_foot",
|
||||
"gun",
|
||||
#if defined(FEATURE_IW5) || defined(FEATURE_T6)
|
||||
"shield",
|
||||
// clang-format on
|
||||
#endif
|
||||
};
|
||||
static_assert(std::extent_v<decltype(HITLOC_NAMES)> == HITLOC_COUNT);
|
||||
} // namespace T6
|
||||
} // namespace GAME
|
Reference in New Issue
Block a user