Add editable panels and refine shell settings (#18)
* Integrate panel composition, adaptive sizing, and overflow * Add instance editing controls to panel settings * Add panel group editing and measured composition preview * Reorganize panel settings and add drag-and-drop item editing * Simplify panel settings and place inspectors beside the editor * Refine Panel & Shell settings, previews, and panel rendering * Organize settings navigation and modernize packaged panel config * Support top and bottom panels and refine shell surfaces Add edge-aware settings, previews, popup placement, notifications, margins, and corner rendering. Preserve translucency in notification and dialog controls, and tighten spacing around the clock and display-mode icon. * Add workspace styles and fix Settings text rendering * Make panel allocation independent of measurement order * Normalize panel item settings and visibility * Move shell geometry into each panel * Add independent group surfaces and finalize panel configuration * Keep panel fit checks and restoration consistent with allocation * Reject unknown panel item options and namespace metadata * Reject invalid shell startup configuration and remove old radius fields * Discover workspace application icons in a background task * Remove the panel architecture document and improve reference prose * Let panel media fill available space and improve Settings scrolling * Preserve panel labels across clipped GPU rendering * Use matching alpine lake wallpapers for light and dark modes * Fix panel accessibility and popup lifecycle Apply Reduce Transparency to panel opacity in the shell, compositor, and Settings preview. Reject unknown theme tokens before snapshot substitution and validate the current geometry fields in both consumers. Dismiss popovers and workspace tooltips after panel layout changes. Handle bar pointer exits directly and recover workspace hover after reentry without repeated motion updates. Cover the transitions with regression tests and update the wallpaper dimensions check for the bundled lake defaults. * Use tagged Ferese toolkit fixes * Fix center-only panel spacing and headless text rendering * Bundle native 4K abstract wallpapers for both appearances * Dismiss workspace tooltips before captured pointer dispatch * Verify installed JPEG wallpapers when replacing a release
This commit is contained in:
1 parent
d4c8c10b39
commit
65fcaef13f
84 files changed
+12809
-1258
No files matched your search
@@ -406,6 +406,93 @@ fn apple_shoulder_extent_never_claims_transparent_pixels_as_opaque() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires an EGL rendering device"]
|
||||
fn docked_panel_fill_covers_the_entire_attached_edge() {
|
||||
let mut renderer = renderer();
|
||||
let mut resources = RenderResources::default();
|
||||
let material = material_program_for_corners(&mut resources, &mut renderer, CornerShape::Circular).unwrap();
|
||||
for edge in [ferese_config::panel::Edge::Top, ferese_config::panel::Edge::Bottom] {
|
||||
let radii = ferese_config::panel::CornerRadii([14., 8., 12., 20.])
|
||||
.at_edge(edge, true)
|
||||
.0;
|
||||
let pixels = rasterize(
|
||||
&mut renderer,
|
||||
&material.0,
|
||||
&[
|
||||
Uniform::new("visible_rect", [0.0f32, 0.0, 64.0, 36.0]),
|
||||
Uniform::new("material_radii", radii),
|
||||
Uniform::new("tint", [1.0f32; 4]),
|
||||
Uniform::new("paint_mode", 0.0f32),
|
||||
Uniform::new("shadow_rect", [0.0f32, 0.0, 64.0, 36.0]),
|
||||
Uniform::new("shadow_values", [8.0f32, 1.0]),
|
||||
],
|
||||
);
|
||||
let (attached_row, free_row) = if edge == ferese_config::panel::Edge::Top {
|
||||
(0, 35)
|
||||
} else {
|
||||
(35, 0)
|
||||
};
|
||||
for x in 0..64 {
|
||||
assert_eq!(
|
||||
pixels[(attached_row * 64 + x) * 4 + 3],
|
||||
255,
|
||||
"wallpaper exposed at {edge:?} pixel {x}"
|
||||
);
|
||||
}
|
||||
assert_eq!(pixels[free_row * 64 * 4 + 3], 0, "opposite corners remain rounded");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires an EGL rendering device"]
|
||||
fn asymmetric_panel_fill_and_shadow_match_each_corner() {
|
||||
let mut renderer = renderer();
|
||||
let mut resources = RenderResources::default();
|
||||
let material = material_program_for_corners(&mut resources, &mut renderer, CornerShape::Circular).unwrap();
|
||||
let rect = [2.0f32, 2.0, 60.0, 60.0];
|
||||
let radii = [0.0f32, 4.0, 12.0, 20.0];
|
||||
for paint_mode in [0.0f32, 2.0] {
|
||||
let pixels = rasterize(
|
||||
&mut renderer,
|
||||
&material.0,
|
||||
&[
|
||||
Uniform::new("visible_rect", rect),
|
||||
Uniform::new("material_radii", radii),
|
||||
Uniform::new("tint", [1.0f32; 4]),
|
||||
Uniform::new("paint_mode", paint_mode),
|
||||
Uniform::new("shadow_rect", rect),
|
||||
Uniform::new("shadow_values", [8.0f32, 1.0]),
|
||||
],
|
||||
);
|
||||
for y in 0..64 {
|
||||
for x in 0..64 {
|
||||
let radius = match (x < 32, y < 32) {
|
||||
(true, true) => radii[0],
|
||||
(false, true) => radii[1],
|
||||
(false, false) => radii[2],
|
||||
(true, false) => radii[3],
|
||||
};
|
||||
let distance = reference_distance(
|
||||
[x as f64 + 0.5, y as f64 + 0.5],
|
||||
rect.map(f64::from),
|
||||
radius.into(),
|
||||
CornerShape::Circular,
|
||||
);
|
||||
let expected = if paint_mode == 0. {
|
||||
coverage(distance)
|
||||
} else {
|
||||
(-0.5 * (distance.max(0.0) / 4.0).powi(2)).exp() * (1. - coverage(distance))
|
||||
};
|
||||
assert!(
|
||||
pixels[(y * 64 + x) * 4 + 3].abs_diff((expected * 255.).round() as u8) <= 2,
|
||||
"corner mismatch at ({x}, {y}), mode {paint_mode}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires an EGL rendering device"]
|
||||
fn apple_shadow_and_window_tint_match_the_same_outline() {
|
||||
@@ -431,7 +518,7 @@ fn apple_shadow_and_window_tint_match_the_same_outline() {
|
||||
&material.0,
|
||||
&[
|
||||
Uniform::new("visible_rect", rect),
|
||||
Uniform::new("material_radius", radius),
|
||||
Uniform::new("material_radii", [radius; 4]),
|
||||
Uniform::new("tint", [1.0f32; 4]),
|
||||
Uniform::new("paint_mode", 0.0f32),
|
||||
Uniform::new("shadow_rect", rect),
|
||||
|
||||
@@ -234,7 +234,7 @@ pub(super) fn window_tint_element(
|
||||
let uniforms = |p: &BorderParameters| {
|
||||
vec![
|
||||
Uniform::new("visible_rect", p.clip_rect),
|
||||
Uniform::new("material_radius", p.radius),
|
||||
Uniform::new("material_radii", [p.radius; 4]),
|
||||
Uniform::new("tint", p.color),
|
||||
Uniform::new("paint_mode", 0.0_f32),
|
||||
Uniform::new("shadow_rect", p.clip_rect),
|
||||
|
||||
@@ -130,6 +130,23 @@ fn material_region_geometry(
|
||||
Some((rect.to_i32_up(), corners))
|
||||
}
|
||||
|
||||
/// Apply the same output transform as framebuffer_clip_rect to corner identity.
|
||||
fn framebuffer_corner_radii(radii: [f32; 4], transform: Transform) -> [f32; 4] {
|
||||
let size = Size::<f64, Physical>::from((1., 1.));
|
||||
let mut transformed = [0.; 4];
|
||||
for (radius, point) in radii.into_iter().zip([(0., 0.), (1., 0.), (1., 1.), (0., 1.)]) {
|
||||
let point = transform.transform_point_in(Point::<f64, Physical>::from(point), &size);
|
||||
let index = match (point.x > 0.5, point.y > 0.5) {
|
||||
(false, false) => 0,
|
||||
(true, false) => 1,
|
||||
(true, true) => 2,
|
||||
(false, true) => 3,
|
||||
};
|
||||
transformed[index] = radius;
|
||||
}
|
||||
transformed
|
||||
}
|
||||
|
||||
pub(super) struct MaterialSurface {
|
||||
pub geometry: Rectangle<i32, Logical>,
|
||||
pub corners: RoundedRect,
|
||||
@@ -156,6 +173,22 @@ pub(super) fn material_element(
|
||||
)
|
||||
}
|
||||
|
||||
fn resolve_surface_material(
|
||||
role: crate::effects::SemanticRole,
|
||||
settings: crate::config::ThemeSettings,
|
||||
panel_opacity: Option<f32>,
|
||||
) -> crate::effects::ResolvedMaterial {
|
||||
let mut material = crate::effects::resolve_material(role, settings.material_style, settings.shell_opacity as f32);
|
||||
if role == crate::effects::SemanticRole::Panel {
|
||||
material.opacity = ferese_config::theme::effective_panel_opacity(
|
||||
material.opacity,
|
||||
panel_opacity,
|
||||
settings.reduce_transparency,
|
||||
);
|
||||
}
|
||||
material
|
||||
}
|
||||
|
||||
pub(super) fn material_element_with_role(
|
||||
state: &mut Ferese,
|
||||
renderer: &mut GlesRenderer,
|
||||
@@ -171,11 +204,7 @@ pub(super) fn material_element_with_role(
|
||||
capture_geometry,
|
||||
alpha,
|
||||
} = surface_geometry;
|
||||
let material = crate::effects::resolve_material(
|
||||
role,
|
||||
state.theme_settings.material_style,
|
||||
state.theme_settings.shell_opacity as f32,
|
||||
);
|
||||
let material = resolve_surface_material(role, state.theme_settings, state.panel_background_opacity);
|
||||
let presentation_alpha = opacity * alpha;
|
||||
let mode = output.current_mode()?;
|
||||
let scale = output.current_scale().fractional_scale();
|
||||
@@ -186,14 +215,43 @@ pub(super) fn material_element_with_role(
|
||||
state.theme_settings.surface_base_color
|
||||
};
|
||||
let [red, green, blue, _] = background.0;
|
||||
let radius = corners.radius;
|
||||
let logical_radii = if role == crate::effects::SemanticRole::Panel {
|
||||
state.panel_corner_radius
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let radii = logical_radii.map_or([corners.radius; 4], |radii| {
|
||||
radii
|
||||
.0
|
||||
.map(|value| clamp_radius(f64::from(value) * scale, corners.rect.size))
|
||||
});
|
||||
let output_size = output
|
||||
.current_transform()
|
||||
.transform_size(mode.size)
|
||||
.to_f64()
|
||||
.to_logical(scale)
|
||||
.to_i32_ceil();
|
||||
let touches_top = role == crate::effects::SemanticRole::Panel && geometry.loc.y == 0;
|
||||
let touches_bottom =
|
||||
role == crate::effects::SemanticRole::Panel && geometry.loc.y + geometry.size.h >= output_size.h;
|
||||
let radii = ferese_config::panel::CornerRadii(radii)
|
||||
.at_top_edge(touches_top)
|
||||
.at_edge(ferese_config::panel::Edge::Bottom, touches_bottom)
|
||||
.0;
|
||||
let radius = radii.into_iter().fold(0., f32::max);
|
||||
let corner_radii = framebuffer_corner_radii(radii, transform);
|
||||
let [offset_y, shadow_blur, shadow_opacity] = material.shadow;
|
||||
let edge_bar = role == crate::effects::SemanticRole::Panel && radius == 0.0 && geometry.loc.y == 0;
|
||||
let edge_bar = radius == 0.0 && (touches_top || touches_bottom);
|
||||
let shadow_opacity = if edge_bar {
|
||||
0.0
|
||||
} else {
|
||||
shadow_opacity * (state.theme_settings.shadow_opacity / 0.2) * f64::from(presentation_alpha)
|
||||
};
|
||||
let shadow_opacity = if role == crate::effects::SemanticRole::Panel {
|
||||
shadow_opacity * f64::from(material.opacity)
|
||||
} else {
|
||||
shadow_opacity
|
||||
};
|
||||
let shadow_geometry = Rectangle::new(
|
||||
(
|
||||
corners.rect.loc.x,
|
||||
@@ -204,22 +262,16 @@ pub(super) fn material_element_with_role(
|
||||
);
|
||||
let background_opacity = material.opacity;
|
||||
let blur = material_blur_radius(material.style, material.opacity, state.theme_settings.backdrop_blur);
|
||||
let output_size = output
|
||||
.current_transform()
|
||||
.transform_size(mode.size)
|
||||
.to_f64()
|
||||
.to_logical(scale)
|
||||
.to_i32_ceil();
|
||||
let sample_geometry = expanded_blur_region(capture_geometry, blur.ceil() as i32, output_size);
|
||||
let sample_physical = sample_geometry.to_physical_precise_round(scale);
|
||||
let mut parameters = MaterialParameters {
|
||||
corner_radii,
|
||||
presentation_alpha,
|
||||
background_opacity,
|
||||
blur: (blur * scale) as f32,
|
||||
sample_geometry,
|
||||
sample_physical,
|
||||
sample_framebuffer: framebuffer_clip_rect(sample_physical, mode.size, transform),
|
||||
radius,
|
||||
shadow_rect: framebuffer_clip_rect(shadow_geometry, mode.size, transform),
|
||||
shadow_values: [(shadow_blur * scale) as f32, shadow_opacity as f32],
|
||||
shadow_bounds: shadow_bounds(geometry, offset_y, shadow_blur),
|
||||
@@ -323,7 +375,7 @@ pub(super) fn material_element_with_role(
|
||||
if cached.parameters.shadow_rect != parameters.shadow_rect
|
||||
|| cached.parameters.shadow_values != parameters.shadow_values
|
||||
|| cached.parameters.shadow_bounds != parameters.shadow_bounds
|
||||
|| cached.parameters.radius != parameters.radius
|
||||
|| cached.parameters.corner_radii != parameters.corner_radii
|
||||
|| cached.parameters.visible_framebuffer != parameters.visible_framebuffer
|
||||
{
|
||||
cached.shadow.resize(parameters.shadow_bounds, None);
|
||||
@@ -388,7 +440,7 @@ pub(super) fn blur_program(resources: &mut RenderResources, renderer: &mut GlesR
|
||||
pub(super) fn blur_uniform_names() -> [UniformName<'static>; 8] {
|
||||
[
|
||||
UniformName::new("visible_rect", UniformType::_4f),
|
||||
UniformName::new("material_radius", UniformType::_1f),
|
||||
UniformName::new("material_radii", UniformType::_4f),
|
||||
UniformName::new("texture_size", UniformType::_2f),
|
||||
UniformName::new("capture_origin", UniformType::_2f),
|
||||
UniformName::new("blur_radius", UniformType::_1f),
|
||||
@@ -401,7 +453,7 @@ pub(super) fn blur_uniform_names() -> [UniformName<'static>; 8] {
|
||||
pub(super) fn blur_uniforms(p: &MaterialParameters) -> Vec<Uniform<'static>> {
|
||||
vec![
|
||||
Uniform::new("visible_rect", p.visible_framebuffer),
|
||||
Uniform::new("material_radius", p.radius),
|
||||
Uniform::new("material_radii", p.corner_radii),
|
||||
Uniform::new("texture_size", [p.sample_framebuffer[2], p.sample_framebuffer[3]]),
|
||||
Uniform::new("capture_origin", [p.sample_framebuffer[0], p.sample_framebuffer[1]]),
|
||||
Uniform::new("blur_radius", p.blur),
|
||||
@@ -452,7 +504,7 @@ pub(super) fn material_program_for_corners(
|
||||
|
||||
let uniforms = [
|
||||
UniformName::new("visible_rect", UniformType::_4f),
|
||||
UniformName::new("material_radius", UniformType::_1f),
|
||||
UniformName::new("material_radii", UniformType::_4f),
|
||||
UniformName::new("tint", UniformType::_4f),
|
||||
UniformName::new("paint_mode", UniformType::_1f),
|
||||
UniformName::new("shadow_rect", UniformType::_4f),
|
||||
@@ -485,7 +537,7 @@ pub(super) fn decoration_uniforms(parameters: &MaterialParameters, paint_mode: f
|
||||
Uniform::new("shadow_rect", parameters.shadow_rect),
|
||||
Uniform::new("shadow_values", parameters.shadow_values),
|
||||
Uniform::new("visible_rect", parameters.visible_framebuffer),
|
||||
Uniform::new("material_radius", parameters.radius),
|
||||
Uniform::new("material_radii", parameters.corner_radii),
|
||||
Uniform::new("tint", parameters.tint),
|
||||
]
|
||||
}
|
||||
@@ -507,6 +559,60 @@ pub(super) fn blur_damage(
|
||||
mod region_geometry_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn reduce_transparency_wins_over_continuous_and_island_panel_materials() {
|
||||
use crate::effects::SemanticRole;
|
||||
for surface in ["solid", "none"] {
|
||||
for opacity in [0., 0.4, 1.] {
|
||||
for reduce in [false, true] {
|
||||
let source = format!(
|
||||
"theme {{ material {{ style translucent; opacity 0.7; }}; accessibility {{ reduce-transparency #{reduce}; }}; }}; panel main {{ surface {surface}; group-surface island; background-opacity {opacity}; }}"
|
||||
);
|
||||
let (_, runtime, candidate) = crate::theme::prepare(&source, std::path::Path::new("/tmp")).unwrap();
|
||||
let material = resolve_surface_material(
|
||||
SemanticRole::Panel,
|
||||
runtime.theme_settings,
|
||||
runtime.panel_background_opacity,
|
||||
);
|
||||
assert_eq!(material.opacity, if reduce { 1. } else { opacity });
|
||||
assert_eq!(material.opacity, candidate.theme.panel_opacity(Some(opacity)));
|
||||
assert_eq!(
|
||||
material.style,
|
||||
if reduce {
|
||||
crate::config::MaterialStyle::Solid
|
||||
} else {
|
||||
crate::config::MaterialStyle::Translucent
|
||||
}
|
||||
);
|
||||
if reduce {
|
||||
assert_eq!(runtime.theme_settings.backdrop_blur, 0.);
|
||||
}
|
||||
let popover = resolve_surface_material(SemanticRole::Popover, runtime.theme_settings, Some(0.));
|
||||
assert!((popover.opacity - if reduce { 1. } else { 0.7 }).abs() < 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn framebuffer_transforms_preserve_each_logical_corner() {
|
||||
let radii = [1., 2., 3., 4.];
|
||||
assert_eq!(framebuffer_corner_radii(radii, Transform::Normal), radii);
|
||||
assert_eq!(framebuffer_corner_radii(radii, Transform::Flipped180), [4., 3., 2., 1.]);
|
||||
for (transform, expected) in [
|
||||
(Transform::Normal, [1., 2., 3., 4.]),
|
||||
(Transform::_90, [4., 1., 2., 3.]),
|
||||
(Transform::_180, [3., 4., 1., 2.]),
|
||||
(Transform::_270, [2., 3., 4., 1.]),
|
||||
(Transform::Flipped, [2., 1., 4., 3.]),
|
||||
(Transform::Flipped90, [1., 4., 3., 2.]),
|
||||
(Transform::Flipped180, [4., 3., 2., 1.]),
|
||||
(Transform::Flipped270, [3., 2., 1., 4.]),
|
||||
] {
|
||||
assert_eq!(framebuffer_corner_radii(radii, transform), expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fractional_regions_snap_once_in_output_pixels() {
|
||||
let bounds = Rectangle::from_size((200, 100).into());
|
||||
|
||||
@@ -135,6 +135,7 @@ fn corner_shader_for(source: &str, shape: CornerShape) -> String {
|
||||
)
|
||||
.replace("precision mediump float;", "precision highp float;"),
|
||||
}
|
||||
.replace("//_MATERIAL_CORNERS_", include_str!("shaders/material_corners.glsl"))
|
||||
}
|
||||
|
||||
pub(crate) fn window_corner_shape(_window: &smithay::desktop::Window) -> CornerShape {
|
||||
@@ -339,13 +340,13 @@ pub(crate) struct MaterialProgram(GlesPixelProgram);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct MaterialParameters {
|
||||
corner_radii: [f32; 4],
|
||||
presentation_alpha: f32,
|
||||
background_opacity: f32,
|
||||
blur: f32,
|
||||
sample_geometry: Rectangle<i32, Logical>,
|
||||
sample_physical: Rectangle<i32, Physical>,
|
||||
sample_framebuffer: [f32; 4],
|
||||
radius: f32,
|
||||
shadow_rect: [f32; 4],
|
||||
shadow_values: [f32; 2],
|
||||
shadow_bounds: Rectangle<i32, Logical>,
|
||||
@@ -734,7 +735,7 @@ mod tests {
|
||||
] {
|
||||
let uniforms = vec![
|
||||
Uniform::new("visible_rect", [0.0f32, 0.0, 32.0, 32.0]),
|
||||
Uniform::new("material_radius", 0.0f32),
|
||||
Uniform::new("material_radii", [0.0f32; 4]),
|
||||
Uniform::new("texture_size", [32.0f32, 32.0]),
|
||||
Uniform::new("capture_origin", [0.0f32, 0.0]),
|
||||
Uniform::new("blur_radius", 12.0f32),
|
||||
|
||||
@@ -41,7 +41,7 @@ pub(super) fn overview_chrome_element(
|
||||
} else {
|
||||
vec![
|
||||
Uniform::new("visible_rect", p.clip_rect),
|
||||
Uniform::new("material_radius", p.radius),
|
||||
Uniform::new("material_radii", [p.radius; 4]),
|
||||
Uniform::new("tint", p.color),
|
||||
Uniform::new("paint_mode", 0.0_f32),
|
||||
Uniform::new("shadow_rect", p.clip_rect),
|
||||
|
||||
@@ -11,7 +11,7 @@ uniform sampler2D tex;
|
||||
#endif
|
||||
uniform float alpha;
|
||||
uniform vec4 visible_rect;
|
||||
uniform float material_radius;
|
||||
uniform vec4 material_radii;
|
||||
uniform vec2 texture_size;
|
||||
uniform vec2 capture_origin;
|
||||
uniform float blur_radius;
|
||||
@@ -20,9 +20,10 @@ uniform float background_opacity;
|
||||
uniform vec4 tint;
|
||||
varying vec2 v_coords;
|
||||
//_CORNERS_
|
||||
//_MATERIAL_CORNERS_
|
||||
|
||||
void main() {
|
||||
float sdf = rounded_rect_distance(gl_FragCoord.xy, visible_rect, material_radius);
|
||||
float sdf = rounded_rect_corners_distance(gl_FragCoord.xy, visible_rect, material_radii);
|
||||
float coverage = alpha * presentation_alpha * edge_coverage(sdf);
|
||||
if (coverage <= 0.0) { gl_FragColor = vec4(0.0); return; }
|
||||
vec2 coords = (gl_FragCoord.xy - capture_origin) / texture_size;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Radii are clockwise from the framebuffer rectangle's top-left.
|
||||
float rounded_rect_corners_distance(vec2 point, vec4 rect, vec4 radii) {
|
||||
vec2 center = rect.xy + rect.zw * 0.5;
|
||||
float radius = point.y < center.y
|
||||
? (point.x < center.x ? radii.x : radii.y)
|
||||
: (point.x < center.x ? radii.w : radii.z);
|
||||
return rounded_rect_distance(point, rect, radius);
|
||||
}
|
||||
@@ -3,22 +3,23 @@ precision highp float;
|
||||
uniform float alpha;
|
||||
uniform vec4 tint;
|
||||
uniform vec4 visible_rect;
|
||||
uniform float material_radius;
|
||||
uniform vec4 material_radii;
|
||||
uniform float paint_mode;
|
||||
uniform vec4 shadow_rect;
|
||||
uniform vec2 shadow_values;
|
||||
varying vec2 v_coords;
|
||||
|
||||
//_CORNERS_
|
||||
//_MATERIAL_CORNERS_
|
||||
|
||||
void main() {
|
||||
float sdf = rounded_rect_distance(gl_FragCoord.xy, visible_rect, material_radius);
|
||||
float sdf = rounded_rect_corners_distance(gl_FragCoord.xy, visible_rect, material_radii);
|
||||
float coverage = edge_coverage(sdf);
|
||||
if (paint_mode > 0.5) {
|
||||
// The shadow pass is multiplied by (1 - coverage). Fully covered
|
||||
// pixels need neither a second contour solve nor a Gaussian sample.
|
||||
if (coverage >= 1.0) { gl_FragColor = vec4(0.0); return; }
|
||||
float distance = max(rounded_rect_distance(gl_FragCoord.xy, shadow_rect, material_radius), 0.0);
|
||||
float distance = max(rounded_rect_corners_distance(gl_FragCoord.xy, shadow_rect, material_radii), 0.0);
|
||||
float sigma = max(shadow_values.x * 0.5, 0.5);
|
||||
float opacity = exp(-0.5 * distance * distance / (sigma * sigma))
|
||||
* shadow_values.y * (1.0 - coverage) * alpha;
|
||||
|
||||
Reference in new issue
Block a user