Project

General

Profile

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

examples / src / main / java / org / distorted / examples / meshfile / MeshFileRenderer.java @ baace8e9

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.examples.meshfile;
21

    
22
import android.content.Context;
23
import android.content.res.Resources;
24
import android.graphics.Bitmap;
25
import android.graphics.Canvas;
26
import android.graphics.Paint;
27
import android.opengl.GLSurfaceView;
28

    
29
import org.distorted.examples.R;
30
import org.distorted.library.effect.Effect;
31
import org.distorted.library.effect.EffectType;
32
import org.distorted.library.effect.MatrixEffectQuaternion;
33
import org.distorted.library.effect.MatrixEffectScale;
34
import org.distorted.library.effect.VertexEffectDisappear;
35
import org.distorted.library.main.DistortedEffects;
36
import org.distorted.library.main.DistortedLibrary;
37
import org.distorted.library.main.DistortedScreen;
38
import org.distorted.library.main.DistortedTexture;
39
import org.distorted.library.mesh.MeshBase;
40
import org.distorted.library.mesh.MeshFile;
41
import org.distorted.library.mesh.MeshPolygon;
42
import org.distorted.library.type.DynamicQuat;
43
import org.distorted.library.type.Static3D;
44
import org.distorted.library.type.Static4D;
45

    
46
import org.distorted.objectlib.helpers.FactoryCubit;
47

    
48
import java.io.DataInputStream;
49
import java.io.IOException;
50
import java.io.InputStream;
51

    
52
import javax.microedition.khronos.egl.EGLConfig;
53
import javax.microedition.khronos.opengles.GL10;
54

    
55
import static org.distorted.examples.meshfile.MeshFileActivity.POLYGON;
56
import static org.distorted.examples.meshfile.MeshFileActivity.PROCEDURAL;
57
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
58

    
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

    
61
class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
62
{
63
    private static final float SQ2 = (float)Math.sqrt(2);
64
    private static final float SQ3 = (float)Math.sqrt(3);
65
    private static final float SQ5 = (float)Math.sqrt(5);
66
    private static final float SQ6 = (float)Math.sqrt(6);
67
    private final float DEFAULT_SCALE = 0.3f;
68

    
69
    private final GLSurfaceView mView;
70
    private DistortedTexture mTexture;
71
    private final DistortedScreen mScreen;
72
    private final DistortedEffects mEffects;
73
    private final Static3D mScale;
74
    private long mTime;
75
    private float mCurrentScale;
76
    private MeshBase mMesh;
77

    
78
    Static4D mQuat1, mQuat2;
79
    int mScreenMin;
80

    
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

    
83
    MeshFileRenderer(GLSurfaceView v)
84
      {
85
      mView = v;
86
      mScreen = new DistortedScreen();
87
      mScale= new Static3D(1,1,1);
88
      Static3D center=new Static3D(0,0,0);
89

    
90
      mCurrentScale = DEFAULT_SCALE;
91

    
92
      mQuat1 = new Static4D(0,0,0,1);
93
      mQuat2 = new Static4D(0,0,0,1);
94

    
95
      DynamicQuat quatInt1 = new DynamicQuat(0,0.5f);
96
      DynamicQuat quatInt2 = new DynamicQuat(0,0.5f);
97

    
98
      quatInt1.add(mQuat1);
99
      quatInt2.add(mQuat2);
100

    
101
      VertexEffectDisappear disappear = new VertexEffectDisappear();
102
      disappear.setMeshAssociation(1,-1);
103

    
104
      mEffects = new DistortedEffects();
105
      mEffects.apply( new MatrixEffectQuaternion(quatInt2, center) );
106
      mEffects.apply( new MatrixEffectQuaternion(quatInt1, center) );
107
      mEffects.apply( new MatrixEffectScale(mScale));
108

    
109
      mEffects.apply( disappear );
110

    
111
      mScreen.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
112
      mScreen.showFPS();
113
      }
114

    
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116
   
117
    public void onDrawFrame(GL10 glUnused) 
118
      {
119
      mScreen.render( System.currentTimeMillis() );
120
      }
121

    
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123
    
124
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
125
      {
126
      mScreenMin = Math.min(width, height);
127
      float factor = mCurrentScale*mScreenMin;
128
      mScale.set(factor,factor,factor);
129
      mScreen.resize(width, height);
130
      }
131

    
132
///////////////////////////////////////////////////////////////////////////////////////////////////
133
    
134
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
135
      {
136
      if( mTexture==null ) mTexture = new DistortedTexture();
137

    
138
      Effect.enableEffects(EffectType.VERTEX);
139
      DistortedLibrary.setMax(EffectType.VERTEX, 20);
140
      DistortedLibrary.needTransformFeedback();
141
      DistortedLibrary.onSurfaceCreated(mView.getContext(), this);
142
      }
143

    
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145

    
146
    public void distortedException(Exception ex)
147
      {
148
      android.util.Log.e("MeshFile", ex.getMessage() );
149
      }
150

    
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152
//   0 ---> 0
153
//  50 ---> DEFAULT_SCALE
154
// 100 ---> 4*DEFAULT_SCALE
155

    
156
    void setScale(int scale)
157
      {
158
      if( scale<= 50 )
159
        {
160
        mCurrentScale = DEFAULT_SCALE * scale / 50.0f;
161
        }
162
      else
163
        {
164
        mCurrentScale = DEFAULT_SCALE * ( 3*(scale/50.0f) - 2.0f);
165
        }
166

    
167
      float factor = mCurrentScale*mScreenMin;
168
      mScale.set(factor,factor,factor);
169
      }
170

    
171
///////////////////////////////////////////////////////////////////////////////////////////////////
172

    
173
    void open(int resourceID)
174
      {
175
      if( mTexture==null ) mTexture = new DistortedTexture();
176
      mTexture.setTexture( createTexture(resourceID) );
177

    
178
      long t1 = System.currentTimeMillis();
179

    
180
      if( resourceID==PROCEDURAL )
181
        {
182
        createMesh();
183
        }
184
      else if( resourceID==POLYGON )
185
        {
186
        createPolygon();
187
        }
188
      else
189
        {
190
        openMesh(resourceID);
191
        }
192

    
193
      long t2 = System.currentTimeMillis();
194

    
195
      mTime = t2-t1;
196

    
197
      mScreen.detachAll();
198
      mScreen.attach(mTexture,mEffects,mMesh);
199
      }
200

    
201
///////////////////////////////////////////////////////////////////////////////////////////////////
202

    
203
    private Bitmap createTexture(int resourceID)
204
      {
205
      TextureFactory factory = TextureFactory.getInstance();
206

    
207
      float[] vertices;
208
      int[] colors;
209
      float F = 0.5f;
210
      float E = SQ3/2;
211

    
212
      switch(resourceID)
213
          {
214
          case  R.raw.deferredjob:
215
          case  R.raw.meshjoin   :
216
          case  PROCEDURAL       :
217
          case  POLYGON          :
218
          case  R.raw.predeform  : return createWhiteTexture();
219

    
220
          case  R.raw.cube2      :
221
          case  R.raw.cube3      :
222
          case  R.raw.cube4      :
223
          case  R.raw.cube5      : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
224
                                   vertices = new float[] { -F,-F, +F,-F, +F,+F, -F,+F};
225
                                   return factory.createTexture(vertices,colors,0.10f, 0.10f, true);
226
          case  R.raw.pyra3      :
227
          case  R.raw.pyra4      :
228
          case  R.raw.pyra5      : colors = new int[] { 0xffffff00, 0xff00ff00, 0xff0000ff, 0xffff0000 };
229
                                   vertices = new float[] { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
230
                                   return factory.createTexture(vertices,colors,0.05f, 0.05f, true);
231

    
232
          case  R.raw.dino       : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
233
                                   vertices = new float[] { -F,F/3, 0,-2*F/3, +F,F/3 };
234
                                   return factory.createTexture(vertices,colors,0.05f, 0.03f, true);
235

    
236
          case R.raw.skewb       : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
237
                                   //vertices = new float[] { -G,-G, +G,-G, +G,+G, -G,+G };
238

    
239
                                   vertices = new float[] { -F+F/4,F/4, F/4,-F+F/4, F/4,F/4};
240
                                   return factory.createTexture(vertices,colors,0.05f, 0.08f, true);
241
          }
242

    
243
      return null;
244
      }
245

    
246
///////////////////////////////////////////////////////////////////////////////////////////////////
247

    
248
    private Bitmap createWhiteTexture()
249
      {
250
      int SIZE = 1;
251
      Bitmap bitmap = Bitmap.createBitmap(SIZE,SIZE, Bitmap.Config.ARGB_8888);
252
      Canvas canvas = new Canvas(bitmap);
253

    
254
      Paint paint = new Paint();
255
      paint.setColor(0xffffff55);
256
      paint.setStyle(Paint.Style.FILL);
257
      canvas.drawRect(0, 0, SIZE, SIZE, paint);
258

    
259
      return bitmap;
260
      }
261

    
262
///////////////////////////////////////////////////////////////////////////////////////////////////
263

    
264
    private void createPolygon()
265
      {
266
      float A = 0.5f;
267
      float B = 0.1f;
268

    
269
      int extraIndex    = 2;
270
      int extraVertices = 2;
271
      int numBands      = 2;
272

    
273
      float[] vertices = new float[] { -A,-A, A,-A, A,A, -A,A };
274
      float[] bands = new float[2*numBands];
275

    
276
      for(int i=0; i<numBands; i++)
277
        {
278
        bands[2*i  ] = 1 + i/(1.0f-numBands);
279
        bands[2*i+1] = B/(numBands-1)*i;
280
        }
281

    
282
      mMesh = new MeshPolygon(vertices,bands,extraIndex,extraVertices);
283
      mMesh.setEffectAssociation(0,0,0);
284
      mMesh.setShowNormals(true);
285
      }
286

    
287
///////////////////////////////////////////////////////////////////////////////////////////////////
288

    
289
    private void createMesh()
290
      {
291
      int mode            = 5;
292
      int numComponents   = 0;
293
      float[][] vertices  = null;
294
      int[][] vertIndexes = null;
295
      float[][] bands     = null;
296
      int[] bandIndexes   = null;
297
      float[][] corners   = null;
298
      int[] cornerIndexes = null;
299
      float[][] centers   = null;
300
      int[] centerIndexes = null;
301
      float[] convexCenter= null;
302

    
303
      ///// CUBE ////////////////////////////////////////////////////////////////////////////////
304

    
305
      if( mode==0 )
306
        {
307
        vertices = new float[][]
308
          {
309
              { 0.5f, 0.5f, 0.5f },
310
              { 0.5f, 0.5f,-0.5f },
311
              { 0.5f,-0.5f, 0.5f },
312
              { 0.5f,-0.5f,-0.5f },
313
              {-0.5f, 0.5f, 0.5f },
314
              {-0.5f, 0.5f,-0.5f },
315
              {-0.5f,-0.5f, 0.5f },
316
              {-0.5f,-0.5f,-0.5f },
317
          };
318

    
319
        vertIndexes = new int[][]
320
          {
321
              {2,3,1,0},   // counterclockwise!
322
              {7,6,4,5},
323
              {4,0,1,5},
324
              {7,3,2,6},
325
              {6,2,0,4},
326
              {3,7,5,1}
327
          };
328

    
329
        bands = new float[][]
330
          {
331
              {0.05f,40,0.5f,0.2f,5,  2,2}
332
          };
333

    
334
        bandIndexes = new int[] { 0,0,0,0,0,0 };
335

    
336
        corners = new float[][]
337
          {
338
              { 0.01f, 0.10f }
339
          };
340

    
341
        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
342

    
343
        centers = new float[][]
344
          {
345
              { 0.0f, 0.0f, 0.0f }
346
          };
347

    
348
        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
349

    
350
        numComponents = 8;
351
        }
352

    
353
      ///// TETRAHEDRON //////////////////////////////////////////////////////////////////////////
354

    
355
      else if( mode==1 )
356
        {
357
        vertices = new float[][]
358
          {
359
              {-0.5f, SQ2/4, 0.0f},
360
              { 0.5f, SQ2/4, 0.0f},
361
              { 0.0f,-SQ2/4, 0.5f},
362
              { 0.0f,-SQ2/4,-0.5f}
363
          };
364

    
365
        vertIndexes = new int[][]
366
          {
367
              {2,1,0},   // counterclockwise!
368
              {2,3,1},
369
              {3,2,0},
370
              {3,0,1}
371
          };
372

    
373
        bands = new float[][]
374
          {
375
              {0.05f,30,0.6f,0.5f,5,  2,2}
376
          };
377

    
378
        bandIndexes = new int[] { 0,0,0,0 };
379

    
380
        corners = new float[][]
381
          {
382
              { 0.02f, 0.10f }
383
          };
384

    
385
        cornerIndexes = new int[] { 0,0,0,0 };
386

    
387
        centers = new float[][]
388
          {
389
              { 0.0f, 0.0f, 0.0f }
390
          };
391

    
392
        centerIndexes = new int[] { 0,0,0,0 };
393

    
394
        numComponents = 4;
395
        }
396

    
397
      ///// DINO ////////////////////////////////////////////////////////////////////////////////
398

    
399
      else if( mode==2 )
400
        {
401
        vertices = new float[][]
402
          {
403
             {-1.5f, 0.0f, 0.0f},
404
             { 1.5f, 0.0f, 0.0f},
405
             { 0.0f,-1.5f, 0.0f},
406
             { 0.0f, 0.0f,-1.5f}
407
          };
408

    
409
        vertIndexes = new int[][]
410
          {
411
             {2,1,0},   // counterclockwise!
412
             {3,0,1},
413
             {2,3,1},
414
             {3,2,0},
415
          };
416

    
417
        bands = new float[][]
418
          {
419
              {0.035f,30,0.16f,0.8f,6,2,2},
420
              {0.010f,45,0.16f,0.2f,6,2,2}
421
          };
422

    
423
        bandIndexes = new int[] { 0,0,1,1 };
424

    
425
        corners = new float[][]
426
          {
427
               {0.07f,0.40f},
428
               {0.05f,0.30f}
429
          };
430

    
431
        cornerIndexes = new int[] { 0,0,1,1 };
432

    
433
        centers = new float[][]
434
          {
435
              { 0.0f,-0.75f,-0.75f }
436
          };
437

    
438
        centerIndexes = new int[] { 0,0,0,0 };
439

    
440
        numComponents = 4;
441
        }
442

    
443
      ///// OCTAHEDRON ////////////////////////////////////////////////////////////////////////////
444

    
445
      else if( mode==3 )
446
        {
447
        vertices = new float[][]
448
          {
449
              { 0.5f,   0.0f, 0.5f},
450
              { 0.5f,   0.0f,-0.5f},
451
              {-0.5f,   0.0f,-0.5f},
452
              {-0.5f,   0.0f, 0.5f},
453
              { 0.0f,  SQ2/2, 0.0f},
454
              { 0.0f, -SQ2/2, 0.0f},
455
          };
456

    
457
        vertIndexes = new int[][]
458
          {
459
              {3,0,4},   // counterclockwise!
460
              {0,1,4},
461
              {1,2,4},
462
              {2,3,4},
463
              {5,0,3},
464
              {5,1,0},
465
              {5,2,1},
466
              {5,3,2}
467
          };
468

    
469
        bands = new float[][]
470
          {
471
             {0.05f,17,0.5f,0.2f,5,  2,2}
472
          };
473

    
474
        bandIndexes = new int[] { 0,0,0,0,0,0,0,0 };
475

    
476
        corners = new float[][]
477
          {
478
              { 0.03f, 0.12f }
479
          };
480

    
481
        cornerIndexes = new int[] { 0,0,0,0,0,0 };
482

    
483
        centers = new float[][]
484
          {
485
              { 0.0f, 0.0f, 0.0f }
486
          };
487

    
488
        centerIndexes = new int[] { 0,0,0,0,0,0 };
489

    
490
        numComponents = 8;
491
        }
492

    
493
      ///// KILOMINX EDGE ////////////////////////////////////////////////////////////////////////
494

    
495
      else if( mode==4 )
496
        {
497
        float SQ5  = (float)Math.sqrt(5);
498
        float SIN18= (SQ5-1)/4;
499
        float COS18= 0.25f*(float)Math.sqrt(10.0+2.0*SQ5);
500
        float H = 1.0f;
501
        float L = 2.0f;
502
        float X = H*(float)Math.sqrt((5+SQ5)/10);
503
        float Y = H*(float)Math.sqrt((5-SQ5)/10);
504
        float D = H*SIN18/COS18;
505

    
506
        vertices = new float[][]
507
          {
508
              { 0.0f,    Y, L/2},
509
              {    X, 0.0f, L/2},
510
              { 0.0f,   -Y, L/2},
511
              {   -X, 0.0f, L/2},
512
              { 0.0f,    Y, -L/2 +D},
513
              {    X, 0.0f,-L/2   },
514
              { 0.0f,   -Y, -L/2-D },
515
              {   -X, 0.0f,-L/2   }
516
          };
517

    
518
        vertIndexes = new int[][]
519
          {
520
              {3,2,1,0},   // counterclockwise!
521
              {0,1,5,4},
522
              {3,0,4,7},
523
              {2,1,5,6},
524
              {3,2,6,7},
525
              {4,5,6,7}
526
          };
527

    
528
        bands = new float[][]
529
          {
530
             {0.04f,13,(float)(L/3),(float)L/8, 5,2,3},
531
             {0.00f, 0,(float)(L/2),(float)L/4, 5,2,3}
532
          };
533

    
534
        bandIndexes = new int[] { 1,0,0,1,1,1 };
535

    
536
        corners = new float[][]
537
          {
538
              { 0.04f, 0.12f }
539
          };
540

    
541
        cornerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 };
542

    
543
        centers = new float[][]
544
          {
545
              { 0.0f, 0.0f, 0.0f }
546
          };
547

    
548
        centerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 };
549

    
550
        numComponents = 6;
551
        }
552

    
553
      ///// IVY_CORNER ////////////////////////////////////////////////////////////////////////
554

    
555
      else if( mode==5 )
556
        {
557
        int IVY_N = 8;
558
        final float IVY_D = 0.003f;
559
        final float angle = (float)Math.PI/(2*IVY_N);
560
        final float CORR  = 1.0f - 2*IVY_D;
561

    
562
        vertices = new float[3*IVY_N+7][3];
563
        vertIndexes = new int[6][IVY_N+4];
564

    
565
        vertices[0][0] = 0.0f;
566
        vertices[0][1] = 0.0f;
567
        vertices[0][2] = 0.0f;
568
        vertices[1][0] =-1.0f;
569
        vertices[1][1] = 0.0f;
570
        vertices[1][2] = 0.0f;
571
        vertices[2][0] = 0.0f;
572
        vertices[2][1] =-1.0f;
573
        vertices[2][2] = 0.0f;
574
        vertices[3][0] = 0.0f;
575
        vertices[3][1] = 0.0f;
576
        vertices[3][2] =-1.0f;
577

    
578
        vertIndexes[0][0] = 2;
579
        vertIndexes[0][1] = 0;
580
        vertIndexes[0][2] = 1;
581
        vertIndexes[3][0] = 2;
582
        vertIndexes[3][1] = 0;
583
        vertIndexes[3][2] = 1;
584

    
585
        vertIndexes[1][0] = 3;
586
        vertIndexes[1][1] = 0;
587
        vertIndexes[1][2] = 2;
588
        vertIndexes[4][0] = 3;
589
        vertIndexes[4][1] = 0;
590
        vertIndexes[4][2] = 2;
591

    
592
        vertIndexes[2][0] = 1;
593
        vertIndexes[2][1] = 0;
594
        vertIndexes[2][2] = 3;
595
        vertIndexes[5][0] = 1;
596
        vertIndexes[5][1] = 0;
597
        vertIndexes[5][2] = 3;
598

    
599
        int N1 = 4;
600
        int N2 = N1 + IVY_N + 1;
601
        int N3 = N2 + IVY_N + 1;
602

    
603
        for(int i=0; i<=IVY_N; i++)
604
          {
605
          float cos1 = (float)Math.cos((IVY_N-i)*angle);
606
          float sin1 = (float)Math.sin((IVY_N-i)*angle);
607
          float cos2 = (float)Math.cos((      i)*angle);
608
          float sin2 = (float)Math.sin((      i)*angle);
609

    
610
          vertices[N1+i][0] = CORR*(cos1-0.5f) - 0.5f;
611
          vertices[N1+i][1] = CORR*(sin1-0.5f) - 0.5f;
612
          vertices[N1+i][2] = 0.0f;
613

    
614
          vertices[N2+i][0] = 0.0f;
615
          vertices[N2+i][1] = CORR*(sin2-0.5f) - 0.5f;
616
          vertices[N2+i][2] = CORR*(cos2-0.5f) - 0.5f;
617

    
618
          vertices[N3+i][0] = CORR*(cos2-0.5f) - 0.5f;
619
          vertices[N3+i][1] = 0.0f;
620
          vertices[N3+i][2] = CORR*(sin2-0.5f) - 0.5f;
621

    
622
          vertIndexes[0][i+3] = N1 + i;
623
          vertIndexes[1][i+3] = N2 + i;
624
          vertIndexes[2][i+3] = N3 + i;
625
          vertIndexes[3][i+3] = N1 + i;
626
          vertIndexes[4][i+3] = N2 + i;
627
          vertIndexes[5][i+3] = N3 + i;
628
          }
629

    
630
        bands = new float[][]
631
          {
632
             {+0.012f,20,0.2f,0.5f,7,1,2},
633
             {-0.100f,20,0.2f,0.0f,2,1,2}
634
          };
635

    
636
        bandIndexes = new int[] { 0,0,0,1,1,1 };
637

    
638
        corners = new float[][]
639
          {
640
              { 0.04f, 0.12f }
641
          };
642

    
643
        cornerIndexes = new int[3*IVY_N+7];
644

    
645
        centers = new float[][]
646
          {
647
              {-0.5f,-0.5f,-0.5f}
648
          };
649

    
650
        centerIndexes = new int[3*IVY_N+7];
651

    
652
        for(int i=0; i<4; i++)
653
          {
654
          cornerIndexes[i] = 0;
655
          centerIndexes[i] = 0;
656
          }
657
        for(int i=4; i<3*IVY_N+7; i++)
658
          {
659
          cornerIndexes[i] = -1;
660
          centerIndexes[i] = -1;
661
          }
662

    
663
        float C = 0.5f - SQ2/4;
664
        convexCenter = new float[] {-C,-C,-C};
665

    
666
        numComponents = 6;
667
        }
668

    
669
      ///// IVY_FACE ////////////////////////////////////////////////////////////////////////
670

    
671
      else if( mode==6 )
672
        {
673
        int IVY_N = 6;
674
        final float IVY_D = 0.003f;
675
        final float angle = (float)Math.PI/(2*IVY_N);
676
        final float CORR  = 1.0f - 2*IVY_D;
677

    
678
        vertices   = new float[2*IVY_N][3];
679
        vertIndexes= new int[2][2*IVY_N];
680

    
681
        for(int i=0; i<IVY_N; i++)
682
          {
683
          float cos = (float)Math.cos(i*angle);
684
          float sin = (float)Math.sin(i*angle);
685

    
686
          vertices[i      ][0] = CORR*(0.5f-cos);
687
          vertices[i      ][1] = CORR*(0.5f-sin);
688
          vertices[i      ][2] = 0.0f;
689
          vertices[i+IVY_N][0] = CORR*(cos-0.5f);
690
          vertices[i+IVY_N][1] = CORR*(sin-0.5f);
691
          vertices[i+IVY_N][2] = 0.0f;
692

    
693
          vertIndexes[0][i      ] = i;
694
          vertIndexes[0][i+IVY_N] = i+IVY_N;
695
          vertIndexes[1][i      ] = i;
696
          vertIndexes[1][i+IVY_N] = i+IVY_N;
697
          }
698

    
699
        bands = new float[][]
700
          {
701
             {+0.012f,20,0.2f,0.5f,7,1,2},
702
             {-0.100f,20,0.2f,0.0f,2,1,2},
703
          };
704

    
705
        bandIndexes = new int[] { 0,1 };
706

    
707
        corners = new float[][]
708
          {
709
             {0.03f,0.10f}
710
          };
711

    
712
        centers = new float[][]
713
          {
714
              {-0.0f,-0.0f,-0.5f}
715
          };
716

    
717
        cornerIndexes = new int[2*IVY_N];
718
        centerIndexes = new int[2*IVY_N];
719

    
720
        for(int i=0; i<2*IVY_N; i++)
721
          {
722
          cornerIndexes[i] = -1;
723
          centerIndexes[i] = -1;
724
          }
725

    
726
        cornerIndexes[0    ] = 0;
727
        cornerIndexes[IVY_N] = 0;
728
        centerIndexes[0    ] = 0;
729
        centerIndexes[IVY_N] = 0;
730

    
731
        numComponents = 2;
732
        }
733

    
734
      ///// SKEWB Ultimate SMALL  /////////////////////////////////////////////////////////////
735

    
736
      else if( mode==7 )
737
        {
738
        float S = (SQ5+1)/4;
739

    
740
        vertices = new float[][]
741
          {
742
              { 0.0f        ,  0.0f       , 0.0f       },
743
              { -0.5f*S     , 0.5f*S+0.25f, -0.25f     },
744
              {-0.25f       , -S/2        , (-2*S-1)/4 },
745
              { 0.5f*S+0.25f, 0.25f       , -S/2       },
746
              { 0.0f        , 0.5f        , -S-0.5f    },
747
              { 0.0f        , 0.5f        , 0.0f       },
748
              { -0.5f*S     ,-0.5f*S+0.25f, -0.25f     },
749
              {  0.5f*S     ,-0.5f*S+0.25f, -0.25f     }
750
          };
751

    
752
        vertIndexes = new int[][]
753
          {
754
              {6,0,5,1},   // counterclockwise!
755
              {0,7,3,5},
756
              {0,6,2,7},
757
              {4,3,5,1},
758
              {4,2,7,3},
759
              {4,1,6,2},
760
          };
761

    
762
        bands = new float[][]
763
          {
764
             {0.04f,17,0.5f,0.2f,5,  2,2},
765
             {0.01f, 1,0.5f,0.2f,5,  2,2}
766
          };
767

    
768
        bandIndexes = new int[] { 0,0,0,1,1,1 };
769

    
770
        corners = new float[][]
771
          {
772
              { 0.013f, 0.08f }
773
          };
774

    
775
        cornerIndexes = new int[] { 0, 0, 0, 0,-1,0,0,0 };
776

    
777
        centers = new float[][]
778
          {
779
              { 0.0f,-0.5f, (float)(-S-0.5) }
780
          };
781

    
782
        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
783

    
784
        numComponents = 8;
785
        }
786

    
787
      ///// SKEWB Ultimate BIG ///////////////////////////////////////////////////////////////
788

    
789
      else if( mode==8 )
790
        {
791
        float S = (SQ5+1)/4;
792

    
793
        vertices = new float[][]
794
          {
795
              {-S/2      ,-S/2+0.25f,     0.25f},
796
              { S/2      , S/2-0.25f,    -0.25f},
797
              {-S        ,     0.00f,     0.00f},
798
              {     0.25f, S/2      ,-S/2-0.25f},
799
              {-S/2      ,-S/2-0.25f,     0.25f},
800
              { S/2+0.25f,    -0.25f,-S/2      },
801
              {-S        ,    -0.50f,     0.00f},
802
              {     0.50f,     0.00f,-S        },
803
              {-S  +0.25f, S/2      ,-S/2-0.25f},
804
              {     0.25f,-S/2-0.50f,-S/2+0.25f},
805
              {-S/2      ,-S/2-0.25f,-S  -0.25f}
806
          };
807

    
808
        vertIndexes = new int[][]
809
          {
810
              {0,1,3,8,2},   // counterclockwise!
811
              {0,4,9,5,1},
812
              { 0,2,6,4},
813
              { 1,5,7,3},
814
              {10,9,4,6},
815
              {10,9,5,7},
816
              {10,8,3,7},
817
              {10,8,2,6}
818
          };
819

    
820
        bands = new float[][]
821
          {
822
             {0.04f,17,0.5f,0.2f,5,  2,2},
823
             {0.04f,17,0.5f,0.2f,5,  2,2},
824
             {0.01f, 1,0.5f,0.2f,5,  2,2}
825
          };
826

    
827
        bandIndexes = new int[] { 0,0,1,1,2,2,2,2 };
828

    
829
        corners = new float[][]
830
          {
831
              { 0.013f, 0.08f }
832
          };
833

    
834
        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 };
835

    
836
        centers = new float[][]
837
          {
838
              { (float)(-S/2), 0.25f, (float)(-S/2-0.5) }
839
          };
840

    
841
        centerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,0 };
