From 254332261625537d10fca11071b137db80503dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Wed, 2 Aug 2023 01:32:01 +0200 Subject: [PATCH] simplify spheres and reuse the mesh --- examples/3d/tonemapping.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/3d/tonemapping.rs b/examples/3d/tonemapping.rs index 0bdceaae2ed00f..d2f87b079a2577 100644 --- a/examples/3d/tonemapping.rs +++ b/examples/3d/tonemapping.rs @@ -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 }; @@ -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,