Project

General

Profile

Download (20.5 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / bandaged / FactoryBandaged.java @ db0d3a90

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.objectlib.bandaged;
11

    
12
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
13
import static org.distorted.objectlib.objects.TwistyBandagedCuboid.REGION_SIZE;
14
import static org.distorted.objectlib.objects.TwistyBandagedCuboid.STRENGTH;
15

    
16
import org.distorted.library.mesh.MeshBase;
17
import org.distorted.library.type.Static3D;
18
import org.distorted.objectlib.helpers.FactoryCubit;
19
import org.distorted.objectlib.helpers.ObjectFaceShape;
20
import org.distorted.objectlib.helpers.ObjectShape;
21
import org.distorted.objectlib.helpers.ObjectVertexEffects;
22

    
23
import java.util.ArrayList;
24

    
25
///////////////////////////////////////////////////////////////////////////////////////////////////
26

    
27
abstract public class FactoryBandaged
28
  {
29
  private ArrayList<float[]> mTmpArray;
30
  private float[] mDist3D;
31
  private int[][] mFaceBelongsBitmap;
32
  private float[][] mCuts;
33
  private float[][] mRotAxis;
34

    
35
  BandagedElement[] mElements;
36
  ArrayList<float[][]> mVertexArray;
37

    
38
  int[][] mBandIndices;
39
  float[][][] mVertices;
40
  int[][][][] mIndices;
41
  float[][] mMove;
42
  int mNumElements;
43
  int mNumFaces;
44
  int mNumAxis;
45
  Static3D[] mNormals;
46

    
47
  int[] mNumLayers;
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
  FactoryBandaged()
52
    {
53

    
54
    }
55

    
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

    
58
  abstract float faceDiameter(float[][] vertices, int[][] indices);
59
  abstract Static3D[] getNormals();
60
  abstract float[] getDist3D();
61
  abstract float[][] getBands(boolean iconMode);
62
  abstract float[][] getCuts(int[] numLayers);
63
  abstract float[][] getRotAxis();
64
  abstract float[] elementVertices(int ax, boolean left, int element);
65
  abstract int getElementVariant(int index);
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  int[] computeFaceBelongsBitmap(float[][] vertices, float[] move)
70
    {
71
    int numVerts = vertices.length;
72
    int[] ret = new int[numVerts];
73

    
74
    for(int i=0; i<numVerts; i++)
75
      {
76
      int vertBelongsBitmap=0x00000000;
77
      float[] vert=vertices[i];
78

    
79
      for(int j=0; j<mNumFaces; j++)
80
        if( vertInFace(vert, move, mNormals[j], mDist3D[j]) ) vertBelongsBitmap |= (1<<j);
81

    
82
      ret[i]=vertBelongsBitmap;
83
      }
84

    
85
    return ret;
86
    }
87

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89
// return array of:
90
// 0 if this is an inner face, 1 if its diameter is 1, 2 if diameter is 2, 3 if 3, etc
91
// but only up to 5 (because the number of bands is 6 - see createIrregularFaceShape() )
92

    
93
  int[] generateBandIndices(float[][] vertices, int[][][] indices, int[] belongs)
94
    {
95
    int numCubitFaces = indices.length;
96
    int[] bandIndices = new int[numCubitFaces];
97

    
98
    for(int f=0; f<numCubitFaces; f++)
99
      {
100
      bandIndices[f] = 0xffffffff;
101
      for( int index : indices[f][0] ) bandIndices[f] &= belongs[index];
102

    
103
      if( bandIndices[f]!=0 ) // outer face
104
        {
105
        float diameter = faceDiameter(vertices, indices[f]);
106
        bandIndices[f] = (diameter>=6 ? 5: (int)diameter);
107
        }
108
      }
109

    
110
    return bandIndices;
111
    }
112

    
113
///////////////////////////////////////////////////////////////////////////////////////////////////
114

    
115
  void computeMove(float[] pos, int variant)
116
    {
117
    int numMoves = pos.length/3;
118
    float[] m = mMove[variant];
119
    m[0]=0.0f;
120
    m[1]=0.0f;
121
    m[2]=0.0f;
122

    
123
    for(int i=0; i<numMoves; i++)
124
      {
125
      m[0] += pos[3*i  ];
126
      m[1] += pos[3*i+1];
127
      m[2] += pos[3*i+2];
128
      }
129

    
130
    m[0]/=numMoves;
131
    m[1]/=numMoves;
132
    m[2]/=numMoves;
133
    }
134

    
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136

    
137
  float[][] getVertices(ArrayList<float[][]> list, int variant)
138
    {
139
    int total  = 0;
140
    int length = list.size();
141
    float[][][] vertices = new float[length][][];
142

    
143
    for( int i=0; i<length; i++ )
144
      {
145
      vertices[i] = list.get(i);
146
      int len = vertices[i].length;
147
      for(int j=0; j<len; j++) total += vertices[i][j].length/3;
148
      }
149

    
150
    float[][] verts = new float[total][3];
151
    int pointer = 0;
152

    
153
    for(int i=0; i<length; i++)
154
      {
155
      int len = vertices[i].length;
156

    
157
      for(int j=0; j<len; j++)
158
        {
159
        float[] v = vertices[i][j];
160
        int l = v.length/3;
161

    
162
        for(int k=0; k<l; k++)
163
          {
164
          verts[pointer][0] = v[3*k  ] - mMove[variant][0];
165
          verts[pointer][1] = v[3*k+1] - mMove[variant][1];
166
          verts[pointer][2] = v[3*k+2] - mMove[variant][2];
167
          pointer++;
168
          }
169
        }
170
      }
171

    
172
    return verts;
173
    }
174

    
175
///////////////////////////////////////////////////////////////////////////////////////////////////
176

    
177
  int[][][] getIndices(ArrayList<float[][]> list)
178
    {
179
    int indicesSoFar=0;
180
    int length = list.size();
181
    int[][][] indices = new int[length][][];
182

    
183
    for( int i=0; i<length; i++ )
184
      {
185
      float[][] face = list.get(i);
186
      int len = face.length;
187
      int[][] ind = new int[len][];
188

    
189
      for(int j=0; j<len; j++)
190
        {
191
        int l = face[j].length/3;
192
        ind[j] = new int[l];
193
        for(int k=0; k<l; k++) ind[j][k] = (indicesSoFar++);
194
        }
195

    
196
      indices[i] = ind;
197
      }
198

    
199
    return indices;
200
    }
201

    
202
///////////////////////////////////////////////////////////////////////////////////////////////////
203

    
204
  private void markAllVertices(float[] vertex, float[][] vertices, int[][][] indices, int pointer, int variant)
205
    {
206
    int numFaces = indices.length;
207

    
208
    for(int face=0; face<numFaces; face++)
209
      {
210
      int len = indices[face].length;
211

    
212
      for(int comp=0; comp<len; comp++)
213
        {
214
        int l = indices[face][comp].length;
215

    
216
        for(int v=0; v<l; v++)
217
          {
218
          if( mIndices[variant][face][comp][v]==-1 )
219
            {
220
            int ind=indices[face][comp][v];
221
            float[] ver=vertices[ind];
222

    
223
            if(vertex[0]==ver[0] && vertex[1]==ver[1] && vertex[2]==ver[2])
224
              {
225
              mIndices[variant][face][comp][v]=pointer;
226
              }
227
            }
228
          }
229
        }
230
      }
231
    }
232

    
233
///////////////////////////////////////////////////////////////////////////////////////////////////
234
// So far the 'vertices/indices' are stored inefficiently, with each vertex stored three times
235
// (each one normally is a corner of three faces) or even six times. Compress!
236
// Example of six times: the central vertex here:
237
//
238
// { 1.0f,  0.0f, -1.0f,
239
//   1.0f, -1.0f, -1.0f,
240
//   1.0f, -1.0f, +0.0f,
241
//   0.0f, -1.0f, -1.0f },
242

    
243
  void compressVerticesAndIndices(int variant, float[][] vertices, int[][][] indices)
244
    {
245
    if( mTmpArray==null ) mTmpArray = new ArrayList<>();
246

    
247
    int numFaces = indices.length;
248
    int pointer=0;
249

    
250
    mIndices[variant] = new int[numFaces][][];
251

    
252
    for(int face=0; face<numFaces;face++)
253
      {
254
      int len = indices[face].length;
255
      mIndices[variant][face] = new int[len][];
256

    
257
      for(int comp=0; comp<len; comp++)
258
        {
259
        int l = indices[face][comp].length;
260
        mIndices[variant][face][comp] = new int[l];
261
        for(int v=0; v<l; v++) mIndices[variant][face][comp][v] = -1;
262
        }
263
      }
264

    
265
    for(int face=0; face<numFaces; face++)
266
      {
267
      int len = indices[face].length;
268

    
269
      for(int comp=0; comp<len; comp++)
270
        {
271
        int l = indices[face][comp].length;
272

    
273
        for(int v=0; v<l; v++)
274
          {
275
          if( mIndices[variant][face][comp][v]==-1 )
276
            {
277
            int ind=indices[face][comp][v];
278
            float[] ver=vertices[ind];
279
            mTmpArray.add(ver);
280
            markAllVertices(ver, vertices, indices, pointer, variant);
281
            pointer++;
282
            }
283
          }
284
        }
285
      }
286

    
287
    int len = mTmpArray.size();
288
    mVertices[variant] = new float[len][];
289

    
290
    for(int i=0; i<len; i++)
291
      {
292
      mVertices[variant][i] = mTmpArray.remove(0);
293
      }
294
    }
295

    
296
///////////////////////////////////////////////////////////////////////////////////////////////////
297

    
298
  boolean elementDoesntExist(int[] p)
299
    {
300
    boolean res;
301

    
302
    for(int i=0; i<mNumElements; i++)
303
      {
304
      int[] row = mElements[i].getRotRow();
305
      res = true;
306

    
307
      for(int j=0; j<mNumAxis; j++)
308
        if( row[j]!=p[j] )
309
          {
310
          res = false;
311
          break;
312
          }
313

    
314
      if( res ) return false;
315
      }
316

    
317
    return true;
318
    }
319

    
320
///////////////////////////////////////////////////////////////////////////////////////////////////
321

    
322
  static boolean vertInFace(float[] vertex, float[] move, Static3D faceAxis, float dist)
323
    {
324
    final float MAX_ERROR = 0.01f;
325

    
326
    float x= faceAxis.get0();
327
    float y= faceAxis.get1();
328
    float z= faceAxis.get2();
329

    
330
    float a = (vertex[0]+move[0])*x + (vertex[1]+move[1])*y + (vertex[2]+move[2])*z;
331
    float diff = a - dist;
332

    
333
    return diff>-MAX_ERROR && diff<MAX_ERROR;
334
    }
335

    
336
///////////////////////////////////////////////////////////////////////////////////////////////////
337

    
338
  private void computeVectorFace(float[] prev, float[] curr, float[] next, float[] output)
339
    {
340
    float ax = prev[0]-curr[0];
341
    float ay = prev[1]-curr[1];
342
    float az = prev[2]-curr[2];
343

    
344
    float bx = next[0]-curr[0];
345
    float by = next[1]-curr[1];
346
    float bz = next[2]-curr[2];
347

    
348
    float lena = (float)Math.sqrt(ax*ax + ay*ay + az*az);
349
    float lenb = (float)Math.sqrt(bx*bx + by*by + bz*bz);
350

    
351
    ax /= lena;
352
    ay /= lena;
353
    az /= lena;
354

    
355
    bx /= lenb;
356
    by /= lenb;
357
    bz /= lenb;
358

    
359
    output[0] = ay*bz - az*by;
360
    output[1] = az*bx - ax*bz;
361
    output[2] = ax*by - ay*bx;
362

    
363
    output[3] = ax;
364
    output[4] = ay;
365
    output[5] = az;
366

    
367
    output[6] = bx;
368
    output[7] = by;
369
    output[8] = bz;
370
    }
371

    
372
///////////////////////////////////////////////////////////////////////////////////////////////////
373
// 'concave' vertices do not get pushed!
374

    
375
  private boolean vertexIsConcave(float[][] vecs, int numVecs)
376
    {
377
    for(int i=0; i<numVecs; i++)
378
      {
379
      float[] v1 = vecs[i];
380

    
381
      for(int j=0; j<numVecs; j++)
382
        {
383
        if( i==j ) continue;
384

    
385
        float[] v2 = vecs[j];
386

    
387
        float scalar1 = v1[0]*v2[3] + v1[1]*v2[4] + v1[2]*v2[5];
388
        float scalar2 = v1[0]*v2[6] + v1[1]*v2[7] + v1[2]*v2[8];
389

    
390
        if( scalar1<0 || scalar2<0 ) return true;
391
        }
392
      }
393

    
394
    return false;
395
    }
396

    
397
///////////////////////////////////////////////////////////////////////////////////////////////////
398

    
399
  private float[] computeVector(int index, float[][] vertices, int[][][] indices, int[] bandIndices)
400
    {
401
    int band=0;
402
    int numFaces = indices.length;
403
    int numBordering = 0;
404
    float x=0, y=0, z=0;
405

    
406
    float[][] vecs = new float[numFaces][9];
407
    int vecIndex = 0;
408

    
409
    for(int f=0; f<numFaces; f++)
410
      {
411
      int numComponentsInFace = indices[f].length;
412

    
413
      for(int c=0; c<numComponentsInFace; c++)
414
        {
415
        int[] ind = indices[f][c];
416
        int numVertsInComponent = ind.length;
417

    
418
        for(int v=0; v<numVertsInComponent; v++)
419
          {
420
          if(ind[v]==index)
421
            {
422
            int prev=v>0 ? v-1 : numVertsInComponent-1;
423
            int next=v<numVertsInComponent-1 ? v+1 : 0;
424

    
425
            int prevIndex=ind[prev];
426
            int currIndex=ind[v];
427
            int nextIndex=ind[next];
428

    
429
            float[] vec = vecs[vecIndex++];
430
            computeVectorFace(vertices[prevIndex], vertices[currIndex], vertices[nextIndex], vec);
431
            band|=bandIndices[f];
432
            v = numVertsInComponent;
433
            c = numComponentsInFace;
434
            numBordering++;
435

    
436
            x += vec[0];
437
            y += vec[1];
438
            z += vec[2];
439
            }
440
          }
441
        }
442
      }
443

    
444
    boolean concave = vertexIsConcave(vecs,vecIndex);
445

    
446
    return ( concave || band==0 || numBordering<3 ) ? null : new float[] { x/numBordering, y/numBordering, z/numBordering};
447
    }
448

    
449
///////////////////////////////////////////////////////////////////////////////////////////////////
450

    
451
  private float[][] generateVectors(float[][] vertices, int[][][] indices, int[] bandIndices)
452
    {
453
    int len = vertices.length;
454
    float[][] vectors = new float[len][];
455

    
456
    for(int i=0; i<len; i++)
457
      {
458
      vectors[i] = computeVector(i,vertices,indices,bandIndices);
459
      }
460

    
461
    return vectors;
462
    }
463

    
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465

    
466
  private boolean elementsFormSection(int e1, int e2, int ax)
467
    {
468
    int[] r1 = mElements[e1].getRotRow();
469
    int[] r2 = mElements[e2].getRotRow();
470

    
471
    if( r1[ax]==r2[ax] )
472
      {
473
      int dist=0;
474

    
475
      for(int i=0; i<mNumAxis; i++)
476
        {
477
        int d=r1[i]-r2[i];
478
        dist+=d*d;
479
        }
480

    
481
      return dist==1;
482
      }
483
    return false;
484
    }
485

    
486
///////////////////////////////////////////////////////////////////////////////////////////////////
487

    
488
  private int computeConnectedSection(int element, int ax, boolean[] walls, int[] output, int index)
489
    {
490
    int found = index;
491

    
492
    for(int e=0; e<mNumElements; e++)
493
      if( walls[e] && elementsFormSection(element,e,ax) )
494
        {
495
        walls[e] = false;
496
        output[found++] = e;
497
        found = computeConnectedSection(e,ax,walls,output,found);
498
        }
499

    
500
    return found;
501
    }
502

    
503
///////////////////////////////////////////////////////////////////////////////////////////////////
504

    
505
  private void buildAllSections(int ax, boolean left, boolean[] walls, ArrayList<float[][]> list)
506
    {
507
    int numElements = 0;
508
    for(int i=0; i<mNumElements; i++)
509
      if( walls[i] ) numElements++;
510

    
511
    int[] tmp = new int[numElements];
512

    
513
    while( numElements>0 )
514
      {
515
      int element  = 0;
516

    
517
      for( ; element<mNumElements; element++)
518
        if( walls[element] )
519
          {
520
          walls[element] = false;
521
          tmp[0] = element;
522
          break;
523
          }
524

    
525
      int elementsInSection = computeConnectedSection(element,ax,walls,tmp,1);
526

    
527
      float[][] newSection = new float[elementsInSection][];
528

    
529
      for(int i=0; i<elementsInSection; i++)
530
        newSection[i] = elementVertices(ax,left,tmp[i]);
531

    
532
      list.add(newSection);
533

    
534
      numElements -= elementsInSection;
535
      }
536
    }
537

    
538
///////////////////////////////////////////////////////////////////////////////////////////////////
539

    
540
  private void fillUpVertexArray()
541
    {
542
    boolean[][][] walls = new boolean[mNumAxis][2][mNumElements];
543

    
544
    int[] tmp = new int[mNumAxis];
545

    
546
    for(int e=0; e<mNumElements; e++)
547
      {
548
      int[] row = mElements[e].getRotRow();
549
      for(int t=0; t<mNumAxis; t++) tmp[t]=row[t];
550

    
551
      for(int a=0; a<mNumAxis; a++)
552
        {
553
        if( a>0 ) tmp[a-1]=row[a-1];
554
        tmp[a] = row[a]-1;
555
        walls[a][0][e] = elementDoesntExist(tmp);
556
        tmp[a] = row[a]+1;
557
        walls[a][1][e] = elementDoesntExist(tmp);
558
        }
559
      }
560

    
561
    for(int a=0; a<mNumAxis; a++)
562
      {
563
      buildAllSections(a, true,  walls[a][0], mVertexArray );
564
      buildAllSections(a, false, walls[a][1], mVertexArray );
565
      }
566
    }
567

    
568
///////////////////////////////////////////////////////////////////////////////////////////////////
569

    
570
  private void debug(float[][] vert, int[][] ind)
571
    {
572
    String vv="VERTICES: ";
573
    for (float[] floats : vert)
574
      {
575
      vv += "\n";
576
      int lenV2 = floats.length / 3;
577

    
578
      for (int v2 = 0; v2 < lenV2; v2++)
579
        {
580
        vv += " {";
581
        vv += (floats[3 * v2] + " ");
582
        vv += (floats[3 * v2 + 1] + " ");
583
        vv += (floats[3 * v2 + 2] + " ");
584
        vv += "}";
585
        }
586
      }
587
    android.util.Log.e("D", vv);
588

    
589
    String ii="INDICES: ";
590
    for (int[] ints : ind)
591
      {
592
      ii += "\n";
593
      for(int anInt : ints) ii+=(anInt+" ");
594
      }
595
    android.util.Log.e("D", ii);
596
    }
597

    
598
///////////////////////////////////////////////////////////////////////////////////////////////////
599

    
600
  private int debugArray(int start, String str)
601
    {
602
    StringBuilder s = new StringBuilder();
603
    int n = mVertexArray.size();
604
    for(int i=start; i<n; i++)
605
      {
606
      float[][] v = mVertexArray.get(i);
607
      int numC = v.length;
608
      s.append("numComp: ");
609
      s.append(numC);
610

    
611
      for(float[] floats : v)
612
        {
613
        int l=floats.length/3;
614

    
615
        for(int k=0; k<l; k++)
616
          {
617
          s.append(" (");
618
          s.append(floats[3*k  ]);
619
          s.append(" ");
620
          s.append(floats[3*k+1]);
621
          s.append(" ");
622
          s.append(floats[3*k+2]);
623
          s.append(") ");
624
          }
625
        }
626
      }
627

    
628
    android.util.Log.e("D", str+" : "+s);
629

    
630
    return n;
631
    }
632

    
633
///////////////////////////////////////////////////////////////////////////////////////////////////
634
// PUBLIC API
635

    
636
  public void prepare(int numVariants, int[] numLayers)
637
    {
638
    if( mVertexArray==null ) mVertexArray = new ArrayList<>();
639
    mVertices= new float[numVariants][][];
640
    mIndices = new int[numVariants][][][];
641
    mMove = new float[numVariants][3];
642
    mBandIndices = new int[numVariants][];
643
    mFaceBelongsBitmap= new int[numVariants][];
644

    
645
    mNumLayers = numLayers;
646
    mNormals   = getNormals();
647
    mNumFaces  = mNormals.length;
648
    mDist3D    = getDist3D();
649
    mCuts      = getCuts(numLayers);
650
    mRotAxis   = getRotAxis();
651
    mNumAxis   = mRotAxis.length;
652
    }
653

    
654
///////////////////////////////////////////////////////////////////////////////////////////////////
655

    
656
  public ObjectShape createIrregularShape(int variant, float[] pos)
657
    {
658
    mVertexArray.clear();
659

    
660
    mNumElements = pos.length/3;
661
    mElements = new BandagedElement[mNumElements];
662
    for(int i=0; i<mNumElements; i++)
663
      {
664
      int elementVariant = getElementVariant(i);
665
      mElements[i] = new BandagedElement(pos, 3*i, mRotAxis, mCuts,elementVariant);
666
      }
667

    
668
    fillUpVertexArray();
669

    
670
    computeMove(pos,variant);
671
    float[][] verts = getVertices(mVertexArray,variant);
672
    int[][][] inds  = getIndices(mVertexArray);
673

    
674
    compressVerticesAndIndices(variant,verts,inds);
675

    
676
    return new ObjectShape(mVertices[variant], mIndices[variant]);
677
    }
678

    
679
///////////////////////////////////////////////////////////////////////////////////////////////////
680

    
681
  public ObjectFaceShape createIrregularFaceShape(int variant, boolean iconMode)
682
    {
683
    float[][] bands = getBands(iconMode);
684

    
685
    if( mBandIndices[variant]==null )
686
      {
687
      mFaceBelongsBitmap[variant] = computeFaceBelongsBitmap(mVertices[variant], mMove[variant]);
688
      mBandIndices[variant] = generateBandIndices(mVertices[variant], mIndices[variant], mFaceBelongsBitmap[variant]);
689
      }
690

    
691
    return new ObjectFaceShape(bands,mBandIndices[variant],null);
692
    }
693

    
694
///////////////////////////////////////////////////////////////////////////////////////////////////
695

    
696
  public ObjectVertexEffects createVertexEffects(int variant, boolean roundCorners)
697
    {
698
    float[][] vertVec= generateVectors(mVertices[variant], mIndices[variant], mBandIndices[variant]);
699
    int numEffects   = mVertices[variant].length;
700
    float S          = STRENGTH;
701
    float[] region   = {0,0,0,REGION_SIZE};
702
    String[] names   = new String[numEffects];
703
    float[][] regions= new float[numEffects][];
704
    boolean[] uses   = new boolean[numEffects];
705
    float[][] vars   = new float[numEffects][];
706

    
707
    for(int i=0; i<numEffects; i++)
708
      {
709
      float[] v = vertVec[i];
710

    
711
      if( v!=null )
712
        {
713
        names[i]  = FactoryCubit.NAME;
714
        regions[i]= region;
715
        uses[i]   = roundCorners;
716
        vars[i]   = new float[] { 0, S*v[0], S*v[1], S*v[2], 1 };
717
        }
718
      }
719

    
720
    return new ObjectVertexEffects(names,vars,mVertices[variant],regions,uses);
721
    }
722

    
723
///////////////////////////////////////////////////////////////////////////////////////////////////
724

    
725
  public MeshBase createMesh(float[] pos, int[] numLayers, boolean iconMode, boolean roundCorners)
726
    {
727
    prepare(1,numLayers);
728
    ObjectShape shape           = createIrregularShape(0,pos);
729
    ObjectFaceShape face        = createIrregularFaceShape(0,iconMode);
730
    ObjectVertexEffects effects = createVertexEffects(0,roundCorners);
731
    int numFaces                = shape.getNumFaces();
732

    
733
    FactoryCubit factory = FactoryCubit.getInstance();
734
    factory.clear();
735
    factory.createNewFaceTransform(shape,null);
736
    return factory.createRoundedSolid(shape,face,effects,MESH_NICE,numFaces);
737
    }
738
  }
(6-6/8)