[orx-fx] Use the appropriate FilterNto1 interfaces
* Fix webgl 2 compatibility * Add LumaLaplacian, ACESTonemap, ReinhardTonemap, DirectionalHashBlur
This commit is contained in:
@@ -14,7 +14,7 @@ import org.openrndr.math.Vector2
|
||||
* Approximate separated Gaussian blur
|
||||
*/
|
||||
@Description("Approximate Gaussian blur")
|
||||
class ApproximateGaussianBlur : Filter(mppFilterShader(fx_approximate_gaussian_blur, "approximate gaussian blur")) {
|
||||
class ApproximateGaussianBlur : Filter1to1(mppFilterShader(fx_approximate_gaussian_blur, "approximate gaussian blur")) {
|
||||
/**
|
||||
* blur sample window, default value is 5
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Bloom")
|
||||
class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(mppFilterShader(fx_bloom, "bloom")) {
|
||||
class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter1to1(mppFilterShader(fx_bloom, "bloom")) {
|
||||
/**
|
||||
* the blur filter to use for the bloom, default is Approximate Gaussian Blur
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.openrndr.math.Vector2
|
||||
* BoxBlur implemented as a separable filter
|
||||
*/
|
||||
@Description("Box-blur")
|
||||
class BoxBlur : Filter(mppFilterShader(fx_box_blur,"box-blur")) {
|
||||
class BoxBlur : Filter1to1(mppFilterShader(fx_box_blur,"box-blur")) {
|
||||
|
||||
data class ColorBufferDescription(val width: Int, val height: Int, val contentScale: Double, val format: ColorFormat, val type: ColorType)
|
||||
|
||||
|
||||
@@ -12,7 +12,13 @@ import org.openrndr.extra.parameters.IntParameter
|
||||
* Directional blur filter. Takes source image and direction buffer inputs
|
||||
*/
|
||||
@Description("Directional blur")
|
||||
class DirectionalBlur : Filter(mppFilterShader(fx_directional_blur, "directional-blur")) {
|
||||
class DirectionalBlur : Filter2to1(mppFilterShader(fx_directional_blur, "directional-blur")) {
|
||||
|
||||
/**
|
||||
* Should the blur window be centered, default is false
|
||||
*/
|
||||
@BooleanParameter("center window")
|
||||
var centerWindow: Boolean by parameters
|
||||
|
||||
/**
|
||||
* The sample window, default is 5
|
||||
@@ -38,11 +44,14 @@ class DirectionalBlur : Filter(mppFilterShader(fx_directional_blur, "directional
|
||||
@BooleanParameter("perpendicular")
|
||||
var perpendicular: Boolean by parameters
|
||||
|
||||
|
||||
|
||||
init {
|
||||
window = 5
|
||||
spread = 1.0
|
||||
gain = 1.0
|
||||
perpendicular = false
|
||||
centerWindow = false
|
||||
}
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Frame blur")
|
||||
class FrameBlur : Filter(mppFilterShader(fx_frame_blur, "frame-blur")) {
|
||||
class FrameBlur : Filter1to1(mppFilterShader(fx_frame_blur, "frame-blur")) {
|
||||
|
||||
@DoubleParameter("blend", 0.0, 1.0)
|
||||
var blend: Double by parameters
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.Filter1to1
|
||||
import org.openrndr.extra.fx.fx_gaussian_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.openrndr.extra.parameters.IntParameter
|
||||
* Exact Gaussian blur, implemented as a single pass filter
|
||||
*/
|
||||
@Description("Gaussian blur")
|
||||
class GaussianBlur : Filter(mppFilterShader(fx_gaussian_blur,"gaussian-blur")) {
|
||||
class GaussianBlur : Filter1to1(mppFilterShader(fx_gaussian_blur,"gaussian-blur")) {
|
||||
|
||||
/**
|
||||
* The sample window, default value is 5
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.Filter1to1
|
||||
import org.openrndr.draw.Filter2to1
|
||||
import org.openrndr.draw.Filter3to1
|
||||
import org.openrndr.extra.fx.fx_directional_hash_blur
|
||||
import org.openrndr.extra.fx.fx_hash_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
@@ -8,7 +12,10 @@ import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Hash blur")
|
||||
class HashBlur : Filter(mppFilterShader(fx_hash_blur, "hash-blur")) {
|
||||
class HashBlur : Filter1to1(mppFilterShader(fx_hash_blur, "hash-blur")) {
|
||||
private var dynamic: Boolean by parameters
|
||||
|
||||
|
||||
/**
|
||||
* Blur radius in pixels, default is 5.0
|
||||
*/
|
||||
@@ -33,9 +40,125 @@ class HashBlur : Filter(mppFilterShader(fx_hash_blur, "hash-blur")) {
|
||||
var gain: Double by parameters
|
||||
|
||||
init {
|
||||
dynamic = false
|
||||
radius = 5.0
|
||||
time = 0.0
|
||||
samples = 30
|
||||
gain = 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Description("Hash blur")
|
||||
class HashBlurDynamic: Filter2to1(mppFilterShader(fx_hash_blur, "hash-blur")) {
|
||||
|
||||
private var dynamic: Boolean by parameters
|
||||
|
||||
/**
|
||||
* Blur radius in pixels, default is 5.0
|
||||
*/
|
||||
@DoubleParameter("blur radius", 1.0, 25.0)
|
||||
var radius: Double by parameters
|
||||
|
||||
/**
|
||||
* Time/seed, this should be fed with seconds, default is 0.0
|
||||
*/
|
||||
var time: Double by parameters
|
||||
|
||||
/**
|
||||
* Number of samples, default is 30
|
||||
*/
|
||||
@IntParameter("number of samples", 1, 100)
|
||||
var samples: Int by parameters
|
||||
|
||||
/**
|
||||
* Post-blur gain, default is 1.0
|
||||
*/
|
||||
@DoubleParameter("image gain", 0.0, 2.0)
|
||||
var gain: Double by parameters
|
||||
|
||||
init {
|
||||
dynamic = true
|
||||
radius = 5.0
|
||||
time = 0.0
|
||||
samples = 30
|
||||
gain = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
@Description("Directional hash blur")
|
||||
class DirectionalHashBlur : Filter2to1(mppFilterShader(fx_directional_hash_blur, "directional-hash-blur")) {
|
||||
|
||||
/**
|
||||
* Blur radius in pixels, default is 5.0
|
||||
*/
|
||||
@DoubleParameter("blur radius", 0.0, 25.0)
|
||||
var radius: Double by parameters
|
||||
|
||||
@DoubleParameter("blur spread", 0.0, 25.0)
|
||||
var spread: Double by parameters
|
||||
|
||||
|
||||
/**
|
||||
* Time/seed, this should be fed with seconds, default is 0.0
|
||||
*/
|
||||
var time: Double by parameters
|
||||
|
||||
/**
|
||||
* Number of samples, default is 30
|
||||
*/
|
||||
@IntParameter("number of samples", 1, 100)
|
||||
var samples: Int by parameters
|
||||
|
||||
/**
|
||||
* Post-blur gain, default is 1.0
|
||||
*/
|
||||
@DoubleParameter("image gain", 0.0, 2.0)
|
||||
var gain: Double by parameters
|
||||
|
||||
init {
|
||||
radius = 5.0
|
||||
spread = 25.0
|
||||
time = 0.0
|
||||
samples = 30
|
||||
gain = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
@Description("Directional hash blur")
|
||||
class DirectionalHashBlurDynamic : Filter3to1(mppFilterShader("#define RADIUS_FROM_TEXTURE\n${fx_directional_hash_blur}", "directional-hash-blur")) {
|
||||
|
||||
/**
|
||||
* Blur radius in pixels, default is 5.0
|
||||
*/
|
||||
@DoubleParameter("blur radius", 0.0, 25.0)
|
||||
var radius: Double by parameters
|
||||
|
||||
@DoubleParameter("blur spread", 0.0, 25.0)
|
||||
var spread: Double by parameters
|
||||
|
||||
|
||||
/**
|
||||
* Time/seed, this should be fed with seconds, default is 0.0
|
||||
*/
|
||||
var time: Double by parameters
|
||||
|
||||
/**
|
||||
* Number of samples, default is 30
|
||||
*/
|
||||
@IntParameter("number of samples", 1, 100)
|
||||
var samples: Int by parameters
|
||||
|
||||
/**
|
||||
* Post-blur gain, default is 1.0
|
||||
*/
|
||||
@DoubleParameter("image gain", 0.0, 2.0)
|
||||
var gain: Double by parameters
|
||||
|
||||
init {
|
||||
radius = 5.0
|
||||
spread = 25.0
|
||||
time = 0.0
|
||||
samples = 30
|
||||
gain = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ private class LaserBlurPass : Filter(mppFilterShader(fx_laser_blur, "laser-blur"
|
||||
}
|
||||
|
||||
@Description("Laser blur")
|
||||
class LaserBlur : Filter() {
|
||||
class LaserBlur : Filter1to1() {
|
||||
@Vector2Parameter("center", order = 0)
|
||||
var center = Vector2.ZERO
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlin.math.sin
|
||||
* BoxBlur implemented as a separable filter
|
||||
*/
|
||||
@Description("Line blur")
|
||||
class LineBlur : Filter(mppFilterShader(fx_box_blur, "line-blur")) {
|
||||
class LineBlur : Filter1to1(mppFilterShader(fx_box_blur, "line-blur")) {
|
||||
|
||||
/**
|
||||
* The sample window, default is 5
|
||||
|
||||
@@ -42,7 +42,7 @@ class BloomCombine : Filter(mppFilterShader(fx_bloom_combine, "bloom-combine"))
|
||||
}
|
||||
|
||||
@Description("MipBloom")
|
||||
open class MipBloom<T : Filter>(val blur: T) : Filter(mppFilterShader(fx_bloom_combine, "bloom-combine")) {
|
||||
open class MipBloom<T : Filter>(val blur: T) : Filter1to1(mppFilterShader(fx_bloom_combine, "bloom-combine")) {
|
||||
var passes = 6
|
||||
|
||||
@DoubleParameter("shape", 0.0, 4.0)
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
@Description("Zoom Blur")
|
||||
class ZoomBlur : Filter(mppFilterShader(fx_zoom_blur, "zoom-blur")) {
|
||||
class ZoomBlur : Filter1to1(mppFilterShader(fx_zoom_blur, "zoom-blur")) {
|
||||
var center: Vector2 by parameters
|
||||
|
||||
@DoubleParameter("strength", 0.0, 1.0)
|
||||
|
||||
Reference in New Issue
Block a user