Add LumaOpacity, StackRepeat filters, fix LumaMap, add bicubic filtering
This commit is contained in:
@@ -6,7 +6,7 @@ import org.openrndr.extra.fx.filterFragmentCode
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
|
||||
@Description("Horizontal wave")
|
||||
@Description("Block repeat")
|
||||
class BlockRepeat : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("distort/block-repeat.frag"))) {
|
||||
@DoubleParameter("block width", 0.0, 1.0, order = 0)
|
||||
var blockWidth: Double by parameters
|
||||
|
||||
48
orx-fx/src/main/kotlin/distort/StackRepeat.kt
Normal file
48
orx-fx/src/main/kotlin/distort/StackRepeat.kt
Normal file
@@ -0,0 +1,48 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentCode
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.extra.parameters.IntParameter
|
||||
|
||||
@Description("Stack repeat")
|
||||
class StackRepeat : Filter(Shader.createFromCode(filterVertexCode, filterFragmentCode("distort/stack-repeat.frag"))) {
|
||||
@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
|
||||
|
||||
@DoubleParameter("rotation", -180.0, 180.0, order = 5)
|
||||
var rotation: Double by parameters
|
||||
|
||||
@IntParameter("repeats", 0, 16, order = 6)
|
||||
var repeats: Int by parameters
|
||||
|
||||
init {
|
||||
zoom = 0.0
|
||||
repeats = 2
|
||||
xOffset = 0.0
|
||||
yOffset = 0.0
|
||||
xOrigin = 0.0
|
||||
yOrigin = 0.0
|
||||
rotation = 0.0
|
||||
}
|
||||
var bicubicFiltering = true
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
if (bicubicFiltering && source.isNotEmpty()) {
|
||||
source[0].generateMipmaps()
|
||||
source[0].filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
||||
}
|
||||
super.apply(source, target)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.openrndr.extra.fx.distort
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
import org.openrndr.draw.Shader
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.extra.fx.filterFragmentCode
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
@@ -22,6 +21,15 @@ class HorizontalWave : Filter(Shader.createFromCode(filterVertexCode, filterFrag
|
||||
amplitude = 0.1
|
||||
phase = 0.0
|
||||
}
|
||||
|
||||
var bicubicFiltering = true
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
if (bicubicFiltering && source.isNotEmpty()) {
|
||||
source[0].generateMipmaps()
|
||||
source[0].filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
||||
}
|
||||
super.apply(source, target)
|
||||
}
|
||||
}
|
||||
|
||||
@Description("Vertical wave")
|
||||
@@ -40,5 +48,13 @@ class VerticalWave : Filter(Shader.createFromCode(filterVertexCode, filterFragme
|
||||
amplitude = 0.1
|
||||
phase = 0.0
|
||||
}
|
||||
var bicubicFiltering = true
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
if (bicubicFiltering && source.isNotEmpty()) {
|
||||
source[0].generateMipmaps()
|
||||
source[0].filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
||||
}
|
||||
super.apply(source, target)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user