Use new loader scheme in imposters example
@@ -14,10 +14,16 @@ fn main() {
let mut camera = Camera::new_perspective(&gl, vec3(180.0, 40.0, 70.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0),
degrees(45.0), width as f32 / height as f32, 0.1, 10000.0);
+ let mut loader = Loader::new();
+ loader.start_loading("./examples/assets/models/leaves1.3d");
+ loader.start_loading("./examples/assets/models/tree1.3d");
+ loader.wait_all(move |loaded| {
+ let leaves_cpu_mesh = ThreeD::parse(loaded.get("./examples/assets/models/leaves1.3d").unwrap()).unwrap();
+ let tree_cpu_mesh = ThreeD::parse(loaded.get("./examples/assets/models/tree1.3d").unwrap()).unwrap();
+ loaded.clear();
+
// Tree
- let leaves_cpu_mesh = CPUMesh::from_bytes(include_bytes!("../assets/models/leaves1.3d")).unwrap();
let mut leaves_mesh = Mesh::from_cpu_mesh(&gl, &leaves_cpu_mesh).unwrap();
- let tree_cpu_mesh = CPUMesh::from_bytes(include_bytes!("../assets/models/tree1.3d")).unwrap();
let mut tree_mesh = Mesh::from_cpu_mesh(&gl, &tree_cpu_mesh).unwrap();
tree_mesh.color = vec3(0.5, 0.2, 0.2);
tree_mesh.specular_intensity = 0.0;
@@ -120,4 +126,6 @@ fn main() {
}
}).unwrap();
+ });
+
}
\ No newline at end of file
