commit d7829514389c0b0c7ab3dd5072229ba86bd6f266
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue May 26 13:53:47 2020 +0100

    1) Cube: convert it to the latest library. Main difference: objects are rendered better, individual cubits have rounded corners.
    2) Examples: some adjustments to MeshJoin & Predeform
    3) Library: fix a bug in main_vertex_shader's 'degree' function, which didn't work proprely in case of a vertex which was exactly at the center (i.e. vector PS was zero)

diff --git a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
index 0a525e9..33857be 100644
--- a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
+++ b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
@@ -86,7 +86,7 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       quatInt1.add(mQuat1);
       quatInt2.add(mQuat2);
 
-      mSinkAssociation = 15;
+      mSinkAssociation = 0;
       mSink = new VertexEffectSink( sink, center, new Static4D(0,0,0,0.75f) );
       mSink.setMeshAssociation(mSinkAssociation);
 
@@ -214,7 +214,7 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
 
       for(int i=0; i<MESHES; i++)
         {
-        meshes[i] = new MeshTriangles(10);
+        meshes[i] = new MeshTriangles(5);
         meshes[i].setEffectAssociation(0,association);
         association <<= 1;
         }
@@ -267,17 +267,10 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       VertexEffectDeform effect10= new VertexEffectDeform(dVec2, dRad, dCen2, dReg);
       VertexEffectDeform effect11= new VertexEffectDeform(dVec3, dRad, dCen3, dReg);
 
-      effect1.setMeshAssociation(15);  // apply to all 4 meshes
-      effect2.setMeshAssociation(15);  // apply to all 4 meshes
-      effect3.setMeshAssociation(15);  // apply to all 4 meshes
       effect4.setMeshAssociation(14);  // apply to mesh[1], [2] and [3]
       effect5.setMeshAssociation( 2);  // apply only to mesh[1]
       effect6.setMeshAssociation( 4);  // apply only to mesh[2]
       effect7.setMeshAssociation( 8);  // apply only to mesh[3]
-      effect8.setMeshAssociation(15);  // apply to all 4 meshes
-      effect9.setMeshAssociation(15);  // apply to all 4 meshes
-      effect10.setMeshAssociation(15); // apply to all 4 meshes
-      effect11.setMeshAssociation(15); // apply to all 4 meshes
 
       result.apply(effect1);
       result.apply(effect2);
diff --git a/src/main/java/org/distorted/examples/predeform/PredeformActivity.java b/src/main/java/org/distorted/examples/predeform/PredeformActivity.java
index 282aa8e..e0beb29 100644
--- a/src/main/java/org/distorted/examples/predeform/PredeformActivity.java
+++ b/src/main/java/org/distorted/examples/predeform/PredeformActivity.java
@@ -330,27 +330,6 @@ public class PredeformActivity extends Activity implements View.OnClickListener,
 
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getWidth()
-    {
-    return mNumCols;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getHeight()
-    {
-    return mNumRows;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getDepth()
-    {
-    return mNumSlic;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   @Override
diff --git a/src/main/java/org/distorted/examples/predeform/PredeformEffect.java b/src/main/java/org/distorted/examples/predeform/PredeformEffect.java
index 09e956e..4e72e8e 100644
--- a/src/main/java/org/distorted/examples/predeform/PredeformEffect.java
+++ b/src/main/java/org/distorted/examples/predeform/PredeformEffect.java
@@ -204,13 +204,13 @@ class PredeformEffect implements SeekBar.OnSeekBarChangeListener
       ///////////////////////////////////////////////////////////////////////////////////////
 
       case VERTEX_MOVE      :
-      case DISTORT          : float ld = mAct.get().getWidth()/50.0f;
+      case DISTORT          : float ld = 0.02f;
                               float xd = (mInter[0]-50)*ld;
                               float yd = (mInter[1]-50)*ld;
                               float zd = (mInter[2]-50)*ld;
                               mSta3.set(xd,yd,zd);
                               break;
-      case DEFORM           : float le = mAct.get().getWidth()/50.0f;
+      case DEFORM           : float le = 0.02f;
                               float xe = (mInter[0]-50)*le;
                               float ye = (mInter[1]-50)*le;
                               float ze = (mInter[2]-50)*le;
@@ -218,7 +218,7 @@ class PredeformEffect implements SeekBar.OnSeekBarChangeListener
                               float re = (mInter[3])*le;
                               mSta1.set(re);
                               break;
-      case WAVE             : float l2 = mAct.get().getWidth()/50.0f;
+      case WAVE             : float l2 = 0.02f;
                               float x2 = (mInter[0]-50)*l2;
                               float y2 = (mInter[1]-50)*l2;
                               float z2 = (mInter[2]-50)*180 / 50.0f;
@@ -355,9 +355,9 @@ class PredeformEffect implements SeekBar.OnSeekBarChangeListener
     {
     PredeformActivity act = mAct.get();
 
-    float x = (mInterCenter[0]*0.012f - 0.6f)*act.getWidth();
-    float y = (mInterCenter[1]*0.012f - 0.6f)*act.getHeight();
-    float z = (mInterCenter[2]*0.012f - 0.6f)*act.getDepth();
+    float x = (mInterCenter[0]*0.012f - 0.6f);
+    float y = (mInterCenter[1]*0.012f - 0.6f);
+    float z = (mInterCenter[2]*0.012f - 0.6f);
 
     if( mName.getType() == EffectType.MATRIX )
       {
@@ -396,9 +396,9 @@ class PredeformEffect implements SeekBar.OnSeekBarChangeListener
     {
     PredeformActivity act = mAct.get();
 
-    float factorX = act.getWidth() / 100.0f;
-    float factorY = act.getHeight()/ 100.0f;
- // float factorZ = act.getDepth() / 100.0f;
+    float factorX = 0.01f;
+    float factorY = 0.01f;
+ // float factorZ = 0.01f;
 
     int deduct = (mName.getType() == EffectType.VERTEX ? 50:0);
 
diff --git a/src/main/res/layout/meshjoinlayout.xml b/src/main/res/layout/meshjoinlayout.xml
index 070dee8..917c507 100644
--- a/src/main/res/layout/meshjoinlayout.xml
+++ b/src/main/res/layout/meshjoinlayout.xml
@@ -29,7 +29,7 @@
             android:text="@string/color_yellow"
             android:onClick="onClick"
             android:layout_weight="1"
-            android:checked="true"/>
+            android:checked="false"/>
         <CheckBox
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
@@ -37,7 +37,7 @@
             android:text="@string/color_green"
             android:onClick="onClick"
             android:layout_weight="1"
-            android:checked="true"/>
+            android:checked="false"/>
         <CheckBox
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
@@ -45,7 +45,7 @@
             android:text="@string/color_blue"
             android:onClick="onClick"
             android:layout_weight="1"
-            android:checked="true"/>
+            android:checked="false"/>
         <CheckBox
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
@@ -53,7 +53,7 @@
             android:text="@string/color_red"
             android:onClick="onClick"
             android:layout_weight="1"
-            android:checked="true"/>
+            android:checked="false"/>
 
     </LinearLayout>
 
