[orx-jumpflood] fix demo in/out detection

This commit is contained in:
Abe Pazos
2024-11-01 14:47:31 +01:00
parent 6b89b4620d
commit 82650b8084

View File

@@ -10,13 +10,17 @@ import org.openrndr.shape.Rectangle
/** /**
* Shows how to use the [DistanceField] filter. * Shows how to use the [DistanceField] filter.
*
* Draws moving white shapes on black background, * Draws moving white shapes on black background,
* then applies the DistanceField filter which returns a [ColorBuffer] in which * then applies the DistanceField filter which returns a [ColorBuffer] in which
* the red component encodes the distance to the closest black/white edge. * 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 * The value of the green component is negative when on the black background
* between two colors. The inverse of the distance is used to obtain a * and positive when inside white shapes. The sign is used in the [shadeStyle] to choose
* non-linear brightness. * 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. * Hold down a mouse button to see the raw animation.
*/ */
fun main() = application { fun main() = application {
@@ -39,8 +43,7 @@ fun main() = application {
// wavy effect // wavy effect
// bri *= (1.0 + 0.2 * sin(distance * 0.2)); // bri *= (1.0 + 0.2 * sin(distance * 0.2));
x_fill.rgb = bri * (x_fill.r > 0 ? x_fill.rgb = bri * (x_fill.g > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0));
vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0));
""" """
} }
val mouseTracker = MouseTracker(mouse) val mouseTracker = MouseTracker(mouse)