prefer this code

This commit is contained in:
Quaternions 2024-02-13 05:43:37 -08:00
parent ed0dcdd051
commit 048e408390

View File

@ -215,7 +215,7 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Mesh{
let mut generated_vertices=Vec::new();
let mut polygon_groups=Vec::new();
let mut graphics_groups=Vec::new();
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
let mut physics_group=IndexedPhysicsGroup::default();
let mut transforms=Vec::new();
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
for (face_id,face_description) in face_descriptions.pairs(){
@ -271,7 +271,7 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Mesh{
render:face_description.render,
groups:vec![group_id],
});
physics_groups[0].groups.push(group_id);
physics_group.groups.push(group_id);
}
Mesh{
unique_pos:generated_pos,
@ -281,7 +281,7 @@ pub fn generate_partial_unit_cube(face_descriptions:CubeFaceDescription)->Mesh{
unique_vertices:generated_vertices,
polygon_groups,
graphics_groups,
physics_groups,
physics_groups:vec![physics_group],
}
}
//don't think too hard about the copy paste because this is all going into the map tool eventually...
@ -328,7 +328,7 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Mesh
let mut generated_vertices=Vec::new();
let mut polygon_groups=Vec::new();
let mut graphics_groups=Vec::new();
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
let mut physics_group=IndexedPhysicsGroup::default();
let mut transforms=Vec::new();
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
for (face_id,face_description) in face_descriptions.pairs(){
@ -384,7 +384,7 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Mesh
render:face_description.render,
groups:vec![group_id],
});
physics_groups[0].groups.push(group_id);
physics_group.groups.push(group_id);
}
Mesh{
unique_pos:generated_pos,
@ -394,7 +394,7 @@ pub fn generate_partial_unit_wedge(face_descriptions:WedgeFaceDescription)->Mesh
unique_vertices:generated_vertices,
polygon_groups,
graphics_groups,
physics_groups,
physics_groups:vec![physics_group],
}
}
@ -439,7 +439,7 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
let mut generated_vertices=Vec::new();
let mut polygon_groups=Vec::new();
let mut graphics_groups=Vec::new();
let mut physics_groups=vec![IndexedPhysicsGroup::default()];
let mut physics_group=IndexedPhysicsGroup::default();
let mut transforms=Vec::new();
//note that on a cube every vertex is guaranteed to be unique, so there's no need to hash them against existing vertices.
for (face_id,face_description) in face_descriptions.pairs(){
@ -495,7 +495,7 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
render:face_description.render,
groups:vec![group_id],
});
physics_groups[0].groups.push(group_id);
physics_group.groups.push(group_id);
}
Mesh{
unique_pos:generated_pos,
@ -505,6 +505,6 @@ pub fn generate_partial_unit_cornerwedge(face_descriptions:CornerWedgeFaceDescri
unique_vertices:generated_vertices,
polygon_groups,
graphics_groups,
physics_groups,
physics_groups:vec![physics_group],
}
}