Qmsh format - Tomash667/carpg GitHub Wiki
QMSH FILE FORMAT
HEADER
char[4] - format QMSH
byte - version (12 - 20)
byte - flags
F_TANGENTS = 1 << 0 - mesh contains tangents
F_ANIMATED = 1 << 1 - mesh is animated (bones, bone groups, animations)
F_STATIC = 1 << 2 - mesh is static (armor - use different mesh animations)
F_PHYSICS = 1 << 3 - mesh is physics (only vertex Vec3 pos)
F_SPLIT = 1 << 4 - mesh contain splits
word - n_verts
word - n_tris
word - n_subs
word - n_bones
word - n_anims
word - n_points
word - n_groups
float - radius
Box - bbox
if(version >= 20)
uint - points_offset
if(version >= 13)
{
Vec3 - cam_pos
Vec3 - cam_target
}
if(version >= 15)
Vec3 - cam_up
VERTEX DATA
byte[n_verts * vertex_size]
TRIANGLES
word[n_tris * 3]
SUBMESHES
[n_subs]
{
word - first
word - tris
word - min_ind
word - n_ind
string1 - name
string1 - diffuse texture
if(version >= 18)
{
Vec3 - specular_color
float - specular_intensity
int - specular_hardness
}
if(version >= 16)
{
if(flags & F_TANGENTS)
{
string1 - normal texture
if(have normal texture)
float - normal_factor
}
string1 - specular texture
if(have specular texture)
{
float - specular_factor
float - specular_color_factor
}
}
}
BONES
if(flags & F_ANIMATED and flags !& F_STATIC)
{
[n_bones]
{
word - bone_parent
float[12] - matrix
string1 - name
}
}
ANIMATIONS
if(flags & F_ANIMATED and flags !& F_STATIC)
{
[n_anims]
{
string1 - name
float - length
word - n_frames
[n_frames]
{
float - time
KeyframeBone[n_bones]
}
}
}
POINTS
[n_points]
{
string1 - name
Matrix - mat
word - bone
if(version == 12)
++bone;
word - type
if(version >= 14)
Vec3 - size
else
float - size
if(version >= 19)
Vec3 - rot
}
BONE GROUPS
if(flags & F_ANIMATED and flags !& F_STATIC and version >= 13)
{
string1 - name
word - parent
byte - count
byte[count] - bones
}
SPLITS
if(flags & F_SPLITS)
{
[n_splits]
{
Vec3 - pos
float - radius
BOx - box
}
}