Remove old GltfPrimitiveAttributes struct
This commit is contained in:
parent
cb5b559bbd
commit
b908fbe74d
31
src/model.rs
31
src/model.rs
|
@ -1,7 +1,6 @@
|
||||||
use crate::handle::*;
|
use crate::handle::*;
|
||||||
use crate::mesh::*;
|
use crate::mesh::*;
|
||||||
use crate::pool::{MaterialData, TextureData};
|
use crate::pool::{MaterialData, TextureData};
|
||||||
use crate::renderer::Renderer;
|
|
||||||
use crate::scene::MeshInstance;
|
use crate::scene::MeshInstance;
|
||||||
|
|
||||||
pub trait OnLoad {
|
pub trait OnLoad {
|
||||||
|
@ -286,33 +285,3 @@ impl<'a, T: OnLoad> GltfLoader<'a, T> {
|
||||||
self.on_load.load_mesh(&MeshData { vertices, indices })
|
self.on_load.load_mesh(&MeshData { vertices, indices })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct GltfPrimitiveAttributes<'a> {
|
|
||||||
pub positions: Option<gltf::Accessor<'a>>,
|
|
||||||
pub normals: Option<gltf::Accessor<'a>>,
|
|
||||||
pub texcoords: Option<gltf::Accessor<'a>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> GltfPrimitiveAttributes<'a> {
|
|
||||||
pub fn new(primitive: gltf::Primitive<'a>) -> Self {
|
|
||||||
let mut positions = None;
|
|
||||||
let mut normals = None;
|
|
||||||
let mut texcoords = None;
|
|
||||||
|
|
||||||
for (semantic, accessor) in primitive.attributes() {
|
|
||||||
use gltf::Semantic::*;
|
|
||||||
match semantic {
|
|
||||||
Positions => positions = Some(accessor),
|
|
||||||
Normals => normals = Some(accessor),
|
|
||||||
TexCoords(0) => texcoords = Some(accessor),
|
|
||||||
_ => println!("unused glTF attribute {:?}", semantic),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Self {
|
|
||||||
positions,
|
|
||||||
normals,
|
|
||||||
texcoords,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue