Update tutorial 12 to tobj 3.0.x

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

2
Cargo.lock generated

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

@ -12,7 +12,7 @@ env_logger = "0.8"
futures = "0.3"
image = "0.23"
log = "0.4"
tobj = "2.0"
tobj = "3.0"
wgpu = "0.8"
winit = "0.24"

@ -1,3 +1,4 @@
use tobj::LoadOptions;
use anyhow::*;
use std::ops::Range;
use std::path::Path;
@ -124,7 +125,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