Skip to content

Commit c402e2a

Browse files
committed
fmt and clippy
1 parent 7420ba6 commit c402e2a

File tree

1 file changed

+22
-25
lines changed
  • crates/processing_render/src/geometry

1 file changed

+22
-25
lines changed

crates/processing_render/src/geometry/mod.rs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -473,42 +473,39 @@ pub fn sphere(
473473
}
474474

475475
// Append normals with rotation applied (no translation/scale)
476-
if layout.has_attribute(builtins.normal) {
477-
if let Some(VertexAttributeValues::Float32x3(new_normals)) =
476+
if layout.has_attribute(builtins.normal)
477+
&& let Some(VertexAttributeValues::Float32x3(new_normals)) =
478478
sphere_mesh.attribute(Mesh::ATTRIBUTE_NORMAL)
479-
&& let Some(VertexAttributeValues::Float32x3(normals)) =
480-
mesh.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
481-
{
482-
let normal_matrix = transform.matrix3;
483-
for normal in new_normals {
484-
let transformed = normal_matrix
485-
.mul_vec3(Vec3::from_array(*normal))
486-
.normalize();
487-
normals.push(transformed.to_array());
488-
}
479+
&& let Some(VertexAttributeValues::Float32x3(normals)) =
480+
mesh.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
481+
{
482+
let normal_matrix = transform.matrix3;
483+
for normal in new_normals {
484+
let transformed = normal_matrix
485+
.mul_vec3(Vec3::from_array(*normal))
486+
.normalize();
487+
normals.push(transformed.to_array());
489488
}
490489
}
491490

492491
// Append colors if in layout - fill with current color
493-
if layout.has_attribute(builtins.color) {
494-
if let Some(VertexAttributeValues::Float32x4(colors)) =
492+
if layout.has_attribute(builtins.color)
493+
&& let Some(VertexAttributeValues::Float32x4(colors)) =
495494
mesh.attribute_mut(Mesh::ATTRIBUTE_COLOR)
496-
{
497-
for _ in 0..vertex_count {
498-
colors.push(geometry.current_color);
499-
}
495+
{
496+
for _ in 0..vertex_count {
497+
colors.push(geometry.current_color);
500498
}
501499
}
502500

503501
// Append UVs if in layout
504-
if layout.has_attribute(builtins.uv) {
505-
if let Some(VertexAttributeValues::Float32x2(new_uvs)) =
502+
if layout.has_attribute(builtins.uv)
503+
&& let Some(VertexAttributeValues::Float32x2(new_uvs)) =
506504
sphere_mesh.attribute(Mesh::ATTRIBUTE_UV_0)
507-
&& let Some(VertexAttributeValues::Float32x2(uvs)) =
508-
mesh.attribute_mut(Mesh::ATTRIBUTE_UV_0)
509-
{
510-
uvs.extend_from_slice(new_uvs);
511-
}
505+
&& let Some(VertexAttributeValues::Float32x2(uvs)) =
506+
mesh.attribute_mut(Mesh::ATTRIBUTE_UV_0)
507+
{
508+
uvs.extend_from_slice(new_uvs);
512509
}
513510

514511
// Append indices with offset

0 commit comments

Comments
 (0)