Project

General

Profile

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

examples / src / main / java / org / distorted / examples / meshfile / MeshFileRenderer.java @ 93ad90ba

1 42aa970f Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 1af8e143 Leszek Koltunski
import android.content.Context;
23
import android.content.res.Resources;
24 42aa970f Leszek Koltunski
import android.graphics.Bitmap;
25
import android.graphics.Canvas;
26
import android.graphics.Paint;
27
import android.opengl.GLSurfaceView;
28
29 8ac4c0bc Leszek Koltunski
import org.distorted.examples.R;
30 a65604a7 Leszek Koltunski
import org.distorted.library.effect.Effect;
31 6991ece5 Leszek Koltunski
import org.distorted.library.effect.EffectType;
32 42aa970f Leszek Koltunski
import org.distorted.library.effect.MatrixEffectQuaternion;
33
import org.distorted.library.effect.MatrixEffectScale;
34 39b925d5 Leszek Koltunski
import org.distorted.library.effect.VertexEffectDisappear;
35 42aa970f Leszek Koltunski
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 6991ece5 Leszek Koltunski
import org.distorted.library.mesh.MeshBase;
40 1af8e143 Leszek Koltunski
import org.distorted.library.mesh.MeshFile;
41 b2adcd57 Leszek Koltunski
import org.distorted.library.mesh.MeshMultigon;
42 1bb5d3b7 Leszek Koltunski
import org.distorted.library.mesh.MeshPolygon;
43 42aa970f Leszek Koltunski
import org.distorted.library.type.DynamicQuat;
44
import org.distorted.library.type.Static3D;
45
import org.distorted.library.type.Static4D;
46
47 1bb5d3b7 Leszek Koltunski
import org.distorted.objectlib.helpers.FactoryCubit;
48 0dee575b Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectFaceShape;
49
import org.distorted.objectlib.helpers.ObjectShape;
50 acb2aaae Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectVertexEffects;
51 1bb5d3b7 Leszek Koltunski
52 1af8e143 Leszek Koltunski
import java.io.DataInputStream;
53
import java.io.IOException;
54
import java.io.InputStream;
55
56 42aa970f Leszek Koltunski
import javax.microedition.khronos.egl.EGLConfig;
57
import javax.microedition.khronos.opengles.GL10;
58
59 b2adcd57 Leszek Koltunski
import static org.distorted.examples.meshfile.MeshFileActivity.MULTIGON;
60 1bb5d3b7 Leszek Koltunski
import static org.distorted.examples.meshfile.MeshFileActivity.POLYGON;
61 6991ece5 Leszek Koltunski
import static org.distorted.examples.meshfile.MeshFileActivity.PROCEDURAL;
62 baace8e9 Leszek Koltunski
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
63 3e129d0b Leszek Koltunski
import static org.distorted.objectlib.main.TwistyObject.MODE_NORM;
64 6991ece5 Leszek Koltunski
65 42aa970f Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
66
67 dc10a48d Leszek Koltunski
class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.LibraryUser
68 42aa970f Leszek Koltunski
{
69 7edab735 Leszek Koltunski
    private static final float SQ3 = (float)Math.sqrt(3);
70 16b336db Leszek Koltunski
    private final float DEFAULT_SCALE = 0.3f;
71
72 140f2c4e Leszek Koltunski
    private final GLSurfaceView mView;
73 dc10a48d Leszek Koltunski
    private final Resources mResources;
74 140f2c4e Leszek Koltunski
    private final DistortedScreen mScreen;
75
    private final DistortedEffects mEffects;
76
    private final Static3D mScale;
77 dc10a48d Leszek Koltunski
78
    private DistortedTexture mTexture;
79
    private MeshBase mMesh;
80 48c88f57 Leszek Koltunski
    private long mTime;
81 16b336db Leszek Koltunski
    private float mCurrentScale;
82 42aa970f Leszek Koltunski
83
    Static4D mQuat1, mQuat2;
84
    int mScreenMin;
85
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87
88
    MeshFileRenderer(GLSurfaceView v)
89
      {
90
      mView = v;
91 dc10a48d Leszek Koltunski
      mResources = v.getResources();
92
93 42aa970f Leszek Koltunski
      mScreen = new DistortedScreen();
94
      mScale= new Static3D(1,1,1);
95
      Static3D center=new Static3D(0,0,0);
96
97 16b336db Leszek Koltunski
      mCurrentScale = DEFAULT_SCALE;
98
99 42aa970f Leszek Koltunski
      mQuat1 = new Static4D(0,0,0,1);
100 fe032f52 Leszek Koltunski
      mQuat2 = new Static4D(0,0,0,1);
101 42aa970f Leszek Koltunski
102
      DynamicQuat quatInt1 = new DynamicQuat(0,0.5f);
103
      DynamicQuat quatInt2 = new DynamicQuat(0,0.5f);
104
105
      quatInt1.add(mQuat1);
106
      quatInt2.add(mQuat2);
107
108 39b925d5 Leszek Koltunski
      VertexEffectDisappear disappear = new VertexEffectDisappear();
109
      disappear.setMeshAssociation(1,-1);
110
111 42aa970f Leszek Koltunski
      mEffects = new DistortedEffects();
112
      mEffects.apply( new MatrixEffectQuaternion(quatInt2, center) );
113
      mEffects.apply( new MatrixEffectQuaternion(quatInt1, center) );
114
      mEffects.apply( new MatrixEffectScale(mScale));
115
116 39b925d5 Leszek Koltunski
      mEffects.apply( disappear );
117
118 42aa970f Leszek Koltunski
      mScreen.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
119 48c88f57 Leszek Koltunski
      mScreen.showFPS();
120 42aa970f Leszek Koltunski
      }
121
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123
   
124
    public void onDrawFrame(GL10 glUnused) 
125
      {
126
      mScreen.render( System.currentTimeMillis() );
127
      }
128
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130
    
131
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
132
      {
133
      mScreenMin = Math.min(width, height);
134 16b336db Leszek Koltunski
      float factor = mCurrentScale*mScreenMin;
135 42aa970f Leszek Koltunski
      mScale.set(factor,factor,factor);
136
      mScreen.resize(width, height);
137
      }
138
139
///////////////////////////////////////////////////////////////////////////////////////////////////
140
    
141
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
142
      {
143
      if( mTexture==null ) mTexture = new DistortedTexture();
144
145 a65604a7 Leszek Koltunski
      Effect.enableEffects(EffectType.VERTEX);
146 04a21ed6 Leszek Koltunski
      DistortedLibrary.setMax(EffectType.VERTEX, 20);
147 ef02f5e0 Leszek Koltunski
      DistortedLibrary.needTransformFeedback();
148 dc10a48d Leszek Koltunski
      DistortedLibrary.onSurfaceCreated(this);
149 42aa970f Leszek Koltunski
      }
150
151 16b336db Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 42aa970f Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
172
173 1af8e143 Leszek Koltunski
    void open(int resourceID)
174 42aa970f Leszek Koltunski
      {
175 099d8f8b Leszek Koltunski
      if( mTexture==null ) mTexture = new DistortedTexture();
176 8ac4c0bc Leszek Koltunski
      mTexture.setTexture( createTexture(resourceID) );
177
178 acad428e Leszek Koltunski
      long t1 = System.currentTimeMillis();
179 6991ece5 Leszek Koltunski
180 1bb5d3b7 Leszek Koltunski
      if( resourceID==PROCEDURAL )
181 6991ece5 Leszek Koltunski
        {
182 1bb5d3b7 Leszek Koltunski
        createMesh();
183
        }
184
      else if( resourceID==POLYGON )
185
        {
186
        createPolygon();
187 6991ece5 Leszek Koltunski
        }
188 b2adcd57 Leszek Koltunski
      else if( resourceID==MULTIGON )
189
        {
190
        createMultigon();
191
        }
192 6991ece5 Leszek Koltunski
      else
193
        {
194 1bb5d3b7 Leszek Koltunski
        openMesh(resourceID);
195 6991ece5 Leszek Koltunski
        }
196
197 acad428e Leszek Koltunski
      long t2 = System.currentTimeMillis();
198
199 48c88f57 Leszek Koltunski
      mTime = t2-t1;
200 42aa970f Leszek Koltunski
201 71c7624f Leszek Koltunski
      mScreen.detachAll();
202 7198e5c9 Leszek Koltunski
      mScreen.attach(mTexture,mEffects,mMesh);
203 42aa970f Leszek Koltunski
      }
204
205
///////////////////////////////////////////////////////////////////////////////////////////////////
206
207 1af8e143 Leszek Koltunski
    private Bitmap createTexture(int resourceID)
208 42aa970f Leszek Koltunski
      {
209 7edab735 Leszek Koltunski
      TextureFactory factory = TextureFactory.getInstance();
210
211
      float[] vertices;
212
      int[] colors;
213
      float F = 0.5f;
214
      float E = SQ3/2;
215
216 77e66c58 Leszek Koltunski
      if( resourceID == R.raw.deferredjob ||
217
          resourceID == R.raw.meshjoin    ||
218
          resourceID == PROCEDURAL        ||
219
          resourceID == POLYGON           ||
220 b2adcd57 Leszek Koltunski
          resourceID == MULTIGON          ||
221 77e66c58 Leszek Koltunski
          resourceID == R.raw.predeform    ) return createWhiteTexture();
222
223
      if( resourceID == R.raw.cube2       ||
224
          resourceID == R.raw.cube3       ||
225
          resourceID == R.raw.cube4       ||
226
          resourceID == R.raw.cube5        )
227
        {
228
        colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
229
        vertices = new float[] { -F,-F, +F,-F, +F,+F, -F,+F};
230
        return factory.createTexture(vertices,colors,0.10f, 0.10f, true);
231
        }
232
      if( resourceID == R.raw.pyra3       ||
233
          resourceID == R.raw.pyra4       ||
234
          resourceID == R.raw.pyra5        )
235
        {
236
        colors = new int[] { 0xffffff00, 0xff00ff00, 0xff0000ff, 0xffff0000 };
237
        vertices = new float[] { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
238
        return factory.createTexture(vertices,colors,0.05f, 0.05f, true);
239
        }
240
      if( resourceID == R.raw.dino )
241
        {
242
        colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
243
        vertices = new float[] { -F,F/3, 0,-2*F/3, +F,F/3 };
244
        return factory.createTexture(vertices,colors,0.05f, 0.03f, true);
245
        }
246
      if( resourceID == R.raw.skewb )
247
        {
248
        colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d };
249
        vertices = new float[] { -F+F/4,F/4, F/4,-F+F/4, F/4,F/4};
250
        return factory.createTexture(vertices,colors,0.05f, 0.08f, true);
251
        }
252 8ac4c0bc Leszek Koltunski
253 7edab735 Leszek Koltunski
      return null;
254 8ac4c0bc Leszek Koltunski
      }
255
256
///////////////////////////////////////////////////////////////////////////////////////////////////
257
258 7edab735 Leszek Koltunski
    private Bitmap createWhiteTexture()
259 8ac4c0bc Leszek Koltunski
      {
260 7edab735 Leszek Koltunski
      int SIZE = 1;
261 8ac4c0bc Leszek Koltunski
      Bitmap bitmap = Bitmap.createBitmap(SIZE,SIZE, Bitmap.Config.ARGB_8888);
262
      Canvas canvas = new Canvas(bitmap);
263
264
      Paint paint = new Paint();
265 36793c52 Leszek Koltunski
      paint.setColor(0xffffff55);
266 1beffb69 Leszek Koltunski
      paint.setStyle(Paint.Style.FILL);
267 7edab735 Leszek Koltunski
      canvas.drawRect(0, 0, SIZE, SIZE, paint);
268 6991ece5 Leszek Koltunski
269 72059460 Leszek Koltunski
      return bitmap;
270 6991ece5 Leszek Koltunski
      }
271
272 1bb5d3b7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
273
274
    private void createPolygon()
275
      {
276
      float A = 0.5f;
277 46a0999e Leszek Koltunski
      float B = 0.04f;
278 1bb5d3b7 Leszek Koltunski
279 46a0999e Leszek Koltunski
      int extraIndex    = 1;
280
      int extraVertices = 1;
281 1bb5d3b7 Leszek Koltunski
      float[] vertices = new float[] { -A,-A, A,-A, A,A, -A,A };
282 46a0999e Leszek Koltunski
283 bb6efcda Leszek Koltunski
      float C = 2f;
284 46a0999e Leszek Koltunski
      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};
285
286
/*
287
      int numBands      = 5;
288 1bb5d3b7 Leszek Koltunski
      float[] bands = new float[2*numBands];
289
290
      for(int i=0; i<numBands; i++)
291
        {
292
        bands[2*i  ] = 1 + i/(1.0f-numBands);
293
        bands[2*i+1] = B/(numBands-1)*i;
294
        }
295 46a0999e Leszek Koltunski
*/
296 bb6efcda Leszek Koltunski
      boolean[] edgesUp = new boolean[] {true,true,false,false};
297
      boolean[] vertsUp = new boolean[] {true,true,false,false};
298 1bb5d3b7 Leszek Koltunski
299 bb6efcda Leszek Koltunski
      mMesh = new MeshPolygon(vertices,bands,edgesUp,vertsUp,extraIndex,extraVertices,0.0f,0.0f);
300 1bb5d3b7 Leszek Koltunski
      mMesh.setEffectAssociation(0,0,0);
301 bb6efcda Leszek Koltunski
    //  mMesh.setShowNormals(true);
302 b2adcd57 Leszek Koltunski
      }
