Skip to content

ojhunt/obj-rs

 
 

Repository files navigation

obj-rs Travis Build Status AppVeyor Build Status

Wavefront obj parser for Rust. It handles both .obj and .mtl formats.

[dependencies]
obj-rs = "0.4"
use std::fs::File;
use std::io::BufReader;
use obj::*;

let input = try!(BufReader::new(File::open("tests/fixtures/dome.obj")));
let dome: Obj = try!(load_obj(input));

// Do whatever you want
dome.vertices;
dome.indices;

img

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.


Glium support

obj-rs supports glium out of the box.

[dependencies]
glium = "0.14"
obj-rs = { version = "0.4", features = ["glium-support"] }
use std::fs::File;
use std::io::BufReader;
use obj::*;

let input = BufReader::new(try!(File::open("rilakkuma.obj")));
let obj: Obj = try!(load_obj(input));

let vb = try!(obj.vertex_buffer(&display));
let ib = try!(obj.index_buffer(&display));

Please see the working sample for the further details. Use can execute it with the command below.

cargo run --example glium --features glium-support


obj-rs is primarily distributed under the terms of both the Apache License (Version 2.0) and the MIT license. See COPYRIGHT for details.

About

:shipit: Wavefront obj parser for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%