commit 264eda72544ecff28d9f1235bac5ac6c0dd98666
Author: leszek <leszek@koltunski.pl>
Date:   Mon Dec 1 00:27:29 2025 +0100

    fix errors loading Effect.code() and calling stuff via reflection. Remove java.lang.reflect!

diff --git a/src/main/java/org/distorted/library/effect/Effect.kt b/src/main/java/org/distorted/library/effect/Effect.kt
index 4d90424..c474600 100644
--- a/src/main/java/org/distorted/library/effect/Effect.kt
+++ b/src/main/java/org/distorted/library/effect/Effect.kt
@@ -21,10 +21,8 @@
 package org.distorted.library.effect
 
 import org.distorted.library.effectqueue.EffectQueue
-import org.distorted.library.main.DistortedLibrary
 import org.distorted.library.main.InternalStackFrameList
 import org.distorted.library.message.EffectListener
-import java.lang.reflect.Method
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
@@ -84,34 +82,8 @@ abstract class Effect internal constructor (val name: EffectName)
          */
         fun enableEffects(type: EffectType)
         {
-            var method: Method?
-
             for (name in EffectName.entries)
-            {
-                if (name.type==type)
-                {
-                    val cls = name.effectClass
-
-                    try
-                    {
-                        method = cls.getMethod("enable") // getMethod and NOT getDeclaredMethod because enable() is public
-                    }
-                    catch (ex: NoSuchMethodException)
-                    {
-                        DistortedLibrary.logMessage("Effect: exception getting method: "+ex.message)
-                        method = null
-                    }
-
-                    try
-                    {
-                        method?.invoke(null)
-                    }
-                    catch (ex: Exception)
-                    {
-                        DistortedLibrary.logMessage("Effect: exception invoking method: "+ex.message)
-                    }
-                }
-            }
+                if (name.type==type) name.enable?.invoke()
         }
     }
 
diff --git a/src/main/java/org/distorted/library/effect/EffectName.kt b/src/main/java/org/distorted/library/effect/EffectName.kt
index ed281ae..24427b5 100644
--- a/src/main/java/org/distorted/library/effect/EffectName.kt
+++ b/src/main/java/org/distorted/library/effect/EffectName.kt
@@ -37,45 +37,46 @@ package org.distorted.library.effect
  * This is used by the EffectQueue classes to decide if the final form of the Effect is NULL - and
  * thus if it can safely be removed from Effect Queues without affecting the visual in any way.
  */
-enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e: Class<out Effect>)
+enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e: (()->String)?, s: (()->Unit)?, n: (()->Unit)?)
 {
-    // EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER // CLASS
-    ROTATE           (EffectType.MATRIX,      floatArrayOf(0.0f),             4, 0, 3, MatrixEffectRotate::class.java),
-    QUATERNION       (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, MatrixEffectQuaternion::class.java),
-    MOVE             (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, MatrixEffectMove::class.java),
-    SCALE            (EffectType.MATRIX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, MatrixEffectScale::class.java),
-    SHEAR            (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, MatrixEffectShear::class.java),
+    // EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER //// code() //// destroyStatics() //// enable()
+    ROTATE           (EffectType.MATRIX,      floatArrayOf(0.0f),             4, 0, 3, null,null,null),
+    QUATERNION       (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, null,null,null),
+    MOVE             (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, null,null,null),
+    SCALE            (EffectType.MATRIX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, null,null,null),
+    SHEAR            (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, null,null,null),
 
-    DISTORT          (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 4, 3, VertexEffectDistort::class.java),
-    DEFORM           (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 4, 3, VertexEffectDeform::class.java),
-    SINK             (EffectType.VERTEX,      floatArrayOf(1.0f),             1, 4, 3, VertexEffectSink::class.java),
-    PINCH            (EffectType.VERTEX,      floatArrayOf(1.0f),             3, 4, 3, VertexEffectPinch::class.java),
-    SWIRL            (EffectType.VERTEX,      floatArrayOf(0.0f),             1, 4, 3, VertexEffectSwirl::class.java),
-    WAVE             (EffectType.VERTEX,      floatArrayOf(0.0f),             5, 4, 3, VertexEffectWave::class.java),
-    DISAPPEAR        (EffectType.VERTEX,      floatArrayOf(),                 0, 0, 0, VertexEffectDisappear::class.java),
-    PIPE             (EffectType.VERTEX,      floatArrayOf(1f, 0f),           5, 0, 3, VertexEffectPipe::class.java),
+    DISTORT          (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 4, 3, { VertexEffectDistort.code()      }, null, { VertexEffectDistort.enable()      }),
+    DEFORM           (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 4, 3, { VertexEffectDeform.code()       }, null, { VertexEffectDeform.enable()       }),
+    SINK             (EffectType.VERTEX,      floatArrayOf(1.0f),             1, 4, 3, { VertexEffectSink.code()         }, null, { VertexEffectSink.enable()         }),
+    PINCH            (EffectType.VERTEX,      floatArrayOf(1.0f),             3, 4, 3, { VertexEffectPinch.code()        }, null, { VertexEffectPinch.enable()        }),
+    SWIRL            (EffectType.VERTEX,      floatArrayOf(0.0f),             1, 4, 3, { VertexEffectSwirl.code()        }, null, { VertexEffectSwirl.enable()        }),
+    WAVE             (EffectType.VERTEX,      floatArrayOf(0.0f),             5, 4, 3, { VertexEffectWave.code()         }, null, { VertexEffectWave.enable()         }),
+    DISAPPEAR        (EffectType.VERTEX,      floatArrayOf(),                 0, 0, 0, { VertexEffectDisappear.code()    }, null, { VertexEffectDisappear.enable()    }),
+    PIPE             (EffectType.VERTEX,      floatArrayOf(1f, 0f),           5, 0, 3, { VertexEffectPipe.code()         }, null, { VertexEffectPipe.enable()         }),
 
-    VERTEX_MOVE      (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, VertexEffectMove::class.java),
-    VERTEX_QUATERNION(EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, VertexEffectQuaternion::class.java),
-    VERTEX_ROTATE    (EffectType.VERTEX,      floatArrayOf(0.0f),             4, 0, 3, VertexEffectRotate::class.java),
-    VERTEX_SCALE     (EffectType.VERTEX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, VertexEffectScale::class.java),
-    VERTEX_SHEAR     (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, VertexEffectShear::class.java),
+    VERTEX_MOVE      (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, { VertexEffectMove.code()         }, null, { VertexEffectMove.enable()         }),
+    VERTEX_QUATERNION(EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, { VertexEffectQuaternion.code()   }, null, { VertexEffectQuaternion.enable()   }),
+    VERTEX_ROTATE    (EffectType.VERTEX,      floatArrayOf(0.0f),             4, 0, 3, { VertexEffectRotate.code()       }, null, { VertexEffectRotate.enable()       }),
+    VERTEX_SCALE     (EffectType.VERTEX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, { VertexEffectScale.code()        }, null, { VertexEffectScale.enable()        }),
+    VERTEX_SHEAR     (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, { VertexEffectShear.code()        }, null, { VertexEffectShear.enable()        }),
 
-    ALPHA            (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectAlpha::class.java),
-    SMOOTH_ALPHA     (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectAlpha::class.java),
-    CHROMA           (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, FragmentEffectChroma::class.java),
-    SMOOTH_CHROMA    (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, FragmentEffectChroma::class.java),
-    BRIGHTNESS       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectBrightness::class.java),
-    SMOOTH_BRIGHTNESS(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectBrightness::class.java),
-    SATURATION       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectSaturation::class.java),
-    SMOOTH_SATURATION(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectSaturation::class.java),
-    CONTRAST         (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectContrast::class.java),
-    SMOOTH_CONTRAST  (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectContrast::class.java),
+    ALPHA            (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectAlpha.code()      }, null, { FragmentEffectAlpha.enable()      }),
+    SMOOTH_ALPHA     (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectAlpha.code()      }, null, { FragmentEffectAlpha.enable()      }),
+    CHROMA           (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, { FragmentEffectChroma.code()     }, null, { FragmentEffectChroma.enable()     }),
+    SMOOTH_CHROMA    (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, { FragmentEffectChroma.code()     }, null, { FragmentEffectChroma.enable()     }),
+    BRIGHTNESS       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectBrightness.code() }, null, { FragmentEffectBrightness.enable() }),
+    SMOOTH_BRIGHTNESS(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectBrightness.code() }, null, { FragmentEffectBrightness.enable() }),
+    SATURATION       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectSaturation.code() }, null, { FragmentEffectSaturation.enable() }),
+    SMOOTH_SATURATION(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectSaturation.code() }, null, { FragmentEffectSaturation.enable() }),
+    CONTRAST         (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectContrast.code()   }, null, { FragmentEffectContrast.enable()   }),
+    SMOOTH_CONTRAST  (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectContrast.code()   }, null, { FragmentEffectContrast.enable()   }),
 
