Remove normals in setup for planet.
They get generated later in glamor.rs as flat normals on de-duped verts.
This commit is contained in:
parent
d068ba30db
commit
2d950401dc
1 changed files with 2 additions and 11 deletions
|
@ -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::<SuperSimplex>::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::<Vec<[f32; 3]>>();
|
||||
|
||||
let points = raw_points
|
||||
let points = noisy_points
|
||||
.iter()
|
||||
.map(|&p| (Vec3::from_slice(&p) * sphere.radius).into())
|
||||
.collect::<Vec<[f32; 3]>>();
|
||||
|
||||
let normals = raw_points
|
||||
.iter()
|
||||
.copied()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<[f32; 3]>>();
|
||||
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue