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 }