mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Add IW5 XModel dumping
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
#include "CommonIW5.h"
|
||||
|
||||
#include "Utils/Pack.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
|
||||
{
|
||||
return PackedTexCoords{ Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in)) };
|
||||
}
|
||||
|
||||
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
|
||||
{
|
||||
return PackedUnitVec{ Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in)) };
|
||||
}
|
||||
|
||||
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
|
||||
{
|
||||
return GfxColor{ Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in)) };
|
||||
}
|
||||
|
||||
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
|
||||
{
|
||||
Pack32::Vec2UnpackTexCoords(in.packed, reinterpret_cast<float*>(out));
|
||||
}
|
||||
|
||||
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
|
||||
{
|
||||
Pack32::Vec3UnpackUnitVec(in.packed, reinterpret_cast<float*>(out));
|
||||
}
|
||||
|
||||
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
|
||||
{
|
||||
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
|
||||
}
|
||||
|
@ -1,5 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "IW5.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class Common
|
||||
{
|
||||
public:
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
@ -179,6 +179,7 @@ namespace IW5
|
||||
|
||||
typedef float vec2_t[2];
|
||||
typedef float vec3_t[3];
|
||||
typedef float vec4_t[4];
|
||||
|
||||
typedef tdef_align(16) uint16_t r_index16_t;
|
||||
typedef tdef_align(16) char raw_byte16;
|
||||
@ -422,6 +423,12 @@ namespace IW5
|
||||
XAnimDeltaPart* deltaPart;
|
||||
};
|
||||
|
||||
struct DObjSkelMat
|
||||
{
|
||||
float axis[3][4];
|
||||
float origin[4];
|
||||
};
|
||||
|
||||
struct XSurfaceVertexInfo
|
||||
{
|
||||
short vertCount[4];
|
||||
@ -450,8 +457,8 @@ namespace IW5
|
||||
|
||||
union GfxColor
|
||||
{
|
||||
unsigned char array[4];
|
||||
unsigned int packed;
|
||||
unsigned char array[4];
|
||||
};
|
||||
|
||||
struct GfxQuantizedVertex
|
||||
@ -526,9 +533,9 @@ namespace IW5
|
||||
unsigned short vertCount;
|
||||
unsigned short triCount;
|
||||
char zoneHandle;
|
||||
float quantizeScale;
|
||||
uint16_t baseTriIndex;
|
||||
uint16_t baseVertIndex;
|
||||
float quantizeScale;
|
||||
r_index16_t(*triIndices)[3];
|
||||
XSurfaceVertexInfo vertInfo;
|
||||
GfxVertexUnion0 verts0;
|
||||
|
Reference in New Issue
Block a user