Skip to content

Quad Info Struct

skzk edited this page Mar 18, 2020 · 13 revisions

The quad_info struct holds terrain data for various items.

u16 material_count

token material (repeated)

The list of materials applied on this terrain. The first entry is the main material.

u16 color_count

u32 color (repeated)

The list of colors applied to this terrain, as ARGB. By default, this list only contains white (0, FF, FF, FF).

u16 size_x: 7

The amount of terrain quad rows.

u16 size_y: 7

The amount of terrain quad columns.

The grid size of a terrain is determined by the item's length and settings and can't be set freely. The game will complain about it if you do. They are calculated as follows:

Rows

The game has a hardcoded sequence for row sizes:

1, 1, 1, 2, 6, 6, 10, 10, 10, 20, 40, 50, 50, 50, 100.

With a terrain size of 10, for example, you get 5 rows: 1 + 1 + 1 + 2 + 6.

Columns

TODO: Complete this section

u32 storage_size

Total amount of terrain quads (the above two values multiplied).

u32 data (repeated)

Now we get into the actual quad data; one uint per quad.

Data is stored as nibbles.

Nibble 0: Main material. The value is an index of the material list above.

Nibble 1: Blend material. Will be blended on top of the main material. Also an index of the material list.

Nibble 2: Blend opacity.

Nibble 3: Bottom left color.

Nibble 4: Bottom right color.

Nibble 5: Top left color.

Nibble 6: Top right color.

Nibble 7: Vegetation type override. Normal = 0; No detail vegetation = 1; No vegetation = 2.

u32 offset_count

Amount of offets created by the vertex tool.

The following three values are repeated for each:

u16 offset_pos_x

u16 offset_pos_y

Position of the quad corner in the grid.

float3 data

The overridden position of the quad, relative to its unmodified position.

u32 normal_count

Not sure what these normals do exactly, but the structure is the same as above.

u16 normal_pos_x

u16 normal_pos_y

float3 data

Clone this wiki locally