use super::*;
pub(crate) fn render_mode_name(idx: usize) -> &'static str {
match idx {
1 => MODE_SOFTWARE,
2 => MODE_HARDWARE,
3 => MODE_HYBRID,
_ => MODE_AUTO,
}
}
pub(crate) fn render_blur_radius(idx: usize) -> f32 {
match idx {
0 => 8.0,
2 => 24.0,
_ => 16.0,
}
}
pub(crate) fn render_gradient_angle(idx: usize) -> f32 {
match idx {
0 => 0.0,
2 => 90.0,
3 => 135.0,
_ => 45.0,
}
}
pub(crate) fn mount_render_vector_card(
mode_idx: Signal<usize>,
tokens: ThemeTokens,
) -> (NodeId, NodeId) {
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let mut canvas_id: NodeId = NodeId::default();
let pipeline_label = move || -> String {
let mode_name: &str = render_mode_name(mode_idx.get());
format!("Demo Preview Pipeline: {mode_name} (Widget-Scoped — Global App Unchanged)")
};
let paint_preview = move |bounds: Rect, display_list: &mut DisplayList| {
let live: ThemeTokens = live_tokens_untracked(tokens);
let lp: ThemePalette = live.get_palette();
let mode: usize = mode_idx.get_untracked();
let border_width: f32 = bounds.get_width().max(120.0);
let bh: f32 = bounds.get_height().max(100.0);
let grid_col: Color = lp.get_border().with_alpha(90);
let step_x: f32 = (border_width / 6.0).max(32.0);
let mut gx: f32 = bounds.get_x() + step_x;
while gx < bounds.right() - 8.0 {
display_list.push(DrawCommand::Line {
from: Point::new(gx, bounds.get_y() + 8.0),
to: Point::new(gx, bounds.bottom() - 8.0),
color: grid_col,
width: 1.0,
});
gx += step_x;
}
let rect_w: f32 = (border_width * 0.28).clamp(64.0, 210.0);
let rect_h: f32 = (bh - 52.0).max(60.0);
let primary_fill: Color = match mode {
1 => lp.get_secondary(),
2 => lp.get_primary(),
3 => lp.get_success(),
_ => lp.get_primary(),
};
display_list.push(DrawCommand::FillRoundedRect {
rect: Rect::new(bounds.get_x() + 18.0, bounds.get_y() + 34.0, rect_w, rect_h),
color: primary_fill,
radius: CornerRadius::all(14.0),
border: Border::new(1.5, lp.get_border()),
});
let circle_r: f32 = (border_width * 0.085).clamp(22.0, 48.0);
let circle_x: f32 = (bounds.get_x() + 18.0 + rect_w + circle_r + 24.0)
.min(bounds.right() - circle_r - 14.0);
let circle_y: f32 = bounds.get_y() + 34.0 + rect_h * 0.5;
display_list.push(DrawCommand::Circle {
center: Point::new(circle_x, circle_y),
radius: circle_r + 6.0,
color: lp.get_success().with_alpha(52),
});
display_list.push(DrawCommand::Circle {
center: Point::new(circle_x, circle_y),
radius: circle_r,
color: lp.get_success(),
});
let line_x0: f32 = (circle_x + circle_r + 18.0).min(bounds.right() - 24.0);
let line_x1: f32 = (bounds.right() - 18.0).max(line_x0);
display_list.push(DrawCommand::Line {
from: Point::new(line_x0, bounds.get_y() + 42.0),
to: Point::new(line_x1, bounds.bottom() - 22.0),
color: lp.get_warning(),
width: 3.5,
});
display_list.push(DrawCommand::Line {
from: Point::new(line_x0, bounds.bottom() - 22.0),
to: Point::new(line_x1, bounds.get_y() + 42.0),
color: lp.get_primary().with_alpha(180),
width: 2.0,
});
let mut hud_style: TextStyle = TextStyle::default();
hud_style
.set_font_size(11.5)
.set_weight(FontWeight::SemiBold)
.set_color(lp.get_foreground());
display_list.push(DrawCommand::TextRun {
rect: Rect::new(
bounds.get_x() + 16.0,
bounds.get_y() + 10.0,
(border_width - 32.0).max(1.0),
18.0,
),
text: format!(
"SDF Vector Stage | Preview Mode: {} | Bounds: {:.0}x{:.0}",
render_mode_name(mode),
border_width,
bh
),
style: hud_style,
});
};
let column_fifth_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_SM)
};
let text_tertiary_style: Style = style! {
Width(Length::Percent(100.0))
FontSize(13.0)
FontWeight::SemiBold
TextColor(palette.get_primary())
};
let text_quaternary_style: Style = style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontWeight::Medium
TextColor(palette.get_muted_foreground())
};
let canvas_tertiary_style: Style = style! {
Width(Length::Percent(100.0))
Height(Length::Px(RENDER_VECTOR_CANVAS_HEIGHT))
Background(palette.get_muted())
Border::new(geometry.get_border_width(), palette.get_border())
Radius(geometry.get_radius_md())
};
let card: NodeId = view! {
EuvCard {
title: RENDER_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_CARD_SUB
column {
style: column_fifth_style
text {
style: text_tertiary_style
{ pipeline_label }
}
text {
style: text_quaternary_style
{ CANVAS_LABEL }
}
canvas {
node_ref: canvas_id
style: canvas_tertiary_style
painter: paint_preview
}
}
}
};
(card, canvas_id)
}
pub(crate) fn mount_render_blur_card(
blur_idx: Signal<usize>,
tokens: ThemeTokens,
) -> (NodeId, NodeId) {
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let mut glass_id: NodeId = NodeId::default();
let paint_backdrop = move |bounds: Rect, display_list: &mut DisplayList| {
let live: ThemeTokens = live_tokens_untracked(tokens);
let lp: ThemePalette = live.get_palette();
let border_width: f32 = bounds.get_width().max(80.0);
let bh: f32 = bounds.get_height().max(80.0);
display_list.push(DrawCommand::Circle {
center: Point::new(
bounds.get_x() + border_width * 0.24,
bounds.get_y() + bh * 0.48,
),
radius: (bh * 0.34).max(20.0),
color: lp.get_primary(),
});
display_list.push(DrawCommand::Circle {
center: Point::new(
bounds.get_x() + border_width * 0.56,
bounds.get_y() + bh * 0.42,
),
radius: (bh * 0.30).max(18.0),
color: lp.get_success(),
});
display_list.push(DrawCommand::Circle {
center: Point::new(
bounds.get_x() + border_width * 0.80,
bounds.get_y() + bh * 0.58,
),
radius: (bh * 0.28).max(16.0),
color: lp.get_warning(),
});
};
let glass_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
let lp: ThemePalette = live.get_palette();
let lg: ThemeGeometry = live.get_geometry();
style! {
Width(Length::Percent(100.0))
FlexGrow(1.0)
FlexDirection::Column
JustifyContent::Center
Gap(SPACE_XS)
Padding(Edges::all(SPACE_MD))
Background(lp.get_card().with_alpha(196))
Border::new(lg.get_border_width(), lp.get_border())
Radius(lg.get_radius_md())
Overflow::Hidden
}
};
let glass_title_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(14.0)
FontWeight::Bold
TextColor(live.get_palette().get_card_foreground())
}
};
let glass_sub_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontFamily::Monospace
TextColor(live.get_palette().get_card_foreground())
}
};
let blur_caption = move || -> String {
let radius: f32 = render_blur_radius(blur_idx.get());
format!("Dual-Kawase radius: {radius:.0}px | alpha=196/255")
};
let view_style: Style = style! {
Width(Length::Percent(100.0))
Height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
Padding(Edges::all(SPACE_LG))
JustifyContent::Center
Background(palette.get_muted())
Border::new(geometry.get_border_width(), palette.get_border())
Radius(geometry.get_radius_md())
Overflow::Hidden
};
let canvas_secondary_style: Style = style! {
Position::Absolute
Inset(Some(0.0), Some(0.0), Some(0.0), Some(0.0))
Width(Length::Percent(100.0))
Height(Length::Percent(100.0))
};
let card: NodeId = view! {
EuvCard {
title: RENDER_BLUR_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_BLUR_CARD_SUB
view {
style: view_style
canvas {
style: canvas_secondary_style
painter: paint_backdrop
}
view {
node_ref: glass_id
bind_style: glass_style
text {
bind_style: glass_title_style
{ RENDER_BLUR_GLASS_TITLE }
}
text {
bind_style: glass_sub_style
{ blur_caption }
}
}
}
}
};
(card, glass_id)
}
pub(crate) fn mount_render_shadow_card(shadow_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let tile_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
let lp: ThemePalette = live.get_palette();
let lg: ThemeGeometry = live.get_geometry();
let sh: Shadow = match shadow_idx.get() {
0 => lg.get_shadow_sm(),
2 => lg.get_shadow_lg(),
_ => lg.get_shadow_md(),
};
style! {
FlexDirection::Column
Width(Length::Percent(100.0))
Padding(Edges::all(SPACE_MD))
Gap(SPACE_XS)
Background(lp.get_card())
Border::new(lg.get_border_width(), lp.get_border())
Radius(lg.get_radius_lg())
sh
Overflow::Hidden
}
};
let tile_title_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(14.0)
FontWeight::Bold
TextColor(live.get_palette().get_card_foreground())
}
};
let tile_meta_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontFamily::Monospace
TextColor(live.get_palette().get_muted_foreground())
}
};
let shadow_meta = move || -> String {
let live: ThemeTokens = use_live_tokens(tokens);
let lg: ThemeGeometry = live.get_geometry();
let (tier, sh): (&str, Shadow) = match shadow_idx.get() {
0 => (RENDER_SHADOW_OPT_SM, lg.get_shadow_sm()),
2 => (RENDER_SHADOW_OPT_LG, lg.get_shadow_lg()),
_ => (RENDER_SHADOW_OPT_MD, lg.get_shadow_md()),
};
format!(
"{tier} | offset=({:.0},{:.0}) blur={:.0}px",
sh.get_offset_x(),
sh.get_offset_y(),
sh.get_blur_radius()
)
};
let column_quaternary_style: Style = style! {
Width(Length::Percent(100.0))
Height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
Padding(Edges::all(SPACE_LG))
JustifyContent::Center
Background(palette.get_muted())
Border::new(geometry.get_border_width(), palette.get_border())
Radius(geometry.get_radius_md())
Overflow::Hidden
};
view! {
EuvCard {
title: RENDER_SHADOW_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_SHADOW_CARD_SUB
column {
style: column_quaternary_style
view {
bind_style: tile_style
text {
bind_style: tile_title_style
{ RENDER_SHADOW_SAMPLE_TITLE }
}
text {
bind_style: tile_meta_style
{ shadow_meta }
}
}
}
}
}
}
pub(crate) fn mount_render_gradient_card(angle_idx: Signal<usize>, tokens: ThemeTokens) -> NodeId {
let grad_box_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
let lp: ThemePalette = live.get_palette();
let lg: ThemeGeometry = live.get_geometry();
let angle: f32 = render_gradient_angle(angle_idx.get());
let grad: LinearGradient = LinearGradient::new(angle, lp.get_primary(), lp.get_success());
style! {
FlexDirection::Column
Width(Length::Percent(100.0))
Height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
Padding(Edges::all(SPACE_MD))
JustifyContent::End
Gap(SPACE_XS)
Background(lp.get_primary())
grad
Border::new(lg.get_border_width(), lp.get_border())
Radius(lg.get_radius_md())
Overflow::Hidden
}
};
let grad_title_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(14.0)
FontWeight::Bold
TextColor(live.get_palette().get_primary_foreground())
}
};
let grad_meta_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontFamily::Monospace
TextColor(live.get_palette().get_primary_foreground())
}
};
let grad_meta = move || -> String {
let angle: f32 = render_gradient_angle(angle_idx.get());
format!("LinearGradient({angle:.0} deg, primary -> success)")
};
view! {
EuvCard {
title: RENDER_GRADIENT_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_GRADIENT_CARD_SUB
view {
bind_style: grad_box_style
text {
bind_style: grad_title_style
{ RENDER_GRADIENT_SAMPLE_TITLE }
}
text {
bind_style: grad_meta_style
{ grad_meta }
}
}
}
}
}
pub(crate) fn mount_render_damage_card(
pulse_sig: Signal<u32>,
tokens: ThemeTokens,
) -> (NodeId, NodeId) {
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let mut damage_canvas_id: NodeId = NodeId::default();
let paint_damage = move |bounds: Rect, display_list: &mut DisplayList| {
let live: ThemeTokens = live_tokens_untracked(tokens);
let lp: ThemePalette = live.get_palette();
let pulse: u32 = pulse_sig.get_untracked();
let cols: usize = 4;
let rows: usize = 2;
let pad: f32 = 10.0;
let gap: f32 = 6.0;
let usable_w: f32 = (bounds.get_width() - pad * 2.0 - gap * ((cols - 1) as f32)).max(40.0);
let usable_h: f32 =
(bounds.get_height() - 28.0 - pad * 2.0 - gap * ((rows - 1) as f32)).max(24.0);
let cell_w: f32 = usable_w / (cols as f32);
let cell_h: f32 = usable_h / (rows as f32);
let active_idx: usize = (pulse as usize) % (cols * rows);
for row in 0..rows {
for col in 0..cols {
let idx: usize = row * cols + col;
let rx: f32 = bounds.get_x() + pad + (col as f32) * (cell_w + gap);
let ry: f32 = bounds.get_y() + 26.0 + pad + (row as f32) * (cell_h + gap);
let is_dirty: bool = idx == active_idx;
let fill: Color = if is_dirty {
lp.get_warning().with_alpha(96)
} else {
lp.get_card()
};
let stroke: Color = if is_dirty {
lp.get_warning()
} else {
lp.get_border()
};
display_list.push(DrawCommand::FillRoundedRect {
rect: Rect::new(rx, ry, cell_w, cell_h),
color: fill,
radius: CornerRadius::all(6.0),
border: Border::new(if is_dirty { 2.0 } else { 1.0 }, stroke),
});
}
}
let mut hud_style: TextStyle = TextStyle::default();
hud_style
.set_font_size(11.5)
.set_weight(FontWeight::SemiBold)
.set_color(lp.get_foreground());
display_list.push(DrawCommand::TextRun {
rect: Rect::new(
bounds.get_x() + 10.0,
bounds.get_y() + 8.0,
(bounds.get_width() - 20.0).max(1.0),
18.0,
),
text: format!("DIRTY_PAINT Pulses: {pulse} | Active Tile: #{active_idx}"),
style: hud_style,
});
};
let canvas_style: Style = style! {
Width(Length::Percent(100.0))
Height(Length::Px(RENDER_EFFECT_STAGE_HEIGHT))
Background(palette.get_muted())
Border::new(geometry.get_border_width(), palette.get_border())
Radius(geometry.get_radius_md())
};
let card: NodeId = view! {
EuvCard {
title: RENDER_DAMAGE_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_DAMAGE_CARD_SUB
canvas {
node_ref: damage_canvas_id
style: canvas_style
painter: paint_damage
}
}
};
(card, damage_canvas_id)
}
pub(crate) fn mount_render_shader_cache_card(tokens: ThemeTokens) -> NodeId {
let initial_report: Option<ShaderPrecompileReport> = shader_precompile_status();
let report_sig: Signal<Option<ShaderPrecompileReport>> = Signal::new(initial_report);
let summary_text = move || -> String {
if let Some(report) = report_sig.get() {
report.summary_line()
} else if is_shader_precompile_in_flight() {
"Compiling GPU shader pipelines on background worker thread...".to_string()
} else {
RENDER_SHADER_STATUS_PENDING.to_string()
}
};
let archive_text = move || -> String {
if let Some(report) = report_sig.get() {
let archive_label: &str = if report.get_binary_archive_hit() {
"Disk Archive Hit"
} else if report.get_binary_archive_enabled() {
"Disk Archive Written"
} else {
"Process PSO Cache"
};
format!(
"Backend: {:?} · Hardware PSOs: {}/{} · Cache: {archive_label}",
report.get_backend(),
report.get_hardware_compiled_programs(),
report.get_total_programs(),
)
} else {
format!(
"Target Backend: {:?} · Registered Shaders: {} (UI, Blur, 3D PBR, Ocean)",
default_native_gpu_backend(),
ShaderProgramId::all().len(),
)
}
};
let entries_text = move || -> String {
if let Some(report) = report_sig.get() {
let mut lines: Vec<String> = Vec::with_capacity(report.get_entries().len());
for entry in report.get_entries().iter() {
let compile_ms: f64 = (entry.get_compile_time_us() as f64) / 1000.0;
let short_name: &str = match entry.get_program() {
ShaderProgramId::UiUber => "UI Uber",
ShaderProgramId::BackdropBlur => "BackdropBlur",
ShaderProgramId::Engine3dPbr => "3D PBR",
ShaderProgramId::FluidOceanOptical => "Fluid Ocean",
};
lines.push(format!(
"{short_name} [{}] · {} ({compile_ms:.2}ms)",
entry.get_language(),
entry.get_state().label(),
));
}
lines.join("\n")
} else {
"UI Uber · Dual-Kawase Blur · 3D Engine PBR · Fluid Ocean Optical".to_string()
}
};
let on_precompile_now = move |_: &UiEvent| {
let report: ShaderPrecompileReport = precompile_shaders(default_native_gpu_backend());
let _: bool = report_sig.set(Some(report));
};
let on_warmup_async = move |_: &UiEvent| {
precompile_shaders_async(default_native_gpu_backend());
let status: Option<ShaderPrecompileReport> = shader_precompile_status();
if status.is_some() {
let _: bool = report_sig.set(status);
}
};
let primary_mono_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(12.5)
FontFamily::Monospace
FontWeight::SemiBold
TextColor(live.get_palette().get_primary())
}
};
let muted_mono_style = move || -> Style {
let live: ThemeTokens = use_live_tokens(tokens);
style! {
Width(Length::Percent(100.0))
FontSize(11.5)
FontFamily::Monospace
TextColor(live.get_palette().get_muted_foreground())
}
};
let card_col_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_SM)
};
view! {
EuvCard {
title: RENDER_SHADER_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_SHADER_CARD_SUB
column {
style: card_col_style
text {
bind_style: primary_mono_style
{ summary_text }
}
text {
bind_style: muted_mono_style
{ archive_text }
}
text {
bind_style: muted_mono_style
{ entries_text }
}
EuvActionRow {
EuvButton {
label: RENDER_BTN_PRECOMPILE_SHADERS.to_string()
tokens: tokens
small()
on_click: on_precompile_now
}
EuvButton {
label: RENDER_BTN_WARMUP_ASYNC.to_string()
tokens: tokens
outline()
small()
on_click: on_warmup_async
}
}
}
}
}
}
pub fn mount_render_page(state: &ShowcaseState, tokens: ThemeTokens) -> NodeId {
let palette: ThemePalette = tokens.get_palette();
let ctx: Context = current_context();
let mode_idx: Signal<usize> = state.get_render_mode_index();
let blur_idx: Signal<usize> = Signal::new(2);
let shadow_idx: Signal<usize> = Signal::new(2);
let angle_idx: Signal<usize> = Signal::new(1);
let damage_pulse: Signal<u32> = Signal::new(0);
let (vector_card, vector_canvas_id): (NodeId, NodeId) =
mount_render_vector_card(mode_idx, tokens);
let (blur_card, glass_id): (NodeId, NodeId) = mount_render_blur_card(blur_idx, tokens);
let shadow_card: NodeId = mount_render_shadow_card(shadow_idx, tokens);
let gradient_card: NodeId = mount_render_gradient_card(angle_idx, tokens);
let (damage_card, damage_canvas_id): (NodeId, NodeId) =
mount_render_damage_card(damage_pulse, tokens);
let effects_grid: NodeId =
mount_responsive_grid(vec![blur_card, shadow_card, gradient_card, damage_card], 2);
let pulse_scene: SceneHandle = ctx.get_scene().clone();
let on_pulse_dirty = move |_: &UiEvent| {
let _: bool = {
if let Some(mut updated_value) = damage_pulse.try_get_untracked() {
{
let item_count: &mut u32 = &mut updated_value;
*item_count = item_count.saturating_add(1);
}
damage_pulse.set(updated_value)
} else {
false
}
};
pulse_scene.mark_dirty(damage_canvas_id, DIRTY_PAINT);
};
let pulse_readout = move || -> String {
format!(
"Surgical DIRTY_PAINT count: {} (zero global layout rebuild)",
damage_pulse.get()
)
};
let pipeline_card: NodeId = view! {
EuvCard {
title: RENDER_PIPELINE_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_PIPELINE_CARD_SUB
EuvSegmented {
options: vec![
MODE_AUTO.to_string(),
MODE_SOFTWARE.to_string(),
MODE_HARDWARE.to_string(),
MODE_HYBRID.to_string(),
]
selected: mode_idx
tokens: tokens
}
}
};
let column_tertiary_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_SM)
};
let text_style: Style = style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontWeight::Medium
TextColor(palette.get_muted_foreground())
};
let text_secondary_style: Style = style! {
Width(Length::Percent(100.0))
FontSize(12.0)
FontFamily::Monospace
TextColor(palette.get_primary())
};
let controls_card: NodeId = view! {
EuvCard {
title: RENDER_CONTROLS_CARD_TITLE.to_string()
tokens: tokens
subtitle: RENDER_CONTROLS_CARD_SUB
column {
style: column_tertiary_style
text {
style: text_style
{ RENDER_LABEL_BLUR_RADIUS }
}
EuvSegmented {
options: vec![
RENDER_BLUR_OPT_8.to_string(),
RENDER_BLUR_OPT_16.to_string(),
RENDER_BLUR_OPT_24.to_string(),
]
selected: blur_idx
tokens: tokens
}
text {
style: text_style
{ RENDER_LABEL_SHADOW_TIER }
}
EuvSegmented {
options: vec![
RENDER_SHADOW_OPT_SM.to_string(),
RENDER_SHADOW_OPT_MD.to_string(),
RENDER_SHADOW_OPT_LG.to_string(),
]
selected: shadow_idx
tokens: tokens
}
text {
style: text_style
{ RENDER_LABEL_GRADIENT_ANGLE }
}
EuvSegmented {
options: vec![
RENDER_ANGLE_0.to_string(),
RENDER_ANGLE_45.to_string(),
RENDER_ANGLE_90.to_string(),
RENDER_ANGLE_135.to_string(),
]
selected: angle_idx
tokens: tokens
}
EuvActionRow {
EuvButton {
label: RENDER_BTN_PULSE_DIRTY.to_string()
tokens: tokens
small()
on_click: on_pulse_dirty
}
}
text {
style: text_secondary_style
{ pulse_readout }
}
}
}
};
let shader_cache_card: NodeId = mount_render_shader_cache_card(tokens);
let column_secondary_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_MD)
};
let rail: NodeId = view! {
column {
style: column_secondary_style
{ pipeline_card }
{ controls_card }
}
};
let column_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_MD)
};
let main: NodeId = view! {
column {
style: column_style
{ vector_card }
{ shader_cache_card }
{ effects_grid }
}
};
let studio: NodeId = mount_studio_layout(main, rail);
let page: NodeId = view! {
EuvPage {
title: RENDER_TITLE.to_string()
subtitle: RENDER_SUBTITLE.to_string()
tokens: tokens
{ studio }
}
};
let scene_for_mode: SceneHandle = ctx.get_scene().clone();
let scene_for_blur: SceneHandle = ctx.get_scene().clone();
let (render_scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
let _: Effect = Effect::new(move || {
let _: usize = mode_idx.get();
scene_for_mode.mark_dirty(vector_canvas_id, DIRTY_PAINT);
});
Effect::new(move || {
let radius: f32 = render_blur_radius(blur_idx.get());
scene_for_blur.with_write(
|tree: &mut SceneTree| {
tree.set_backdrop_blur(glass_id, radius);
tree.mark_dirty(glass_id, DIRTY_PAINT);
},
(),
);
})
});
ctx.get_scene().with_write(
|tree: &mut SceneTree| {
tree.attach_scope(page, render_scope);
},
(),
);
page
}