TrnNWN2WalkmeshPayload

Compressed walkmesh (only contained inside TRX files) (ASWM)

Constructors

this
this(ubyte[] payload)

Build packet with raw data

Members

Functions

bake
void bake(bool removeBorders)

Bake the existing walkmesh by re-creating tiles, islands, path tables, ...

buildEdges
void buildEdges()

Rebuilds edge data by going through every triangle / vertices

dump
string dump()

Dump trn data as text

findIslandsPath
uint16_t[] findIslandsPath(uint16_t fromIslandIndex, uint16_t toIslandIndex)

Calculate the fastest route between two islands. The area need to be baked, as it uses existing path tables.

removeTriangles
void removeTriangles(bool delegate(in Triangle) removeFunc)

Removes triangles from the mesh, and removes unused vertices and edges accordingly.

serialize
ubyte[] serialize()

Serialize TRN packet data

serializeUncompressed
ubyte[] serializeUncompressed()

Serialize the aswm data without compressing it. Useful for debugging raw data.

setFootstepSounds
void setFootstepSounds(TrnPacket[] trrnPackets, Triangle.Flags[string] textureFlags)

Set the footstep sound flags for each triangle of the walkmesh

setFootstepSounds
void setFootstepSounds(TrnPacket[] trrnPackets, TwoDA terrainmaterials)

ditto

setGenericMesh
void setGenericMesh(GenericMesh mesh)

Set 3d mesh geometry

toGenericMesh
GenericMesh toGenericMesh(uint16_t triangleFlags)

Converts terrain mesh data to a more generic format.

translateIndices
void translateIndices(uint32_t[] triTransTable, uint32_t[] edgeTransTable, uint32_t[] vertTransTable)

Translate triangle / edge / vertex indices stored in mesh data.

validate
void validate(bool strict)

Check if the ASWM contains legit data

Structs

Edge
struct Edge

Edge between two triangles

Header
struct Header

ASWM packet header

Island
struct Island

Tile or fraction of a tile used for pathfinding through large distances.

IslandPathNode
struct IslandPathNode
Undocumented in source.
Tile
struct Tile

Tile with its path table

Triangle
struct Triangle

Mesh Triangle + pre-calculated data + metadata

Unions

Vertex
union Vertex
Undocumented in source.

Variables

edges
Edge[] edges;
Undocumented in source.
header
Header header;

ASWM packet header

islands
Island[] islands;

Islands list. See Island

islands_path_nodes
IslandPathNode[] islands_path_nodes;
Undocumented in source.
tiles
Tile[] tiles;

Map tile list Non border tiles have header.vertices_count > 0 || header.edges_count > 0 || header.triangles_count > 0

tiles_border_size
uint32_t tiles_border_size;

Width of the map borders in tiles (8 means that 8 tiles will be removed on each side)

tiles_flags
uint32_t tiles_flags;

Always 31 in TRX files, 15 in TRN files

tiles_grid_height
uint32_t tiles_grid_height;

Number of tiles along Y axis TODO: double check height = Y

tiles_grid_width
uint32_t tiles_grid_width;

Number of tiles along X axis TODO: double check width = X

tiles_width
float tiles_width;

Width in meters of a terrain tile (most likely to be 10.0)

triangles
Triangle[] triangles;
Undocumented in source.
vertices
Vertex[] vertices;
Undocumented in source.

Meta