303
304
///////////////////////////////////////////////////////////////////////////////////////////////////
305
306
    private void createMultigon()
307
      {
308
      float A = 0.5f;
309 45b6b6b5 Leszek Koltunski
      int extraIndex    = 0;
310
      int extraVertices = 0;
311 b2adcd57 Leszek Koltunski
312 bb6efcda Leszek Koltunski
      float[] v1 = new float[] {  -A,-A,   A,-A,   A,  A,   -A,  A };
313
      float[] v2 = new float[] {   A,-A, 2*A,-A, 2*A,  A,    A,  A };
314
      float[] v3 = new float[] {-3*A,-A,  -A,-A,  -A,  A, -3*A,  A };
315
      float[] v4 = new float[] {  -A, A,   A, A,   A,3*A,   -A,3*A };
316
      float[] v5 = new float[] {-3*A, A,  -A, A,  -A,3*A, -3*A,3*A };
317 b2adcd57 Leszek Koltunski
318 bb6efcda Leszek Koltunski
      float[][] vertices = new float[][] {v1,v2,v3,v4,v5};
319
/*
320 b2adcd57 Leszek Koltunski
      float[] c1 = new float[] { 0,0 };
321
      float[] c2 = new float[] { 1.5f*A,0 };
322 bb6efcda Leszek Koltunski
      float[] c3 = new float[] {-1.5f*A,0 };
323
      float[] c4 = new float[] { 0,1.5f*A };
324
      float[] c5 = new float[] { -1.5f*A,1.5f*A };
325
326
      float[][] centers = new float[][] { c1,c2,c3,c4,c5 };
327
*/
328 b2adcd57 Leszek Koltunski
      float C = 0.5f;
329
      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};
