commit 1d292925e8a8bc9c7c24f96453d71ac26cb71375
Author: LeszekKoltunski <leszek@koltunski.pl>
Date:   Wed Jun 4 10:28:17 2025 +0200

    bugfix. DistortedNodes work now.

diff --git a/src/main/java/org/distorted/library/main/DistortedNode.kt b/src/main/java/org/distorted/library/main/DistortedNode.kt
index 2ed5a2e..3d626d7 100644
--- a/src/main/java/org/distorted/library/main/DistortedNode.kt
+++ b/src/main/java/org/distorted/library/main/DistortedNode.kt
@@ -50,6 +50,7 @@ open class DistortedNode : InternalChildrenList.Parent
     private var mFOV: Float
     private var mNear: Float
     private var mLastTime: Long
+    private var mSurface: InternalSurface? = null
 
     companion object
     {
@@ -161,7 +162,7 @@ open class DistortedNode : InternalChildrenList.Parent
     // return the total number of render calls issued
     fun drawNoBlend(currTime: Long, surface: InternalOutputSurface): Int
     {
-        if ( mSurface!!.setAsInput() )
+        if( setAsInput() )
         {
             mState.apply()
             GLES30.glDisable(GLES30.GL_BLEND)
@@ -179,7 +180,7 @@ open class DistortedNode : InternalChildrenList.Parent
     // Use the Order Independent Transparency method to draw a non-postprocessed child.
     fun drawOIT(currTime: Long, surface: InternalOutputSurface): Int
     {
-        if (mSurface!!.setAsInput())
+        if( setAsInput() )
         {
             mState.apply()
             if (mLastTime==0L) mLastTime = currTime
@@ -195,7 +196,7 @@ open class DistortedNode : InternalChildrenList.Parent
     // return the total number of render calls issued
     fun draw(currTime: Long, surface: InternalOutputSurface): Int
     {
-        if (mSurface!!.setAsInput())
+        if( setAsInput() )
         {
             mState.apply()
             if (mLastTime==0L) mLastTime = currTime
@@ -514,12 +515,12 @@ open class DistortedNode : InternalChildrenList.Parent
 
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     /**
-     * Returns the surface this object gets rendered to.
-     *
-     * @return The InternalSurface contained in the Node (if a leaf), or the FBO (if an internal Node)
+     * Sets the surface this object gets rendered to as rendering input.
      */
-    var mSurface: InternalSurface? = null
-        get() = if (mChildren.numChildren==0) field else mData.mFBO
+     fun setAsInput(): Boolean
+     {
+         return (if (mChildren.numChildren==0) mSurface!!.setAsInput() else mData.mFBO!!.setAsInput())
+     }
 
     //////////////////////////////////////////////////////////////////////////////////////////////////
      /**
diff --git a/src/main/java/org/distorted/library/main/InternalOutputSurface.kt b/src/main/java/org/distorted/library/main/InternalOutputSurface.kt
index 5339a3c..055d863 100644
--- a/src/main/java/org/distorted/library/main/InternalOutputSurface.kt
+++ b/src/main/java/org/distorted/library/main/InternalOutputSurface.kt
@@ -352,7 +352,7 @@ abstract class InternalOutputSurface
         {
             val node = children.getChild(j)
 
-            if (node.mSurface!!.setAsInput())
+            if( node.setAsInput() )
             {
                 buffer.setAsOutput()
                 numRenders += queue.preprocess(buffer, node, buffer.mDistance, buffer.mMipmap, buffer.mProjectionMatrix)
@@ -360,7 +360,7 @@ abstract class InternalOutputSurface
         }
         numRenders += queue.postprocess(buffer)
 
-        if (oit)
+        if( oit )
         {
             numRenders += oitBuild(time, buffer, fbo)
             GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT or GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT)
