Wavefront obj parser for Rust. It handles both .obj
and .mtl
formats. Documentation
[dependencies.obj-rs]
git = "https://github.com/simnalamburt/obj-rs"
features = ["glium-support"]
use std::fs::File;
use std::io::BufReader;
use obj::*;
let input = BufReader::new(File::open("tests/fixtures/dome.obj").unwrap());
let dome: Obj = load_obj(input).unwrap();
// Do whatever you want
dome.vertices;
dome.indices;
This sample image is pretty good illustration of current status of obj-rs. obj-rs is currently able to load position and normal data of
obj
but not texture & material data yet.
obj-rs supports glium out of the box. See example for further details.
use glium::*;
let input = BufReader::new(File::open("rilakkuma.obj").unwrap());
let bear: Obj = load_obj(input).unwrap();
let vertex_buffer = VertexBuffer::new(&display, bear.vertices);
let index_buffer = IndexBuffer::new(&display, index::TrianglesList(bear.indices));