rbx_loader: default physics for unions
This commit is contained in:
parent
28ac6b5d76
commit
61073ea192
@ -1,4 +1,5 @@
|
|||||||
use crate::rbx::RobloxPartDescription;
|
use crate::rbx::RobloxPartDescription;
|
||||||
|
use crate::primitives::{CUBE_DEFAULT_VERTICES,CUBE_DEFAULT_POLYS};
|
||||||
|
|
||||||
use rbx_mesh::mesh_data::{VertexId as MeshDataVertexId,NormalId2 as MeshDataNormalId2};
|
use rbx_mesh::mesh_data::{VertexId as MeshDataVertexId,NormalId2 as MeshDataNormalId2};
|
||||||
use rbx_mesh::physics_data::VertexId as PhysicsDataVertexId;
|
use rbx_mesh::physics_data::VertexId as PhysicsDataVertexId;
|
||||||
@ -168,8 +169,15 @@ pub fn convert(
|
|||||||
});
|
});
|
||||||
polygon_groups_normal_it.chain(physics_convex_meshes_it).collect::<Result<_,_>>()?
|
polygon_groups_normal_it.chain(physics_convex_meshes_it).collect::<Result<_,_>>()?
|
||||||
}else{
|
}else{
|
||||||
// TODO: generate a unit cube as default physics
|
// generate a unit cube as default physics
|
||||||
polygon_groups_normal_it.collect::<Result<_,_>>()?
|
let pos_list=CUBE_DEFAULT_VERTICES.map(|pos|mb.acquire_pos_id(pos));
|
||||||
|
let tex=mb.acquire_tex_id(glam::Vec2::ZERO);
|
||||||
|
let normal=mb.acquire_normal_id(vec3::ZERO);
|
||||||
|
let color=mb.acquire_color_id(glam::Vec4::ONE);
|
||||||
|
let polygon_group=PolygonGroup::PolygonList(PolygonList::new(CUBE_DEFAULT_POLYS.map(|poly|poly.map(|[pos_id,_]|
|
||||||
|
mb.acquire_vertex_id(IndexedVertex{pos:pos_list[pos_id as usize],tex,normal,color})
|
||||||
|
).to_vec()).to_vec()));
|
||||||
|
polygon_groups_normal_it.chain([Ok(polygon_group)]).collect::<Result<_,_>>()?
|
||||||
};
|
};
|
||||||
let physics_groups=(NORMAL_FACES..polygon_groups.len()).map(|id|model::IndexedPhysicsGroup{
|
let physics_groups=(NORMAL_FACES..polygon_groups.len()).map(|id|model::IndexedPhysicsGroup{
|
||||||
groups:vec![PolygonGroupId::new(id as u32)]
|
groups:vec![PolygonGroupId::new(id as u32)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user