mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
Add Model dumping for T6
This commit is contained in:
@ -2,7 +2,11 @@
|
||||
|
||||
#include <cctype>
|
||||
|
||||
int CommonT6::Com_HashKey(const char* str, const int maxLen)
|
||||
#include "Utils/Pack.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
int Common::Com_HashKey(const char* str, const int maxLen)
|
||||
{
|
||||
if (str == nullptr)
|
||||
return 0;
|
||||
@ -19,7 +23,7 @@ int CommonT6::Com_HashKey(const char* str, const int maxLen)
|
||||
return hash ^ ((hash ^ (hash >> 10)) >> 10);
|
||||
}
|
||||
|
||||
int CommonT6::Com_HashString(const char* str)
|
||||
int Common::Com_HashString(const char* str)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
@ -35,7 +39,7 @@ int CommonT6::Com_HashString(const char* str)
|
||||
return result;
|
||||
}
|
||||
|
||||
int CommonT6::Com_HashString(const char* str, const int len)
|
||||
int Common::Com_HashString(const char* str, const int len)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
@ -52,4 +56,34 @@ int CommonT6::Com_HashString(const char* str, const int len)
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
|
||||
{
|
||||
return PackedTexCoords{ Pack32::Vec2PackTexCoords(in->v) };
|
||||
}
|
||||
|
||||
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
|
||||
{
|
||||
return PackedUnitVec{ Pack32::Vec3PackUnitVec(in->v) };
|
||||
}
|
||||
|
||||
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
|
||||
{
|
||||
return GfxColor{ Pack32::Vec4PackGfxColor(in->v) };
|
||||
}
|
||||
|
||||
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
|
||||
{
|
||||
Pack32::Vec2UnpackTexCoordsUV(in.packed, out->v);
|
||||
}
|
||||
|
||||
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
|
||||
{
|
||||
Pack32::Vec3UnpackUnitVecThirdBased(in.packed, out->v);
|
||||
}
|
||||
|
||||
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
|
||||
{
|
||||
Pack32::Vec4UnpackGfxColor(in.packed, out->v);
|
||||
}
|
@ -1,9 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
class CommonT6
|
||||
#include "T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
public:
|
||||
static int Com_HashKey(const char* str, int maxLen);
|
||||
static int Com_HashString(const char* str);
|
||||
static int Com_HashString(const char* str, int len);
|
||||
};
|
||||
class Common
|
||||
{
|
||||
public:
|
||||
static int Com_HashKey(const char* str, int maxLen);
|
||||
static int Com_HashString(const char* str);
|
||||
static int Com_HashString(const char* str, int len);
|
||||
|
||||
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
|
||||
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
|
||||
static GfxColor Vec4PackGfxColor(const vec4_t* in);
|
||||
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
|
||||
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
|
||||
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
|
||||
};
|
||||
}
|
@ -375,14 +375,16 @@ namespace T6
|
||||
void* data;
|
||||
};
|
||||
|
||||
|
||||
struct XModelPieces
|
||||
union vec2_t
|
||||
{
|
||||
const char* name;
|
||||
int numpieces;
|
||||
XModelPiece* pieces;
|
||||
};
|
||||
float v[2];
|
||||
|
||||
struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
};
|
||||
|
||||
union vec3_t
|
||||
{
|
||||
@ -396,6 +398,34 @@ namespace T6
|
||||
float v[3];
|
||||
};
|
||||
|
||||
union vec4_t
|
||||
{
|
||||
float v[4];
|
||||
|
||||
struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
};
|
||||
};
|
||||
|
||||
struct XModelPieces
|
||||
{
|
||||
const char* name;
|
||||
int numpieces;
|
||||
XModelPiece* pieces;
|
||||
};
|
||||
|
||||
struct PhysPresetInfo
|
||||
{
|
||||
float mass;
|
||||
@ -555,6 +585,11 @@ namespace T6
|
||||
XAnimDeltaPart* deltaPart;
|
||||
};
|
||||
|
||||
struct DObjSkelMat
|
||||
{
|
||||
vec4_t axis[3];
|
||||
vec4_t origin;
|
||||
};
|
||||
|
||||
struct XModelLodInfo
|
||||
{
|
||||
@ -573,8 +608,8 @@ namespace T6
|
||||
unsigned char numsurfs;
|
||||
char lodRampType;
|
||||
uint16_t* boneNames;
|
||||
char* parentList;
|
||||
int16_t (*quats)[4];
|
||||
unsigned char* parentList;
|
||||
uint16_t (*quats)[4];
|
||||
float (*trans)[4];
|
||||
char* partClassification;
|
||||
DObjAnimMat* baseMat;
|
||||
@ -588,14 +623,14 @@ namespace T6
|
||||
float radius;
|
||||
vec3_t mins;
|
||||
vec3_t maxs;
|
||||
int16_t numLods;
|
||||
int16_t collLod;
|
||||
uint16_t numLods;
|
||||
uint16_t collLod;
|
||||
float* himipInvSqRadii;
|
||||
int memUsage;
|
||||
int flags;
|
||||
bool bad;
|
||||
PhysPreset* physPreset;
|
||||
char numCollmaps;
|
||||
unsigned char numCollmaps;
|
||||
Collmap* collmaps;
|
||||
PhysConstraints* physConstraints;
|
||||
vec3_t lightingOriginOffset;
|
||||
@ -647,9 +682,9 @@ namespace T6
|
||||
{
|
||||
MaterialInfo info;
|
||||
char stateBitsEntry[36];
|
||||
char textureCount;
|
||||
char constantCount;
|
||||
char stateBitsCount;
|
||||
unsigned char textureCount;
|
||||
unsigned char constantCount;
|
||||
unsigned char stateBitsCount;
|
||||
char stateFlags;
|
||||
char cameraRegion;
|
||||
char probeMipBits;
|
||||
@ -746,6 +781,50 @@ namespace T6
|
||||
uint32_t valid : 1;
|
||||
};
|
||||
|
||||
enum TextureSemantic
|
||||
{
|
||||
TS_2D = 0x0,
|
||||
TS_FUNCTION = 0x1,
|
||||
TS_COLOR_MAP = 0x2,
|
||||
TS_UNUSED_1 = 0x3,
|
||||
TS_UNUSED_2 = 0x4,
|
||||
TS_NORMAL_MAP = 0x5,
|
||||
TS_UNUSED_3 = 0x6,
|
||||
TS_UNUSED_4 = 0x7,
|
||||
TS_SPECULAR_MAP = 0x8,
|
||||
TS_UNUSED_5 = 0x9,
|
||||
TS_OCCLUSION_MAP = 0xA,
|
||||
TS_UNUSED_6 = 0xB,
|
||||
TS_COLOR0_MAP = 0xC,
|
||||
TS_COLOR1_MAP = 0xD,
|
||||
TS_COLOR2_MAP = 0xE,
|
||||
TS_COLOR3_MAP = 0xF,
|
||||
TS_COLOR4_MAP = 0x10,
|
||||
TS_COLOR5_MAP = 0x11,
|
||||
TS_COLOR6_MAP = 0x12,
|
||||
TS_COLOR7_MAP = 0x13,
|
||||
TS_COLOR8_MAP = 0x14,
|
||||
TS_COLOR9_MAP = 0x15,
|
||||
TS_COLOR10_MAP = 0x16,
|
||||
TS_COLOR11_MAP = 0x17,
|
||||
TS_COLOR12_MAP = 0x18,
|
||||
TS_COLOR13_MAP = 0x19,
|
||||
TS_COLOR14_MAP = 0x1A,
|
||||
TS_COLOR15_MAP = 0x1B,
|
||||
TS_THROW_MAP = 0x1C,
|
||||
};
|
||||
|
||||
enum ImageCategory
|
||||
{
|
||||
IMG_CATEGORY_UNKNOWN = 0x0,
|
||||
IMG_CATEGORY_AUTO_GENERATED = 0x1,
|
||||
IMG_CATEGORY_LIGHTMAP = 0x2,
|
||||
IMG_CATEGORY_LOAD_FROM_FILE = 0x3,
|
||||
IMG_CATEGORY_RAW = 0x4,
|
||||
IMG_CATEGORY_FIRST_UNMANAGED = 0x5,
|
||||
IMG_CATEGORY_RENDERTARGET = 0x5,
|
||||
IMG_CATEGORY_TEMP = 0x6,
|
||||
};
|
||||
|
||||
struct GfxImage
|
||||
{
|
||||
@ -1027,29 +1106,6 @@ namespace T6
|
||||
int* leafRefs;
|
||||
};
|
||||
|
||||
|
||||
union vec4_t
|
||||
{
|
||||
float v[4];
|
||||
|
||||
struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct GfxWorldSun
|
||||
{
|
||||
unsigned int control;
|
||||
@ -2025,19 +2081,6 @@ namespace T6
|
||||
float vertResistDown;
|
||||
};
|
||||
|
||||
|
||||
union vec2_t
|
||||
{
|
||||
float v[2];
|
||||
|
||||
struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
enum TractionType
|
||||
{
|
||||
TRACTION_TYPE_FRONT = 0x0,
|
||||
|
Reference in New Issue
Block a user