330
331 bb6efcda Leszek Koltunski
/*
332
      float B = 0.1f;
333
      int numBands = 7;
334 b2adcd57 Leszek Koltunski
      float[] bands = new float[2*numBands];
335
336
      for(int i=0; i<numBands; i++)
337
        {
338
        bands[2*i  ] = 1 + i/(1.0f-numBands);
339
        bands[2*i+1] = B/(numBands-1)*i;
340
        }
341 bb6efcda Leszek Koltunski
*/
342
      mMesh = new MeshMultigon(vertices,bands,extraIndex,extraVertices);
343 45b6b6b5 Leszek Koltunski
344
      int numEff = mMesh.getNumEffComponents();
345
346
      for(int i=0; i<numEff; i++)
347
        {
348
        mMesh.setEffectAssociation(i, 0, i);
349
        }
350
351 bb6efcda Leszek Koltunski
     // mMesh.setShowNormals(true);
352 1bb5d3b7 Leszek Koltunski
      }
353
354 6991ece5 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
355
356
    private void createMesh()
357
      {
358 d1d5d7e2 Leszek Koltunski
      float[][] vertices =
359
          {
360
              { 0.5f, 0.5f, 0.5f },
361
              { 0.5f, 0.5f,-0.5f },
362
              { 0.5f,-0.5f, 0.5f },
363
              { 0.5f,-0.5f,-0.5f },
364
              {-0.5f, 0.5f, 0.5f },
365
              {-0.5f, 0.5f,-0.5f },
366
              {-0.5f,-0.5f, 0.5f },
367
              {-0.5f,-0.5f,-0.5f },
368
369
              {-0.5f, 0.0f, 0.5f },
370
              { 0.5f, 0.0f, 0.5f },
371
          };
372
373
      int[][][] vertIndices =
374
          {
375
              { {2,3,1,0} },
376
              { {7,6,4,5} },
377
              { {4,0,1,5} },
378
              { {7,3,2,6} },
379 93ad90ba Leszek Koltunski
              { {8,9,0,4}, {6,2,9,8} },
380 d1d5d7e2 Leszek Koltunski
              { {3,7,5,1} }
381
          };
382
383
      float height = 0.05f;
384
      int num = 5;
385
      int extraI = 1;
386
      int extraV = 1;
387
388
      float[][] bands= { {height,35,0.5f,0.7f,num,extraI,extraV} };
389
390
      int[] bandIndices = {0,0,0,0,0,0};
391
      float[] convex = null;
392
393
      float[][] corners= { {0.036f,0.12f} };
394
      float[][] centers= { {0.0f, 0.0f, 0.0f} };
395
      int[] ind    = { 0,0,0,0,0,0,0,0,-1,-1 };
396
397
      ObjectShape shape = new ObjectShape(vertices, vertIndices);
398
      ObjectFaceShape face = new ObjectFaceShape(bands, bandIndices, convex);
399
      ObjectVertexEffects effects = FactoryCubit.generateVertexEffect(vertices,corners,ind,centers,ind);
400
401
      int numFaces = shape.getNumFaces();
402
      int[] outer = new int[numFaces];
403 db9903e8 Leszek Koltunski
404 33647db9 Leszek Koltunski
      FactoryCubit factory = FactoryCubit.getInstance();
405 6983badf Leszek Koltunski
      factory.clear();
406 fa96775c Leszek Koltunski
      factory.createNewFaceTransform(shape,outer);
407 d1d5d7e2 Leszek Koltunski
      mMesh = factory.createRoundedSolid(shape,face,effects,MESH_NICE,numFaces);
408 6983badf Leszek Koltunski
409
      int numEff = mMesh.getNumEffComponents();
410 d32fe3d9 Leszek Koltunski
      for(int i=0; i<numEff; i++) mMesh.setEffectAssociation(i, 0, i);
411 6991ece5 Leszek Koltunski
      }
