Module qmap

Module qmap 

Source
Expand description

Quake source map data structures, parsing, and writing

§Example

use quake_util::{qmap, WriteError, TextParseError};
use qmap::Entity;

let mut map = qmap::parse(&mut source).map_err(|err| match err {
    TextParseError::Io(_) => String::from("Failed to read map"),
    l_err@TextParseError::Lexer(_) => l_err.to_string(),
    p_err@TextParseError::Parser(_) => p_err.to_string(),
})?;

let mut soldier = Entity::new();

soldier.edict.push((
    CString::new("classname").unwrap(),
    CString::new("monster_army").unwrap(),
));

soldier.edict.push((
    CString::new("origin").unwrap(),
    CString::new("128 -256 24").unwrap(),
));

map.entities.push(soldier);

map.write_to(&mut dest).map_err(|err| match err {
    WriteError::Io(e) => e.to_string(),
    WriteError::Validation(msg) => msg
})?;

Structs§

Alignment
Texture alignment properties
Entity
A collection of key/value pairs in the form of an edict and 0 or more brushes
QuakeMap
Transparent data structure representing a Quake source map
Surface
Brush face

Enums§

EntityKind
Entity type: Brush for entities with brushes, Point for entities without

Traits§

CheckWritable
Validation of entities and other items

Functions§

parse
Parses a Quake source map

Type Aliases§

Brush
Convex polyhedron
Edict
Entity dictionary
HalfSpace
A set of 3 points that determine a plane with its facing direction determined by the winding order of the points
Point
3-dimensional point used to determine the half-space a surface lies on
ValidationResult
Return type for validating writability of entities and other items
Vec2
Vec3