[orx-integral-image] Add DemoFII02

This commit is contained in:
Edwin Jakobs
2024-06-29 10:21:02 +02:00
parent b7ec47c17f
commit 6f3adba383
2 changed files with 92 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
/**
* Apply box blurs with large windows
*/
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
@@ -10,7 +14,7 @@ fun main() = application {
}
program {
val fii = FastIntegralImage()
val target = colorBuffer(width, height, 1.0, ColorFormat.RGBa, ColorType.FLOAT32)
val integralImage = colorBuffer(width, height, 1.0, ColorFormat.RGBa, ColorType.FLOAT32)
val rt = renderTarget(width, height) {
colorBuffer()
}
@@ -22,7 +26,7 @@ fun main() = application {
drawer.fill = ColorRGBa.PINK.shade(1.0)
drawer.circle(mouse.position, 128.0)
}
fii.apply(rt.colorBuffer(0), target)
fii.apply(rt.colorBuffer(0), integralImage)
// -- here we sample from the integral image
drawer.shadeStyle = shadeStyle {
@@ -36,7 +40,7 @@ fun main() = application {
x_fill = (t11 - t01 - t10 + t00) / ((2.0 * w +1.0) * (2.0 * w + 1.0));
""".trimIndent()
}
drawer.image(target)
drawer.image(integralImage)
}
}
}