842

    
843
        numComponents = 8;
844
        }
845

    
846
      ///// SQUARE-1 MIDDLE ///////////////////////////////////////////////////////////////
847

    
848
      else if( mode==9 )
849
        {
850
        final float X = 3*(2-SQ3)/2;
851

    
852
        vertices = new float[][]
853
          {
854
              { -1.5f-X, 0.5f, 1.5f },
855
              {    0.0f, 0.5f, 1.5f },
856
              {    0.0f, 0.5f,-1.5f },
857
              { -1.5f+X, 0.5f,-1.5f },
858
              { -1.5f-X,-0.5f, 1.5f },
859
              {    0.0f,-0.5f, 1.5f },
860
              {    0.0f,-0.5f,-1.5f },
861
              { -1.5f+X,-0.5f,-1.5f }
862
          };
863

    
864
        vertIndexes = new int[][]
865
          {
866
              {0,1,2,3},   // counterclockwise!
867
              {4,5,6,7},
868
              {4,5,1,0},
869
              {5,6,2,1},
870
              {6,7,3,2},
871
              {7,4,0,3}
872
          };
873

    
874
        bands = new float[][]
875
          {
876
             {0.040f,35,0.8f,1.0f,5,2,1},
877
             {0.020f,35,0.8f,1.0f,5,2,1},
878
             {0.001f,35,0.8f,1.0f,5,2,1}
879
          };
880

    
881
        bandIndexes = new int[] { 2,2,1,1,0,2 };
882

    
883
        corners = new float[][]
884
          {
885
              {0.04f,0.05f}
886
          };
887

    
888
        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
889

    
890
        centers = new float[][]
891
          {
892
              { -0.75f, 0.0f, 0.0f}
893
          };
894

    
895
        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
896

    
897
        numComponents = 6;
898
        }
