forked from 1b-agent/opencadstudio-upstream
feat(statusbar): transparency-display toggle (TPY pill)
Add a transparency_enable uniform read by the wire shader: when the new TPY pill is off, every line is forced opaque; when on, baked entity transparency shows through. Toggling is a uniform write, no retessellate (same mechanism as the lineweight-display toggle). Pill is toggleable from the status-bar customization menu. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
28ec360255
commit
66f7d24bc9
9 files changed
+48
-3
No files matched your search
@@ -553,6 +553,9 @@ pub struct Scene {
|
||||
/// `tessellate_block`'s visibility test skips these, so they neither
|
||||
/// render nor hit-test until isolation ends.
|
||||
pub hidden: HashSet<Handle>,
|
||||
/// Whether entity transparency is honoured on screen. When false the
|
||||
/// wire shader forces every line opaque (a uniform toggle, no retessellate).
|
||||
pub transparency_display: bool,
|
||||
/// In-progress preview wires while a command is active (rubber-band + object ghosts).
|
||||
pub preview_wires: Vec<WireModel>,
|
||||
/// Committed-segment wire drawn during multi-point commands (normal colour).
|
||||
@@ -698,6 +701,7 @@ impl Scene {
|
||||
document: CadDocument::new(),
|
||||
selected: HashSet::new(),
|
||||
hidden: HashSet::new(),
|
||||
transparency_display: true,
|
||||
preview_wires: vec![],
|
||||
interim_wire: None,
|
||||
camera_generation: 0,
|
||||
|
||||
@@ -19,9 +19,13 @@ pub struct Uniforms {
|
||||
/// triangle gets a uniform shade (FlatShaded mode); 0.0 → keeps the
|
||||
/// per-vertex normal interpolation (GouraudShaded-style).
|
||||
pub flat_shade: f32,
|
||||
/// Transparency-display toggle (1.0 = honour entity transparency,
|
||||
/// 0.0 = force opaque). Read by the wire shader so the toggle does not
|
||||
/// require a retessellate.
|
||||
pub transparency_enable: f32,
|
||||
/// Pads the struct to 112 B (next multiple of 16) so wgpu's uniform
|
||||
/// alignment rules are satisfied.
|
||||
pub _pad: [f32; 3],
|
||||
pub _pad: [f32; 2],
|
||||
}
|
||||
|
||||
impl Uniforms {
|
||||
@@ -39,7 +43,8 @@ impl Uniforms {
|
||||
world_per_pixel,
|
||||
lwdisplay_enable: if lwdisplay_enable { 1.0 } else { 0.0 },
|
||||
flat_shade: 0.0,
|
||||
_pad: [0.0; 3],
|
||||
transparency_enable: 1.0,
|
||||
_pad: [0.0; 2],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -636,6 +636,7 @@ impl Scene {
|
||||
uniforms.view_proj = crop_view_proj(uniforms.view_proj, uo, vo, us, vs);
|
||||
uniforms.viewport_size = [visible_w, visible_h];
|
||||
uniforms.flat_shade = if flags.flat_shade { 1.0 } else { 0.0 };
|
||||
uniforms.transparency_enable = if self.transparency_display { 1.0 } else { 0.0 };
|
||||
|
||||
// `screen_rect` carries the *visible* sub-rectangle in normalized
|
||||
// canvas coords — that's what `Pipeline::prepare` uses to size
|
||||
|
||||
Reference in new issue
Block a user