commit 8d3cfe991fce4476f2ebc21dee1fa64c1e2b0a57
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Oct 6 23:08:01 2020 +0100

    New API for the library: add an empty texture component to a Mesh.
    Use this in thr Magic Cube to add empty texture components to some types of cubits.

diff --git a/src/main/java/org/distorted/objects/CubitFactory.java b/src/main/java/org/distorted/objects/CubitFactory.java
index b2f5071d..2e03f0d4 100644
--- a/src/main/java/org/distorted/objects/CubitFactory.java
+++ b/src/main/java/org/distorted/objects/CubitFactory.java
@@ -298,8 +298,6 @@ public class CubitFactory
 
   MeshBase createSkewbFaceMesh()
     {
-    int association = 1;
-
     float D = 0.03f;
     float E = SQ2/4;
     float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
@@ -312,28 +310,21 @@ public class CubitFactory
                        0.30f   , D*1.60f,
                        0.0f    , D*1.70f };
 
-    MeshBase[] meshes = new MeshBase[6];
+    MeshBase[] meshes = new MeshBase[5];
     meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
-    meshes[0].setEffectAssociation(0,association,0);
-
-    association <<= 1;
+    meshes[0].setEffectAssociation(0,1,0);
 
     float[] vertices1 = { -E,-SQ3*E, +E,-SQ3*E, 0,0 };
     float[] bands1 = { 1.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f };
 
     meshes[1] = new MeshPolygon(vertices1,bands1,0,0);
-    meshes[1].setEffectAssociation(0,association,0);
-
-    for(int i=2; i<5; i++)
-      {
-      association <<= 1;
-      meshes[i] = meshes[1].copy(true);
-      meshes[i].setEffectAssociation(0,association,0);
-      }
-
-    association <<= 1;
-    meshes[5] = new MeshTriangle(1);                  // empty triangle so that
-    meshes[5].setEffectAssociation(0,association,0);  // all cubits have 6 faces
+    meshes[1].setEffectAssociation(0,2,0);
+    meshes[2] = meshes[1].copy(true);
+    meshes[2].setEffectAssociation(0,4,0);
+    meshes[3] = meshes[1].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+    meshes[4] = meshes[1].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
 
     MeshBase mesh = new MeshJoined(meshes);
 
@@ -348,7 +339,6 @@ public class CubitFactory
     VertexEffect effect3 = new VertexEffectRotate( new Static1D(  -45), axisZ, center);
     VertexEffect effect4 = new VertexEffectRotate( new Static1D( -135), axisZ, center);
     VertexEffect effect5 = new VertexEffectMove( new Static3D(0,0,-0.5f) );
-    VertexEffect effect6 = new VertexEffectScale(0);
 
     effect0.setMeshAssociation(30,-1);  // meshes 1,2,3,4
     effect1.setMeshAssociation( 2,-1);  // mesh 1
@@ -356,7 +346,6 @@ public class CubitFactory
     effect3.setMeshAssociation( 8,-1);  // mesh 3
     effect4.setMeshAssociation(16,-1);  // mesh 4
     effect5.setMeshAssociation(30,-1);  // meshes 1,2,3,4
-    effect6.setMeshAssociation(32,-1); // mesh 5
 
     mesh.apply(effect0);
     mesh.apply(effect1);
@@ -364,7 +353,6 @@ public class CubitFactory
     mesh.apply(effect3);
     mesh.apply(effect4);
     mesh.apply(effect5);
-    mesh.apply(effect6);
 
     Static3D roundingCenter = new Static3D(0,0,-0.2f);
 
@@ -376,6 +364,7 @@ public class CubitFactory
     roundCorners(mesh,roundingCenter,vertices,0.10f,0.10f);
 
     mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
 
     return mesh;
     }
@@ -467,7 +456,7 @@ public class CubitFactory
 
   MeshBase createTetraMesh()
     {
-    MeshBase[] meshes = new MeshBase[8];
+    MeshBase[] meshes = new MeshBase[4];
     int association = 1;
 
     float C = 0.06f;
@@ -494,13 +483,6 @@ public class CubitFactory
       meshes[i].setEffectAssociation(0,association,0);
       }
 
-    for(int i=4; i<8; i++)
-      {
-      association <<= 1;
-      meshes[i] = new MeshTriangle(1);
-      meshes[i].setEffectAssociation(0,association,0);
-      }
-
     MeshBase mesh = new MeshJoined(meshes);
 
     Static3D flipZ = new Static3D( 1, 1,-1);
