Add parameter annotations to most orx-fx filters
This commit is contained in:
@@ -3,29 +3,36 @@ package org.openrndr.extra.fx.antialias
|
|||||||
import org.openrndr.draw.Filter
|
import org.openrndr.draw.Filter
|
||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FXAA approximate antialiasing filter. Only works on LDR inputs
|
* FXAA approximate antialiasing filter. Only works on LDR inputs
|
||||||
*/
|
*/
|
||||||
|
@Description("FXAA")
|
||||||
class FXAA : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("antialias/fxaa.frag"))) {
|
class FXAA : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("antialias/fxaa.frag"))) {
|
||||||
/**
|
/**
|
||||||
* luma threshold, default value is 0.5
|
* luma threshold, default value is 0.5
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("luma threshold", 0.0, 1.0)
|
||||||
var lumaThreshold: Double by parameters
|
var lumaThreshold: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* max search span, default value is 8.0
|
* max search span, default value is 8.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("max search span", 1.0, 16.0)
|
||||||
var maxSpan: Double by parameters
|
var maxSpan: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* direction reduce multiplier, default value is 0.0
|
* direction reduce multiplier, default value is 0.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("direction reduce multiplier", 0.0, 1.0)
|
||||||
var directionReduceMultiplier: Double by parameters
|
var directionReduceMultiplier: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* direction reduce minimum, default value is 0.0
|
* direction reduce minimum, default value is 0.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("direction reduce minium", 0.0, 1.0)
|
||||||
var directionReduceMinimum: Double by parameters
|
var directionReduceMinimum: Double by parameters
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -2,39 +2,45 @@ package org.openrndr.extra.fx.blur
|
|||||||
|
|
||||||
import org.openrndr.draw.*
|
import org.openrndr.draw.*
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
import org.openrndr.extra.parameters.IntParameter
|
||||||
|
|
||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approximate separated Gaussian blur
|
* Approximate separated Gaussian blur
|
||||||
*/
|
*/
|
||||||
|
@Description("Approximate Gaussian blur")
|
||||||
class ApproximateGaussianBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
class ApproximateGaussianBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
||||||
filterFragmentCode("blur/approximate-gaussian-blur.frag"))) {
|
filterFragmentCode("blur/approximate-gaussian-blur.frag"))) {
|
||||||
|
|
||||||
data class ColorBufferDescription(val width: Int, val height: Int, val contentScale: Double, val format: ColorFormat, val type: ColorType)
|
data class ColorBufferDescription(val width: Int, val height: Int, val contentScale: Double, val format: ColorFormat, val type: ColorType)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blur sample window, default value is 5
|
* blur sample window, default value is 5
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("window size", 1, 25)
|
||||||
var window: Int by parameters
|
var window: Int by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spread multiplier, default value is 1.0
|
* spread multiplier, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("kernel spread", 1.0, 4.0)
|
||||||
var spread: Double by parameters
|
var spread: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blur sigma, default value is 1.0
|
* blur sigma, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("kernel sigma", 0.0, 25.0)
|
||||||
var sigma: Double by parameters
|
var sigma: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* post blur gain, default value is 1.0
|
* post blur gain, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("gain", 0.0, 4.0)
|
||||||
var gain: Double by parameters
|
var gain: Double by parameters
|
||||||
|
|
||||||
|
|
||||||
private var intermediateCache = mutableMapOf<ColorBufferDescription, ColorBuffer>()
|
private var intermediateCache = mutableMapOf<ColorBufferDescription, ColorBuffer>()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package org.openrndr.extra.fx.blur
|
|||||||
import org.openrndr.draw.*
|
import org.openrndr.draw.*
|
||||||
import org.openrndr.extra.fx.blend.Add
|
import org.openrndr.extra.fx.blend.Add
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
import org.openrndr.extra.parameters.IntParameter
|
||||||
|
|
||||||
|
@Description("Bloom")
|
||||||
class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("blur/bloom.frag"))) {
|
class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("blur/bloom.frag"))) {
|
||||||
/**
|
/**
|
||||||
* the blur filter to use for the bloom, default is Approximate Gaussian Blur
|
* the blur filter to use for the bloom, default is Approximate Gaussian Blur
|
||||||
@@ -14,21 +17,25 @@ class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(Shader.createFrom
|
|||||||
/**
|
/**
|
||||||
* number of downsampled textures to use, default value is 2
|
* number of downsampled textures to use, default value is 2
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("blur iterations", 1, 8)
|
||||||
var downsamples: Int = 2
|
var downsamples: Int = 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rate of downsampling, f.ex: 4 -> 4x, 8x, 16x.., default value is 2
|
* rate of downsampling, f.ex: 4 -> 4x, 8x, 16x.., default value is 2
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("downsamping rate", 1, 4)
|
||||||
var downsampleRate: Int = 2
|
var downsampleRate: Int = 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blending amount between original image and blurred, default value is 0.5
|
* blending amount between original image and blurred, default value is 0.5
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("blend factor", 0.0, 1.0)
|
||||||
var blendFactor: Double by parameters
|
var blendFactor: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* brightness of the resulting image, default value is 0.5
|
* brightness of the resulting image, default value is 0.5
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("brightness", 0.0, 1.0)
|
||||||
var brightness: Double by parameters
|
var brightness: Double by parameters
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -62,7 +69,6 @@ class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(Shader.createFrom
|
|||||||
blur.apply(src, bufferA)
|
blur.apply(src, bufferA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for ((index, buffers) in samplers.asReversed().withIndex()) {
|
for ((index, buffers) in samplers.asReversed().withIndex()) {
|
||||||
val (bufferCurrA) = buffers
|
val (bufferCurrA) = buffers
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ package org.openrndr.extra.fx.blur
|
|||||||
|
|
||||||
import org.openrndr.draw.*
|
import org.openrndr.draw.*
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
import org.openrndr.extra.parameters.IntParameter
|
||||||
|
|
||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BoxBlur implemented as a separable filter
|
* BoxBlur implemented as a separable filter
|
||||||
*/
|
*/
|
||||||
|
@Description("Box-blur")
|
||||||
class BoxBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
class BoxBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
||||||
filterFragmentCode("blur/box-blur.frag"))) {
|
filterFragmentCode("blur/box-blur.frag"))) {
|
||||||
|
|
||||||
@@ -16,16 +20,19 @@ class BoxBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
|||||||
/**
|
/**
|
||||||
* The sample window, default is 5
|
* The sample window, default is 5
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("window size", 1, 25)
|
||||||
var window: Int by parameters
|
var window: Int by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spread multiplier, default is 1.0
|
* Spread multiplier, default is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("kernel spread", 1.0, 4.0)
|
||||||
var spread: Double by parameters
|
var spread: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post-blur gain, default is 1.0
|
* Post-blur gain, default is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("gain", 0.0, 4.0)
|
||||||
var gain: Double by parameters
|
var gain: Double by parameters
|
||||||
|
|
||||||
private var intermediateCache = mutableMapOf<ApproximateGaussianBlur.ColorBufferDescription, ColorBuffer>()
|
private var intermediateCache = mutableMapOf<ApproximateGaussianBlur.ColorBufferDescription, ColorBuffer>()
|
||||||
|
|||||||
@@ -1,33 +1,41 @@
|
|||||||
package org.openrndr.extra.fx.blur
|
package org.openrndr.extra.fx.blur
|
||||||
|
|
||||||
|
import jdk.jfr.Description
|
||||||
import org.openrndr.draw.Filter
|
import org.openrndr.draw.Filter
|
||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
import org.openrndr.extra.parameters.IntParameter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exact Gaussian blur, implemented as a single pass filter
|
* Exact Gaussian blur, implemented as a single pass filter
|
||||||
*/
|
*/
|
||||||
|
@Description("Gaussian blur")
|
||||||
class GaussianBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
class GaussianBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
||||||
filterFragmentCode("blur/gaussian-blur.frag"))) {
|
filterFragmentCode("blur/gaussian-blur.frag"))) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sample window, default value is 5
|
* The sample window, default value is 5
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("window size", 1, 25)
|
||||||
var window: Int by parameters
|
var window: Int by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spread multiplier, default value is 1.0
|
* Spread multiplier, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("kernel spread", 1.0, 4.0)
|
||||||
var spread: Double by parameters
|
var spread: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blur kernel sigma, default value is 1.0
|
* Blur kernel sigma, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("kernel sigma", 0.0, 25.0)
|
||||||
var sigma: Double by parameters
|
var sigma: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post-blur gain, default value is 1.0
|
* Post-blur gain, default value is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("gain", 0.0, 4.0)
|
||||||
var gain: Double by parameters
|
var gain: Double by parameters
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
package org.openrndr.extra.fx.blur
|
package org.openrndr.extra.fx.blur
|
||||||
|
|
||||||
|
import jdk.jfr.Description
|
||||||
import org.openrndr.draw.Filter
|
import org.openrndr.draw.Filter
|
||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
import org.openrndr.extra.parameters.IntParameter
|
||||||
|
|
||||||
|
@Description("Hash blur")
|
||||||
class HashBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
class HashBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
||||||
filterFragmentCode("blur/hash-blur.frag"))) {
|
filterFragmentCode("blur/hash-blur.frag"))) {
|
||||||
/**
|
/**
|
||||||
* Blur radius in pixels, default is 5.0
|
* Blur radius in pixels, default is 5.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("blur radius", 1.0, 25.0)
|
||||||
var radius: Double by parameters
|
var radius: Double by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,11 +24,13 @@ class HashBlur : Filter(Shader.createFromCode(Filter.filterVertexCode,
|
|||||||
/**
|
/**
|
||||||
* Number of samples, default is 30
|
* Number of samples, default is 30
|
||||||
*/
|
*/
|
||||||
|
@IntParameter("number of samples", 1, 100)
|
||||||
var samples: Int by parameters
|
var samples: Int by parameters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post-blur gain, default is 1.0
|
* Post-blur gain, default is 1.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("image gain", 0.0, 2.0)
|
||||||
var gain: Double by parameters
|
var gain: Double by parameters
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -2,16 +2,19 @@ package org.openrndr.extra.fx.color
|
|||||||
|
|
||||||
import org.openrndr.draw.*
|
import org.openrndr.draw.*
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
import org.openrndr.resourceUrl
|
import org.openrndr.resourceUrl
|
||||||
|
|
||||||
|
@Description("Chromatic Aberration")
|
||||||
class ChromaticAberration : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("color/chromatic-aberration.frag"))){
|
class ChromaticAberration : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("color/chromatic-aberration.frag"))){
|
||||||
/**
|
/**
|
||||||
* aberration factor, default value is 1.0
|
* aberration factor, default value is 8.0
|
||||||
*/
|
*/
|
||||||
|
@DoubleParameter("aberration factor", 0.0, 16.0)
|
||||||
var aberrationFactor: Double by parameters
|
var aberrationFactor: Double by parameters
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
aberrationFactor = 8.0
|
aberrationFactor = 8.0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,4 @@ import org.openrndr.draw.Filter
|
|||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
|
||||||
class ColorMix : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("color/color-mix.frag"))) {
|
class ColorMix : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("color/color-mix.frag")))
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,34 @@
|
|||||||
import org.openrndr.draw.Filter
|
import org.openrndr.draw.Filter
|
||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.BooleanParameter
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Film grain filter
|
* Film grain filter
|
||||||
*/
|
*/
|
||||||
|
@Description("film grain")
|
||||||
class FilmGrain : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("grain/film-grain.frag"))) {
|
class FilmGrain : Filter(Shader.createFromCode(Filter.filterVertexCode, filterFragmentCode("grain/film-grain.frag"))) {
|
||||||
|
|
||||||
|
@BooleanParameter("use color")
|
||||||
var useColor: Boolean by parameters
|
var useColor: Boolean by parameters
|
||||||
|
|
||||||
var time: Double by parameters;
|
var time: Double by parameters;
|
||||||
|
|
||||||
|
@DoubleParameter("grain lift ratio", 0.0, 1.0)
|
||||||
var grainLiftRatio: Double by parameters
|
var grainLiftRatio: Double by parameters
|
||||||
|
|
||||||
|
@DoubleParameter("grain strength", 0.0, 1.0)
|
||||||
var grainStrength: Double by parameters
|
var grainStrength: Double by parameters
|
||||||
|
|
||||||
|
@DoubleParameter("grain rate", 0.0, 1.0)
|
||||||
var grainRate: Double by parameters
|
var grainRate: Double by parameters
|
||||||
|
|
||||||
|
@DoubleParameter("grain pitch", 0.0, 1.0)
|
||||||
var grainPitch: Double by parameters
|
var grainPitch: Double by parameters
|
||||||
|
|
||||||
|
@DoubleParameter("color level", 0.0, 1.0)
|
||||||
var colorLevel: Double by parameters
|
var colorLevel: Double by parameters
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ package org.openrndr.extra.fx.tonemap
|
|||||||
import org.openrndr.draw.Filter
|
import org.openrndr.draw.Filter
|
||||||
import org.openrndr.draw.Shader
|
import org.openrndr.draw.Shader
|
||||||
import org.openrndr.extra.fx.filterFragmentCode
|
import org.openrndr.extra.fx.filterFragmentCode
|
||||||
|
import org.openrndr.extra.parameters.Description
|
||||||
|
import org.openrndr.extra.parameters.DoubleParameter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uncharted 2 tonemap filter
|
* Uncharted 2 tonemap filter
|
||||||
*/
|
*/
|
||||||
|
@Description("Uncharted 2 tonemap")
|
||||||
class Uncharted2Tonemap : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("tonemap/uncharted2-tonemap.frag"))) {
|
class Uncharted2Tonemap : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("tonemap/uncharted2-tonemap.frag"))) {
|
||||||
var exposureBias by parameters
|
|
||||||
|
@DoubleParameter("exposure bias", 0.0, 128.0)
|
||||||
|
var exposureBias:Double by parameters
|
||||||
init {
|
init {
|
||||||
exposureBias = 2.0
|
exposureBias = 2.0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user