Skip to content

Commit

Permalink
simplify spheres and reuse the mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Aug 1, 2023
1 parent fdb022e commit 2543322
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/3d/tonemapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ fn setup_basic_scene(
}

// spheres
let sphere_mesh = meshes.add(Mesh::from(shape::UVSphere {
radius: 0.125,
..default()
}));
for i in 0..6 {
let j = i % 3;
let s_val = if i < 3 { 0.0 } else { 0.2 };
Expand Down Expand Up @@ -162,11 +166,7 @@ fn setup_basic_scene(
};
commands.spawn((
PbrBundle {
mesh: meshes.add(Mesh::from(shape::UVSphere {
radius: 0.125,
sectors: 128,
stacks: 128,
})),
mesh: sphere_mesh.clone(),
material,
transform: Transform::from_xyz(
j as f32 * 0.25 + if i < 3 { -0.15 } else { 0.15 } - 0.4,
Expand Down

0 comments on commit 2543322

Please sign in to comment.