8 releases

0.2.3 Sep 12, 2022
0.2.2 Mar 1, 2021
0.2.1 Feb 24, 2021
0.1.3 Dec 19, 2020
0.1.2 Sep 11, 2020

#1702 in Parser implementations

Download history 95/week @ 2024-07-19 196/week @ 2024-07-26 162/week @ 2024-08-02 197/week @ 2024-08-09 152/week @ 2024-08-16 174/week @ 2024-08-23 165/week @ 2024-08-30 118/week @ 2024-09-06 101/week @ 2024-09-13 180/week @ 2024-09-20 139/week @ 2024-09-27 101/week @ 2024-10-04 106/week @ 2024-10-11 113/week @ 2024-10-18 99/week @ 2024-10-25 99/week @ 2024-11-01

437 downloads per month

Apache-2.0 AND MIT

26KB
498 lines

Wavefront

crates.io crates.io

A Wavefront OBJ parser and utility crate.

[dependencies]
wavefront = "x.y.z"

Example

let model = wavefront::Obj::from_file("tests/ship.obj").unwrap();

for [a, b, c] in model.triangles() {
    // No index lookup required: wavefront handles this for you!
    println!("{:?} {:?} {:?}", a.position(), b.position(), c.position());
}

A parsec isn't a unit of time, Han

Features

  • Ergonomic API for parsing OBJs from files and readers.

  • Wrapper types that automatically perform indexing and hide the annoyances of the OBJ format if you just want to grab some triangles...

  • ...but allows you to dip into the nitty-gritty details of OBJ if you want to do that too.

  • Correct handling of complex polygons.

  • No dependencies

Roadmap

  • Materials and the MTL support.

  • Object, group, polygon, vertex and vertex attribute insertion

  • Saving

  • Arbitrary geometry support.

Why not [alternative]?

wavefront was born of a general feeling that the API of existing OBJ parsers were either unnecessarily verbose or didn't properly handle the heirarchical structure of the OBJ format. wavefront aims to couple correct handling of the format's features with a clean, terse API that allows you to jump straight to the thing you want to do: rendering your model.

License

wavefront is distributed under either of:

at the disgression of the user.

Dependencies

~1MB
~13K SLoC