sourcenav

Crates.iosourcenav
lib.rssourcenav
version0.3.0
created_at2020-04-30 22:30:26.421024+00
updated_at2025-05-30 19:30:49.052491+00
descriptionParsing of SourceEngine .nav files
homepage
repositoryhttps://codeberg.org/icewind/sourcenav
max_upload_size
id235970
size1,189,395
Robin Appelman (icewind1991)

documentation

https://docs.rs/sourcenav

README

SourceNav

parsing of SourceEngine .nav files

Usage

This library is currently focused on getting the z-height from an x/y coordinate in a map and the api is tailored towards that usage. For other usages the raw navigation areas are exposed.

use sourcenav::get_quad_tree;
use std::fs::File;
use std::io::BufReader;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut file = BufReader::new(File::open("data/pl_badwater.nav")?);
    let tree = get_quad_tree(&mut file)?;

    assert_eq!(Some(220.83125),  tree.find_best_height(320.0, -1030.0, 0.0));

    Ok(())
}

Credits and Licence

This library is largely based on gonav, a parser for .nav files written in Go and is licenced under AGPL-3.0.

Commit count: 0

cargo fmt