commit 55fa249997e18a5628c9450767c6d4b05560626c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Jun 10 11:49:06 2020 +0100

    Speedup for rendering: cubes 2,3 contain better quality cubit faces (more vertices) than cubes 4,5.

diff --git a/src/main/java/org/distorted/objects/RubikCube.java b/src/main/java/org/distorted/objects/RubikCube.java
index 1bc863ff..13f676a4 100644
--- a/src/main/java/org/distorted/objects/RubikCube.java
+++ b/src/main/java/org/distorted/objects/RubikCube.java
@@ -93,7 +93,8 @@ class RubikCube extends RubikObject
          new Static4D( -0.5f,   0.5f,   0.5f,   0.5f)
          };
 
-  private static MeshBase mMesh = null;
+  private static MeshBase mMeshBig = null;
+  private static MeshBase mMeshSma = null;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -161,12 +162,22 @@ class RubikCube extends RubikObject
 
   MeshBase createCubitMesh(int cubit)
     {
-    if( mMesh==null )
+    return createCubitMesh(getSize()<=3);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createCubitMesh(boolean big)
+    {
+    MeshBase mesh = big ? mMeshBig : mMeshSma;
+    int size = big ? 14 : 9;
+
+    if( mesh==null )
       {
       final int MESHES=6;
       int association = 1;
       MeshBase[] meshes = new MeshRectangles[MESHES];
-      meshes[0] = new MeshRectangles(14,14);
+      meshes[0] = new MeshRectangles(size,size);
       meshes[0].setEffectAssociation(0,association,0);
 
       for(int i=1; i<MESHES; i++)
@@ -176,7 +187,7 @@ class RubikCube extends RubikObject
         meshes[i].setEffectAssociation(0,association,0);
         }
 
-      mMesh = new MeshJoined(meshes);
+      mesh = new MeshJoined(meshes);
 
       Static3D axisY   = new Static3D(0,1,0);
       Static3D axisX   = new Static3D(1,0,0);
@@ -234,26 +245,26 @@ class RubikCube extends RubikObject
 
       VertexEffectSink   effect14= new VertexEffectSink( new Static1D(1.5f), center, new Static4D(0,0,0,0.72f) );
 
-      mMesh.apply(effect0);
-      mMesh.apply(effect1);
-      mMesh.apply(effect2);
-      mMesh.apply(effect3);
-      mMesh.apply(effect4);
-      mMesh.apply(effect5);
-      mMesh.apply(effect6);
-      mMesh.apply(effect7);
-      mMesh.apply(effect8);
-      mMesh.apply(effect9);
-      mMesh.apply(effect10);
-      mMesh.apply(effect11);
-      mMesh.apply(effect12);
-      mMesh.apply(effect13);
-      mMesh.apply(effect14);
-
-      mMesh.mergeEffComponents();
+      mesh.apply(effect0);
+      mesh.apply(effect1);
+      mesh.apply(effect2);
+      mesh.apply(effect3);
+      mesh.apply(effect4);
+      mesh.apply(effect5);
+      mesh.apply(effect6);
+      mesh.apply(effect7);
+      mesh.apply(effect8);
+      mesh.apply(effect9);
+      mesh.apply(effect10);
+      mesh.apply(effect11);
+      mesh.apply(effect12);
+      mesh.apply(effect13);
+      mesh.apply(effect14);
+
+      mesh.mergeEffComponents();
       }
 
-    return mMesh.copy(true);
+    return mesh.copy(true);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