@@ -523,7 +505,6 @@ public class CubitFactory
     VertexEffect effect3 = new VertexEffectScale(flipZ);
     VertexEffect effect4 = new VertexEffectRotate(angle1, axisY, cent0);
     VertexEffect effect5 = new VertexEffectRotate(angle2, axisZ, cent0);
-    VertexEffect effect6 = new VertexEffectScale(0);
 
     effect0.setMeshAssociation(15,-1); // meshes 0,1,2,3
     effect1.setMeshAssociation(15,-1); // meshes 0,1,2,3
@@ -531,7 +512,6 @@ public class CubitFactory
     effect3.setMeshAssociation(10,-1); // meshes 1 & 3
     effect4.setMeshAssociation(12,-1); // meshes 2 & 3
     effect5.setMeshAssociation(12,-1); // meshes 2 & 3
-    effect6.setMeshAssociation(240,-1);// meshes 4,5,6,7
 
     mesh.apply(effect0);
     mesh.apply(effect1);
@@ -539,7 +519,6 @@ public class CubitFactory
     mesh.apply(effect3);
     mesh.apply(effect4);
     mesh.apply(effect5);
-    mesh.apply(effect6);
 
     Static3D[] verticesRound = new Static3D[4];
     verticesRound[0] = new Static3D(-0.5f,+SQ2/4,   0 );
@@ -549,6 +528,10 @@ public class CubitFactory
     roundCorners(mesh,cent0,verticesRound,0.08f,0.15f);
 
     mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
 
     return mesh;
     }
@@ -761,7 +744,7 @@ public class CubitFactory
 
   MeshBase createHelicopterFaceMesh()
     {
-    MeshBase[] meshes = new MeshBase[6];
+    MeshBase[] meshes = new MeshBase[4];
 
     float D = 0.02f;
     float E = 0.5f;
@@ -800,10 +783,6 @@ public class CubitFactory
     meshes[2].setEffectAssociation(0,4,0);
     meshes[3] = meshes[2].copy(true);
     meshes[3].setEffectAssociation(0,8,0);
-    meshes[4] = new MeshTriangle(1);
-    meshes[4].setEffectAssociation(0,16,0);
-    meshes[5] = new MeshTriangle(1);
-    meshes[5].setEffectAssociation(0,32,0);
 
     MeshBase mesh = new MeshJoined(meshes);
 
@@ -833,7 +812,6 @@ public class CubitFactory
     VertexEffect effect7 = new VertexEffectRotate(angle4, axisX, center);
     VertexEffect effect8 = new VertexEffectRotate(angle1, axisY, center);
     VertexEffect effect9 = new VertexEffectMove(move4);
-    VertexEffect effect10= new VertexEffectScale(0);
 
     effect0.setMeshAssociation( 1,-1);  // mesh 0
     effect1.setMeshAssociation( 2,-1);  // mesh 1
@@ -845,7 +823,6 @@ public class CubitFactory
     effect7.setMeshAssociation( 4,-1);  // mesh 2
     effect8.setMeshAssociation( 8,-1);  // mesh 3
     effect9.setMeshAssociation(15,-1);  // meshes 0,1,2,3
-    effect10.setMeshAssociation(48,-1); // meshes 4,5
 
     mesh.apply(effect0);
     mesh.apply(effect1);
@@ -857,7 +834,6 @@ public class CubitFactory
     mesh.apply(effect7);
     mesh.apply(effect8);
     mesh.apply(effect9);
-    mesh.apply(effect10);
 
     Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
 
@@ -871,6 +847,8 @@ public class CubitFactory
     roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f);
 
     mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
 
     return mesh;
     }
diff --git a/src/main/java/org/distorted/objects/TwistyObject.java b/src/main/java/org/distorted/objects/TwistyObject.java
index 3c490cf6..28395efe 100644
--- a/src/main/java/org/distorted/objects/TwistyObject.java
+++ b/src/main/java/org/distorted/objects/TwistyObject.java
@@ -69,7 +69,7 @@ public abstract class TwistyObject extends DistortedNode
   private static final float MAX_SIZE_CHANGE = 1.35f;
   private static final float MIN_SIZE_CHANGE = 0.8f;
 
-  private static boolean mCreateFromDMesh = true;
+  private static boolean mCreateFromDMesh = false;
 
   private static final Static3D CENTER = new Static3D(0,0,0);
   private static final int POST_ROTATION_MILLISEC = 500;
