[orx-fx] convert to MPP
This commit is contained in:
@@ -2,13 +2,12 @@ package org.openrndr.extra.fx
|
||||
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.Shader
|
||||
import org.openrndr.draw.filterShaderFromCode
|
||||
import org.openrndr.internal.Driver
|
||||
import org.openrndr.resourceUrl
|
||||
|
||||
internal class FilterTools
|
||||
|
||||
|
||||
internal fun filterFragmentUrl(resourceId: String): String {
|
||||
return resourceUrl("gl3/$resourceId", FilterTools::class)
|
||||
}
|
||||
fun mppFilterShader(code: String, name: String) : Shader =
|
||||
filterShaderFromCode("${Driver.instance.shaderConfiguration()}\n${code}", name)
|
||||
|
||||
internal data class ColorBufferDescription(val width: Int, val height: Int, val contentScale: Double, val format: ColorFormat, val type: ColorType)
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.openrndr.extra.fx.antialias
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_fxaa
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.openrndr.extra.parameters.DoubleParameter
|
||||
* FXAA approximate antialiasing filter. Only works on LDR inputs
|
||||
*/
|
||||
@Description("FXAA")
|
||||
class FXAA : Filter(filterShaderFromUrl(filterFragmentUrl("antialias/fxaa.frag"))) {
|
||||
class FXAA : Filter( mppFilterShader(fx_fxaa, "fxaa")) {
|
||||
/**
|
||||
* luma threshold, default value is 0.5
|
||||
*/
|
||||
115
orx-fx/src/commonMain/kotlin/blend/BlendFilters.kt
Normal file
115
orx-fx/src/commonMain/kotlin/blend/BlendFilters.kt
Normal file
@@ -0,0 +1,115 @@
|
||||
package org.openrndr.extra.fx.blend
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.extra.fx.*
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
|
||||
class ColorBurn : Filter(mppFilterShader(fx_color_burn, "color-burn")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class ColorDodge : Filter(mppFilterShader(fx_color_dodge, "color-dodge")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Darken : Filter(mppFilterShader(fx_darken, "darken")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class HardLight : Filter(mppFilterShader(fx_hard_light, "hard-light")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Lighten : Filter(mppFilterShader(fx_lighten, "lighten")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Multiply : Filter(mppFilterShader(fx_multiply,"multiply")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Normal : Filter(mppFilterShader(fx_normal, "normal")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Overlay : Filter(mppFilterShader(fx_overlay, "overlay")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Screen : Filter(mppFilterShader(fx_screen, "screen")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SourceIn : Filter(mppFilterShader(fx_source_in, "source-in"))
|
||||
class SourceOut : Filter(mppFilterShader(fx_source_out,"source-out"))
|
||||
class SourceAtop : Filter(mppFilterShader(fx_source_atop, "source-atop"))
|
||||
class DestinationIn : Filter(mppFilterShader(fx_destination_in, "destination-in"))
|
||||
class DestinationOut : Filter(mppFilterShader(fx_destination_out, "destination-out"))
|
||||
class DestinationAtop : Filter(mppFilterShader(fx_destination_atop, "destination-atop"))
|
||||
class Xor : Filter(mppFilterShader(fx_xor, "xor"))
|
||||
|
||||
class MultiplyContrast : Filter(mppFilterShader(fx_multiply_contrast, "multiply-contrast"))
|
||||
|
||||
class Passthrough : Filter(mppFilterShader(fx_passthrough, "passthrough"))
|
||||
class Add : Filter(mppFilterShader(fx_add, "add")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
class Subtract : Filter(mppFilterShader(fx_subtract,"subtract")) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@ package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.ColorBufferDescription
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_approximate_gaussian_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
@@ -13,7 +14,7 @@ import org.openrndr.math.Vector2
|
||||
* Approximate separated Gaussian blur
|
||||
*/
|
||||
@Description("Approximate Gaussian blur")
|
||||
class ApproximateGaussianBlur : Filter(filterShaderFromUrl(filterFragmentUrl(("blur/approximate-gaussian-blur.frag")))) {
|
||||
class ApproximateGaussianBlur : Filter(mppFilterShader(fx_approximate_gaussian_blur, "approximate gaussian blur")) {
|
||||
/**
|
||||
* blur sample window, default value is 5
|
||||
*/
|
||||
@@ -2,13 +2,14 @@ package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.blend.Add
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_bloom
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
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(filterShaderFromUrl(filterFragmentUrl("blur/bloom.frag"))) {
|
||||
class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(mppFilterShader(fx_bloom, "bloom")) {
|
||||
/**
|
||||
* the blur filter to use for the bloom, default is Approximate Gaussian Blur
|
||||
*/
|
||||
@@ -59,8 +60,8 @@ class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(filterShaderFromU
|
||||
|
||||
for (downsample in 0 until downsamples) {
|
||||
val div = 1 shl downsample
|
||||
val bufferA = colorBuffer(dest.width/div, dest.height/div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||
val bufferB = colorBuffer(dest.width/div, dest.height/div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||
val bufferA = colorBuffer(dest.width / div, dest.height / div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||
val bufferB = colorBuffer(dest.width / div, dest.height / div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||
samplers.add(Pair(bufferA, bufferB))
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_box_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
@@ -12,7 +13,7 @@ import org.openrndr.math.Vector2
|
||||
* BoxBlur implemented as a separable filter
|
||||
*/
|
||||
@Description("Box-blur")
|
||||
class BoxBlur : Filter(filterShaderFromUrl(filterFragmentUrl("blur/box-blur.frag"))) {
|
||||
class BoxBlur : Filter(mppFilterShader(fx_box_blur,"box-blur")) {
|
||||
|
||||
data class ColorBufferDescription(val width: Int, val height: Int, val contentScale: Double, val format: ColorFormat, val type: ColorType)
|
||||
|
||||
@@ -2,12 +2,13 @@ package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
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(filterShaderFromUrl(filterFragmentUrl("blur/frame-blur.frag"))) {
|
||||
class FrameBlur : Filter(mppFilterShader(fx_frame_blur, "frame-blur")) {
|
||||
|
||||
@DoubleParameter("blend", 0.0, 1.0)
|
||||
var blend: Double by parameters
|
||||
@@ -25,17 +26,16 @@ class FrameBlur : Filter(filterShaderFromUrl(filterFragmentUrl("blur/frame-blur.
|
||||
it.destroy()
|
||||
intermediate = null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (intermediate == null) {
|
||||
intermediate = colorBuffer(target[0].width, target[0].height, type = ColorType.FLOAT16)
|
||||
intermediate?.fill(ColorRGBa.TRANSPARENT)
|
||||
//intermediate?.fill(ColorRGBa.TRANSPARENT)
|
||||
TODO("no mpp colorbuffer.fill")
|
||||
}
|
||||
|
||||
super.apply(arrayOf(source[0], intermediate!!), arrayOf(intermediate!!))
|
||||
intermediate!!.copyTo(target[0])
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_gaussian_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
@@ -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(filterShaderFromUrl(filterFragmentUrl("blur/gaussian-blur.frag"))) {
|
||||
class GaussianBlur : Filter(mppFilterShader(fx_gaussian_blur,"gaussian-blur")) {
|
||||
|
||||
/**
|
||||
* The sample window, default value is 5
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_hash_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Hash blur")
|
||||
class HashBlur : Filter(filterShaderFromUrl(filterFragmentUrl("blur/hash-blur.frag"))) {
|
||||
class HashBlur : Filter(mppFilterShader(fx_hash_blur, "hash-blur")) {
|
||||
/**
|
||||
* Blur radius in pixels, default is 5.0
|
||||
*/
|
||||
@@ -1,14 +1,13 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.ColorBuffer
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.fx_laser_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import kotlin.math.pow
|
||||
|
||||
private class LaserBlurPass : Filter(filterShaderFromUrl(filterFragmentUrl("blur/laser-blur.frag"))) {
|
||||
private class LaserBlurPass : Filter(mppFilterShader(fx_laser_blur, "laser-blur")) {
|
||||
var radius: Double by parameters
|
||||
var amp0: Double by parameters
|
||||
var amp1: Double by parameters
|
||||
@@ -96,7 +95,7 @@ class LaserBlur : Filter() {
|
||||
intermediates.add(source[0].createEquivalent(type = ColorType.FLOAT16))
|
||||
}
|
||||
|
||||
pass.radius = 1.0 + Math.pow(exp, 0.0) * radius
|
||||
pass.radius = 1.0 + pow(exp, 0.0) * radius
|
||||
|
||||
pass.linearInput = linearInput
|
||||
pass.linearOutput = true
|
||||
@@ -105,12 +104,16 @@ class LaserBlur : Filter() {
|
||||
pass.linearInput = true
|
||||
pass.linearOutput = true
|
||||
|
||||
pass.radius = 1.0 + Math.pow(exp, i + 1.0) * radius //(1.0 + simplex(0, phase + i)) / 2.0
|
||||
pass.radius = 1.0 + pow(exp, i + 1.0) * radius //(1.0 + simplex(0, phase + i)) / 2.0
|
||||
pass.apply(intermediates[i % 2], intermediates[(i + 1) % 2])
|
||||
}
|
||||
pass.radius = 1.0 + Math.pow(exp, (passes) * 1.0) * radius
|
||||
pass.radius = 1.0 + pow(exp, (passes) * 1.0) * radius
|
||||
pass.linearInput = true
|
||||
pass.linearOutput = linearOutput
|
||||
pass.apply(intermediates[(passes + 1) % 2], target[0])
|
||||
}
|
||||
}
|
||||
|
||||
private fun pow(a: Double, x: Double): Double {
|
||||
return a.pow(x)
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_bloom_combine
|
||||
import org.openrndr.extra.fx.fx_bloom_downscale
|
||||
import org.openrndr.extra.fx.fx_bloom_upscale
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
@@ -10,9 +13,9 @@ import org.openrndr.extra.parameters.IntParameter
|
||||
import org.openrndr.filter.color.delinearize
|
||||
import org.openrndr.filter.color.linearize
|
||||
|
||||
class BloomDownscale : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-downscale.frag")))
|
||||
class BloomDownscale : Filter(mppFilterShader(fx_bloom_downscale,"bloom-downscale"))
|
||||
|
||||
class BloomUpscale : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-upscale.frag"))) {
|
||||
class BloomUpscale : Filter(mppFilterShader(fx_bloom_upscale, "bloom-upscale")) {
|
||||
var gain: Double by parameters
|
||||
var shape: Double by parameters
|
||||
var noiseSeed: Double by parameters
|
||||
@@ -26,7 +29,7 @@ class BloomUpscale : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-up
|
||||
}
|
||||
}
|
||||
|
||||
class BloomCombine : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-combine.frag"))) {
|
||||
class BloomCombine : Filter(mppFilterShader(fx_bloom_combine, "bloom-combine")) {
|
||||
var gain: Double by parameters
|
||||
var bias: ColorRGBa by parameters
|
||||
|
||||
@@ -37,7 +40,7 @@ class BloomCombine : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-co
|
||||
}
|
||||
|
||||
@Description("MipBloom")
|
||||
open class MipBloom<T : Filter>(val blur: T) : Filter(filterShaderFromUrl(filterFragmentUrl("blur/bloom-combine.frag"))) {
|
||||
open class MipBloom<T : Filter>(val blur: T) : Filter(mppFilterShader(fx_bloom_combine, "bloom-combine")) {
|
||||
var passes = 6
|
||||
|
||||
@DoubleParameter("shape", 0.0, 4.0)
|
||||
@@ -154,7 +157,6 @@ class GaussianBloom : MipBloom<GaussianBlur>(blur = GaussianBlur()) {
|
||||
@DoubleParameter("kernel sigma", 0.0, 25.0)
|
||||
var sigma: Double = 1.0
|
||||
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
blur.window = window
|
||||
blur.sigma = sigma
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.openrndr.extra.fx.blur
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_zoom_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
@Description("Zoom Blur")
|
||||
class ZoomBlur : Filter(filterShaderFromUrl(filterFragmentUrl("blur/zoom-blur.frag"))) {
|
||||
class ZoomBlur : Filter(mppFilterShader(fx_zoom_blur, "zoom-blur")) {
|
||||
var center: Vector2 by parameters
|
||||
|
||||
@DoubleParameter("strength", 0.0, 1.0)
|
||||
@@ -28,7 +29,8 @@ class ZoomBlur : Filter(filterShaderFromUrl(filterFragmentUrl("blur/zoom-blur.fr
|
||||
}
|
||||
|
||||
if (intermediate == null) {
|
||||
intermediate = colorBuffer(target[0].width, target[0].height, target[0].contentScale, target[0].format, target[0].type)
|
||||
intermediate =
|
||||
colorBuffer(target[0].width, target[0].height, target[0].contentScale, target[0].format, target[0].type)
|
||||
}
|
||||
|
||||
intermediate?.let {
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_chromatic_aberration
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
|
||||
@Description("Chromatic Aberration")
|
||||
class ChromaticAberration : Filter(filterShaderFromUrl(filterFragmentUrl("color/chromatic-aberration.frag"))){
|
||||
class ChromaticAberration : Filter(mppFilterShader(fx_chromatic_aberration, "chromatic-aberration")) {
|
||||
/**
|
||||
* aberration factor, default value is 8.0
|
||||
*/
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_color_correction
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Color correction")
|
||||
class ColorCorrection : Filter(filterShaderFromUrl(filterFragmentUrl("color/color-correction.frag"))) {
|
||||
class ColorCorrection : Filter(mppFilterShader(fx_color_correction, "color-correction")) {
|
||||
@DoubleParameter("brightness", -1.0, 1.0, order = 0)
|
||||
var brightness: Double by parameters
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_color_lookup
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
class ColorLookup(lookup: ColorBuffer) : Filter(filterShaderFromUrl(filterFragmentUrl("color/color-lookup.frag"))) {
|
||||
class ColorLookup(lookup: ColorBuffer) : Filter(mppFilterShader(fx_color_lookup, "color-lookup")) {
|
||||
/** a color look-up texture */
|
||||
var lookup: ColorBuffer by parameters
|
||||
|
||||
@@ -2,20 +2,20 @@ package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_color_mix
|
||||
import org.openrndr.extra.fx.fx_color_tint
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
|
||||
class ColorMix : Filter(filterShaderFromUrl(filterFragmentUrl("color/color-mix.frag")))
|
||||
class ColorMix : Filter(mppFilterShader(fx_color_mix, "color-mix"))
|
||||
|
||||
@Description("Tint")
|
||||
class ColorTint : Filter(filterShaderFromUrl(filterFragmentUrl("color/color-tint.frag"))) {
|
||||
class ColorTint : Filter(mppFilterShader(fx_color_tint, "color-tint")) {
|
||||
@ColorParameter("tint")
|
||||
var tint: ColorRGBa by parameters
|
||||
|
||||
init {
|
||||
tint = ColorRGBa.PINK
|
||||
}
|
||||
|
||||
}
|
||||
9
orx-fx/src/commonMain/kotlin/color/Colorspaces.kt
Normal file
9
orx-fx/src/commonMain/kotlin/color/Colorspaces.kt
Normal file
@@ -0,0 +1,9 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.extra.fx.fx_rgb_to_ycbcr
|
||||
import org.openrndr.extra.fx.fx_ycbcr_to_rgb
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
class RgbToYCbcr : Filter(mppFilterShader(fx_rgb_to_ycbcr, "rgb-to-ycbcr"))
|
||||
class YcbcrToRgb : Filter(mppFilterShader(fx_ycbcr_to_rgb, "ycbcr_to_rgb"))
|
||||
@@ -2,14 +2,14 @@ package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_luma_map
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Luma map ")
|
||||
class LumaMap : Filter(filterShaderFromUrl(filterFragmentUrl("color/luma-map.frag"))) {
|
||||
class LumaMap : Filter(mppFilterShader(fx_luma_map, "luma-map")) {
|
||||
@ColorParameter("foreground color")
|
||||
var foreground: ColorRGBa by parameters
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_luma_opacity
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Luma map ")
|
||||
class LumaOpacity : Filter(filterShaderFromUrl(filterFragmentUrl("color/luma-opacity.frag"))) {
|
||||
class LumaOpacity : Filter(mppFilterShader(fx_luma_opacity, "luma-opacity")) {
|
||||
@DoubleParameter("foreground luma",0.0, 1.0)
|
||||
var foregroundLuma: Double by parameters
|
||||
|
||||
@@ -2,14 +2,14 @@ package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_luma_threshold
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Luma threshold ")
|
||||
class LumaThreshold : Filter(filterShaderFromUrl(filterFragmentUrl("color/luma-threshold.frag"))) {
|
||||
class LumaThreshold : Filter(mppFilterShader(fx_luma_threshold, "luma-threshold")) {
|
||||
@DoubleParameter("threshold value", 0.0, 1.0)
|
||||
var threshold: Double by parameters
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_pal
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Pal TV Effect")
|
||||
class Pal : Filter(filterShaderFromUrl(filterFragmentUrl("color/pal.frag"))) {
|
||||
class Pal : Filter(mppFilterShader(fx_pal,"pal")) {
|
||||
@DoubleParameter("amount", 0.0, 1.0)
|
||||
var amount: Double by parameters
|
||||
@DoubleParameter("pixelation", 0.0, 1.0)
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_sepia
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Sepia")
|
||||
class Sepia : Filter(filterShaderFromUrl(filterFragmentUrl("color/sepia.frag"))) {
|
||||
class Sepia : Filter(mppFilterShader(fx_sepia, "sepia")) {
|
||||
@DoubleParameter("amount", 0.0, 1.0)
|
||||
var amount: Double by parameters
|
||||
|
||||
@@ -2,15 +2,14 @@ package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_set_background
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Set background")
|
||||
class SetBackground : Filter(filterShaderFromUrl(filterFragmentUrl("color/set-background.frag"))) {
|
||||
|
||||
class SetBackground : Filter(mppFilterShader(fx_set_background, "set-background")) {
|
||||
@ColorParameter("background color")
|
||||
var background: ColorRGBa by parameters
|
||||
|
||||
@@ -2,10 +2,10 @@ package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_subtract_constant
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
class SubtractConstant : Filter(filterShaderFromUrl(filterFragmentUrl("color/subtract-constant.frag"))) {
|
||||
class SubtractConstant : Filter(mppFilterShader(fx_subtract_constant, "subtract-constant")) {
|
||||
var constant: ColorRGBa by parameters
|
||||
|
||||
init {
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_block_repeat
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Block repeat")
|
||||
class BlockRepeat : Filter(filterShaderFromUrl(filterFragmentUrl("distort/block-repeat.frag"))) {
|
||||
class BlockRepeat : Filter(mppFilterShader(fx_block_repeat, "block-repeat")) {
|
||||
@DoubleParameter("block width", 0.0, 1.0, order = 0)
|
||||
var blockWidth: Double by parameters
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_displace_blend
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector3
|
||||
|
||||
@Description("Perturb")
|
||||
class DisplaceBlend : Filter(filterShaderFromUrl(filterFragmentUrl("distort/displace-blend.frag"))) {
|
||||
@Description("Displace blend")
|
||||
class DisplaceBlend : Filter(mppFilterShader(fx_displace_blend, "displace-blend")) {
|
||||
var seed: Vector3 by parameters
|
||||
|
||||
@DoubleParameter("offset", -1.0, 1.0)
|
||||
@@ -1,25 +1,24 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_fisheye
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Fisheye")
|
||||
class Fisheye : Filter(filterShaderFromUrl(filterFragmentUrl("distort/fisheye.frag"))) {
|
||||
class Fisheye : Filter(mppFilterShader(fx_fisheye, "fisheye")) {
|
||||
@DoubleParameter("strength", -1.0, 1.0, order = 0)
|
||||
var strength: Double by parameters
|
||||
|
||||
@DoubleParameter("scale", 0.0, 2.0, order = 0)
|
||||
var scale: Double by parameters
|
||||
|
||||
|
||||
@DoubleParameter("feather", 0.0, 100.0, order = 1)
|
||||
var feather: Double by parameters
|
||||
|
||||
@DoubleParameter("rotation", -180.0, 180.0, order = 1)
|
||||
var rotation : Double by parameters
|
||||
|
||||
var rotation: Double by parameters
|
||||
|
||||
init {
|
||||
strength = 0.1
|
||||
@@ -35,6 +34,5 @@ class Fisheye : Filter(filterShaderFromUrl(filterFragmentUrl("distort/fisheye.fr
|
||||
source[0].filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
||||
}
|
||||
super.apply(source, target)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,22 +2,22 @@ package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.ColorBuffer
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.isEquivalentTo
|
||||
import org.openrndr.extra.fx.fx_fluid_distort
|
||||
import org.openrndr.extra.fx.fx_uvmap
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import kotlin.math.cos
|
||||
|
||||
private class UVMap: Filter(filterShaderFromUrl(filterFragmentUrl("distort/uvmap.frag"))) {
|
||||
private class UVMap: Filter( mppFilterShader(fx_uvmap, "uvmap"))
|
||||
|
||||
}
|
||||
|
||||
private class FluidDistortFilter : Filter(filterShaderFromUrl(filterFragmentUrl("distort/fluid-distort.frag"))) {
|
||||
private class FluidDistortFilter : Filter(mppFilterShader(fx_fluid_distort, "fluid-distort")) {
|
||||
var blend : Double by parameters
|
||||
var random: Double by parameters
|
||||
init {
|
||||
blend = 0.0
|
||||
random = 0.0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FluidDistort : Filter() {
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_perspective_plane
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
@@ -9,7 +10,7 @@ import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.transforms.transform
|
||||
|
||||
@Description("Perspective plane")
|
||||
class PerspectivePlane : Filter(filterShaderFromUrl(filterFragmentUrl("distort/perspective-plane.frag"))) {
|
||||
class PerspectivePlane : Filter(mppFilterShader(fx_perspective_plane, "perspective-plane")) {
|
||||
// @DoubleParameter("camera x", -1.0, 1.0, order = 0)
|
||||
var cameraX: Double = 0.0
|
||||
// @DoubleParameter("camera y", -1.0, 1.0, order = 1)
|
||||
@@ -1,16 +1,15 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_perturb
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.Vector4
|
||||
|
||||
@Description("Perturb")
|
||||
class Perturb : Filter(filterShaderFromUrl(filterFragmentUrl("distort/perturb.frag"))) {
|
||||
class Perturb : Filter(mppFilterShader(fx_perturb, "perturb")) {
|
||||
var seed: Vector3 by parameters
|
||||
|
||||
/**
|
||||
* base noise scale, default is Vector3(1.0, 1.0, 1.0)
|
||||
*/
|
||||
@@ -1,23 +1,26 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_stack_repeat
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Stack repeat")
|
||||
class StackRepeat : Filter(filterShaderFromUrl(filterFragmentUrl("distort/stack-repeat.frag"))) {
|
||||
class StackRepeat : Filter(mppFilterShader(fx_stack_repeat, "stack-repeat")) {
|
||||
@DoubleParameter("zoom", -1.0, 1.0, order = 0)
|
||||
var zoom: Double by parameters
|
||||
|
||||
@DoubleParameter("x-origin", -1.0, 1.0, order = 1)
|
||||
var xOrigin: Double by parameters
|
||||
|
||||
@DoubleParameter("y-origin", -1.0, 1.0, order = 2)
|
||||
var yOrigin: Double by parameters
|
||||
|
||||
@DoubleParameter("x-offset", -1.0, 1.0, order = 3)
|
||||
var xOffset: Double by parameters
|
||||
|
||||
@DoubleParameter("y-offset", -1.0, 1.0, order = 4)
|
||||
var yOffset: Double by parameters
|
||||
|
||||
@@ -36,6 +39,7 @@ class StackRepeat : Filter(filterShaderFromUrl(filterFragmentUrl("distort/stack-
|
||||
yOrigin = 0.0
|
||||
rotation = 0.0
|
||||
}
|
||||
|
||||
var bicubicFiltering = true
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
if (bicubicFiltering && source.isNotEmpty()) {
|
||||
@@ -44,5 +48,4 @@ class StackRepeat : Filter(filterShaderFromUrl(filterFragmentUrl("distort/stack-
|
||||
}
|
||||
super.apply(source, target)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_stretch_waves
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Stretch waves")
|
||||
class StretchWaves : Filter(filterShaderFromUrl(filterFragmentUrl("distort/stretch-waves.frag"))) {
|
||||
class StretchWaves : Filter(mppFilterShader(fx_stretch_waves, "stretch-waves")) {
|
||||
@DoubleParameter("distortion", -0.0,1.0, 1)
|
||||
var distortion: Double by parameters
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_tape_noise
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
|
||||
@Description("Tape noise")
|
||||
class TapeNoise : Filter(filterShaderFromUrl(filterFragmentUrl("distort/tape-noise.frag"))) {
|
||||
class TapeNoise : Filter(mppFilterShader(fx_tape_noise, "tape-noise")) {
|
||||
var time: Double by parameters
|
||||
|
||||
@DoubleParameter("gain", 0.0, 1.0)
|
||||
@@ -38,7 +36,6 @@ class TapeNoise : Filter(filterShaderFromUrl(filterFragmentUrl("distort/tape-noi
|
||||
@DoubleParameter("deform frequency", 0.0, 1.0)
|
||||
var deformFrequency: Double by parameters
|
||||
|
||||
|
||||
@ColorParameter("tint")
|
||||
var tint: ColorRGBa by parameters
|
||||
|
||||
@@ -54,6 +51,5 @@ class TapeNoise : Filter(filterShaderFromUrl(filterFragmentUrl("distort/tape-noi
|
||||
gapFrequency = 10.0
|
||||
gapLow = -1.0
|
||||
gapHigh = -0.99
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_tiles
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Tiles")
|
||||
class Tiles : Filter(filterShaderFromUrl(filterFragmentUrl("distort/tiles.frag"))) {
|
||||
|
||||
class Tiles : Filter(mppFilterShader(fx_tiles, "tiles")) {
|
||||
@DoubleParameter("rotation", -180.0, 180.0, order = 2)
|
||||
var rotation: Double by parameters
|
||||
|
||||
@@ -18,8 +18,6 @@ class Tiles : Filter(filterShaderFromUrl(filterFragmentUrl("distort/tiles.frag")
|
||||
@IntParameter("y segments", 0, 256, order = 0)
|
||||
var ySegments: Int by parameters
|
||||
|
||||
|
||||
|
||||
init {
|
||||
rotation = 0.0
|
||||
xSegments = 32
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_video_glitch
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Video glitch")
|
||||
class VideoGlitch : Filter(filterShaderFromUrl(filterFragmentUrl("distort/video-glitch.frag"))) {
|
||||
class VideoGlitch : Filter(mppFilterShader(fx_video_glitch, "video-glitch")) {
|
||||
var time: Double by parameters
|
||||
|
||||
@DoubleParameter("amplitude", 0.0, 10.0)
|
||||
@@ -1,13 +1,15 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_horizontal_wave
|
||||
import org.openrndr.extra.fx.fx_vertical_wave
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Horizontal wave")
|
||||
class HorizontalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/horizontal-wave.frag"))) {
|
||||
class HorizontalWave : Filter(mppFilterShader(fx_horizontal_wave, "horizontal-wave")) {
|
||||
@DoubleParameter("frequency", 0.0, 64.0, order = 1)
|
||||
var frequency: Double by parameters
|
||||
|
||||
@@ -20,7 +22,6 @@ class HorizontalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/hor
|
||||
@IntParameter("segments", 0, 256, order = 3)
|
||||
var segments: Int by parameters
|
||||
|
||||
|
||||
init {
|
||||
frequency = 1.0
|
||||
amplitude = 0.1
|
||||
@@ -39,7 +40,7 @@ class HorizontalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/hor
|
||||
}
|
||||
|
||||
@Description("Vertical wave")
|
||||
class VerticalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/vertical-wave.frag"))) {
|
||||
class VerticalWave : Filter(mppFilterShader(fx_vertical_wave, "vertical-wave")) {
|
||||
@DoubleParameter("frequency", 0.0, 64.0, order = 1)
|
||||
var frequency: Double by parameters
|
||||
|
||||
@@ -52,7 +53,6 @@ class VerticalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/verti
|
||||
@IntParameter("segments", 0, 256, order = 3)
|
||||
var segments: Int by parameters
|
||||
|
||||
|
||||
init {
|
||||
frequency = 1.0
|
||||
amplitude = 0.1
|
||||
@@ -60,6 +60,7 @@ class VerticalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/verti
|
||||
segments = 0
|
||||
}
|
||||
var bicubicFiltering = true
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
if (bicubicFiltering && source.isNotEmpty()) {
|
||||
source[0].generateMipmaps()
|
||||
@@ -67,5 +68,4 @@ class VerticalWave : Filter(filterShaderFromUrl(filterFragmentUrl("distort/verti
|
||||
}
|
||||
super.apply(source, target)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.openrndr.extra.fx.dither
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_a_dither
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("ADither")
|
||||
class ADither: Filter(filterShaderFromUrl(filterFragmentUrl("dither/a-dither.frag"))) {
|
||||
class ADither: Filter(mppFilterShader(fx_a_dither, "a-dither")) {
|
||||
@IntParameter("pattern index", 0, 3)
|
||||
var pattern: Int by parameters
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
package org.openrndr.extra.fx.dither
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_cmyk_halftone
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("CMYK Halftone")
|
||||
class CMYKHalftone: Filter(filterShaderFromUrl(filterFragmentUrl("dither/cmyk-halftone.frag"))) {
|
||||
|
||||
class CMYKHalftone: Filter(mppFilterShader(fx_cmyk_halftone, "cmyk-halftone")) {
|
||||
@DoubleParameter("scale", 1.0, 30.0, precision = 4)
|
||||
var scale: Double by parameters
|
||||
|
||||
@DoubleParameter("dotSize", 1.0, 3.0, precision = 4)
|
||||
var dotSize: Double by parameters
|
||||
|
||||
|
||||
@DoubleParameter("rotation", -180.0, 180.0)
|
||||
var rotation: Double by parameters
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package org.openrndr.extra.fx.dither
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_crosshatch
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
|
||||
@Description("Crosshatch")
|
||||
class Crosshatch: Filter(filterShaderFromUrl(filterFragmentUrl("dither/crosshatch.frag"))) {
|
||||
class Crosshatch : Filter(mppFilterShader(fx_crosshatch, "crosshatch")) {
|
||||
@DoubleParameter("threshold 1", 0.0, 1.0)
|
||||
var t1: Double by parameters
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package org.openrndr.extra.vfx
|
||||
package org.openrndr.extra.fx.edges
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_contour
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Contour")
|
||||
class Contour : Filter(filterShaderFromUrl(filterFragmentUrl("edges/contour.frag"))) {
|
||||
class Contour : Filter(mppFilterShader(fx_contour, "contour")) {
|
||||
@DoubleParameter("levels", 1.0, 16.0)
|
||||
var levels: Double by parameters
|
||||
|
||||
|
||||
@DoubleParameter("contour width", 0.0, 4.0)
|
||||
var contourWidth: Double by parameters
|
||||
|
||||
@@ -23,11 +22,9 @@ class Contour : Filter(filterShaderFromUrl(filterFragmentUrl("edges/contour.frag
|
||||
@DoubleParameter("background opacity", 0.0, 1.0)
|
||||
var backgroundOpacity: Double by parameters
|
||||
|
||||
|
||||
@ColorParameter("contour color")
|
||||
var contourColor: ColorRGBa by parameters
|
||||
|
||||
|
||||
init {
|
||||
levels = 6.0
|
||||
contourWidth = 0.4
|
||||
@@ -2,13 +2,14 @@ package org.openrndr.extra.fx.edges
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.ColorBufferDescription
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_edges_work_1
|
||||
import org.openrndr.extra.fx.fx_edges_work_2
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
|
||||
internal class EdgesWork1 : Filter(filterShaderFromUrl(filterFragmentUrl("edges/edges-work-1.frag"))) {
|
||||
internal class EdgesWork1 : Filter(mppFilterShader(fx_edges_work_1, "edges-work-1")) {
|
||||
var delta: Vector2 by parameters
|
||||
|
||||
init {
|
||||
@@ -17,7 +18,7 @@ internal class EdgesWork1 : Filter(filterShaderFromUrl(filterFragmentUrl("edges/
|
||||
}
|
||||
|
||||
@Description("Edges Work")
|
||||
open class EdgesWork : Filter(filterShaderFromUrl(filterFragmentUrl("edges/edges-work-2.frag"))) {
|
||||
open class EdgesWork : Filter(mppFilterShader(fx_edges_work_2, "edges-work-2")) {
|
||||
/**
|
||||
* radius, default value is 1.0
|
||||
*/
|
||||
@@ -36,7 +37,13 @@ open class EdgesWork : Filter(filterShaderFromUrl(filterFragmentUrl("edges/edges
|
||||
}
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
val intermediateDescription = ColorBufferDescription(target[0].width, target[0].height, target[0].contentScale, target[0].format, target[0].type)
|
||||
val intermediateDescription = ColorBufferDescription(
|
||||
target[0].width,
|
||||
target[0].height,
|
||||
target[0].contentScale,
|
||||
target[0].format,
|
||||
target[0].type
|
||||
)
|
||||
val intermediate = intermediateCache.getOrPut(intermediateDescription) {
|
||||
colorBuffer(target[0].width, target[0].height, target[0].contentScale, target[0].format, target[0].type)
|
||||
}
|
||||
@@ -2,15 +2,14 @@ package org.openrndr.extra.fx.edges
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_luma_sobel
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Luma Sobel")
|
||||
class LumaSobel : Filter(filterShaderFromUrl(filterFragmentUrl("edges/luma-sobel.frag"))) {
|
||||
|
||||
class LumaSobel : Filter(mppFilterShader(fx_luma_sobel, "luma-sobel")) {
|
||||
@ColorParameter("background color")
|
||||
var backgroundColor: ColorRGBa by parameters
|
||||
|
||||
@@ -18,10 +17,10 @@ class LumaSobel : Filter(filterShaderFromUrl(filterFragmentUrl("edges/luma-sobel
|
||||
var edgeColor: ColorRGBa by parameters
|
||||
|
||||
@DoubleParameter("background opacity", 0.0, 1.0)
|
||||
var backgroundOpacity:Double by parameters
|
||||
var backgroundOpacity: Double by parameters
|
||||
|
||||
@DoubleParameter("edge opacity", 0.0, 1.0)
|
||||
var edgeOpacity:Double by parameters
|
||||
var edgeOpacity: Double by parameters
|
||||
|
||||
init {
|
||||
backgroundColor = ColorRGBa.BLACK
|
||||
@@ -1,17 +1,14 @@
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.Shader
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_film_grain
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
/**
|
||||
* Film grain filter
|
||||
*/
|
||||
@Description("film grain")
|
||||
class FilmGrain : Filter(filterShaderFromUrl(filterFragmentUrl("grain/film-grain.frag"))) {
|
||||
|
||||
class FilmGrain : Filter(mppFilterShader(fx_film_grain, "film-grain")) {
|
||||
@BooleanParameter("use color")
|
||||
var useColor: Boolean by parameters
|
||||
|
||||
@@ -40,5 +37,4 @@ class FilmGrain : Filter(filterShaderFromUrl(filterFragmentUrl("grain/film-grain
|
||||
grainPitch = 1.0
|
||||
colorLevel = 1.0
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,22 +2,24 @@ package org.openrndr.extra.fx.patterns
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_checkers
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Checkers pattern")
|
||||
class Checkers : Filter(filterShaderFromUrl(filterFragmentUrl("patterns/checkers.frag"))) {
|
||||
class Checkers : Filter(mppFilterShader(fx_checkers, "checkers")) {
|
||||
var background: ColorRGBa by parameters
|
||||
var foreground: ColorRGBa by parameters
|
||||
|
||||
@DoubleParameter("size", 0.0, 1.0)
|
||||
var size: Double by parameters
|
||||
|
||||
@DoubleParameter("opacity", 0.0, 1.0)
|
||||
var opacity: Double by parameters
|
||||
|
||||
init {
|
||||
size = 1.0/64.0
|
||||
size = 1.0 / 64.0
|
||||
opacity = 1.0
|
||||
foreground = ColorRGBa.WHITE.shade(0.9)
|
||||
background = ColorRGBa.WHITE.shade(0.8)
|
||||
@@ -1,22 +1,22 @@
|
||||
package org.openrndr.extra.fx.shadow
|
||||
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_dropshadow_blend
|
||||
import org.openrndr.extra.fx.fx_dropshadow_blur
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.ColorParameter
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
private class Blend : Filter(filterShaderFromUrl(filterFragmentUrl("shadow/dropshadow-blend.frag"))) {
|
||||
private class Blend : Filter(mppFilterShader(fx_dropshadow_blend, "dropshadow-blend")) {
|
||||
var shift: Vector2 by parameters
|
||||
}
|
||||
|
||||
@Description("Drop shadow")
|
||||
class DropShadow : Filter(filterShaderFromUrl(filterFragmentUrl("shadow/dropshadow-blur.frag"))) {
|
||||
|
||||
class DropShadow : Filter(mppFilterShader(fx_dropshadow_blur, "dropshadow-blur")) {
|
||||
@IntParameter("blur window", 1, 25)
|
||||
var window: Int by parameters
|
||||
var spread: Double by parameters
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.openrndr.extra.fx.tonemap
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.fx.fx_uncharted2_tonemap
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@@ -10,8 +10,7 @@ import org.openrndr.extra.parameters.DoubleParameter
|
||||
* Uncharted 2 tonemap filter
|
||||
*/
|
||||
@Description("Uncharted 2 tonemap")
|
||||
class Uncharted2Tonemap : Filter(filterShaderFromUrl(filterFragmentUrl("tonemap/uncharted2-tonemap.frag"))) {
|
||||
|
||||
class Uncharted2Tonemap : Filter(mppFilterShader(fx_uncharted2_tonemap, "uncharted2-tonemap")) {
|
||||
@DoubleParameter("exposure bias", 0.0, 128.0)
|
||||
var exposureBias:Double by parameters
|
||||
init {
|
||||
10
orx-fx/src/commonMain/kotlin/transform/FlipVertically.kt
Normal file
10
orx-fx/src/commonMain/kotlin/transform/FlipVertically.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
package org.openrndr.extra.fx.transform
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.extra.fx.fx_flip_vertically
|
||||
import org.openrndr.extra.fx.mppFilterShader
|
||||
|
||||
/**
|
||||
* Vertically flips in the input image
|
||||
*/
|
||||
class FlipVertically : Filter(mppFilterShader(fx_flip_vertically, "flip-vertically"))
|
||||
31
orx-fx/src/demo/kotlin/DemoBlend01.kt
Normal file
31
orx-fx/src/demo/kotlin/DemoBlend01.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
package org.openrndr.extra.fx.demo
|
||||
|
||||
import org.openrndr.applicationSynchronous
|
||||
import org.openrndr.extra.fx.blend.*
|
||||
fun main() {
|
||||
applicationSynchronous {
|
||||
program {
|
||||
val add = Add()
|
||||
val colorBurn = ColorBurn()
|
||||
val colorDodge = ColorDodge()
|
||||
val darken = Darken()
|
||||
val destIn = DestinationIn()
|
||||
val destOut = DestinationOut()
|
||||
val destAtop = DestinationAtop()
|
||||
val hardLight = HardLight()
|
||||
val lighten = Lighten()
|
||||
val multiply = Multiply()
|
||||
val multiplyContrast = MultiplyContrast()
|
||||
val normal = Normal()
|
||||
val overlay = Overlay()
|
||||
val passthrough = Passthrough()
|
||||
val screen = Screen()
|
||||
val sourceIn = SourceIn()
|
||||
val sourceAtop = SourceAtop()
|
||||
val sourceOut = SourceOut()
|
||||
val subtract = Subtract()
|
||||
val xor = Xor()
|
||||
application.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.distort.FluidDistort
|
||||
import org.openrndr.extra.fx.patterns.Checkers
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.compositor.compose
|
||||
import org.openrndr.extra.compositor.draw
|
||||
import org.openrndr.extra.compositor.layer
|
||||
import org.openrndr.extra.compositor.post
|
||||
import org.openrndr.extra.fx.blur.GaussianBloom
|
||||
import org.openrndr.extra.fx.blur.LaserBlur
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.gui.addTo
|
||||
import org.openrndr.extra.noise.simplex
|
||||
import org.openrndr.math.Vector2
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
suspend fun main() = application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gui = GUI()
|
||||
val c = compose {
|
||||
layer {
|
||||
draw {
|
||||
drawer.fill = null
|
||||
drawer.strokeWeight = 4.0
|
||||
drawer.translate(width/2.0, height/2.0)
|
||||
drawer.rotate(seconds*45.0 + simplex(0, seconds)*45.0)
|
||||
drawer.translate(-width/2.0, -height/2.0)
|
||||
for (y in -1..1) {
|
||||
for (x in -1..1) {
|
||||
drawer.stroke = ColorRGBa.RED.toHSVa()
|
||||
.shiftHue(0.0 + simplex(500+x+y,seconds)*5.0)
|
||||
.shade(0.5 + 0.5 * simplex(300+x+y,seconds*4.0).absoluteValue)
|
||||
.toRGBa()
|
||||
val r = simplex(400+x+y, seconds) * 150.0 + 150.0
|
||||
drawer.circle(width / 2.0 + x * 100.0, height / 2.0 + y * 100.0, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
post(LaserBlur()) {
|
||||
center = Vector2(simplex(2, seconds*0.1), simplex(100, seconds*0.1))
|
||||
aberration = simplex(5, seconds) * 0.01
|
||||
radius = simplex(7, seconds)
|
||||
}.addTo(gui)
|
||||
post(GaussianBloom()).addTo(gui)
|
||||
}
|
||||
}
|
||||
extend(gui) {
|
||||
doubleBind = true
|
||||
}
|
||||
extend {
|
||||
c.draw(drawer)
|
||||
}
|
||||
}
|
||||
}
|
||||
//import org.openrndr.application
|
||||
//import org.openrndr.color.ColorRGBa
|
||||
//import org.openrndr.extensions.SingleScreenshot
|
||||
//import org.openrndr.extra.compositor.compose
|
||||
//import org.openrndr.extra.compositor.draw
|
||||
//import org.openrndr.extra.compositor.layer
|
||||
//import org.openrndr.extra.compositor.post
|
||||
//import org.openrndr.extra.fx.blur.GaussianBloom
|
||||
//import org.openrndr.extra.fx.blur.LaserBlur
|
||||
//import org.openrndr.extra.gui.GUI
|
||||
//import org.openrndr.extra.gui.addTo
|
||||
//import org.openrndr.extra.noise.simplex
|
||||
//import org.openrndr.math.Vector2
|
||||
//import kotlin.math.absoluteValue
|
||||
//
|
||||
//suspend fun main() = application {
|
||||
// configure {
|
||||
// width = 1280
|
||||
// height = 720
|
||||
// }
|
||||
//
|
||||
// program {
|
||||
// if (System.getProperty("takeScreenshot") == "true") {
|
||||
// extend(SingleScreenshot()) {
|
||||
// this.outputFile = System.getProperty("screenshotPath")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// val gui = GUI()
|
||||
// val c = compose {
|
||||
// layer {
|
||||
// draw {
|
||||
// drawer.fill = null
|
||||
// drawer.strokeWeight = 4.0
|
||||
// drawer.translate(width/2.0, height/2.0)
|
||||
// drawer.rotate(seconds*45.0 + simplex(0, seconds)*45.0)
|
||||
// drawer.translate(-width/2.0, -height/2.0)
|
||||
// for (y in -1..1) {
|
||||
// for (x in -1..1) {
|
||||
// drawer.stroke = ColorRGBa.RED.toHSVa()
|
||||
// .shiftHue(0.0 + simplex(500+x+y,seconds)*5.0)
|
||||
// .shade(0.5 + 0.5 * simplex(300+x+y,seconds*4.0).absoluteValue)
|
||||
// .toRGBa()
|
||||
// val r = simplex(400+x+y, seconds) * 150.0 + 150.0
|
||||
// drawer.circle(width / 2.0 + x * 100.0, height / 2.0 + y * 100.0, r)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// post(LaserBlur()) {
|
||||
// center = Vector2(simplex(2, seconds*0.1), simplex(100, seconds*0.1))
|
||||
// aberration = simplex(5, seconds) * 0.01
|
||||
// radius = simplex(7, seconds)
|
||||
// }.addTo(gui)
|
||||
// post(GaussianBloom()).addTo(gui)
|
||||
// }
|
||||
// }
|
||||
// extend(gui) {
|
||||
// doubleBind = true
|
||||
// }
|
||||
// extend {
|
||||
// c.draw(drawer)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,116 +0,0 @@
|
||||
package org.openrndr.extra.fx.blend
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
|
||||
class ColorBurn : Filter(filterShaderFromUrl(filterFragmentUrl("blend/color-burn.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class ColorDodge : Filter(filterShaderFromUrl(filterFragmentUrl("blend/color-dodge.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Darken : Filter(filterShaderFromUrl(filterFragmentUrl("blend/darken.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class HardLight : Filter(filterShaderFromUrl(filterFragmentUrl("blend/hard-light.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Lighten : Filter(filterShaderFromUrl(filterFragmentUrl("blend/lighten.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Multiply : Filter(filterShaderFromUrl(filterFragmentUrl("blend/multiply.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Normal : Filter(filterShaderFromUrl(filterFragmentUrl("blend/normal.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Overlay : Filter(filterShaderFromUrl(filterFragmentUrl("blend/overlay.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
class Screen : Filter(filterShaderFromUrl(filterFragmentUrl("blend/screen.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SourceIn : Filter(filterShaderFromUrl(filterFragmentUrl("blend/source-in.frag")))
|
||||
class SourceOut : Filter(filterShaderFromUrl(filterFragmentUrl("blend/source-out.frag")))
|
||||
class SourceAtop : Filter(filterShaderFromUrl(filterFragmentUrl("blend/source-atop.frag")))
|
||||
class DestinationIn : Filter(filterShaderFromUrl(filterFragmentUrl("blend/destination-in.frag")))
|
||||
class DestinationOut : Filter(filterShaderFromUrl(filterFragmentUrl("blend/destination-out.frag")))
|
||||
class DestinationAtop : Filter(filterShaderFromUrl(filterFragmentUrl("blend/destination-atop.frag")))
|
||||
class Xor : Filter(filterShaderFromUrl(filterFragmentUrl("blend/xor.frag")))
|
||||
|
||||
class MultiplyContrast : Filter(filterShaderFromUrl(filterFragmentUrl("blend/multiply-contrast.frag")))
|
||||
|
||||
class Passthrough : Filter(filterShaderFromUrl(filterFragmentUrl("blend/passthrough.frag")))
|
||||
class Add : Filter(filterShaderFromUrl(filterFragmentUrl("blend/add.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
class Subtract : Filter(filterShaderFromUrl(filterFragmentUrl("blend/subtract.frag"))) {
|
||||
@BooleanParameter("source clip")
|
||||
var clip: Boolean by parameters
|
||||
|
||||
init {
|
||||
clip = false
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package org.openrndr.extra.fx.color
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
|
||||
class RgbToYCbcr : Filter(filterShaderFromUrl(filterFragmentUrl("color/rgb-to-ycbcr.frag")))
|
||||
class YcbcrToRgb : Filter(filterShaderFromUrl(filterFragmentUrl("color/ycbcr-to-rgb.frag")))
|
||||
@@ -1,11 +0,0 @@
|
||||
package org.openrndr.extra.fx.transform
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.Shader
|
||||
import org.openrndr.draw.filterShaderFromUrl
|
||||
import org.openrndr.extra.fx.filterFragmentUrl
|
||||
|
||||
/**
|
||||
* Vertically flips in the input image
|
||||
*/
|
||||
class FlipVertically : Filter(filterShaderFromUrl(filterFragmentUrl("transform/flip-vertically.frag")))
|
||||
@@ -1,23 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
out vec4 o_color;
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
|
||||
vec3 addColor = b.rgb; //mix(vec3(0.0), nb, b.a);
|
||||
|
||||
if (clip) {
|
||||
o_color = vec4((na + addColor), 1) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(min(na + nb, vec3(1.0)), 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
|
||||
vec3 m = vec3(
|
||||
nb.r <= na.r? nb.r : na.r,
|
||||
nb.g <= na.g? nb.g : na.g,
|
||||
nb.b <= na.b? nb.b : na.b);
|
||||
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
o_color = src * lsrc + dest * 0.0 + dest * lboth;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
o_color = dest * lboth;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
|
||||
o_color = dest * ldest;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
|
||||
vec3 m = vec3(
|
||||
nb.r >= na.r? nb.r : na.r,
|
||||
nb.g >= na.g? nb.g : na.g,
|
||||
nb.b >= na.b? nb.b : na.b);
|
||||
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
|
||||
|
||||
|
||||
//float ai = dot(vec3(1.0), a.rgb)/3.0;
|
||||
//float bi = dot(vec3(1.0), b.rgb)/3.0;
|
||||
|
||||
|
||||
float ai = max(a.z, max(a.x, a.y));
|
||||
float bi = max(b.z, max(b.x, b.y));
|
||||
|
||||
//vec3 f = bi < 0.5? vec3(0.0) : a.rgb;
|
||||
|
||||
// vec3 f = smoothstep(0.5, 0.9, bi) * a.rgb;
|
||||
|
||||
vec3 f = a.rgb - (1.0-b.rgb)*2.0*b.a;
|
||||
|
||||
o_color.rgb = max(vec3(0.0), f) * (1.0) + b.rgb * (1.0-a.a);;
|
||||
|
||||
o_color.a = 1.0; //min(1.0, a.a + b.a);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
uniform bool clip;
|
||||
|
||||
out vec4 o_color;
|
||||
|
||||
vec3 u(vec4 x) {
|
||||
return x.a == 0.0? vec3(0.0) : x.rgb / x.a;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
vec3 na = u(a);
|
||||
vec3 nb = u(b);
|
||||
vec3 mulColor = mix(vec3(1.0), nb, b.a);
|
||||
|
||||
if (clip) {
|
||||
o_color = vec4(a.rgb * mulColor, a.a);
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(na * nb, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
float alpha = min(1,max(0, b.a));
|
||||
|
||||
if (!clip) {
|
||||
o_color = a * (1.0-alpha) + b;
|
||||
o_color.a = clamp(o_color.a, 0.0, 1.0);
|
||||
} else {
|
||||
o_color = a * (1.0-alpha) + b * a.a;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
o_color = texture(tex0, v_texCoord0);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
o_color = dest * ldest + src * lboth;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
o_color = src * lboth;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
|
||||
o_color = src * lsrc;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
vec3 subColor = b.rgb;
|
||||
if (clip) {
|
||||
o_color = vec4(max(na - subColor, vec3(0.0)), 1) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(max(na - nb, vec3(0.0)), 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
|
||||
o_color = src * lsrc + dest * ldest;
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
#version 330 core
|
||||
|
||||
|
||||
|
||||
//uniform vec2 u_texelStep;
|
||||
|
||||
|
||||
uniform float lumaThreshold;
|
||||
uniform float maxSpan;
|
||||
uniform float directionReduceMultiplier;
|
||||
uniform float directionReduceMinimum;
|
||||
|
||||
uniform sampler2D tex0;
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// see FXAA
|
||||
@@ -20,14 +15,10 @@ out vec4 fragColor;
|
||||
// http://iryoku.com/aacourse/downloads/09-FXAA-3.11-in-15-Slides.pdf
|
||||
// http://horde3d.org/wiki/index.php5?title=Shading_Technique_-_FXAA
|
||||
|
||||
void main(void)
|
||||
{
|
||||
void main(void) {
|
||||
const int u_showEdges = 0;
|
||||
const int u_fxaaOn = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
vec2 u_texelStep = 1.0 / textureSize(tex0, 0);
|
||||
vec3 rgbM = min(vec3(1), texture(tex0, v_texCoord0).rgb);
|
||||
|
||||
@@ -35,7 +26,6 @@ void main(void)
|
||||
if (u_fxaaOn == 0)
|
||||
{
|
||||
fragColor = vec4(rgbM, 1.0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
40
orx-fx/src/shaders/glsl/blend/add.frag
Normal file
40
orx-fx/src/shaders/glsl/blend/add.frag
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
|
||||
vec3 addColor = b.rgb;
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4((na + addColor), 1) * a.a;
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(min(na + nb, vec3(1.0)), 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
#version 330
|
||||
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
@@ -9,11 +12,17 @@ float blendColorBurn(float base, float blend) {
|
||||
return (blend==0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0);
|
||||
}
|
||||
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
@@ -24,9 +33,16 @@ void main() {
|
||||
blendColorBurn(na.b, nb.b)
|
||||
);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
#version 330
|
||||
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
@@ -9,10 +12,18 @@ float dodge(float base, float blend) {
|
||||
return (blend==1.0)?blend:min(base/(1.0-blend),1.0);
|
||||
}
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
@@ -23,9 +34,17 @@ void main() {
|
||||
dodge(na.b, nb.b)
|
||||
);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
|
||||
}
|
||||
43
orx-fx/src/shaders/glsl/blend/darken.frag
Normal file
43
orx-fx/src/shaders/glsl/blend/darken.frag
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
|
||||
vec3 m = vec3(
|
||||
nb.r <= na.r? nb.r : na.r,
|
||||
nb.g <= na.g? nb.g : na.g,
|
||||
nb.b <= na.b? nb.b : na.b);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
32
orx-fx/src/shaders/glsl/blend/destination-atop.frag
Normal file
32
orx-fx/src/shaders/glsl/blend/destination-atop.frag
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
vec4 result = src * lsrc + dest * 0.0 + dest * lboth;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
30
orx-fx/src/shaders/glsl/blend/destination-in.frag
Normal file
30
orx-fx/src/shaders/glsl/blend/destination-in.frag
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float lboth = src.a * dest.a;
|
||||
vec4 result = dest * lboth;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
31
orx-fx/src/shaders/glsl/blend/destination-out.frag
Normal file
31
orx-fx/src/shaders/glsl/blend/destination-out.frag
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
|
||||
vec4 result = dest * ldest;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,13 +1,25 @@
|
||||
#version 330
|
||||
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
@@ -18,9 +30,15 @@ void main() {
|
||||
nb.b <= 0.5? 2*na.b * nb.b : 1.0 - 2.0*(1.0 - na.b)*(1.0 - nb.b)
|
||||
);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
44
orx-fx/src/shaders/glsl/blend/lighten.frag
Normal file
44
orx-fx/src/shaders/glsl/blend/lighten.frag
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
|
||||
vec3 m = vec3(
|
||||
nb.r >= na.r? nb.r : na.r,
|
||||
nb.g >= na.g? nb.g : na.g,
|
||||
nb.b >= na.b? nb.b : na.b);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
37
orx-fx/src/shaders/glsl/blend/multiply-contrast.frag
Normal file
37
orx-fx/src/shaders/glsl/blend/multiply-contrast.frag
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float ai = max(a.z, max(a.x, a.y));
|
||||
float bi = max(b.z, max(b.x, b.y));
|
||||
|
||||
vec3 f = a.rgb - (1.0-b.rgb)*2.0*b.a;
|
||||
|
||||
vec4 result;
|
||||
result.rgb = max(vec3(0.0), f) * (1.0) + b.rgb * (1.0-a.a);
|
||||
result.a = 1.0;
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
46
orx-fx/src/shaders/glsl/blend/multiply.frag
Normal file
46
orx-fx/src/shaders/glsl/blend/multiply.frag
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
vec3 u(vec4 x) {
|
||||
return x.a == 0.0? vec3(0.0) : x.rgb / x.a;
|
||||
}
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = u(a);
|
||||
vec3 nb = u(b);
|
||||
vec3 mulColor = mix(vec3(1.0), nb, b.a);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4(a.rgb * mulColor, a.a);
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(na * nb, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
|
||||
39
orx-fx/src/shaders/glsl/blend/normal.frag
Normal file
39
orx-fx/src/shaders/glsl/blend/normal.frag
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float alpha = min(1,max(0, b.a));
|
||||
|
||||
vec4 result;
|
||||
if (!clip) {
|
||||
result = a * (1.0-alpha) + b;
|
||||
result.a = clamp(o_color.a, 0.0, 1.0);
|
||||
} else {
|
||||
result = a * (1.0-alpha) + b * a.a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
|
||||
#version 330
|
||||
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
vec3 demul(vec4 c) {
|
||||
if (c.a == 0) {
|
||||
@@ -17,8 +21,13 @@ vec3 demul(vec4 c) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = demul(a);
|
||||
vec3 nb = demul(b);
|
||||
@@ -29,10 +38,18 @@ void main() {
|
||||
na.b <= 0.5? 2.0 * na.b * nb.b : (1.0 - 2.0 * (1.0 - na.b) * (1.0 - nb.b))
|
||||
);
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
vec3 fc = na * (1.0 - b.a) + m * b.a;
|
||||
o_color = vec4(fc, 1.0) * a.a;
|
||||
result = vec4(fc, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
|
||||
}
|
||||
25
orx-fx/src/shaders/glsl/blend/passthrough.frag
Normal file
25
orx-fx/src/shaders/glsl/blend/passthrough.frag
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 result = texture(tex0, v_texCoord0);
|
||||
#else
|
||||
vec4 result = texture2D(tex0, v_texCoord0);
|
||||
#endif
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,14 +1,25 @@
|
||||
#version 330
|
||||
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a == 0.0 ? vec3(0.0): a.rgb / a.a;
|
||||
vec3 nb = b.a == 0.0 ? vec3(0.0): b.rgb / b.a;
|
||||
@@ -18,9 +29,16 @@ void main() {
|
||||
1.0-((1.0-na.g)*(1.0-nb.g)),
|
||||
1.0-((1.0-na.b)*(1.0-nb.b)));
|
||||
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
o_color = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
result = vec4(na * (1.0 - b.a) + b.a * m, 1.0) * a.a;
|
||||
} else {
|
||||
o_color = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(m, 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
32
orx-fx/src/shaders/glsl/blend/source-atop.frag
Normal file
32
orx-fx/src/shaders/glsl/blend/source-atop.frag
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
float lboth = src.a * dest.a;
|
||||
|
||||
vec4 result = dest * ldest + src * lboth;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
31
orx-fx/src/shaders/glsl/blend/source-in.frag
Normal file
31
orx-fx/src/shaders/glsl/blend/source-in.frag
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float lboth = src.a * dest.a;
|
||||
vec4 result = src * lboth;
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
31
orx-fx/src/shaders/glsl/blend/source-out.frag
Normal file
31
orx-fx/src/shaders/glsl/blend/source-out.frag
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
|
||||
vec4 result = src * lsrc;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
39
orx-fx/src/shaders/glsl/blend/subtract.frag
Normal file
39
orx-fx/src/shaders/glsl/blend/subtract.frag
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform bool clip;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 a = texture2D(tex0, v_texCoord0);
|
||||
vec4 b = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
vec3 na = a.a > 0 ? a.rgb/a.a : vec3(0.0);
|
||||
vec3 nb = b.a > 0 ? b.rgb/b.a : vec3(0.0);
|
||||
vec3 subColor = b.rgb;
|
||||
vec4 result;
|
||||
if (clip) {
|
||||
result = vec4(max(na - subColor, vec3(0.0)), 1) * a.a;
|
||||
} else {
|
||||
result = (1.0-a.a) * b + a.a * b.a * vec4(max(na - nb, vec3(0.0)), 1.0) + (1.0-b.a) * a;
|
||||
}
|
||||
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
32
orx-fx/src/shaders/glsl/blend/xor.frag
Normal file
32
orx-fx/src/shaders/glsl/blend/xor.frag
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifdef OR_IN_OUT
|
||||
in vec2 v_texCoord0;
|
||||
#else
|
||||
varying vec2 v_texCoord0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
|
||||
#ifndef OR_GL_FRAGCOLOR
|
||||
out vec4 o_color;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#ifndef OR_GL_TEXTURE2D
|
||||
vec4 src = texture(tex0, v_texCoord0);
|
||||
vec4 dest = texture(tex1, v_texCoord0);
|
||||
#else
|
||||
vec4 src = texture2D(tex0, v_texCoord0);
|
||||
vec4 dest = texture2D(tex1, v_texCoord0);
|
||||
#endif
|
||||
|
||||
float lsrc = src.a * (1.0 - dest.a);
|
||||
float ldest = dest.a * (1.0 - src.a);
|
||||
|
||||
vec4 result = src * lsrc + dest * ldest;
|
||||
#ifdef OR_GL_FRAGCOLOR
|
||||
gl_FragColor = result;
|
||||
#else
|
||||
o_color = result;
|
||||
#endif
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
// openrndr - gl3 - approximate-gaussian-blur
|
||||
|
||||
#version 330 core
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform vec2 blurDirection;
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 o_output;
|
||||
in vec2 v_texCoord0;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330
|
||||
|
||||
out vec4 o_output;
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330
|
||||
|
||||
float nrand(vec2 n) {
|
||||
return fract(sin(dot(n.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
out vec4 o_color;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// openrndr - gl3 - box-blur
|
||||
|
||||
#version 330 core
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
uniform vec2 blurDirection;
|
||||
@@ -1,7 +1,3 @@
|
||||
// openrndr - gl3 - frame-blur
|
||||
|
||||
#version 330 core
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0; // input image
|
||||
uniform sampler2D tex1; // accumulator image
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330 core
|
||||
|
||||
// based on Hashed blur by David Hoskins.
|
||||
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330
|
||||
|
||||
out vec4 o_color;
|
||||
in vec2 v_texCoord0;
|
||||
uniform sampler2D tex0;
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 core
|
||||
out vec4 o_output;
|
||||
uniform sampler2D tex0;
|
||||
in vec2 v_texCoord0;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user