commit 828498b151d1a3d34e08cf4bd4e423a0c7ad4979
Author: leszek <leszek@koltunski.pl>
Date:   Wed Dec 18 22:14:51 2024 +0100

    Make it possible to apply Postprocessing effects to only an arbitrary subset of components.

diff --git a/src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java b/src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java
index 6ca2550..a3b6141 100644
--- a/src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java
+++ b/src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java
@@ -106,4 +106,23 @@ public class SingleMeshActivity extends Activity
       if( id == R.id.singlemesh6 ) r.disappear(6);
       if( id == R.id.singlemesh7 ) r.disappear(7);
       }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void NotAffected(View view)
+      {
+      CheckBox box = (CheckBox)view;
+      int id = box.getId();
+      SingleMeshSurfaceView v = findViewById(R.id.singlemeshSurfaceView);
+      SingleMeshRenderer r = v.getRenderer();
+
+      if( id == R.id.singlemeshNot0 ) r.notAffected(0);
+      if( id == R.id.singlemeshNot1 ) r.notAffected(1);
+      if( id == R.id.singlemeshNot2 ) r.notAffected(2);
+      if( id == R.id.singlemeshNot3 ) r.notAffected(3);
+      if( id == R.id.singlemeshNot4 ) r.notAffected(4);
+      if( id == R.id.singlemeshNot5 ) r.notAffected(5);
+      if( id == R.id.singlemeshNot6 ) r.notAffected(6);
+      if( id == R.id.singlemeshNot7 ) r.notAffected(7);
+      }
 }
diff --git a/src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java b/src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java
index f9dacd3..4064e30 100644
--- a/src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java
+++ b/src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java
@@ -119,6 +119,7 @@ class SingleMeshRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Lib
     private final Static1D mAngle;
     private final Static3D mAxis;
     private final boolean[] mInvisible;
+    private final boolean[] mNotAffected;
 
     private int mDisappearAssociation;
     private DistortedTexture mTexture;
@@ -132,6 +133,7 @@ class SingleMeshRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Lib
     SingleMeshRenderer(GLSurfaceView v)
       {
       mInvisible = new boolean[NUM_CUBITS];
+      mNotAffected = new boolean[NUM_CUBITS];
       mResources = v.getResources();
 
       mScreen = new DistortedScreen();
@@ -270,6 +272,23 @@ class SingleMeshRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Lib
       mDisappear.setMeshAssociation(mDisappearAssociation,-1);
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    void notAffected(int cubit)
+      {
+      mNotAffected[cubit] = !mNotAffected[cubit];
+
+      int numComponents = 0;
+      for(int c=0; c<NUM_CUBITS; c++) if( mNotAffected[c] ) numComponents++;
+      int[] components = new int[numComponents];
+
+      int index =0;
+      for(int c=0; c<NUM_CUBITS; c++)
+        if( mNotAffected[c] ) components[index++]=c;
+
+      mMesh.setComponentsNotAffectedByPostprocessing(components);
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     int addAssociation(int cubit, int assoc) { return (assoc |  (1<<cubit)); }
diff --git a/src/main/res/layout/singlemeshlayout.xml b/src/main/res/layout/singlemeshlayout.xml
index bde3a92..0389c4f 100644
--- a/src/main/res/layout/singlemeshlayout.xml
+++ b/src/main/res/layout/singlemeshlayout.xml
@@ -140,4 +140,83 @@
 
     </LinearLayout>
 
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <CheckBox
+            android:id="@+id/singlemeshNot0"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="1"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot1"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="2"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot2"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="3"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot3"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="4"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot4"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="5"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot5"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="6"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot6"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="7"
+            android:textSize="12sp"/>
+        <CheckBox
+            android:id="@+id/singlemeshNot7"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:checked="false"
+            android:onClick="NotAffected"
+            android:text="8"
+            android:textSize="12sp"/>
+
+    </LinearLayout>
 </LinearLayout>
\ No newline at end of file
