[orx-fx] convert to MPP

This commit is contained in:
Edwin Jakobs
2021-06-27 21:07:44 +02:00
parent 7d524df2de
commit 4dfc5c31c8
144 changed files with 1197 additions and 847 deletions

View File

@@ -0,0 +1,41 @@
package org.openrndr.extra.fx.blur
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
import org.openrndr.extra.fx.fx_frame_blur
import org.openrndr.extra.fx.mppFilterShader
import org.openrndr.extra.parameters.Description
import org.openrndr.extra.parameters.DoubleParameter
@Description("Frame blur")
class FrameBlur : Filter(mppFilterShader(fx_frame_blur, "frame-blur")) {
@DoubleParameter("blend", 0.0, 1.0)
var blend: Double by parameters
private var intermediate: ColorBuffer? = null
init {
blend = 0.5
}
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
if (target.isNotEmpty()) {
intermediate?.let {
if (it.width != target[0].width || it.height != target[0].height) {
it.destroy()
intermediate = null
}
}
if (intermediate == null) {
intermediate = colorBuffer(target[0].width, target[0].height, type = ColorType.FLOAT16)
//intermediate?.fill(ColorRGBa.TRANSPARENT)
TODO("no mpp colorbuffer.fill")
}
super.apply(arrayOf(source[0], intermediate!!), arrayOf(intermediate!!))
intermediate!!.copyTo(target[0])
}
}
}