mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-10-30 18:17:15 +00:00 
			
		
		
		
	Add IW3 xmodel dumping
This commit is contained in:
		| @@ -0,0 +1,35 @@ | ||||
| #include "CommonIW3.h" | ||||
|  | ||||
| #include "Utils/Pack.h" | ||||
|  | ||||
| using namespace IW3; | ||||
|  | ||||
| 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 "IW3.h" | ||||
|  | ||||
| namespace IW3 | ||||
| { | ||||
|     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); | ||||
|     }; | ||||
| } | ||||
| @@ -134,6 +134,7 @@ namespace IW3 | ||||
|     typedef char cbrushedge_t; | ||||
|     typedef float vec2_t[2]; | ||||
|     typedef float vec3_t[3]; | ||||
|     typedef float vec4_t[4]; | ||||
|     typedef tdef_align(128) unsigned int raw_uint128; | ||||
|  | ||||
|     struct XModelPiece | ||||
| @@ -276,6 +277,12 @@ namespace IW3 | ||||
|         XAnimDeltaPart* deltaPart; | ||||
|     }; | ||||
|  | ||||
|     struct DObjSkelMat | ||||
|     { | ||||
|         float axis[3][4]; | ||||
|         float origin[4]; | ||||
|     }; | ||||
|  | ||||
|     struct DObjAnimMat | ||||
|     { | ||||
|         float quat[4]; | ||||
| @@ -492,8 +499,8 @@ namespace IW3 | ||||
|         float radius; | ||||
|         float mins[3]; | ||||
|         float maxs[3]; | ||||
|         int16_t numLods; | ||||
|         int16_t collLod; | ||||
|         uint16_t numLods; | ||||
|         uint16_t collLod; | ||||
|         XModelStreamInfo streamInfo; | ||||
|         int memUsage; | ||||
|         char flags; | ||||
| @@ -593,10 +600,10 @@ namespace IW3 | ||||
|     { | ||||
|         MaterialInfo info; | ||||
|         char stateBitsEntry[34]; | ||||
|         char textureCount; | ||||
|         char constantCount; | ||||
|         char stateBitsCount; | ||||
|         char stateFlags; | ||||
|         unsigned char textureCount; | ||||
|         unsigned char constantCount; | ||||
|         unsigned char stateBitsCount; | ||||
|         unsigned char stateFlags; | ||||
|         char cameraRegion; | ||||
|         MaterialTechniqueSet* techniqueSet; | ||||
|         MaterialTextureDef* textureTable; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user