surely it needs to be a mutable reference to avoid copying the function
This commit is contained in:
parent
d50c15c187
commit
c1062449b2
30
src/mesh.rs
30
src/mesh.rs
@ -23,11 +23,11 @@ fn ingest_vertices2<
|
||||
AcquireVertexId,
|
||||
>(
|
||||
vertices:Vec<Vertex2>,
|
||||
mut acquire_pos_id:AcquirePosId,
|
||||
mut acquire_tex_id:AcquireTexId,
|
||||
mut acquire_normal_id:AcquireNormalId,
|
||||
mut acquire_color_id:AcquireColorId,
|
||||
mut acquire_vertex_id:AcquireVertexId,
|
||||
acquire_pos_id:&mut AcquirePosId,
|
||||
acquire_tex_id:&mut AcquireTexId,
|
||||
acquire_normal_id:&mut AcquireNormalId,
|
||||
acquire_color_id:&mut AcquireColorId,
|
||||
acquire_vertex_id:&mut AcquireVertexId,
|
||||
)->Result<HashMap<rbx_mesh::mesh::VertexId2,VertexId>,Error>
|
||||
where
|
||||
AcquirePosId:FnMut([f32;3])->Result<PositionId,Error>,
|
||||
@ -55,11 +55,11 @@ fn ingest_vertices_truncated2<
|
||||
AcquireVertexId,
|
||||
>(
|
||||
vertices:Vec<Vertex2Truncated>,
|
||||
mut acquire_pos_id:AcquirePosId,
|
||||
mut acquire_tex_id:AcquireTexId,
|
||||
mut acquire_normal_id:AcquireNormalId,
|
||||
acquire_pos_id:&mut AcquirePosId,
|
||||
acquire_tex_id:&mut AcquireTexId,
|
||||
acquire_normal_id:&mut AcquireNormalId,
|
||||
static_color_id:ColorId,//pick one color and fill everything with it
|
||||
mut acquire_vertex_id:AcquireVertexId,
|
||||
acquire_vertex_id:&mut AcquireVertexId,
|
||||
)->Result<HashMap<rbx_mesh::mesh::VertexId2,VertexId>,Error>
|
||||
where
|
||||
AcquirePosId:FnMut([f32;3])->Result<PositionId,Error>,
|
||||
@ -150,25 +150,25 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<model::Me
|
||||
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
||||
//pick white and make all the vertices white
|
||||
let color_id=acquire_color_id([1.0f32;4]);
|
||||
ingest_vertices_truncated2(mesh.vertices_truncated,acquire_pos_id,acquire_tex_id,acquire_normal_id,color_id,acquire_vertex_id)?
|
||||
ingest_vertices_truncated2(mesh.vertices_truncated,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,color_id,&mut acquire_vertex_id)?
|
||||
},
|
||||
rbx_mesh::mesh::SizeOfVertex2::Full=>ingest_vertices2(mesh.vertices,acquire_pos_id,acquire_tex_id,acquire_normal_id,acquire_color_id,acquire_vertex_id)?,
|
||||
rbx_mesh::mesh::SizeOfVertex2::Full=>ingest_vertices2(mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id)?,
|
||||
};
|
||||
},
|
||||
rbx_mesh::mesh::VersionedMesh::Version3(mesh)=>{
|
||||
let vertex_id_map=match mesh.header.sizeof_vertex{
|
||||
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
||||
let color_id=acquire_color_id([1.0f32;4]);
|
||||
ingest_vertices_truncated2(mesh.vertices_truncated,acquire_pos_id,acquire_tex_id,acquire_normal_id,color_id,acquire_vertex_id)?
|
||||
ingest_vertices_truncated2(mesh.vertices_truncated,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,color_id,&mut acquire_vertex_id)?
|
||||
},
|
||||
rbx_mesh::mesh::SizeOfVertex2::Full=>ingest_vertices2(mesh.vertices,acquire_pos_id,acquire_tex_id,acquire_normal_id,acquire_color_id,acquire_vertex_id)?,
|
||||
rbx_mesh::mesh::SizeOfVertex2::Full=>ingest_vertices2(mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id)?,
|
||||
};
|
||||
},
|
||||
rbx_mesh::mesh::VersionedMesh::Version4(mesh)=>{
|
||||
let vertex_id_map=ingest_vertices2(mesh.vertices,acquire_pos_id,acquire_tex_id,acquire_normal_id,acquire_color_id,acquire_vertex_id)?;
|
||||
let vertex_id_map=ingest_vertices2(mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id)?;
|
||||
},
|
||||
rbx_mesh::mesh::VersionedMesh::Version5(mesh)=>{
|
||||
let vertex_id_map=ingest_vertices2(mesh.vertices,acquire_pos_id,acquire_tex_id,acquire_normal_id,acquire_color_id,acquire_vertex_id)?;
|
||||
let vertex_id_map=ingest_vertices2(mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id)?;
|
||||
},
|
||||
}
|
||||
Ok(model::Mesh{
|
||||
|
Loading…
Reference in New Issue
Block a user