Skip to content

Commit

Permalink
[orx-integral-image, orx-poisson-fill, orx-dnk3] Match changes in Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinRNDR committed Dec 14, 2023
1 parent 3ec3f0b commit d2cd12a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions orx-integral-image/src/main/kotlin/FastIntegralImage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.openrndr.extra.fx.blend.Passthrough

import org.openrndr.math.Vector2
import org.openrndr.resourceUrl
import org.openrndr.shape.Rectangle


class FastIntegralImageFilter : Filter(filterShaderFromUrl(resourceUrl(
Expand Down Expand Up @@ -38,8 +39,8 @@ class FastIntegralImage : Filter(filterShaderFromUrl(resourceUrl(
return sampleCounts
}

override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {

override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
require(clip == null)
val sampleCountBase = 16
val xSampleCounts = sampleCounts(source[0].width, sampleCountBase)
val ySampleCounts = sampleCounts(source[0].height, sampleCountBase)
Expand Down
6 changes: 4 additions & 2 deletions orx-jvm/orx-dnk3/src/main/kotlin/post/VolumetricIrradiance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.openrndr.extra.shaderphrases.preprocessShader
import org.openrndr.math.IntVector3
import org.openrndr.math.Matrix44
import org.openrndr.resourceUrl
import org.openrndr.shape.Rectangle
import java.net.URL

fun preprocessedFilterShaderFromUrl(url: String): Shader {
Expand All @@ -30,7 +31,8 @@ class VolumetricIrradiance : Filter(preprocessedFilterShaderFromUrl(resourceUrl(
projectionMatrixInverse = Matrix44.IDENTITY
}

override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
require(clip == null)
irradianceSH?.shMap?.let {
parameters["shMap"] = it
}
Expand All @@ -39,7 +41,7 @@ class VolumetricIrradiance : Filter(preprocessedFilterShaderFromUrl(resourceUrl(
parameters["shMapOffset"] = it.offset
parameters["shMapSpacing"] = it.spacing
}
super.apply(source, target)
super.apply(source, target, clip)
}
}

4 changes: 3 additions & 1 deletion orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonBlender.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.openrndr.extra.fx.blend.Subtract
import org.openrndr.filter.color.delinearize
import org.openrndr.filter.color.linearize
import org.openrndr.resourceUrl
import org.openrndr.shape.Rectangle

internal class BlendBoundary : Filter(filterShaderFromUrl(resourceUrl("/shaders/gl3/poisson/blend-boundary.frag")))
class AlphaToBitmap : Filter(filterShaderFromUrl(resourceUrl("/shaders/gl3/poisson/alpha-to-bitmap.frag")))
Expand Down Expand Up @@ -71,7 +72,8 @@ class PoissonBlend: Filter2to1() {
val alphaToBitmap = AlphaToBitmap()
var mask: ColorBuffer? = null

override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
require(clip == null)
if (target.isNotEmpty()) {

mask?.let {
Expand Down
4 changes: 3 additions & 1 deletion orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonFiller.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.openrndr.poissonfill

import org.openrndr.draw.*
import org.openrndr.resourceUrl
import org.openrndr.shape.Rectangle

internal class FillBoundary : Filter(filterShaderFromUrl(resourceUrl("/shaders/gl3/poisson/fill-boundary.frag")))
internal class FillCombine : Filter(filterShaderFromUrl(resourceUrl("/shaders/gl3/poisson/fill-combine.frag")))
Expand Down Expand Up @@ -41,7 +42,8 @@ class PoissonFiller(val width: Int, val height: Int, type: ColorType = ColorType
*/
class PoissonFill : Filter1to1() {
private var filler: PoissonFiller? = null
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
require(clip == null)
if (target.isNotEmpty()) {
filler?.let {
if (it.width != target[0].effectiveWidth || it.height != target[0].effectiveHeight) {
Expand Down

0 comments on commit d2cd12a

Please sign in to comment.