Module bwm

Module bwm 

Source
Expand description

BWM/WOK binary walkmesh support. BWM/WOK binary reader and writer.

BWM is KotOR’s binary walkmesh container format. The same binary layout is used by .wok (area walkmesh), .pwk (placeable walkmesh), and .dwk (door walkmesh) resources.

This module provides lossless table-level parsing and deterministic serialization for the binary BWM V1.0 layout.

§Format Layout

+------------------------------+ 0x0000
| Header (136 bytes)           |
| "BWM " + "V1.0" +            |
| properties + counts/offsets  |
+------------------------------+ vertex_offset
| Vertices                     |
| 12 bytes * vertex_count      |
+------------------------------+ face_indices_offset
| Face indices                 |
| 12 bytes * face_count        |
+------------------------------+ materials_offset
| Face materials               |
| 4 bytes * face_count         |
+------------------------------+ normals_offset
| Face normals                 |
| 12 bytes * face_count        |
+------------------------------+ planar_distances_offset
| Planar distances             |
| 4 bytes * face_count         |
+------------------------------+ aabb_offset
| AABB nodes                   |
| 44 bytes * aabb_count        |
+------------------------------+ adjacency_offset
| Adjacency table              |
| 12 bytes * adjacency_count   |
+------------------------------+ edges_offset
| Edge transitions             |
| 8 bytes * edge_count         |
+------------------------------+ perimeters_offset
| Perimeter entries            |
| 4 bytes * perimeter_count    |
+------------------------------+

Re-exports§

pub use ascii_reader::read_bwm_ascii;
pub use ascii_reader::BwmAsciiError;
pub use ascii_writer::write_bwm_ascii;

Modules§

ascii_reader
ASCII reader. BWM ASCII reader implementation.
ascii_writer
ASCII writer. BWM ASCII writer implementation.

Structs§

Bwm
In-memory binary BWM container.
BwmAabbNode
One AABB-node row.
BwmAdjacency
One adjacency row.
BwmEdge
One edge-transition row.
BwmFace
One face row assembled from index/material/normal/distance tables.
BwmTypeCode
Lossless walkmesh-type wrapper.
BwmVec3
Three-dimensional vector value.

Enums§

BwmBinaryError
Errors produced while parsing or serializing BWM binary data.
BwmType
Known walkmesh type values.
SurfaceMaterial
Surface material IDs used in walkmeshes.

Functions§

read_bwm
Reads BWM data from a reader.
read_bwm_from_bytes
Reads BWM data from bytes.
write_bwm
Writes BWM data to a writer.
write_bwm_to_vec
Serializes BWM data to a byte vector.