-    BLUR             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             2, 0, 0, PostprocessEffectBlur::class.java),
-    GLOW             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             6, 0, 0, PostprocessEffectGlow::class.java),
-    BORDER           (EffectType.POSTPROCESS, floatArrayOf(0.0f),             5, 0, 0, PostprocessEffectBorder::class.java),
+    BLUR             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             2, 0, 0, null, { PostprocessEffectBlur.destroyStatics()   }, { PostprocessEffectBlur.enable()   } ),
+    GLOW             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             6, 0, 0, null, { PostprocessEffectGlow.destroyStatics()   }, { PostprocessEffectGlow.enable()   } ),
+    BORDER           (EffectType.POSTPROCESS, floatArrayOf(0.0f),             5, 0, 0, null, { PostprocessEffectBorder.destroyStatics() }, { PostprocessEffectBorder.enable() } ),
     ;
+
     ///////////////////////////////////////////////////////////////////////////////////////////////
 
     val type: EffectType
@@ -83,7 +84,9 @@ enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e:
     private val dimension: Int
     private val regionDim: Int
     private val centerDim: Int
-    val effectClass: Class<out Effect?>
+    val code: (() -> String)?
+    val destroy: (() -> Unit)?
+    val enable: (() -> Unit)?
 
     val effectDimension: Int get() = dimensions[ordinal]
     val regionDimension: Int get() = Companion.regionDimension[ordinal]
@@ -121,7 +124,9 @@ enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e:
         dimension   = d
         regionDim   = r
         centerDim   = c
-        effectClass = e
+        code        = e
+        destroy     = s
+        enable      = n
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////
     fun getName(ordinal: Int): EffectName? = names[ordinal]