899

    
900
      ///// SQUARE-1 EDGE ///////////////////////////////////////////////////////////////
901

    
902
      else if( mode==10 )
903
        {
904
        final float X = 3*(2-SQ3)/2;
905

    
906
        vertices = new float[][]
907
          {
908
              {  -X, 0.5f, 0.0f },
909
              {  +X, 0.5f, 0.0f },
910
              {0.0f, 0.5f,-1.5f },
911
              {  -X,-0.5f, 0.0f },
912
              {  +X,-0.5f, 0.0f },
913
              {0.0f,-0.5f,-1.5f },
914
          };
915

    
916
        vertIndexes = new int[][]
917
          {
918
              {0,1,2},   // counterclockwise!
919
              {3,4,5},
920
              {3,4,1,0},
921
              {4,5,2,1},
922
              {5,3,0,2}
923
          };
924

    
925
        bands = new float[][]
926
          {
927
            {0.038f,35,0.5f,0.9f, 5,2,1},
928
            {0.001f,35,0.5f,0.9f, 5,2,1}
929
          };
930

    
931
        bandIndexes = new int[]  { 0,1,0,1,1 };
932

    
933
        corners = new float[][]
934
          {
935
             {0.06f,0.20f}
936
          };
937

    
938
        cornerIndexes = new int[] { 0,0,-1,0,0,-1 };
939

    
940
        centers = new float[][]
941
          {
942
              { 0.0f, 0.0f,-0.5f}
943
          };
944

    
945
        centerIndexes = new int[] { 0,0,-1,0,0,-1 };
946

    
947
        numComponents = 6;
948
        }
