Mesh file format - sanity check me?

Started by
0 comments, last by monkey_32606 15 years, 2 months ago
I'm writing my own file format for meshes that I'm planning on importing into a game engine I'm working on (based on the Oolong Engine). This is the first time I've done this, however, so I'd really appreciate it if someone could take a look at how I have this planned and warn me if anything I'm planning is particularly stupid... In any case, the format (as currently written) supports the following "features": multi-part meshes. Mesh vertex data can have an arbitrary collection of vertex channel types (and should be easily extensible to support more channel types in the future, if needed) Restricted to Triangle List only, atm Armature Data Animation Data (supporting multiple "Actions") I may cut the Animation data out in favor of doing a seperate file for it (most meshes will share a common skeletal structure, and therefore should be able to share animations) The Structure of the file format is as follows:

File Header:

Name		Type	Count	Offset	Size
File ID		uint	1	0	4
NumMeshParts	uint	1	4	4
VHead Offset	uint	1	8	4
IHead Offset	uint	1	12	4
ArmHead Offset	uint	1	16	4
AnimHead Offset	uint	1	20	4

Vertex Header:
Name		Type	Count	Offset	Size
Vertex Count	uint	1	0	4
Vertex Stride	ushort	1	4	2
Num of Channels	ushort	1	6	2
VData Offset	uint	1	8	4
Channel 0 type	byte	1	12	1
Channel 1 type	byte	1	13	1
Channel 2 type	byte	1	14	1

Vertex Data:
block of interleaved vertex data, according to channels specified in Vertex Header

Channel Codes:
Channel Type IDs	Size	format code	
1	Position	12	fff	(float, float, float)
2	Normal		12	fff	(float, float, float)
3	Binormal	12	fff	(float, float, float)
4	Bitangent	12	fff	(float, float, float)
5	Color3		12	fff	(float, float, float)
6	Color4		16	ffff	(float, float, float, float)
7	UV		8	ff	(float, float)
8	Bone Weight	8	if	(int, float)


Index Header:
Name			Type	Count	Offset	Size
Meshpart Count		uint	1	0	4
Meshpart Header Offset0	uint	1	4	4
Meshpart Header Offet1	uint	1	8	4



Meshpart Header:
Name		Type	Count	Offset	Size
Name		char	16	0	16
Index		int	1	16	4
NumberTriangles	int	1	20	4
Material name	char	16	24	16
ParentBone Ind	int	1	40	4
IndexData Off.	int	1	44	4


Armature Header:
Name		Type	Count	Offset	Size
Bone Count	int	1	0	4
Root Bone Off.	int	1	4	4


Bone data format:
Name				Type	Count	Offset	Size
Name				char	16	0	16
Index				int	1	16	4
Parent Index			int	1	20	4
Rest Position (Armature Space)	float	3	24	12
Rest Rotation (Armature Space)	float	4	36	16


Animation Header:
Name		Type	Count	Offset	Size
Action Count	int	1	0	4
Action FPS	float	1	4	4
Action 1 Offset	int	1	8	4


Action Header:
Name		Type	Count	Offset	Size
Name		char	16	0	16
Index		int	1	16	4
NumBones	int	1	20	4
Duration	float	1	24	4
BoneAct0 Offset	int	1	28	4
BoneAct1 Offset	int	1	32	4


BoneAction Data:
Name		Type	Count	Offset	Size
Bone Index	int	1	0	4
Num keyframes	int	1	4	4
keyframe offset	int	1	8	4
				
				
Keyframe Data				
Frame #		int	1	0	4
Translation	float	3	4	12
Rotation	float	4	16	16



Whew... That's a lot. I *think* that's everything I need, and I'm pretty sure that's enough data to reconstruct a skinned model within the engine - but I'm not 100% sure. Does anything look particularly out of whack with this plan?
Advertisement
Yea, why?
Quote:Michael TanczosCut that shit out. You shouldn't be spying on other people.. especially your parents. If your dad wanted to look at horses having sex with transexual eskimo midgets, that's his business and not yours.

This topic is closed to new replies.

Advertisement