Skip to content

Commit

Permalink
CI style fixes 2: electric boogaloo
Browse files Browse the repository at this point in the history
  • Loading branch information
LaylBongers committed Jul 5, 2023
1 parent a47104b commit f0916b1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 41 deletions.
68 changes: 33 additions & 35 deletions crates/bevy_mikktspace/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ fn generate_tspaces<I: Geometry>(
if any || same_org_face || cos_s > thres_cos && cos_t > thres_cos {
let fresh0 = members;
members += 1;
tmp_members[fresh0] = t
tmp_members[fresh0] = t;
}
}
if members > 1 {
Expand Down Expand Up @@ -528,7 +528,7 @@ fn avg_tspace(tspace0: &TSpace, tspace1: &TSpace) -> TSpace {
ts_res.mag_s = tspace0.mag_s;
ts_res.mag_t = tspace0.mag_t;
ts_res.os = tspace0.os;
ts_res.ot = tspace0.ot
ts_res.ot = tspace0.ot;
} else {
ts_res.mag_s = 0.5f32 * (tspace0.mag_s + tspace1.mag_s);
ts_res.mag_t = 0.5f32 * (tspace0.mag_t + tspace1.mag_t);
Expand Down Expand Up @@ -592,11 +592,11 @@ fn eval_tspace<I: Geometry>(
{
let mut i: i32 = -1i32;
if vertex_indices[(3i32 * f) as usize] == vertex_representative {
i = 0i32
i = 0i32;
} else if vertex_indices[(3i32 * f + 1i32) as usize] == vertex_representative {
i = 1i32
i = 1i32;
} else if vertex_indices[(3i32 * f + 2i32) as usize] == vertex_representative {
i = 2i32
i = 2i32;
}
let index = vertex_indices[(3i32 * f + i) as usize];
let n = get_normal(geometry, index as usize);
Expand Down Expand Up @@ -642,7 +642,7 @@ fn eval_tspace<I: Geometry>(
res.ot += angle * v_ot;
res.mag_s += angle * mag_s;
res.mag_t += angle * mag_t;
angle_sum += angle
angle_sum += angle;
}
}
if v_not_zero(res.os) {
Expand All @@ -653,7 +653,7 @@ fn eval_tspace<I: Geometry>(
}
if angle_sum > 0i32 as f32 {
res.mag_s /= angle_sum;
res.mag_t /= angle_sum
res.mag_t /= angle_sum;
}
res
}
Expand Down Expand Up @@ -808,11 +808,11 @@ fn assign_recur(
let offset = 3 * my_tri_index as usize;
let mut i: i32 = -1;
if vertex_indices[offset] == vert_rep {
i = 0
i = 0;
} else if vertex_indices[offset + 1] == vert_rep {
i = 1
i = 1;
} else if vertex_indices[offset + 2] == vert_rep {
i = 2
i = 2;
}
assert!((0..3).contains(&i));

Expand Down Expand Up @@ -955,7 +955,7 @@ fn init_tri_info<I: Geometry>(
if not_zero(triangles_info[f].mag_s) && not_zero(triangles_info[f].mag_t) {
triangles_info[f]
.flags
.remove(TriangleFlags::GROUP_WITH_ANY)
.remove(TriangleFlags::GROUP_WITH_ANY);
}
}
}
Expand Down Expand Up @@ -1006,9 +1006,9 @@ fn init_tri_info<I: Geometry>(
);
}
}
t += 2
t += 2;
} else {
t += 1
t += 1;
}
}