949

    
950
      ///// SQUARE-1 CORNER ///////////////////////////////////////////////////////////////
951

    
952
      else if( mode==11 )
953
        {
954
        final float X = 3*(2-SQ3)/2;
955

    
956
        vertices = new float[][]
957
          {
958
              { X-1.5f, 0.5f,  0.0f },
959
              {   0.0f, 0.5f,  0.0f },
960
              {   0.0f, 0.5f,X-1.5f },
961
              {  -1.5f, 0.5f, -1.5f },
962
              { X-1.5f,-0.5f,  0.0f },
963
              {   0.0f,-0.5f,  0.0f },
964
              {   0.0f,-0.5f,X-1.5f },
965
              {  -1.5f,-0.5f, -1.5f }
966
          };
967

    
968
        vertIndexes = new int[][]
969
          {
970
              {0,1,2,3},   // counterclockwise!
971
              {4,5,6,7},
972
              {4,5,1,0},
973
              {5,6,2,1},
974
              {7,4,0,3},
975
              {6,7,3,2}
976
          };
977

    
978
        bands = new float[][]
979
          {
980
            {0.038f,35,0.9f,1.0f, 5,2,1},
981
            {0.001f,35,0.9f,1.0f, 5,2,1}
982
          };
983

    
984
        bandIndexes = new int[]  { 0,1,0,0,1,1 };
985

    
986
        corners = new float[][]
987
          {
988
            {0.08f,0.20f}
989
          };
990

    
991
        cornerIndexes = new int[] { 0,0,0,-1,0,0,0,-1 };
992

    
993
        centers = new float[][]
994
          {
995
             { -0.5f, 0.0f,-0.5f}
996
          };
997

    
998
        centerIndexes = new int[] { -1,0,-1,-1,-1,0,-1,-1 };
999

    
1000
        numComponents = 6;
1001
        }
