Directors Cut Wiki : MeshFiles

DirectorsCutModdingFoundry Categories PageIndex RecentChanges RecentlyCommented Login/Register
Trail: MaterialList Matrix34 MeshFiles

These are the data files that hold all information about the 3D Data the game uses to draw everything, from actors to props to sets.

Technical File Info

//--------------------------------------
//--- 010 Editor v2.1.3 Binary Template
//
// File:  LH The Movies Mesh file format (.msh)
// Author: Glen Rickey (Adapted wholly from Rob Ashton & Mark Andrews work)
// Revision: 0.01
// Purpose: To parse msh files, for the purpose of troubleshooting
//--------------------------------------
#include "VecMatrix.bt"
#include "CompressedU16.bt"
struct TMMesh 
{
	struct Head 
	{
	int32	Magic;
	int32	TextureCount;
	int32	MaterialCount;
	int32 	SubMeshCount;

	ubyte	ContainsSkeleton;
	ubyte	ContainsStaticAnimated;
	ubyte	CountLocations;
	ubyte	ContainsSelection;
	ubyte	ContainsOutLine;

	struct {
		
		ubyte	RESERVED		: 1;
		ubyte	ContainsFootprint	: 1;
		ubyte	ContainsPhysic		: 1;
		ubyte	RemoveHeadFromCostume	: 1;
		ubyte	RemoveHairFromCostume	: 1;
		ubyte	IsAutoAnimated		: 1;
		ubyte	ReplaceDummyTexByFace	: 1;
		ubyte	ContainsConvexHull	: 1;
		} Flags1;

	struct {	
		ubyte	ContainsFootprint2	: 1;
		ubyte	ContainsShapes		: 1;
		ubyte	ContainsAntiPhysic	: 1;
		ubyte	ContainsShadow		: 1;
		ubyte	ContainsCollision	: 1;
		ubyte	ContainsBlue		: 1;
		ubyte	ContainsChildMesh	: 1;
		ubyte	ContainsRooms		: 1;
		} Flags2;

	struct {
		ubyte	ContainsNameSubMeshes	: 1;
		} Flags3;

	if (Flags2.ContainsShapes>0)
		{
		int	CountShapes;
		}

	if (Flags2.ContainsChildMesh>0)
		{	
		int	CountChildMesh;
		}

	if (Flags2.ContainsRooms>0)
		{
		int	CountRooms;
		}

	} head;

struct
{
	struct Texture
		{
		char	TextureName[32];
		} Textures[head.TextureCount] <optimize=false>;
} TextureList;

struct
{
	struct Materials
		{
		ubyte	IdxTexDiffuse;
		ubyte	IdxTexShinny;
		ubyte	IdxTexLightMap;
		ubyte	IdxTexSpecular;

		struct {
			ubyte	DoubleSided			: 1;
			ubyte	CastShadowOnFloorWithTexture	: 1;
			ubyte	IsSeparateDiffuseAndAlpha	: 1;
			} Flags0;
		

		ubyte 	WrapU;
		ubyte	WrapV;
		ubyte	IsAlphaTextured;

		ubyte	IsAlphaTestEnable;
		ubyte	IsGlass;
		ubyte	IsWater;
		ubyte	IsDeadWater;

		ubyte	IsAlphaVertex;
		ubyte	AlphaEnvMap;

		struct {
			ubyte	IsInvisible			: 1;
			ubyte	IsNotZWrite			: 1;
			ubyte	ContainsUV			: 1;
			ubyte	IsSelfIluminated		: 1;
			ubyte	DontCastShadowOnFloor		: 1;
			ubyte	DontDelayDrawIfTransparent	: 1;
			ubyte	NeedTriangleSorting		: 1;
			ubyte	IsAdditive			: 1;
			} Flags1;
	
		ubyte	ALIGN;

		#include "ColorRGBA.bt"
		color	Diffuse;

