[orx-filters] Set shader parameter to null in Filter constructors

This commit is contained in:
Edwin Jakobs
2025-08-18 15:09:27 +02:00
parent 48b61c39e8
commit 8b4d31786c
15 changed files with 18 additions and 16 deletions

View File

@@ -24,7 +24,7 @@ private var filterQuadFormat = vertexFormat {
/**
* Filter base class. Renders "full-screen" quads.
*/
open class CubemapFilter(private val shader: Shader? = null, private val watcher: ShaderWatcher? = null) {
open class CubemapFilter(private val shader: Shader? = null) {
/**
* parameter map
@@ -79,7 +79,9 @@ open class CubemapFilter(private val shader: Shader? = null, private val watcher
}
fun apply(source: Array<Cubemap>, target: RenderTarget) {
val shader = if (this.watcher != null) watcher.shader!! else this.shader!!
if (shader == null) {
return
}
target.bind()
if (filterQuad == null) {

View File

@@ -66,7 +66,7 @@ class PoissonBlender(val width: Int, val height: Int, type: ColorType = ColorTyp
}
class PoissonBlend: Filter2to1() {
class PoissonBlend: Filter2to1(null) {
private var blender: PoissonBlender? = null
val alphaToBitmap = AlphaToBitmap()

View File

@@ -40,7 +40,7 @@ class PoissonFiller(val width: Int, val height: Int, type: ColorType = ColorType
/**
* Poison filling as a filter
*/
class PoissonFill : Filter1to1() {
class PoissonFill : Filter1to1(null) {
private var filler: PoissonFiller? = null
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
require(clip == null)