Skip to content

h3mosphere/obj-rs

This branch is 16 commits behind simnalamburt/obj-rs:main.

Folders and files

NameName
Last commit message
Last commit date
Jun 18, 2023
Jun 18, 2023
Mar 30, 2023
Mar 23, 2023
Sep 9, 2020
Mar 21, 2020
Jun 6, 2023
Sep 12, 2020
Jan 10, 2017
Mar 21, 2020
Jun 6, 2023

Repository files navigation

obj-rs version

Wavefront .obj parser for Rust. It handles both .obj and .mtl formats. See Documentation for the further details.

[dependencies]
obj-rs = "0.7"
use std::fs::File;
use std::io::BufReader;
use obj::{load_obj, Obj};

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

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

Rendered image of cute Rilakkuma


Glium support

obj-rs supports glium out of the box.

[dependencies]
glium = "0.26"
obj-rs = { version = "0.6", features = ["glium"] }
use std::fs::File;
use std::io::BufReader;
use obj::{load_obj, Obj};

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

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

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

cargo run -p sampleapp


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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%