Mesher: sort solid quads in the meshing workers, not in Mesher::mesh
Mesher::mesh keeps model order, which the leaf-culling test pairs with the baked faces; the section and tile workers sort what they upload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -689,7 +689,7 @@ impl Lod {
|
||||
}
|
||||
let finer = finer.remove(&key).unwrap_or_default();
|
||||
let input = snapshot.mesh_input(key, finer);
|
||||
let mesh = mesher.mesh(
|
||||
let mut mesh = mesher.mesh(
|
||||
input.key,
|
||||
&input.columns(),
|
||||
&covered,
|
||||
@@ -698,6 +698,7 @@ impl Lod {
|
||||
&input.neighbors,
|
||||
&input.finer,
|
||||
);
|
||||
mesh.sort_solid();
|
||||
meshes.push((input.key, mesh));
|
||||
}
|
||||
Done::Mesh {
|
||||
|
||||
@@ -67,7 +67,7 @@ impl Mesher {
|
||||
neighbors: &[Vec<EdgeColumn>; 4],
|
||||
finer: &[TileKey],
|
||||
) -> SectionMesh {
|
||||
let mut mesh = mesh_columns_with_edges(
|
||||
mesh_columns_with_edges(
|
||||
key,
|
||||
columns,
|
||||
covered,
|
||||
@@ -75,9 +75,7 @@ impl Mesher {
|
||||
neighbors,
|
||||
finer,
|
||||
|span, direction| self.material(span, direction, context),
|
||||
);
|
||||
mesh.sort_solid();
|
||||
mesh
|
||||
)
|
||||
}
|
||||
fn material(&mut self, span: &Span, direction: Direction, context: &WorkerContext) -> Material {
|
||||
let styles = *self
|
||||
|
||||
@@ -116,8 +116,9 @@ mod vertex_tests {
|
||||
}
|
||||
pub struct SectionMesh {
|
||||
pub solid: Vec<TerrainVertex>,
|
||||
/// The buckets `solid` is sorted in by the side its quads face
|
||||
/// (`sort_solid`; empty until then).
|
||||
/// The buckets `solid` is sorted in by the side its quads face: empty
|
||||
/// until `sort_solid`, which the meshing workers call; `solid` is in
|
||||
/// model order before.
|
||||
pub sides: Sides,
|
||||
pub translucent: Vec<TerrainVertex>,
|
||||
/// VisGraph: bit `a * 6 + b` is set when faces `a` and `b` (Direction
|
||||
@@ -811,7 +812,6 @@ impl Mesher<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
out.sort_solid();
|
||||
out
|
||||
}
|
||||
/// `BlockColors` tint source `index`, or `None` for an untinted (-1) layer.
|
||||
|
||||
@@ -507,7 +507,8 @@ impl Streaming {
|
||||
biomes: &context.biomes,
|
||||
visibility,
|
||||
};
|
||||
let mesh = mesher.mesh(&borrow(®ion), sy);
|
||||
let mut mesh = mesher.mesh(&borrow(®ion), sy);
|
||||
mesh.sort_solid();
|
||||
faces = Some((context.tables.clone(), mesher.visibility));
|
||||
Done::Meshed(x, sy, z, mesh, seq)
|
||||
}
|
||||
|
||||
@@ -222,7 +222,9 @@ fn relit_columns_keep_every_mesh_current() {
|
||||
biomes: &context.biomes,
|
||||
visibility: context.tables.visibility.clone(),
|
||||
};
|
||||
let fresh = mesher.mesh(&borrow(®ion), sy);
|
||||
// The workers sort solid quads by side, as uploads expect.
|
||||
let mut fresh = mesher.mesh(&borrow(®ion), sy);
|
||||
fresh.sort_solid();
|
||||
let bytes = |m: &SectionMesh| {
|
||||
[
|
||||
bytemuck::cast_slice::<_, u8>(&m.solid).to_vec(),
|
||||
|
||||
Reference in New Issue
Block a user