1002

    
1003
      ///// SQUARE-2 CORNER ///////////////////////////////////////////////////////////////
1004

    
1005
      else if( mode==12 )
1006
        {
1007
        final float X = 3*(2-SQ3)/2;
1008
        final float Z = 0.75f - X/2;
1009

    
1010
        vertices = new float[][]
1011
          {
1012
              { X-1.5f+Z, 0.5f,  0.0f },
1013
              {        Z, 0.5f,  0.0f },
1014
              {  -1.5f+Z, 0.5f, -1.5f },
1015
              { X-1.5f+Z,-0.5f,  0.0f },
1016
              {        Z,-0.5f,  0.0f },
1017
              {  -1.5f+Z,-0.5f, -1.5f }
1018
          };
1019

    
1020
        vertIndexes = new int[][]
1021
          {
1022
              {0,1,2},   // counterclockwise!
1023
              {5,4,3},
1024
              {3,4,1,0},
1025
              {4,5,2,1},
1026
              {5,3,0,2}
1027
          };
1028

    
1029
        bands = new float[][]
1030
          {
1031
            {0.040f,35,0.9f,1.0f, 5,2,1},
1032
            {0.001f,35,0.9f,1.0f, 5,2,1}
1033
          };
1034

    
1035
        bandIndexes = new int[] { 0,0,0,1,1 };
1036

    
1037
        corners = new float[][]
1038
          {
1039
            {0.05f,0.13f}
1040
          };
1041

    
1042
        cornerIndexes = new int[] { 0,0,-1,0,0,-1 };
1043

    
1044
        centers = new float[][]
1045
          {
1046
             { 0.0f, 0.0f,-0.5f}
1047
          };
1048

    
1049
        centerIndexes = new int[] { 0,0,-1,0,0,-1 };
1050

    
1051
        numComponents = 5;
1052
        }
