From 2d950401dc1399091c2d75e8aa6337a123825efe Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Tue, 1 Mar 2022 20:52:31 -0800 Subject: [PATCH] Remove normals in setup for planet. They get generated later in glamor.rs as flat normals on de-duped verts. --- src/geometry.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/geometry.rs b/src/geometry.rs index 6c5445b..04cf20f 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -87,11 +87,9 @@ fn gen_planet(sphere: Icosphere) -> Mesh { [norm_azimuth, norm_inclination] }); - // TODO: use displaced points for normals by replacing raw_points with - // noise-displaced points. let noise = HybridMulti::::default(); - let raw_points = generated + let noisy_points = generated .raw_points() .iter() .map(|&p| { @@ -101,17 +99,11 @@ fn gen_planet(sphere: Icosphere) -> Mesh { }) .collect::>(); - let points = raw_points + let points = noisy_points .iter() .map(|&p| (Vec3::from_slice(&p) * sphere.radius).into()) .collect::>(); - let normals = raw_points - .iter() - .copied() - .map(Into::into) - .collect::>(); - let uvs = generated.raw_data().to_owned(); let mut indices = Vec::with_capacity(generated.indices_per_main_triangle() * 20); @@ -125,7 +117,6 @@ fn gen_planet(sphere: Icosphere) -> Mesh { let mut mesh = Mesh::new(PrimitiveTopology::TriangleList); mesh.set_indices(Some(indices)); mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, points); - mesh.set_attribute(Mesh::ATTRIBUTE_NORMAL, normals); mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs); mesh }