From 82650b8084da12365184819c4f7b933c9f83db05 Mon Sep 17 00:00:00 2001 From: Abe Pazos Date: Fri, 1 Nov 2024 14:47:31 +0100 Subject: [PATCH] [orx-jumpflood] fix demo in/out detection --- .../src/jvmDemo/kotlin/DemoDistanceField01.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/orx-jumpflood/src/jvmDemo/kotlin/DemoDistanceField01.kt b/orx-jumpflood/src/jvmDemo/kotlin/DemoDistanceField01.kt index c6cdbf6c7..042977406 100644 --- a/orx-jumpflood/src/jvmDemo/kotlin/DemoDistanceField01.kt +++ b/orx-jumpflood/src/jvmDemo/kotlin/DemoDistanceField01.kt @@ -10,13 +10,17 @@ import org.openrndr.shape.Rectangle /** * Shows how to use the [DistanceField] filter. + * * Draws moving white shapes on black background, * then applies the DistanceField filter which returns a [ColorBuffer] in which * the red component encodes the distance to the closest black/white edge. - * The value is positive when on the black background and negative - * when inside white shapes. The sign is used in the [shadeStyle] to choose - * between two colors. The inverse of the distance is used to obtain a - * non-linear brightness. + * + * The value of the green component is negative when on the black background + * and positive when inside white shapes. The sign is used in the [shadeStyle] to choose + * between two colors. + * + * The inverse of the distance is used to obtain a non-linear brightness. + * * Hold down a mouse button to see the raw animation. */ fun main() = application { @@ -39,8 +43,7 @@ fun main() = application { // wavy effect // bri *= (1.0 + 0.2 * sin(distance * 0.2)); - x_fill.rgb = bri * (x_fill.r > 0 ? - vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0)); + x_fill.rgb = bri * (x_fill.g > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0)); """ } val mouseTracker = MouseTracker(mouse)