1053

    
1054
      ///// REDI CORNER ///////////////////////////////////////////////////////////////
1055

    
1056
      else if( mode==13 )
1057
        {
1058
        vertices = new float[][]
1059
          {
1060
             { 0.0f, 0.0f, 0.0f },
1061
             {-0.5f, 0.5f, 0.5f },
1062
             {-0.5f,-0.5f, 0.5f },
1063
             { 0.5f, 0.5f, 0.5f },
1064
             { 0.5f,-0.5f, 0.5f },
1065
             { 0.5f, 0.5f,-0.5f },
1066
             { 0.5f,-0.5f,-0.5f },
1067
             {-0.5f, 0.5f,-0.5f },
1068
          };
1069

    
1070
        vertIndexes = new int[][]
1071
          {
1072
             { 2,4,3,1 },
1073
             { 1,3,5,7 },
1074
             { 4,6,5,3 },
1075

    
1076
             { 2,4,0 },
1077
             { 5,7,0 },
1078
             { 4,6,0 },
1079
             { 7,1,0 },
1080
             { 1,2,0 },
1081
             { 6,5,0 }
1082
          };
1083

    
1084
        bands = new float[][]
1085
          {
1086
             {0.06f,35,0.5f,0.7f,5,2,2},
1087
             {0.01f,35,0.2f,0.4f,5,2,2}
1088
          };
1089

    
1090
        bandIndexes = new int[] { 0,0,0,1,1,1,1,1,1 };
1091

    
1092
        corners = new float[][]
1093
          {
1094
            {0.06f,0.12f}
1095
          };
1096

    
1097
        cornerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
1098

    
1099
        centers = new float[][]
1100
          {
1101
             { 0.0f, 0.0f, 0.0f}
1102
          };
1103

    
1104
        centerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
1105

    
1106
        numComponents = 9;
1107
        }
