-
Notifications
You must be signed in to change notification settings - Fork 21
Model Data Format
tractortractor edited this page Nov 5, 2019
·
4 revisions
This document describes the mesh and vehicle model data formats used in the original Vangers game.
This is a basic 3D mesh format.
Source variable(s) | Type | Description |
---|---|---|
version |
i32 |
Must be 8. |
num_vert |
i32 |
Number of vertices (num_vertices ). |
num_norm |
i32 |
Number of normals (num_normals ). |
num_poly |
i32 |
Number of polygons (num_polygons ). |
num_vert_total |
i32 |
number of polygons * number of vertices per polygon (3 for regular, 4 for bound) |
xmax, ymax, zmax |
[i32; 3] |
Maximum bound of coordinates. |
xmin, ymin, zmin |
[i32; 3] |
Minimum bound of coordinates. Never used. |
x_off, y_off, z_off |
[i32; 3] |
For weapons — position of attachment point. For wheels — position of wheel in main model. For debris — position relative to mechos after explosion, but all original debris don't use this feature (value 0,0,0). Value is 0,0,0 in all other original models. |
rmax |
i32 |
Maximum radius. |
phi, psi, tetta |
[i32; 3] |
Must be 83,83,83. The game checks whether those variables are equal to 83 and never uses them. |
volume |
f64 |
Volume. Affects many calculations. Must be positive. |
rcm |
[f64; 3] |
Never used. |
J |
[f64; 9] |
Inertia tensor. Affects many calculations. |
vertices |
[Vertex; num_vertices] |
Vertex array. |
normals |
[Normal; num_normals] |
Normal array. |
variable_polygons / polygons |
[Polygon; num_polygons] |
Polygon array. |
poly_ind |
[[i32; num_polygons]; 3] |
Arrays of polygon indices for sorting. Never used. Filled with 0 values in original models. |
Vertex format:
Source variable(s) | Type | Description |
---|---|---|
tf |
[f32; 3] |
Precise coordinates. Never used. In original models they are equal or very close to less precise coordinates (variable below). |
x_8, y_8, z_8 |
[i8; 3] |
Less precise coordinates. |
sort_info |
i32 |
Never used. Value is 0 in original models. |
Normal format:
Source variable(s) | Type | Description |
---|---|---|
x, y, z |
[i8; 3] |
Normal vector. Scaled to length 123. |
n_power |
u8 |
Never used. Value is 0-8 in original models. |
sort_info |
Option<i32> |
Never used. Value is 0 in original models. Doesn't exist in normals of polygons. |
Polygon format:
Source variable(s) | Type | Description |
---|---|---|
num |
i32 |
Number of vertices (num_corners ). Must be 3 in regular, 4 in bound. |
sort_info |
i32 |
Never used. Value is 0 in original models. |
color_id |
u32 |
Color index. |
color_shift |
u32 |
Never used. Value is 0 in original models. |
flat_normal |
Normal (without sort_info) |
Used in bound models while calculating collisions with landscape. |
middle_x, middle_y, middle_z |
[i8; 3] |
Middle point. Polygons of bound model with zero_reserved color index have special middle point. middle_z for all those polygons is zmin of bound C3D. middle_x is either xmax or -xmax of M3D. middle_y is either ymax or -ymax of M3D. In all other polygons middle point is average vertex. |
vert_ind, norm_ind |
[(i32, i32), num_corners] |
Vertex and normal indices per corner. |
Animated 3D model.
Source variable(s) | Type | Description |
---|---|---|
n_models |
i32 |
Model count (num_models ). |
xmax, ymax, zmax |
[i32; 3] |
Maximum bound of coordinates. In original models equal to xmax, ymax, zmax of first C3D model. |
rmax |
i32 |
Maximum radius of all models. |
body_color_offset, body_color_shift |
(i32, i32) |
Determines color of body material. Possible offset values: 0-255. Possible shift values: 0-7. |
models |
[C3D; num_models] |
Models. |
The vehicles ("mechoses") format, containing multiple meshes (for the body and wheels) as well as some meta-data.
Source variable(s) | Type | Description |
---|---|---|
model |
C3D |
Body model. |
xmax, ymax, zmax |
[i32; 3] |
Maximum bound of coordinates. In original models equal to xmax, ymax, zmax of body C3D model (variable above). |
rmax |
i32 |
Maximum radius of all models. |
n_wheels |
i32 |
Number of wheels (num_wheels ). |
n_debris |
i32 |
Number of debris (num_debris ). |
body_color_offset, body_color_shift |
(i32, i32) |
Determines color of body material. Possible offset values: 0-255. Possible shift values: 0-7. |
wheels |
[Wheel, num_wheels] |
Wheels. |
debris, bound_debris |
[Debris, num_debris] |
Debris models. |
bound |
C3D |
Physical bound. |
slots_existence |
i32 |
Bitmask. Only rightmost 3 bits are important. Each bit corresponds to weapon slot from right to left. Example: rightmost bits are "001". In this case weapon 1 exists, weapons 2 and 3 do not exist. |
R_slots, location_angle_of_slots |
Option<[Slot; MAX_SLOTS]> |
Slots data, where MAX_SLOTS = 3 . Exists only when slots_existence is not 0. |
Wheel format:
Source variable(s) | Type | Description |
---|---|---|
steer |
i32 |
Value is 1 if steering, 0 otherwise. |
r |
[f64; 3] |
Position of wheel in main model. |
width |
i32 |
Wheel width. max x - min x
|
radius |
i32 |
Wheel height divided by 2. (max y - min y) / 2
|
bound_index |
i32 |
Never used. Value is 0 in original models. |
model |
Option<C3D> |
Wheel model. Exists only when steer is not 0. |
Debris format:
Source variable(s) | Type | Description |
---|---|---|
model |
C3D |
Debris model. |
model |
C3D |
Debris physical bound. |
Slot format:
Source variable(s) | Type | Description |
---|---|---|
R_slots |
[i32; 3] |
Location of slot. |
location_angle_of_slots |
i32 |
Rotation angle by y-axis in special unit of measurement. angle in radians * 2048 / Pi
|