on a better track
This commit is contained in:
parent
b14d5a7e56
commit
3784f5aacf
@ -10,7 +10,7 @@ pub mod data{
|
||||
pub fn new(bytes:Vec<u8>)->Self{
|
||||
Self(bytes)
|
||||
}
|
||||
pub fn cursor(self)->std::io::Cursor<Vec<u8>>{
|
||||
pub(crate) fn cursor(self)->std::io::Cursor<Vec<u8>>{
|
||||
std::io::Cursor::new(self.0)
|
||||
}
|
||||
}
|
||||
|
16
src/rbx.rs
16
src/rbx.rs
@ -751,16 +751,20 @@ impl PartialMap1{
|
||||
|
||||
//decode roblox meshes
|
||||
//generate mesh_id_map based on meshes that failed to load
|
||||
let (meshes,mesh_id_map):(Vec<model::Mesh>,HashMap<model::MeshId,model::MeshId>)=
|
||||
let loaded_meshes:HashMap<model::MeshId,model::Mesh>=
|
||||
meshpart_meshes.into_iter().flat_map(|(old_mesh_id,roblox_mesh_bytes)|
|
||||
Ok((old_mesh_id,crate::mesh::convert(roblox_mesh_bytes)?))
|
||||
).enumerate().map(|(new_mesh_id,(old_mesh_id,mesh))|
|
||||
(mesh,(old_mesh_id,model::MeshId::new(new_mesh_id as u32)))
|
||||
).unzip();
|
||||
match crate::mesh::convert(roblox_mesh_bytes){
|
||||
Ok(mesh)=>Some((old_mesh_id,mesh)),
|
||||
Err(e)=>{
|
||||
println!("Error converting mesh: {e:?}");
|
||||
None
|
||||
},
|
||||
}
|
||||
).collect();
|
||||
//now that the meshes are loaded, these models can be generated
|
||||
let models_owned_attributes=self.deferred_models_deferred_attributes.into_iter().map(|deferred_model_deferred_attributes|{
|
||||
let render=deferred_model_deferred_attributes.render;
|
||||
//meshes need to be cloned with a new id when they are reused with a new render_id
|
||||
//meshes need to be cloned from loaded_meshes with a new id when they are used with a new render_id
|
||||
//insert into primitive_meshes
|
||||
ModelDeferredAttributes{
|
||||
mesh:deferred_model_deferred_attributes.model.mesh,
|
||||
|
Loading…
Reference in New Issue
Block a user