Update tutorial 13 to tobj 3.0.x

pull/185/head
Hugo Woodiwiss 3 years ago
parent fd7b232e6f
commit 3a4b2d56dc
No known key found for this signature in database
GPG Key ID: DA90F48139594E88

2
Cargo.lock generated

@ -2239,7 +2239,7 @@ dependencies = [
"image",
"log",
"rayon",
"tobj 2.0.2",
"tobj 3.0.1",
"wgpu",
"winit",
]

@ -13,7 +13,7 @@ futures = "0.3"
image = "0.23"
log = "0.4"
rayon = "1.4" # NEW!
tobj = "2.0"
tobj = "3.0"
wgpu = "0.8"
winit = "0.24"

@ -1,3 +1,4 @@
use tobj::LoadOptions;
use anyhow::*;
use rayon::prelude::*;
use std::ops::Range;
@ -125,7 +126,14 @@ impl Model {
layout: &wgpu::BindGroupLayout,
path: P,
) -> 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
let containing_folder = path.as_ref().parent().context("Directory has no parent")?;

Loading…
Cancel
Save