input stuff

This commit is contained in:
2021-10-14 07:30:12 +02:00
parent 3d449456e6
commit 35f3d0e4a8
4 changed files with 72 additions and 51 deletions

View File

@@ -28,14 +28,14 @@ impl From<String> for LoadError {
}
#[derive(Debug)]
pub enum CPUVertex {
Vertex3D(Vertex),
VertexText(TextVertex)
pub enum CPUVertexList {
Vertex3D(Vec<Vertex>),
VertexText(Vec<TextVertex>)
}
#[derive(Debug)]
pub struct CPUMesh {
pub vertices: Vec<CPUVertex>,
pub vertices: CPUVertexList,
pub indices: Vec<u32>,
pub local_texture_index: Option<usize>,
pub local_normal_map_index: Option<usize>,
@@ -88,16 +88,18 @@ pub fn load_mesh<V>(mesh_path: &str, print_status: bool) -> Result<(Vec<CPUMesh>
reader.read_tangents(),
reader.read_joints(0),
reader.read_weights(0));
let vertices = vertices_result?.iter().map(|v| CPUVertex::Vertex3D(v.clone())).collect();
let verts = vertices_result?;
let vert_count = verts.len();
let cpu_mesh = CPUMesh {
vertices,
vertices: CPUVertexList::Vertex3D(verts),
indices: indices.into_u32().collect(),
local_texture_index: texture_index,
local_normal_map_index: normal_map_index,
name: mesh.name().map(|n| n.to_owned()),
};
if print_status {
let vert_count = cpu_mesh.vertices.len();
let index_count = cpu_mesh.indices.len();
total_vertices += vert_count;