412 42aa970f Leszek Koltunski
413
///////////////////////////////////////////////////////////////////////////////////////////////////
414
415 6991ece5 Leszek Koltunski
    private void openMesh(int resourceID)
416 42aa970f Leszek Koltunski
      {
417 1af8e143 Leszek Koltunski
      Context con = mView.getContext();
418
      Resources res = con.getResources();
419
      InputStream is = res.openRawResource(resourceID);
420
      DataInputStream dos = new DataInputStream(is);
421 7198e5c9 Leszek Koltunski
      mMesh = new MeshFile(dos);
422 1af8e143 Leszek Koltunski
423 6983badf Leszek Koltunski
      int numEff = mMesh.getNumEffComponents();
424 39b925d5 Leszek Koltunski
425
      for(int i=0; i<numEff; i++)
426
        {
427
        mMesh.setEffectAssociation(i, 0, i);
428
        }
429
430 1af8e143 Leszek Koltunski
      try
431
        {
432
        is.close();
433
        }
434
      catch(IOException e)
435
        {
436 48c88f57 Leszek Koltunski
        android.util.Log.e("MeshFile", "Error closing InputStream: "+e.toString());
437 1af8e143 Leszek Koltunski
        }
438 42aa970f Leszek Koltunski
      }
439 48c88f57 Leszek Koltunski
440 39b925d5 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
441
442 6991ece5 Leszek Koltunski
    MeshBase getMesh()
