Project

General

Profile

« Previous | Next » 

Revision bb6efcda

Added by Leszek Koltunski over 1 year ago

MeshMultigon finished.

View differences:

src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
283 283
      int extraVertices = 1;
284 284
      float[] vertices = new float[] { -A,-A, A,-A, A,A, -A,A };
285 285

  
286
      float C = 0.5f;
286
      float C = 2f;
287 287
      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};
288 288

  
289 289
/*
......
296 296
        bands[2*i+1] = B/(numBands-1)*i;
297 297
        }
298 298
*/
299
      boolean[] up = new boolean[] {true,false,false,false};
299
      boolean[] edgesUp = new boolean[] {true,true,false,false};
300
      boolean[] vertsUp = new boolean[] {true,true,false,false};
300 301

  
301
      mMesh = new MeshPolygon(vertices,bands,up,extraIndex,extraVertices,0.0f,0.0f);
302
      mMesh = new MeshPolygon(vertices,bands,edgesUp,vertsUp,extraIndex,extraVertices,0.0f,0.0f);
302 303
      mMesh.setEffectAssociation(0,0,0);
303
      mMesh.setShowNormals(true);
304
    //  mMesh.setShowNormals(true);
304 305
      }
305 306

  
306 307
///////////////////////////////////////////////////////////////////////////////////////////////////
......
311 312
      int extraIndex    = 0;
312 313
      int extraVertices = 0;
313 314

  
314
      float[] v1 = new float[] { -A,-A,  A,-A,  A,A, -A,A };
315
      float[] v2 = new float[] {  A,-A,2*A,-A,2*A,A,  A,A };
316
      float[][] vertices = new float[][] {v1,v2};
315
      float[] v1 = new float[] {  -A,-A,   A,-A,   A,  A,   -A,  A };
316
      float[] v2 = new float[] {   A,-A, 2*A,-A, 2*A,  A,    A,  A };
317
      float[] v3 = new float[] {-3*A,-A,  -A,-A,  -A,  A, -3*A,  A };
318
      float[] v4 = new float[] {  -A, A,   A, A,   A,3*A,   -A,3*A };
319
      float[] v5 = new float[] {-3*A, A,  -A, A,  -A,3*A, -3*A,3*A };
317 320

  
321
      float[][] vertices = new float[][] {v1,v2,v3,v4,v5};
322
/*
318 323
      float[] c1 = new float[] { 0,0 };
319 324
      float[] c2 = new float[] { 1.5f*A,0 };
320
      float[][] centers = new float[][] { c1,c2 };
321
/*
325
      float[] c3 = new float[] {-1.5f*A,0 };
326
      float[] c4 = new float[] { 0,1.5f*A };
327
      float[] c5 = new float[] { -1.5f*A,1.5f*A };
328

  
329
      float[][] centers = new float[][] { c1,c2,c3,c4,c5 };
330
*/
322 331
      float C = 0.5f;
323 332
      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};
324
*/
325 333

  
326
      float B = 0.05f;
327
      int numBands = 2;
334
/*
335
      float B = 0.1f;
336
      int numBands = 7;
328 337
      float[] bands = new float[2*numBands];
329 338

  
330 339
      for(int i=0; i<numBands; i++)
......
332 341
        bands[2*i  ] = 1 + i/(1.0f-numBands);
333 342
        bands[2*i+1] = B/(numBands-1)*i;
334 343
        }
335

  
336
      mMesh = new MeshMultigon(vertices,bands,extraIndex,extraVertices,centers);
344
*/
345
      mMesh = new MeshMultigon(vertices,bands,extraIndex,extraVertices);
337 346

  
338 347
      int numEff = mMesh.getNumEffComponents();
339 348

  
......
342 351
        mMesh.setEffectAssociation(i, 0, i);
343 352
        }
344 353

  
345
      mMesh.setShowNormals(true);
354
     // mMesh.setShowNormals(true);
346 355
      }
347 356

  
348 357
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff