|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
use tobj::LoadOptions;
|
|
|
|
use anyhow::*;
|
|
|
|
use anyhow::*;
|
|
|
|
use rayon::prelude::*;
|
|
|
|
use rayon::prelude::*;
|
|
|
|
use std::ops::Range;
|
|
|
|
use std::ops::Range;
|
|
|
@ -125,7 +126,14 @@ impl Model {
|
|
|
|
layout: &wgpu::BindGroupLayout,
|
|
|
|
layout: &wgpu::BindGroupLayout,
|
|
|
|
path: P,
|
|
|
|
path: P,
|
|
|
|
) -> Result<Self> {
|
|
|
|
) -> Result<Self> {
|
|
|
|
let (obj_models, obj_materials) = tobj::load_obj(path.as_ref(), true)?;
|
|
|
|
let (obj_models, obj_materials) = tobj::load_obj(path.as_ref(), &LoadOptions {
|
|
|
|
|
|
|
|
triangulate: true,
|
|
|
|
|
|
|
|
single_index: true,
|
|
|
|
|
|
|
|
..Default::default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let obj_materials = obj_materials?;
|
|
|
|
|
|
|
|
|
|
|
|
// We're assuming that the texture files are stored with the obj file
|
|
|
|
// We're assuming that the texture files are stored with the obj file
|
|
|
|
let containing_folder = path.as_ref().parent().context("Directory has no parent")?;
|
|
|
|
let containing_folder = path.as_ref().parent().context("Directory has no parent")?;
|
|
|
|