443 39b925d5 Leszek Koltunski
      {
444
      return mMesh;
445
      }
446
447 48c88f57 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
448
449
    long getTime()
450
      {
451
      return mTime;
452
      }
453
454
///////////////////////////////////////////////////////////////////////////////////////////////////
455
456
    int getBytes()
457
      {
458 6991ece5 Leszek Koltunski
      if( mMesh instanceof MeshFile )
459
        {
460
        return ((MeshFile)mMesh).getNumBytes();
461
        }
462
463
      return 0;
464 48c88f57 Leszek Koltunski
      }
465
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467
468
    int getVertices()
469
      {
470 7198e5c9 Leszek Koltunski
      return mMesh.getNumVertices();
471
      }
472
473
///////////////////////////////////////////////////////////////////////////////////////////////////
474
475
    int getEndEffIndex(int component)
476
      {
477
      return mMesh.getLastVertexEff(component);
478
      }
479
480
///////////////////////////////////////////////////////////////////////////////////////////////////
481
482
    int getEndTexIndex(int component)
483
      {
484
      return mMesh.getLastVertexTex(component);
485
      }
486
487
///////////////////////////////////////////////////////////////////////////////////////////////////
488
489
    int getEffComponentNum()
490
      {
491 6983badf Leszek Koltunski
      return mMesh.getNumEffComponents();
492 7198e5c9 Leszek Koltunski
      }
493
494
///////////////////////////////////////////////////////////////////////////////////////////////////
495
496
    int getTexComponentNum()
497
      {
498 6983badf Leszek Koltunski
      return mMesh.getNumTexComponents();
499 48c88f57 Leszek Koltunski
      }
500 dc10a48d Leszek Koltunski
501
///////////////////////////////////////////////////////////////////////////////////////////////////
502
503
    public void distortedException(Exception ex)
504
      {
505
      android.util.Log.e("MeshFile", ex.getMessage() );
506
      }
507
508
///////////////////////////////////////////////////////////////////////////////////////////////////
509
510
    public InputStream localFile(int fileID)
511
      {
512
      return mResources.openRawResource(fileID);
513
      }
514
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516
517
    public void logMessage(String message)
518
      {
519
      android.util.Log.e("MeshFile", message );
520
      }
521 42aa970f Leszek Koltunski
}