fix(render): draw block-contained 3D faces
This commit is contained in:
parent
c8840e2706
commit
8601fd8e4b
7 changed files with 90 additions and 60 deletions
12
src/scene/cache/block_cache.rs
vendored
12
src/scene/cache/block_cache.rs
vendored
|
|
@ -48,6 +48,7 @@ pub struct LocalWire {
|
|||
pub tangent_geoms: Vec<TangentGeom>,
|
||||
pub fill_tris: Vec<[f32; 3]>,
|
||||
pub fill_tris_low: Vec<[f32; 3]>,
|
||||
pub fill_is_3d: bool,
|
||||
/// Preserves the planar SOLID classification through block expansion so
|
||||
/// it never gets merged with unrelated annotation fills of the same style.
|
||||
pub fill_is_2d_solid: bool,
|
||||
|
|
@ -789,6 +790,7 @@ fn tessellate_sub_local(
|
|||
tangent_geoms: wire.tangent_geoms,
|
||||
fill_tris: wire.fill_tris,
|
||||
fill_tris_low: wire.fill_tris_low,
|
||||
fill_is_3d: wire.fill_is_3d,
|
||||
fill_is_2d_solid: wire.fill_is_2d_solid,
|
||||
pick_tris: wire.pick_tris,
|
||||
pick_tris_low: wire.pick_tris_low,
|
||||
|
|
@ -1359,6 +1361,7 @@ struct StyleKey {
|
|||
/// Part of the batch key so planar SOLID fills remain independently
|
||||
/// switchable after block geometry is merged by style.
|
||||
fill_is_2d_solid: bool,
|
||||
fill_is_3d: bool,
|
||||
/// Bit-cast composed block-local depth for band wires (`0` = no override).
|
||||
/// Keeps bands of different in-block draw ranks in separate batches so
|
||||
/// each finalized WireModel carries one correct `depth_override`.
|
||||
|
|
@ -1391,6 +1394,7 @@ struct BatchEntry {
|
|||
/// reconstructs `high + low`). Without it absolute f32 fills quantize to
|
||||
/// ~0.5 m and the greek-text rectangles shear.
|
||||
fill_tris_low: Vec<[f32; 3]>,
|
||||
fill_is_3d: bool,
|
||||
fill_is_2d_solid: bool,
|
||||
/// Accumulated thickness-wall pick geometry, paired high/low like
|
||||
/// `fill_tris`. Pick-only — no GPU batch reads this.
|
||||
|
|
@ -1455,6 +1459,7 @@ impl BatchEntry {
|
|||
plinegen: bool,
|
||||
_is_fill_only: bool,
|
||||
fill_is_2d_solid: bool,
|
||||
fill_is_3d: bool,
|
||||
) -> Self {
|
||||
// `is_fill_only` is part of the StyleKey hash so greek fills never
|
||||
// share a batch with regular wires (otherwise the finalized
|
||||
|
|
@ -1473,6 +1478,7 @@ impl BatchEntry {
|
|||
aci,
|
||||
plinegen,
|
||||
fill_is_2d_solid,
|
||||
fill_is_3d,
|
||||
min_x: f32::INFINITY,
|
||||
min_y: f32::INFINITY,
|
||||
max_x: f32::NEG_INFINITY,
|
||||
|
|
@ -1515,7 +1521,7 @@ impl Batches {
|
|||
taper_widths: Vec::new(),
|
||||
world_width: b.world_width,
|
||||
depth_override: b.local_depth,
|
||||
fill_is_3d: false,
|
||||
fill_is_3d: b.fill_is_3d,
|
||||
fill_is_2d_solid: b.fill_is_2d_solid,
|
||||
render_instance: None,
|
||||
pick_tris: b.pick_tris,
|
||||
|
|
@ -1566,6 +1572,7 @@ fn style_key(
|
|||
plinegen: bool,
|
||||
is_fill_only: bool,
|
||||
fill_is_2d_solid: bool,
|
||||
fill_is_3d: bool,
|
||||
local_depth: Option<f32>,
|
||||
) -> StyleKey {
|
||||
StyleKey {
|
||||
|
|
@ -1595,6 +1602,7 @@ fn style_key(
|
|||
plinegen,
|
||||
is_fill_only,
|
||||
fill_is_2d_solid,
|
||||
fill_is_3d,
|
||||
depth_bits: local_depth.map_or(0, f32::to_bits),
|
||||
}
|
||||
}
|
||||
|
|
@ -2005,6 +2013,7 @@ fn emit_wire(
|
|||
lw.plinegen,
|
||||
lw.is_fill_only,
|
||||
lw.fill_is_2d_solid,
|
||||
lw.fill_is_3d,
|
||||
local_depth,
|
||||
);
|
||||
|
||||
|
|
@ -2031,6 +2040,7 @@ fn emit_wire(
|
|||
lw.plinegen,
|
||||
lw.is_fill_only,
|
||||
lw.fill_is_2d_solid,
|
||||
lw.fill_is_3d,
|
||||
)
|
||||
});
|
||||
entry.local_depth = local_depth;
|
||||
|
|
|
|||
Loading…
Reference in a new issue