1108

    
1109
      ///// JING CORNER ///////////////////////////////////////////////////////////////
1110

    
1111
      else if( mode==14 )
1112
        {
1113
        final float F = 0.24f;
1114
        final float X = F/2;
1115
        final float Y = F*SQ2/2;
1116
        final float Z =-F/2;
1117

    
1118
        vertices = new float[][]
1119
          {
1120
             { 0.0f, 0.0f,  0.0f },
1121
             {    X,    Y,     Z },
1122
             { 0.0f,  2*Y,   2*Z },
1123
             {   -X,    Y,     Z },
1124
             { 0.0f, 0.0f,    -F },
1125
             {    X,    Y,   Z-F },
1126
             { 0.0f,  2*Y, 2*Z-F },
1127
             {   -X,    Y,   Z-F },
1128
          };
1129

    
1130
        vertIndexes = new int[][]
1131
          {
1132
             {0,1,2,3},
1133
             {1,0,4,5},
1134
             {7,4,0,3},
1135
             {1,5,6,2},
1136
             {7,3,2,6},
1137
             {4,7,6,5}
1138
          };
1139

    
1140
        bands = new float[][]
1141
          {
1142
             {0.015f,35,0.5f*F,F,5,1,1},
1143
             {0.001f,35,0.5f*F,F,5,1,1}
1144
          };
1145

    
1146
        bandIndexes = new int[] { 0,0,0,1,1,1 };
1147

    
1148
        corners = new float[][]
1149
          {
1150
            {0.08f,0.20f*F},
1151
            {0.07f,0.20f*F}
1152
          };
1153

    
1154
        cornerIndexes = new int[] { 0,1,1,-1,1,-1,-1,-1 };
1155

    
1156
        centers = new float[][]
1157
          {
1158
             { 0.0f, Y, Z-F/2}
1159
          };
1160

    
1161
        centerIndexes = new int[] { 0,0,0,-1,0,-1,-1,-1 };
1162

    
1163
        numComponents = 6;
1164
        }
1165

    
1166
      ///// JING EDGE ///////////////////////////////////////////////////////////////
1167

    
1168
      else if( mode==15 )
1169
        {
1170
        final float F = 0.24f;
1171
        final float X = F/2;
1172
        final float Y = F*SQ2/2;
1173
        final float Z =-F/2;
1174

    
1175
        vertices = new float[][]
1176
          {
1177
             { 0.0f, 0.0f,     0.5f-F },
1178
             {    X,    Y,   Z+0.5f-F },
1179
             { 0.0f,  2*Y, 2*Z+0.5f-F },
1180
             {   -X,    Y,   Z+0.5f-F },
1181
             { 0.0f, 0.0f,    -0.5f+F },
1182
             {    X,    Y,  -Z-0.5f+F },
1183
             { 0.0f,  2*Y,-2*Z-0.5f+F },
1184
             {   -X,    Y,  -Z-0.5f+F },
1185
          };
1186

    
1187
        vertIndexes = new int[][]
1188
          {
1189
             {0,4,5,1},
1190
             {3,7,4,0},
1191
             {0,1,2,3},
1192
             {4,7,6,5},
1193
             {1,5,6,2},
1194
             {2,6,7,3}
1195
          };
1196

    
1197
        bands = new float[][]
1198
          {
1199
             {0.015f,35,0.5f*F,F,5,1,1},
1200
             {0.001f,35,0.5f*F,F,5,1,1}
1201
          };
1202

    
1203
        bandIndexes = new int[] { 0,0,1,1,1,1 };
1204

    
1205
        corners = new float[][]
1206
          {
1207
            {0.07f,0.20f*F}
1208
          };
1209

    
1210
        cornerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
1211

    
1212
        centers = new float[][]
1213
          {
1214
             { 0, F*SQ2/2, 0 }
1215
          };
1216

    
1217
        centerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
1218

    
1219
        numComponents = 6;
1220
        }
