commit 0339e04e9505dfcaf71dd816b8b720bc53067a59
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat May 23 23:47:47 2020 +0100

    Progress with MeshJoin - round the corners. Looks so-so.

diff --git a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
index 64e7044..0a525e9 100644
--- a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
+++ b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
@@ -27,6 +27,7 @@ import android.opengl.GLSurfaceView;
 import org.distorted.library.effect.EffectType;
 import org.distorted.library.effect.MatrixEffectQuaternion;
 import org.distorted.library.effect.MatrixEffectScale;
+import org.distorted.library.effect.VertexEffectDeform;
 import org.distorted.library.effect.VertexEffectMove;
 import org.distorted.library.effect.VertexEffectRotate;
 import org.distorted.library.effect.VertexEffectScale;
@@ -128,7 +129,7 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       mScreen.detachAll();
       mScreen.attach(mTexture,mEffects,mMesh);
 
-      DistortedLibrary.setMax(EffectType.VERTEX, 7);
+      DistortedLibrary.setMax(EffectType.VERTEX, 11);
       VertexEffectSink.enable();
 
       try
@@ -223,6 +224,29 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       MeshBase result = new MeshJoined(meshes);
       result.setTextureMap(textureMaps);
 
+      Static3D a0 = new Static3D(         0,        1,       0 );
+      Static3D a1 = new Static3D(         0,  -1.0f/3, 2*SQ2/3 );
+      Static3D a2 = new Static3D(-SQ2*SQ3/3,  -1.0f/3,  -SQ2/3 );
+      Static3D a3 = new Static3D( SQ2*SQ3/3,  -1.0f/3,  -SQ2/3 );
+
+      float tetraHeight = SQ2*SQ3/3;
+      float d1 = 0.75f*tetraHeight;
+      float d2 =-0.10f*tetraHeight;
+      float d3 = 0.20f*tetraHeight;
+
+      Static3D dCen0 = new Static3D( d1*a0.get0(), d1*a0.get1(), d1*a0.get2() );
+      Static3D dCen1 = new Static3D( d1*a1.get0(), d1*a1.get1(), d1*a1.get2() );
+      Static3D dCen2 = new Static3D( d1*a2.get0(), d1*a2.get1(), d1*a2.get2() );
+      Static3D dCen3 = new Static3D( d1*a3.get0(), d1*a3.get1(), d1*a3.get2() );
+
+      Static3D dVec0 = new Static3D( d2*a0.get0(), d2*a0.get1(), d2*a0.get2() );
+      Static3D dVec1 = new Static3D( d2*a1.get0(), d2*a1.get1(), d2*a1.get2() );
+      Static3D dVec2 = new Static3D( d2*a2.get0(), d2*a2.get1(), d2*a2.get2() );
+      Static3D dVec3 = new Static3D( d2*a3.get0(), d2*a3.get1(), d2*a3.get2() );
+
+      Static4D dReg  = new Static4D(0,0,0,d3);
+      Static1D dRad  = new Static1D(1);
+
       Static1D angle  = new Static1D(angleFaces);
       Static3D axis1  = new Static3D(  -1, 0,      0);
       Static3D axis2  = new Static3D(0.5f, 0, -SQ3/2);
@@ -230,13 +254,18 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       Static3D center1= new Static3D(0,-SQ3*SQ2/12,-SQ3/6);
       Static3D center2= new Static3D(0,-SQ3*SQ2/12,+SQ3/3);
 
-      VertexEffectScale  effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) );
-      VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
-      VertexEffectMove   effect3 = new VertexEffectMove  ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
-      VertexEffectRotate effect4 = new VertexEffectRotate( new Static1D(180), new Static3D(0,0,1), center1 );
-      VertexEffectRotate effect5 = new VertexEffectRotate( angle, axis1, center1 );
-      VertexEffectRotate effect6 = new VertexEffectRotate( angle, axis2, center2 );
-      VertexEffectRotate effect7 = new VertexEffectRotate( angle, axis3, center2 );
+      VertexEffectScale   effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) );
+      VertexEffectRotate  effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
+      VertexEffectMove    effect3 = new VertexEffectMove  ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
+      VertexEffectRotate  effect4 = new VertexEffectRotate( new Static1D(180), new Static3D(0,0,1), center1 );
+      VertexEffectRotate  effect5 = new VertexEffectRotate( angle, axis1, center1 );
+      VertexEffectRotate  effect6 = new VertexEffectRotate( angle, axis2, center2 );
+      VertexEffectRotate  effect7 = new VertexEffectRotate( angle, axis3, center2 );
+
+      VertexEffectDeform effect8 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg);
+      VertexEffectDeform effect9 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg);
+      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
@@ -245,6 +274,10 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       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);
@@ -253,6 +286,10 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       result.apply(effect5);
       result.apply(effect6);
       result.apply(effect7);
+      result.apply(effect8);
+      result.apply(effect9);
+      result.apply(effect10);
+      result.apply(effect11);
 
       return result;
       }