		if (Flags1.ContainsUV)
			{

				ubyte	SpeedU;
				ubyte	SpeedV;
				ubyte	SpeedRotUV;
				ubyte	ALIGN2;
			}
	} MaterialList[head.MaterialCount] <optimize=false>;

} MaterialList;	

// ==========LOW POLY MESH DEF ==========================
struct LowPolyMesh
		{
		struct LowPolyMeshHeader
			{
			uint16	CountVertices;
			uint16	TypeLandscapeTexture;
			uint16	CountTriangle;
			uint16	ALIGN;

			} LPMHead;
		V3	Vertices[LPMHead.CountVertices];
		int16	Indexes[LPMHead.CountTriangle * 3];

		if ((LPMHead.CountTriangle & 1))
		{
			uint16	ALIGN;
		}	
		
		
		} ;
//======================================================

// Load any Low Poly Meshes
if ( head.ContainsSelection > 0 )
	{
	LowPolyMesh	Selection;
	}

if ( head.Flags2.ContainsCollision > 0 )
	{	
	LowPolyMesh	Collision;
	}

if ( head.Flags2.ContainsShadow > 0 )
	{
	LowPolyMesh	Shadow;
	}

if ( head.Flags1.ContainsPhysic > 0 )
	{
	LowPolyMesh	Physic;
	}

if ( head.Flags2.ContainsAntiPhysic > 0 )
	{
	LowPolyMesh	AntiPhysic;
	}

if ( head.Flags1.ContainsFootprint > 0 )
	{
	LowPolyMesh	Footprint;
	}

if ( head.Flags2.ContainsFootprint2 > 0 )
	{
	LowPolyMesh	FootPrint;
	}

if ( head.Flags2.ContainsRooms > 0 )
	{
	if ( head.CountRooms > 0 )
		{
		struct Room 
			{
				char		RoomName[32];
				LowPolyMesh	Room;
			} Rooms[head.CountRooms] <optimize=false>;
		}
	}

if (head.SubMeshCount > 0 )
	{
	struct SubMesh	
		{
		ubyte	CountPrimitives;
		ubyte	REMOVED;
		struct 
			{
				ubyte	IsStaticAnimated		: 1;
				ubyte	IsLeaderForCarriableObject	: 1;
				ubyte					: 0;
			} Flags1;
		struct 
			{
				ubyte	REMOVED2			: 1;
				ubyte	REMOVED3			: 1;
				ubyte	IsLand				: 1;
				ubyte	IsHideReflection		: 1;
				ubyte	ContainsHiddenPart		: 1;
				ubyte					: 0;
			} Flags2;

		Matrix34	Pivot;

		if ( Flags2.ContainsHiddenPart > 0 )
			{
			uint16	HiddenPartOn;
			uint16	HiddenPartOff;
			}
		
		struct	Primitive
			{
				int	IndexMaterial;
				int	CountTriangle; //faces
				int	CountVertices;
				
			struct 
			{
				ubyte	IsBoned				: 1;
				ubyte	IsReflectiveFloor		: 1;
				ubyte	IsNotSupportingOutLine		: 1;
				ubyte	IsLandscapeLayer		: 1;
				ubyte	ContainsPrimitiveID		: 1;
				ubyte	IsCompressed			: 1;
				ubyte	ContainsNeckInfo		: 1;
				ubyte	IsReceivingPeopleShadow		: 1;
				ubyte					: 0;
			} Flags1;

			struct 
			{
				ubyte	IsUV2				: 1;
				ubyte	IsClockNeedle			: 2;	// 0: no, 1==short, 2==long
				ubyte	IsNonAnimatedBackdrop		: 1;
				ubyte					: 0;
			} Flags2;

				ubyte	BonePerVertex;
				ubyte	IsWebCam;

			if (Flags1.ContainsPrimitiveID > 0)
				{
				int32	ID_Indices;
				int32	ID_Vertices;
				int32	ID_Bones;
				}
			
			if (Flags1.IsCompressed > 0 )
				{
				V3	PosMin;
				V3	PosMax;
				V2	UVMin;
				V2	UVMax;
				V2	UV2Min;
				V2	UV2Max;
				}

			if (Flags1.ContainsNeckInfo > 0 )
				{
				int	CountNeckInfo;
				}

			//Triangles (faces)
				uint16	FaceIDs[CountTriangle * 3];

				if (CountTriangle & 1)
					{
					uint16	ALIGN;
					}
				struct	Vert
					{
					U16F	x;
					U16F	y;
					U16F	z;
					} Vertices [CountVertices];
				struct	Norm
					{
					U16F	x;
					U16F	y;
					U16F	z;
					} Normals [CountVertices];
				struct	UV 
					{
					U16F	x;
					U16F	y;
					} UVs [CountVertices];


				if (Flags2.IsUV2)
					{
					struct	UV2 
						{
						U16F	x;
						U16F	y;
						} UV2s [CountVertices];
					}
			// Bone Weights
				if (Flags1.IsBoned)
					{
					struct Weight
						{
						float	weightval[4];
						ubyte	BoneID[4];
						} Weights[CountVertices];
					} 
					
			// Neck Data
				if (Flags1.ContainsNeckInfo > 0)
					{
					if (CountNeckInfo > 0)
						{
						struct 
							{
							int	Index;
							int	Position;
							} NeckInfo [CountNeckInfo];
						}
					}
			} Primitives[CountPrimitives] <optimize=false>;

		} SubMeshes[head.SubMeshCount] <optimize=false>;

	}

// Bones
if (head.ContainsSkeleton > 0)
	{

	struct 
	{
		int	CheckSum;
		int	CountBones;

		struct Bone
		{
			char		BoneName[32];
			int		IndexFather;
			Matrix34	Pose;
		} Bones[CountBones];
	} Skeleton;

	}
/*
// Static Anims ?
if (head.ContainsStaticAnimated > 0)
	{
	struct StaticAnimatedHeader
		{
		char Name[32];


		struct {
				ubyte	IsCarriable			: 1;
				ubyte  	ContainsScale			: 1;
				ubyte	IndexLikeMe			: 4;
				ubyte	IsMoreThanOneLikeMe		: 1;
			} Flags1;

		ubyte	IndexSkeleton;	//	valid for carriable object only
		uint16	ALIGN;
		if (Flags1.ContainsScale > 0 )
			{
			float	Scale;	
			}
		} StaticAnim;
	}
*/
// Submesh Names (Groups)
if (head.Flags3.ContainsNameSubMeshes > 0 | head.ContainsStaticAnimated > 0)
	{
		struct
		{
			char	GroupName[32];
		} Groups[head.SubMeshCount];
	}

// Locations ?
if (head.CountLocations > 0)
	{
	struct 
		{
		char		Name[32];
		Matrix34	Pos3D;
		
		} Locations[head.CountLocations];
	}

// Convex Hull ?
if (head.Flags1.ContainsConvexHull > 0 )
	{
	struct 
		{
			int	Size;
			int16	Count1;
			int16	Count2;
			U16F	flt[4];
			float	Pos[6];
			struct t1
				{
				U16F	x;
				U16F	y;
				} thing [Count1];
			struct t2
			{
			int16	Count3;
			int16	Count4;
			float	fl[4];
			U16F	Iflt[2];
			float	fl1[Count3 * 3];
			} thing2[Count1 + 1] <optimize=false>;

		} ConvexHull;
	}

if (head.Flags2.ContainsShapes > 0)
	{
	struct
		{
			int		Unknown;
			Matrix34	PosMatrix;
			V3		Pos;
		} Shapes [head.CountShapes];
	}
} MshFile;
 Comments [Hide comments/form]
Valid XHTML 1.0 Transitional Valid CSS Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0171 seconds