1221

    
1222
      ///// JING FACE ///////////////////////////////////////////////////////////////
1223

    
1224
      else if( mode==16 )
1225
        {
1226
        final float F = 0.24f;
1227
        final float L = (1-3*F);
1228
        final float X = L/2;
1229
        final float Y = L*SQ2/2;
1230
        final float Z =-L/2;
1231
        final float D = F/L;
1232

    
1233
        vertices = new float[][]
1234
          {
1235
              {    0.0f,     -2*Y/3,   -2*Z/3 },
1236
              {       X,        Y/3,      Z/3 },
1237
              {      -X,        Y/3,      Z/3 },
1238
              {    0.0f,     -2*Y/3,   -2*Z/3+2*D*Z },
1239
              {   X-D*X,    Y/3-D*Y,  Z/3+D*Z },
1240
              {  -X+D*X,    Y/3-D*Y,  Z/3+D*Z },
1241
          };
1242

    
1243
        vertIndexes = new int[][]
1244
          {
1245
             {0,1,2},
1246
             {3,5,4},
1247
             {0,3,4,1},
1248
             {5,3,0,2},
1249
             {4,5,2,1}
1250
          };
1251

    
1252
        bands = new float[][]
1253
          {
1254
             {0.025f,35,0.20f*(1-3*F),0.6f*(1-3*F),5,1,1},
1255
             {0.001f,35,0.05f*(1-3*F),0.1f*(1-3*F),5,1,1}
1256
          };
1257

    
1258
        bandIndexes = new int[] { 0,1,1,1,1,1 };
1259

    
1260
        corners = new float[][]
1261
          {
1262
            {0.04f,0.15f}
1263
          };
1264

    
1265
        cornerIndexes = new int[] { 0,0,0,-1,-1,-1 };
1266

    
1267
        centers = new float[][]
1268
          {
1269
            { 0, -2*Y/3, 4*Z/3 }
1270
          };
1271

    
1272
        centerIndexes = new int[] { 0,0,0,-1,-1,-1 };
1273

    
1274
        numComponents = 6;
1275
        }
1276

    
1277
      ///// END DEFINITIONS /////////////////////////////////////////////////////////////////
1278

    
1279
      FactoryCubit factory = FactoryCubit.getInstance();
1280

    
1281
      factory.clear();
1282
      factory.createNewFaceTransform(vertices,vertIndexes);
1283
      mMesh = factory.createRoundedSolid(vertices, vertIndexes,
1284
                                         bands, bandIndexes,
1285
                                         corners, cornerIndexes,
1286
                                         centers, centerIndexes,
1287
                                         numComponents, convexCenter, MESH_NICE );
1288

    
1289
      int numEff = mMesh.getNumEffComponents();
1290

    
1291
      for(int i=0; i<numEff; i++)
1292
        {
1293
        mMesh.setEffectAssociation(i, 0, i);
1294
        }
1295
      }
1296

    
1297
///////////////////////////////////////////////////////////////////////////////////////////////////
1298

    
1299
    private void openMesh(int resourceID)
1300
      {
1301
      Context con = mView.getContext();
1302
      Resources res = con.getResources();
1303
      InputStream is = res.openRawResource(resourceID);
1304
      DataInputStream dos = new DataInputStream(is);
1305
      mMesh = new MeshFile(dos);
1306

    
1307
      int numEff = mMesh.getNumEffComponents();
1308

    
1309
      for(int i=0; i<numEff; i++)
1310
        {
1311
        mMesh.setEffectAssociation(i, 0, i);
1312
        }
1313

    
1314
      try
1315
        {
1316
        is.close();
1317
        }
1318
      catch(IOException e)
1319
        {
1320
        android.util.Log.e("MeshFile", "Error closing InputStream: "+e.toString());
1321
        }
1322
      }
1323

    
1324
///////////////////////////////////////////////////////////////////////////////////////////////////
1325

    
1326
    MeshBase getMesh()
1327
      {
1328
      return mMesh;
1329
      }
1330

    
1331
///////////////////////////////////////////////////////////////////////////////////////////////////
1332

    
1333
    long getTime()
1334
      {
1335
      return mTime;
1336
      }
1337

    
1338
///////////////////////////////////////////////////////////////////////////////////////////////////
1339

    
1340
    int getBytes()
1341
      {
1342
      if( mMesh instanceof MeshFile )
1343
        {
1344
        return ((MeshFile)mMesh).getNumBytes();
1345
        }
1346

    
1347
      return 0;
1348
      }
1349

    
1350
///////////////////////////////////////////////////////////////////////////////////////////////////
1351

    
1352
    int getVertices()
1353
      {
1354
      return mMesh.getNumVertices();
1355
      }
1356

    
1357
///////////////////////////////////////////////////////////////////////////////////////////////////
1358

    
1359
    int getEndEffIndex(int component)
1360
      {
1361
      return mMesh.getLastVertexEff(component);
1362
      }
1363

    
1364
///////////////////////////////////////////////////////////////////////////////////////////////////
1365

    
1366
    int getEndTexIndex(int component)
1367
      {
1368
      return mMesh.getLastVertexTex(component);
1369
      }
1370

    
1371
///////////////////////////////////////////////////////////////////////////////////////////////////
1372

    
1373
    int getEffComponentNum()
1374
      {
1375
      return mMesh.getNumEffComponents();
1376
      }
1377

    
1378
///////////////////////////////////////////////////////////////////////////////////////////////////
1379

    
1380
    int getTexComponentNum()
1381
      {
1382
      return mMesh.getNumTexComponents();
1383
      }
1384
}
(2-2/4)