Expand Down Expand Up @@ -1116,15 +1116,15 @@ fn build_neighbors_fast(
let unassigned_b =
triangles_info[t as usize].face_neighbors[edgenum_b as usize] == -1;
if i0_a == i0_b && i1_a == i1_b && unassigned_b {
not_found = false
not_found = false;
} else {
j += 1
j += 1;
}
}
if !not_found {
let t_0: i32 = edges[j as usize].f;
triangles_info[f_0 as usize].face_neighbors[edgenum_a as usize] = t_0;
triangles_info[t_0 as usize].face_neighbors[edgenum_b as usize] = f_0
triangles_info[t_0 as usize].face_neighbors[edgenum_b as usize] = f_0;
}
}
}
Expand Down Expand Up @@ -1247,7 +1247,7 @@ fn degen_prologue(
.contains(TriangleFlags::MARK_DEGENERATE);
if is_deg_a ^ is_deg_b {
triangles_info[t as usize].flags |= TriangleFlags::QUAD_ONE_DEGEN_TRI;
triangles_info[(t + 1i32) as usize].flags |= TriangleFlags::QUAD_ONE_DEGEN_TRI
triangles_info[(t + 1i32) as usize].flags |= TriangleFlags::QUAD_ONE_DEGEN_TRI;
}
t += 2i32;
} else {
Expand Down Expand Up @@ -1290,9 +1290,7 @@ fn degen_prologue(
for i in 0..3 {
vertex_indices.swap((t0 * 3 + i) as usize, (t1 * 3 + i) as usize);
}
let tri_info: TriangleInfo = triangles_info[t0 as usize];
triangles_info[t0 as usize] = triangles_info[t1 as usize];
triangles_info[t1 as usize] = tri_info
triangles_info.swap(t0 as usize, t1 as usize);
} else {
still_finding_good_ones = false;
}
Expand All @@ -1316,19 +1314,19 @@ fn generate_shared_vertices_index_list<I: Geometry>(
let index: i32 = vertex_indices[i];
let p = get_position(geometry, index as usize);
if min.x > p.x {
min.x = p.x
min.x = p.x;
} else if max.x < p.x {
max.x = p.x
max.x = p.x;
}
if min.y > p.y {
min.y = p.y
min.y = p.y;
} else if max.y < p.y {
max.y = p.y
max.y = p.y;
}
if min.z > p.z {
min.z = p.z
min.z = p.z;
} else if max.z < p.z {
max.z = p.z
max.z = p.z;
}
}
let dim = max - min;
Expand All @@ -1338,11 +1336,11 @@ fn generate_shared_vertices_index_list<I: Geometry>(
if dim.y > dim.x && dim.y > dim.z {
channel = 1i32;
f_min = min.y;
f_max = max.y
f_max = max.y;
} else if dim.z > dim.x {
channel = 2i32;
f_min = min.z;
f_max = max.z
f_max = max.z;
}

let mut hash_table = vec![0i32; triangles_count * 3];
Expand All @@ -1368,7 +1366,7 @@ fn generate_shared_vertices_index_list<I: Geometry>(
let mut k = 1;
while k < G_CELLS {
hash_offsets[k] = hash_offsets[k - 1] + hash_count[k - 1];
k += 1
k += 1;
}
#[allow(clippy::needless_range_loop)]
for i in 0..triangles_count * 3 {
Expand All @@ -1393,7 +1391,7 @@ fn generate_shared_vertices_index_list<I: Geometry>(
k = 1;
while k < G_CELLS {
if max_count < hash_count[k] as usize {
max_count = hash_count[k] as usize
max_count = hash_count[k] as usize;
}
k += 1;
}
Expand All @@ -1412,7 +1410,7 @@ fn generate_shared_vertices_index_list<I: Geometry>(
tmp_vert[e].vert[1] = p_2.y;
tmp_vert[e].vert[2] = p_2.z;
tmp_vert[e].index = i_0;
e += 1
e += 1;
}
merge_verts_fast(
geometry,
Expand Down Expand Up @@ -1449,7 +1447,7 @@ fn merge_verts_fast<I: Geometry>(
max[c as usize] = tmp_vert[l as usize].vert[c as usize];
}
}
l += 1
l += 1;
}
let dx = max[0usize] - min[0usize];
let dy = max[1usize] - min[1usize];
Expand Down Expand Up @@ -1489,15 +1487,15 @@ fn merge_verts_fast<I: Geometry>(
&& t.y == t2.y
&& t.z == t2.z
{
not_found = false
not_found = false;
} else {
l2 += 1
l2 += 1;
}
}
if !not_found {
vertex_indices[i as usize] = vertex_indices[i2rec as usize];
}
l += 1
l += 1;
}
} else {
let mut l: i32 = l_in;
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_mikktspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn generate_initial_vertex_indices<G: Geometry>(
vertex_indices[triangle_index * 3 + 1] = face_vertex_to_index(face_index, 1) as i32;
vertex_indices[triangle_index * 3 + 2] = face_vertex_to_index(face_index, 2) as i32;

triangle_index += 1
triangle_index += 1;
} else {
// For quads

Expand All @@ -112,9 +112,9 @@ fn generate_initial_vertex_indices<G: Geometry>(
let quad_diagonal_is_02;

if length_squared_02 < length_squared_13 {
quad_diagonal_is_02 = true
quad_diagonal_is_02 = true;
} else if length_squared_13 < length_squared_02 {
quad_diagonal_is_02 = false
quad_diagonal_is_02 = false;
} else {
let p0 = get_position(geometry, i0);
let p1 = get_position(geometry, i1);
Expand All @@ -137,7 +137,7 @@ fn generate_initial_vertex_indices<G: Geometry>(
vertex_indices[triangle_index * 3] = i0 as i32;
vertex_indices[triangle_index * 3 + 1] = i2 as i32;
vertex_indices[triangle_index * 3 + 2] = i3 as i32;
triangle_index += 1
triangle_index += 1;
} else {
triangles_info[triangle_index].vertex_indices = [0, 1, 3, 0];
vertex_indices[triangle_index * 3] = i0 as i32;
Expand All @@ -149,11 +149,11 @@ fn generate_initial_vertex_indices<G: Geometry>(
vertex_indices[triangle_index * 3] = i1 as i32;
vertex_indices[triangle_index * 3 + 1] = i2 as i32;
vertex_indices[triangle_index * 3 + 2] = i3 as i32;
triangle_index += 1
triangle_index += 1;
}
}

vertex_offset += face_vertices_count as i32
vertex_offset += face_vertices_count as i32;
}

for face_info in &mut triangles_info {
Expand Down

0 comments on commit f0916b1

Please sign in to comment.