commit fa5dad159d89d71dc33cf7f6fc99a7b150e5e43e
Author: leszek <leszek@koltunski.pl>
Date:   Tue Aug 1 19:36:08 2023 +0200

    Major progress with supporting cubit faces with holes.

diff --git a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
index c25bb3f..761b4d3 100644
--- a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
+++ b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
@@ -329,6 +329,13 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Libra
       mMesh.setEffectAssociation(0,0,0);
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    private float[] gen(float x, float y)
+      {
+      return new float[] { x+0.1f, y-0.1f, x-0.1f, y-0.1f, x-0.1f, y+0.1f, x+0.1f, y+0.1f };
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     private void createMultigon()
@@ -337,32 +344,30 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Libra
       int extraIndex    = 0;
       int extraVertices = 0;
 
-      float[] v1 = new float[] {  0,0,  0.5f, -SQ3/2, 1,0 };
-      float[] v2 = new float[] { -1,0, -0.5f, -SQ3/2, 0,0 };
-      float[] v3 = new float[] {  0,0, -0.5f, -SQ3/2, 0.5f, -SQ3/2 };
-
-      float[][] vertices = new float[][] {v1,v2,v3};
-/*
-      float[] v1 = new float[] {  -A,-A,   A,-A,   A,  A,   -A,  A };
-      float[] v2 = new float[] {   A,-A, 2*A,-A, 2*A,  A,    A,  A };
-      float[] v3 = new float[] {-3*A,-A,  -A,-A,  -A,  A, -3*A,  A };
-      float[] v4 = new float[] {  -A, A,   A, A,   A,3*A,   -A,3*A };
-      float[] v5 = new float[] {-3*A, A,  -A, A,  -A,3*A, -3*A,3*A };
-
-      float[][] vertices = new float[][] {v1,v2,v3,v4,v5};
- */
-/*
-      float[] c1 = new float[] { 0,0 };
-      float[] c2 = new float[] { 1.5f*A,0 };
-      float[] c3 = new float[] {-1.5f*A,0 };
-      float[] c4 = new float[] { 0,1.5f*A };
-      float[] c5 = new float[] { -1.5f*A,1.5f*A };
-
-      float[][] centers = new float[][] { c1,c2,c3,c4,c5 };
-*/
-      float C = 2f;
+      float[][] vertices = new float[19][];
+
+      vertices[ 0] = gen( 0.4f,-0.4f);
+      vertices[ 1] = gen( 0.2f,-0.4f);
+      vertices[ 2] = gen( 0.0f,-0.4f);
+      vertices[ 3] = gen(-0.2f,-0.4f);
+      vertices[ 4] = gen(-0.4f,-0.4f);
+      vertices[ 5] = gen(-0.4f,-0.2f);
+      vertices[ 6] = gen(-0.4f, 0.0f);
+      vertices[ 7] = gen(-0.4f, 0.2f);
+      vertices[ 8] = gen(-0.4f, 0.4f);
+      vertices[ 9] = gen(-0.2f, 0.4f);
+      vertices[10] = gen( 0.0f, 0.4f);
+      vertices[11] = gen( 0.2f, 0.4f);
+      vertices[12] = gen( 0.4f, 0.4f);
+      vertices[13] = gen( 0.4f, 0.2f);
+      vertices[14] = gen( 0.4f, 0.0f);
+      vertices[15] = gen( 0.4f,-0.2f);
+      vertices[16] = gen( 0.0f,-0.2f);
+      vertices[17] = gen( 0.0f, 0.0f);
+      vertices[18] = gen( 0.0f, 0.2f);
+
+      float C = 0.5f;
       float[] bands = new float[] { 1.0f, 0.00f*C, 0.9f, 0.04f*C,  0.8f, 0.07f*C, 0.5f, 0.09f*C, 0.0f, 0.10f*C};
-
 /*
       float B = 0.1f;
       int numBands = 7;
@@ -384,90 +389,139 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Libra
         }
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    private float[][] createV()
+      {
+      return new float[][]
+              {
+                      {-0.5f ,  1.5f , -0.5f },  //0
+                      {-0.5f ,  0.5f , -0.5f },
+                      {-0.5f ,  0.5f ,  0.5f },
+                      {-0.5f ,  1.5f ,  0.5f },
+                      {-0.5f , -0.5f , -0.5f },
+                      {-0.5f , -0.5f ,  0.5f },  //5
+                      {-0.5f , -1.5f , -0.5f },
+                      {-0.5f , -1.5f ,  0.5f },
+                      { 1.5f , -0.5f , -0.5f },
+                      { 1.5f , -1.5f , -0.5f },
+                      { 1.5f , -1.5f ,  0.5f },  //10
+                      { 1.5f , -0.5f ,  0.5f },
+                      { 1.5f ,  0.5f , -0.5f },
+                      { 1.5f ,  0.5f ,  0.5f },
+                      { 1.5f ,  1.5f , -0.5f },
+                      { 1.5f ,  1.5f ,  0.5f },  //15
+                      {-2.5f ,  2.5f , -0.5f },
+                      {-2.5f ,  1.5f , -0.5f },
+                      {-2.5f ,  1.5f ,  0.5f },
+                      {-2.5f ,  2.5f ,  0.5f },
+                      {-2.5f ,  0.5f , -0.5f },  //20
+                      {-2.5f ,  0.5f ,  0.5f },
+                      {-2.5f , -0.5f , -0.5f },
+                      {-2.5f , -0.5f ,  0.5f },
+                      {-2.5f , -1.5f , -0.5f },
+                      {-2.5f , -1.5f ,  0.5f },  //25
+                      {-2.5f , -2.5f , -0.5f },
+                      {-2.5f , -2.5f ,  0.5f },
+                      { 0.5f ,  1.5f ,  0.5f },
+                      { 0.5f ,  0.5f ,  0.5f },
+                      { 0.5f ,  0.5f , -0.5f },  //30
+                      { 0.5f ,  1.5f , -0.5f },
+                      { 0.5f , -0.5f ,  0.5f },
+                      { 0.5f , -0.5f , -0.5f },
+                      { 0.5f , -1.5f ,  0.5f },
+                      { 0.5f , -1.5f , -0.5f },  //35
+                      { 2.5f , -0.5f ,  0.5f },
+                      { 2.5f , -1.5f ,  0.5f },
+                      { 2.5f , -1.5f , -0.5f },
+                      { 2.5f , -0.5f , -0.5f },
+                      { 2.5f ,  0.5f ,  0.5f },  //40
+                      { 2.5f ,  0.5f , -0.5f },
+                      { 2.5f ,  1.5f ,  0.5f },
+                      { 2.5f ,  1.5f , -0.5f },
+                      { 2.5f ,  2.5f ,  0.5f },
+                      { 2.5f ,  2.5f , -0.5f },  //45
+                      { 2.5f , -2.5f ,  0.5f },
+                      { 2.5f , -2.5f , -0.5f },
+                      {-1.5f ,  1.5f ,  0.5f },
+                      {-1.5f ,  0.5f ,  0.5f },
+                      {-1.5f ,  0.5f , -0.5f },  //50
+                      {-1.5f ,  1.5f , -0.5f },
+                      {-1.5f , -0.5f ,  0.5f },
+                      {-1.5f , -0.5f , -0.5f },
+                      {-1.5f , -1.5f ,  0.5f },
+                      {-1.5f , -1.5f , -0.5f },  //55
+                      {-1.5f , -2.5f , -0.5f },
+                      {-1.5f , -2.5f ,  0.5f },
+                      {-0.5f , -2.5f , -0.5f },
+                      {-0.5f , -2.5f ,  0.5f },
+                      { 0.5f , -2.5f , -0.5f },  //60
+                      { 0.5f , -2.5f ,  0.5f },
+                      { 1.5f , -2.5f , -0.5f },
+                      { 1.5f , -2.5f ,  0.5f },
+                      { 1.5f ,  2.5f , -0.5f },
+                      { 1.5f ,  2.5f ,  0.5f },  //65
+                      { 0.5f ,  2.5f , -0.5f },
+                      { 0.5f ,  2.5f ,  0.5f },
+                      {-0.5f ,  2.5f , -0.5f },
+                      {-0.5f ,  2.5f ,  0.5f },
+                      {-1.5f ,  2.5f , -0.5f },  //70
+                      {-1.5f ,  2.5f ,  0.5f },
+              };
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    private int[][][] createVI()
+      {
+      return new int[][][]
+              {
+                    //  { {  0, 1, 2, 3 } , {  1, 4, 5, 2 } , {  4, 6, 7, 5 } },
+                    //  { {  8, 9,10,11 } , { 12, 8,11,13 } , { 14,12,13,15 } },
+                    //  { { 16,17,18,19 } , { 17,20,21,18 } , { 20,22,23,21 } , { 22,24,25,23 } , { 24,26,27,25 } },
+                    //  { { 28,29,30,31 } , { 29,32,33,30 } , { 32,34,35,33 } },
+                    //  { { 36,37,38,39 } , { 40,36,39,41 } , { 42,40,41,43 } , { 44,42,43,45 } , { 37,46,47,38 } },
+                    //  { { 48,49,50,51 } , { 49,52,53,50 } , { 52,54,55,53 } },
+                    //  { { 28,31,14,15 } },
+                    //  { { 48,51, 0, 3 } },
+                    //  { { 27,26,56,57 } , { 57,56,58,59 } , { 59,58,60,61 } , { 61,60,62,63 } , { 63,62,47,46 } },
+                    //  { { 64,65,44,45 } , { 66,67,65,64 } , { 68,69,67,66 } , { 70,71,69,68 } , { 16,19,71,70 } },
+                    //  { { 55,54, 7, 6 } },
+                    //  { { 35,34,10, 9 } },
+                      { { 31,30, 1, 0 } , { 30,33, 4, 1 } , { 33,35, 6, 4 } , { 35,60,58, 6 } , {  6,58,56,55 } , { 55,56,26,24 } , { 53,55,24,22 } , { 50,53,22,20 } , { 51,50,20,17 } , { 70,51,17,16 } , { 68, 0,51,70 } , { 66,31, 0,68 } , { 64,14,31,66 } , { 45,43,14,64 } , { 43,41,12,14 } , { 41,39, 8,12 } , { 39,38, 9, 8 } , { 38,47,62, 9 } , {  9,62,60,35 } },
+                      { {  3, 2,29,28 } , {  2, 5,32,29 } , {  5, 7,34,32 } , {  7,59,61,34 } , { 54,57,59, 7 } , { 25,27,57,54 } , { 23,25,54,52 } , { 21,23,52,49 } , { 18,21,49,48 } , { 19,18,48,71 } , { 71,48, 3,69 } , { 69, 3,28,67 } , { 67,28,15,65 } , { 65,15,42,44 } , { 15,13,40,42 } , { 13,11,36,40 } , { 11,10,37,36 } , { 10,63,46,37 } , { 34,61,63,10 } },
+              };
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     private void createMesh()
       {
-      /*
-      float A = 2.0f;
-
-      float[][] vertices =
-          {
-              { 0.5f, 0.5f, 0.5f },
-              { 0.5f, 0.5f,-0.5f },
-              { 0.5f,-0.5f, 0.5f },
-              { 0.5f,-0.5f,-0.5f },
-              {-0.5f, 0.5f, 0.5f },
-              {-0.5f, 0.5f,-0.5f },
-              {-0.5f,-0.5f, 0.5f },
-              {-0.5f,-0.5f,-0.5f },
-
-              { 0.5f,   -A, 0.5f },
-              { 0.5f,   -A,-0.5f },
-              {-0.5f,   -A, 0.5f },
-              {-0.5f,   -A,-0.5f },
-
-              {   -A, 0.5f, 0.5f },
-              {   -A, 0.5f,-0.5f },
-              {   -A,-0.5f, 0.5f },
-              {   -A,-0.5f,-0.5f },
-          };
-
-      int[][][] vertIndices =
-          {
-              { { 8, 9, 1, 0} },
-              { {15,14,12,13} },
-              { {11,10, 6, 7} },
-              { {12, 0, 1,13} },
-              { {11, 9, 8,10} },
-              { {15, 7, 6,14} },
-              { {14, 6, 4,12}, { 6, 2, 0, 4}, {10, 8, 2, 6} },
-              { { 3, 7, 5, 1}, { 9,11, 7, 3}, { 7,15,13, 5} }
-          };
-
-      float height = 0.02f;
-      int num = 5;
-      int extraI = 1;
-      int extraV = 1;
-
-      float[][] bands= { {height,25,0.3f,0.5f,num,extraI,extraV} };
-
-      int[] bandIndices = {0,0,0,0,0,0,0,0};
-      float[] convex = null;
-
-      float[][] corners= { {0.036f,0.12f} };
-      float[][] centers= { {0.0f, 0.0f, 0.0f} };
-      int[] ind    = { 0,0,-1,-1,-1,-1,-1,-1, 0,0,0,0,0,0,0,0 };
-      */
-      float[][] vertices = { {-1.5f, 0.0f, 0.0f},{ 1.5f, 0.0f, 0.0f},{ 0.0f,-1.5f, 0.0f},{ 0.0f, 0.0f,-1.5f},{0,0,0} };
-      int[][][] vertIndices = { {{2,1,4},{4,0,2}},{{3,0,4},{4,1,3}},{{2,3,1}},{{3,2,0}} };
-      float h1 = 0.035f;
-      float h2 = 0.010f;
+      float[][] vertices = createV();
+      int[][][] vertIndices = createVI();
+
+      int numFaces = vertIndices.length;
+
+      float h = 0.001f;
       int angle = 30;
       float R = 0.1f;
       float S = 0.5f;
       int N   = 6;
       int exI = 0;
       int exV = 0;
-      float[][] bands  = { {h1,angle,R,S,N,exI,exV}, {h2,angle,R,S,N,exI,exV} };
-      int[] bandIndices= { 0,0,1,1 };
-      float[] convex = null;
-      float[][] corners   = { {0.07f,0.40f}, {0.05f,0.30f} };
-      int[] cornerIndices = { 0,0,1,1,-1 };
-      float[][] centers   = { {0.0f, -0.75f, -0.75f} };
-      int[] centerIndices = { 0,0,0,0,-1 };
+      float[][] bands  = { {h,angle,R,S,N,exI,exV} };
+
+      int[] bandIndices= new int[numFaces];
 
       ObjectShape shape = new ObjectShape(vertices, vertIndices);
-      ObjectFaceShape face = new ObjectFaceShape(bands, bandIndices, convex);
-      ObjectVertexEffects effects = FactoryCubit.generateVertexEffect(vertices,corners,cornerIndices,centers,centerIndices);
+      ObjectFaceShape face = new ObjectFaceShape(bands, bandIndices, null);
 
-      int numFaces = shape.getNumFaces();
       int[] outer = new int[numFaces];
 
       FactoryCubit factory = FactoryCubit.getInstance();
       factory.clear();
       factory.createNewFaceTransform(shape,outer);
-      mMesh = factory.createRoundedSolid(shape,face,effects,MESH_NICE,numFaces);
+      mMesh = factory.createRoundedSolid(shape,face,null,MESH_NICE,numFaces);
 
       int numEff = mMesh.getNumEffComponents();
       for(int i=0; i<numEff; i++) mMesh.setEffectAssociation(i, 0, i);
