Skip to content

Commit ba34b75

Browse files
committed
update tobj
1 parent 16c0fd0 commit ba34b75

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include = ["reference.brs"]
1010

1111
[dependencies]
1212
brickadia = "0.1.14"
13-
tobj = "2.0"
13+
tobj = "3.2.5"
1414
cgmath = "0.17"
1515
image = "0.23"
1616
uuid = "0.7"

src/main.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use eframe::{egui, egui::*, epi::App, run_native, NativeOptions};
1616
use gui::bool_color;
1717
use rfd::FileDialog;
1818
use simplify::*;
19+
use tobj::LoadOptions;
1920
use std::{
2021
env, fs::File, ops::RangeInclusive, path::Path, path::PathBuf, sync::mpsc,
2122
sync::mpsc::Receiver, thread,
@@ -325,7 +326,13 @@ fn generate_octree(opt: &Obj2Brs) -> Result<octree::VoxelTree<Vector4<u8>>, Stri
325326
}
326327

327328
println!("Importing model...");
328-
let (mut models, materials) = match tobj::load_obj(&opt.input_file_path, true) {
329+
let load_options = LoadOptions {
330+
triangulate: true,
331+
ignore_lines: true,
332+
ignore_points: true,
333+
..Default::default()
334+
};
335+
let (mut models, materials) = match tobj::load_obj(&opt.input_file_path, &load_options) {
329336
Err(e) => {
330337
return Err(format!(
331338
"Error encountered when loading obj file: {}",
@@ -337,7 +344,7 @@ fn generate_octree(opt: &Obj2Brs) -> Result<octree::VoxelTree<Vector4<u8>>, Stri
337344

338345
println!("Loading materials...");
339346
let mut material_images = Vec::<image::RgbaImage>::new();
340-
for material in materials {
347+
for material in materials.unwrap() {
341348
if material.diffuse_texture == "" {
342349
println!(
343350
"\tMaterial {} does not have an associated diffuse texture",

0 commit comments

Comments
 (0)