diff --git a/src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt b/src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt
index bb58d34..bcb41f7 100644
--- a/src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt
+++ b/src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt
@@ -36,14 +36,8 @@ class FragmentEffectAlpha : FragmentEffect
 
     companion object
     {
-        /**
-         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
-         */
-        fun enable()
-        {
-            addEffect(EffectName.ALPHA, EffectName.SMOOTH_ALPHA,
-                "color.a *= (degree*(fUniforms[effect].x-1.0)+1.0);")
-        }
+        fun code(): String = "color.a *= (degree*(fUniforms[effect].x-1.0)+1.0);"
+        fun enable() = addEffect(EffectName.ALPHA, EffectName.SMOOTH_ALPHA, code() )
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
diff --git a/src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt b/src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt
index d08fcfa..fad6958 100644
--- a/src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt
+++ b/src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt
@@ -36,14 +36,8 @@ class FragmentEffectBrightness : FragmentEffect
 
     companion object
     {
-        /**
-         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
-         */
-        fun enable()
-        {
-            addEffect(EffectName.BRIGHTNESS, EffectName.SMOOTH_BRIGHTNESS,
-                "color.rgb = mix(vec3(0.0,0.0,0.0), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );")
-        }
+        fun code(): String = "color.rgb = mix(vec3(0.0,0.0,0.0), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );"
+        fun enable() = addEffect(EffectName.BRIGHTNESS, EffectName.SMOOTH_BRIGHTNESS, code() )
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
diff --git a/src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt b/src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt
index 13f58b1..3c34cdc 100644
--- a/src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt
+++ b/src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt
@@ -37,14 +37,8 @@ class FragmentEffectChroma : FragmentEffect
 
     companion object
     {
-        /**
-         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
-         */
-        fun enable()
-        {
-            addEffect(EffectName.CHROMA, EffectName.SMOOTH_CHROMA,
-                "color.rgb = mix(color.rgb, fUniforms[effect].yzw, degree*fUniforms[effect].x);")
-        }
+        fun code(): String = "color.rgb = mix(color.rgb, fUniforms[effect].yzw, degree*fUniforms[effect].x);"
+        fun enable() = addEffect(EffectName.CHROMA, EffectName.SMOOTH_CHROMA, code() )
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
diff --git a/src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt b/src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt
index ecdb513..b1edffc 100644
--- a/src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt
+++ b/src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt
@@ -35,14 +35,8 @@ class FragmentEffectContrast : FragmentEffect
 
     companion object
     {
-        /**
-         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
-         */
-        fun enable()
-        {
-            addEffect(EffectName.CONTRAST, EffectName.SMOOTH_CONTRAST,
-                "color.rgb = mix(vec3(0.5,0.5,0.5), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );")
-        }
+        fun code(): String = "color.rgb = mix(vec3(0.5,0.5,0.5), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );"
+        fun enable() = addEffect(EffectName.CONTRAST, EffectName.SMOOTH_CONTRAST, code() )
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
diff --git a/src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt b/src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt
index 466fa48..24e3b71 100644
--- a/src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt
+++ b/src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt
@@ -36,17 +36,11 @@ class FragmentEffectSaturation : FragmentEffect
 
     companion object
     {
-        /**
-         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
-         */
-        fun enable()
-        {
-            addEffect(EffectName.SATURATION, EffectName.SMOOTH_SATURATION,
-                """
+        fun code(): String = """
                     float luminance = dot(vec3( 0.2125, 0.7154, 0.0721 ),color.rgb);
                     color.rgb = mix(vec3(luminance,luminance,luminance), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 ); 
-                    """.trimIndent())
-        }
+                    """.trimIndent()
+        fun enable() = addEffect(EffectName.SATURATION, EffectName.SMOOTH_SATURATION, code() )
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
diff --git a/src/main/java/org/distorted/library/effect/MatrixEffect.kt b/src/main/java/org/distorted/library/effect/MatrixEffect.kt
index 03a7a45..98356ba 100644
--- a/src/main/java/org/distorted/library/effect/MatrixEffect.kt
+++ b/src/main/java/org/distorted/library/effect/MatrixEffect.kt
@@ -37,6 +37,6 @@ abstract class MatrixEffect internal constructor(name: EffectName) : Effect(name
         const val NUM_FLOAT_UNIFORMS: Int = 7  //  4 per-effect interpolated values + 3 dimensional center.
         const val NUM_INT_UNIFORMS: Int = 1
         const val CENTER_OFFSET: Int = 4
-        fun destroyStatics() { /* NO OP */ }
+        fun destroyStatics() { }
     }
 }
diff --git a/src/main/java/org/distorted/library/effect/MatrixEffectRotate.kt b/src/main/java/org/distorted/library/effect/MatrixEffectRotate.kt
index b1c62d3..8eeaeec 100644
--- a/src/main/java/org/distorted/library/effect/MatrixEffectRotate.kt
+++ b/src/main/java/org/distorted/library/effect/MatrixEffectRotate.kt
@@ -73,8 +73,4 @@ class MatrixEffectRotate(angle: Data1D, axis: Data3D, center: Data3D) : MatrixEf
         rotateSinCos(matrixV, mTmp1, mTmp2, sin, cos, axisX, axisY, axisZ)
         translate(matrixV, -x, -y, -z)
     }
-
-    ///////////////////////////////////////////////////////////////////////////////////////////////////
-    // PUBLIC API
-    ///////////////////////////////////////////////////////////////////////////////////////////////////
 }
diff --git a/src/main/java/org/distorted/library/effect/PostprocessEffect.kt b/src/main/java/org/distorted/library/effect/PostprocessEffect.kt
index 9636ee2..41a56e8 100644
--- a/src/main/java/org/distorted/library/effect/PostprocessEffect.kt
+++ b/src/main/java/org/distorted/library/effect/PostprocessEffect.kt
@@ -26,7 +26,6 @@ import org.distorted.library.main.DistortedLibrary
 import org.distorted.library.main.InternalMaster
 import org.distorted.library.main.InternalMaster.Slave
 import org.distorted.library.program.DistortedProgram
-import java.lang.reflect.Method
 import java.nio.ByteBuffer
 import java.nio.ByteOrder
 import java.nio.FloatBuffer
@@ -132,34 +131,8 @@ abstract class PostprocessEffect internal constructor(name: EffectName) : Effect
             mSources.clear()
             mNumSources = 0
 
-            var method: Method?
-
             for (name in EffectName.entries)
-            {
-                if (name.type==EffectType.POSTPROCESS)
-                {
-                    val cls = name.effectClass
-
-                    try
-                    {
-                        method = cls.getDeclaredMethod("destroyStatics") // destroyStatics not public, thus getDeclaredMethod
-                    }
-                    catch (ex: NoSuchMethodException)
-                    {
-                        DistortedLibrary.logMessage("PostprocessEffect: "+cls.simpleName+": exception getting method: "+ex.message)
-                        method = null
-                    }
-
-                    try
-                    {
-                        method?.invoke(null)
-                    }
-                    catch (ex: Exception)
-                    {
-                        DistortedLibrary.logMessage("PostprocessEffect: exception invoking method: "+ex.message)
-                    }
-                }
-            }
+                if (name.type==EffectType.POSTPROCESS) name.destroy?.invoke()
         }
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/effect/VertexEffect.kt b/src/main/java/org/distorted/library/effect/VertexEffect.kt
index bcab5f1..90f6275 100644
--- a/src/main/java/org/distorted/library/effect/VertexEffect.kt
+++ b/src/main/java/org/distorted/library/effect/VertexEffect.kt
@@ -21,12 +21,10 @@
 package org.distorted.library.effect
 
 import org.distorted.library.effectqueue.EffectQueue
-import org.distorted.library.main.DistortedLibrary
 import org.distorted.library.type.Static1D
 import org.distorted.library.type.Static3D
 import org.distorted.library.type.Static4D
 import org.distorted.library.type.Static5D
-import java.lang.reflect.Method
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
@@ -96,40 +94,13 @@ abstract class VertexEffect internal constructor(name: EffectName) : Effect(name
         // prepare the code to be injected into the Full program, i.e. code of ALL vertex effects.
         private fun prepareFull()
         {
-            var method: Method?
-
             for (name in EffectName.entries)
-            {
                 if (name.type==EffectType.VERTEX)
                 {
-                    val cls = name.effectClass
-
-                    try
-                    {
-                        method = cls.getDeclaredMethod("code")
-                    }
-                    catch (ex: NoSuchMethodException)
-                    {
-                        DistortedLibrary.logMessage("VertexEffect: exception getting method: "+ex.message)
-                        method = null
-                    }
-
-                    try
-                    {
-                        if (method!=null)
-                        {
-                            val value = method.invoke(null)
-                            val code = value as String
-                            mFullGLSL += retSection(name.ordinal, code)
-                            mFullEnabled++
-                        }
-                    }
-                    catch (ex: Exception)
-                    {
-                        DistortedLibrary.logMessage("VertexEffect: exception invoking method: "+ex.message)
-                    }
+                    val code = name.code?.invoke()
+                    mFullGLSL += retSection(name.ordinal, code)
+                    mFullEnabled++
                 }
-            }
         }
 
         ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -235,6 +206,7 @@ abstract class VertexEffect internal constructor(name: EffectName) : Effect(name
             return null
         }
     }
+    // end companion
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     override fun addQueue(queue: EffectQueue)
     {
diff --git a/src/main/java/org/distorted/library/effect/VertexEffectDeform.kt b/src/main/java/org/distorted/library/effect/VertexEffectDeform.kt
index 6c5f7b0..b0e2ed1 100644
--- a/src/main/java/org/distorted/library/effect/VertexEffectDeform.kt
+++ b/src/main/java/org/distorted/library/effect/VertexEffectDeform.kt
@@ -77,7 +77,7 @@ class VertexEffectDeform : VertexEffect
         //    X(x,y) = -B*x * (|Vy|/(|Vy|+A*W)) * (1-(y/H)^2)                               (**)
         //    Y(x,y) = Vy * (1 - |y|/(|Vy|+C*|y|)) * (1 - (A*W/(|Vy|+A*W))*(x/W)^2)         (**)
         //
-        // We notice that formulas (**) have been construed so that it is possible to continously mirror them
+        // We notice that formulas (**) have been construed so that it is possible to continuously mirror them
         // left-right and up-down (i.e. apply not only to the 'bottom-right' rectangle of the 4 subrectangles
         // but to all 4 of them!).
         //
@@ -85,7 +85,7 @@ class VertexEffectDeform : VertexEffect
         // a) A : valid values: (0,infinity). 'Bendiness' if the surface - the higher A is, the more the surface
         //        bends. A<=0 destroys the system.
         // b) B : valid values: <-1,1>. The amount side edges get 'sucked' inwards when we pull the middle of the
-        //        top edge up. B=0 --> not at all, B=1: a looot. B=-0.5: the edges will actually be pushed outwards
+        //        top edge up. B=0 --> not at all, B=1: a lot. B=-0.5: the edges will actually be pushed outwards
         //        quite a bit. One can also set it to <-1 or >1, but it will look a bit ridiculous.
         // c) C : valid values: <1,infinity). The derivative of the H(y) function at 0, i.e. the rate of 'squeeze'
         //        surface gets along the force line. C=1: our point gets pulled very closely to points above it
