diff --git a/demo/common/src/lib.rs b/demo/common/src/lib.rs index a5c62b55..1189d042 100644 --- a/demo/common/src/lib.rs +++ b/demo/common/src/lib.rs @@ -55,7 +55,7 @@ const MOUSELOOK_ROTATION_SPEED: f32 = 0.007; const CAMERA_VELOCITY: f32 = 1000.0; // How much the scene is scaled when a scale gesture is performed. -const CAMERA_SCALE_SPEED_2D: f32 = 2.0; +const CAMERA_SCALE_SPEED_2D: f32 = 6.0; // How much the scene is scaled when a zoom button is clicked. const CAMERA_ZOOM_AMOUNT_2D: f32 = 0.1; diff --git a/demo/common/src/ui.rs b/demo/common/src/ui.rs index 029e559d..e3cd77c9 100644 --- a/demo/common/src/ui.rs +++ b/demo/common/src/ui.rs @@ -14,6 +14,7 @@ use pathfinder_geometry::basic::point::Point2DI32; use pathfinder_geometry::basic::rect::RectI32; use pathfinder_gl::debug::{DebugUI, PADDING, TEXT_COLOR, WINDOW_COLOR}; use pathfinder_gl::device::{Device, Texture}; +use pathfinder_renderer::paint::ColorU; use std::f32::consts::PI; use std::path::PathBuf; @@ -44,6 +45,9 @@ const ROTATE_PANEL_X: i32 = PADDING + (BUTTON_WIDTH + PADDING) * 3 + (PADDING + const ROTATE_PANEL_WIDTH: i32 = SLIDER_WIDTH + PADDING * 2; const ROTATE_PANEL_HEIGHT: i32 = PADDING * 2 + SLIDER_HEIGHT; +static BUTTON_ICON_COLOR: ColorU = ColorU { r: 255, g: 255, b: 255, a: 255 }; +static OUTLINE_COLOR: ColorU = ColorU { r: 255, g: 255, b: 255, a: 192 }; + static EFFECTS_PNG_NAME: &'static str = "demo-effects"; static OPEN_PNG_NAME: &'static str = "demo-open"; static ROTATE_PNG_NAME: &'static str = "demo-rotate"; @@ -94,10 +98,12 @@ impl DemoUI { bg_light_texture, bg_dark_texture, screenshot_texture, - three_d_enabled: options.three_d, - dark_background_enabled: true, + effects_panel_visible: false, rotate_panel_visible: false, + + three_d_enabled: options.three_d, + dark_background_enabled: true, gamma_correction_effect_enabled: false, stem_darkening_effect_enabled: false, subpixel_aa_effect_enabled: false, @@ -268,8 +274,10 @@ impl DemoUI { -> bool { let button_rect = RectI32::new(origin, Point2DI32::new(BUTTON_WIDTH, BUTTON_HEIGHT)); debug_ui.draw_solid_rounded_rect(button_rect, WINDOW_COLOR); - debug_ui.draw_rounded_rect_outline(button_rect, TEXT_COLOR); - debug_ui.draw_texture(origin + Point2DI32::new(PADDING, PADDING), texture, TEXT_COLOR); + debug_ui.draw_rounded_rect_outline(button_rect, OUTLINE_COLOR); + debug_ui.draw_texture(origin + Point2DI32::new(PADDING, PADDING), + texture, + BUTTON_ICON_COLOR); event.handle_mouse_down_in_rect(button_rect).is_some() } @@ -355,7 +363,7 @@ impl DemoUI { } debug_ui.draw_solid_rounded_rect(widget_rect, WINDOW_COLOR); - debug_ui.draw_rounded_rect_outline(widget_rect, TEXT_COLOR); + debug_ui.draw_rounded_rect_outline(widget_rect, OUTLINE_COLOR); let highlight_size = Point2DI32::new(SWITCH_HALF_SIZE, BUTTON_HEIGHT); if !value { diff --git a/gl/src/debug.rs b/gl/src/debug.rs index dabf285b..848b2f69 100644 --- a/gl/src/debug.rs +++ b/gl/src/debug.rs @@ -41,13 +41,13 @@ pub const PADDING: i32 = 12; pub static TEXT_COLOR: ColorU = ColorU { r: 255, g: 255, b: 255, a: 255 }; pub static WINDOW_COLOR: ColorU = ColorU { r: 0, g: 0, b: 0, a: 255 - 90 }; +static INVERTED_TEXT_COLOR: ColorU = ColorU { r: 0, g: 0, b: 0, a: 255 }; + const PERF_WINDOW_WIDTH: i32 = 375; const PERF_WINDOW_HEIGHT: i32 = LINE_HEIGHT * 6 + PADDING + 2; const FONT_ASCENT: i32 = 28; const LINE_HEIGHT: i32 = 42; -static INVERTED_TEXT_COLOR: ColorU = ColorU { r: 0, g: 0, b: 0, a: 255 }; - static FONT_JSON_FILENAME: &'static str = "debug-font.json"; static FONT_PNG_NAME: &'static str = "debug-font"; diff --git a/resources/shaders/debug_solid.fs.glsl b/resources/shaders/debug_solid.fs.glsl index 0ad312fc..54fad3ca 100644 --- a/resources/shaders/debug_solid.fs.glsl +++ b/resources/shaders/debug_solid.fs.glsl @@ -17,5 +17,5 @@ uniform vec4 uColor; out vec4 oFragColor; void main() { - oFragColor = uColor; + oFragColor = vec4(uColor.rgb, 1.0) * uColor.a; } diff --git a/resources/shaders/debug_texture.fs.glsl b/resources/shaders/debug_texture.fs.glsl index 5ab9a15d..944ff8ab 100644 --- a/resources/shaders/debug_texture.fs.glsl +++ b/resources/shaders/debug_texture.fs.glsl @@ -20,6 +20,6 @@ in vec2 vTexCoord; out vec4 oFragColor; void main() { - float alpha = texture(uTexture, vTexCoord).r; - oFragColor = uColor * alpha; + float alpha = texture(uTexture, vTexCoord).r * uColor.a; + oFragColor = alpha * vec4(uColor.rgb, 1.0); }