Project

General

Profile

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

examples / src / main / java / org / distorted / examples / meshfile / FactoryCubit.java @ 63fb0859

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube 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
// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.examples.meshfile;
21

    
22
import org.distorted.library.effect.VertexEffect;
23
import org.distorted.library.effect.VertexEffectDeform;
24
import org.distorted.library.effect.VertexEffectMove;
25
import org.distorted.library.effect.VertexEffectRotate;
26
import org.distorted.library.effect.VertexEffectScale;
27
import org.distorted.library.mesh.MeshBase;
28
import org.distorted.library.mesh.MeshJoined;
29
import org.distorted.library.mesh.MeshPolygon;
30
import org.distorted.library.type.Static1D;
31
import org.distorted.library.type.Static3D;
32
import org.distorted.library.type.Static4D;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
class FactoryCubit
37
  {
38
  private static final float SQ2 = (float)Math.sqrt(2);
39
  private static final float SQ3 = (float)Math.sqrt(3);
40
  private static final float SQ6 = (float)Math.sqrt(6);
41

    
42
  private static final float IVY_D = 0.003f;
43
  private static final int   IVY_N = 8;
44
  private static final float IVY_C = 0.59f;
45
  private static final float IVY_M = 0.35f;
46
  private static final float REX_D = 0.03f;
47
  private static final int   REX_N = 5;
48

    
49
  private static final Static1D RADIUS = new Static1D(1);
50

    
51
  private static FactoryCubit mThis;
52

    
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

    
55
  private FactoryCubit()
56
    {
57

    
58
    }
59

    
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61

    
62
  public static FactoryCubit getInstance()
63
    {
64
    if( mThis==null ) mThis = new FactoryCubit();
65

    
66
    return mThis;
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70
// H - height of the band in the middle
71
// alpha - angle of the edge  [0,90]
72
// dist - often in a polygon the distance from edge to center is not 1, but something else.
73
// This is the distance.
74
// K - where to begin the second, much more flat part of the band. [0,1]
75
// N - number of bands. N>=3
76
//
77
// theory: two distinct parts to the band:
78
// 1) (0,B) - steep
79
// 2) (B,1) - flat
80
//
81
// In first part, we have y = g(x) ; in second - y = g(f(x)) where
82
//
83
// g(x) = sqrt( R^2 - (x-D)^2 ) - R*cos(alpha)
84
// f(x) = ((D-B)/(1-B)*x + B*(1-D)/(1-B)
85
// h(x) = R*(sin(alpha) - sin(x))
86
// R = H/(1-cos(alpha))
87
// D = H*sin(alpha)
88
// B = h(K*alpha)
89
//
90
// The N points are taken at:
91
//
92
// 1) in the second part, there are K2 = (N-3)/3 such points
93
// 2) in the first - K1 = (N-3) - K2
94
// 3) also, the 3 points 0,B,1
95
//
96
// so we have the sequence A[i] of N points
97
//
98
// 0
99
// h((i+1)*(1-K)*alpha/(K1+1)) (i=0,1,...,K1-1)
100
// B
101
// (1-B)*(i+1)/(K2+1) + B   (i=0,i,...,K2-1)
102
// 1
103

    
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

    
106
  private float f(float D, float B, float x)
107
    {
108
    return ((D-B)*x + B*(1-D))/(1-B);
109
    }
110

    
111
///////////////////////////////////////////////////////////////////////////////////////////////////
112

    
113
  private float g(float R, float D, float x, float cosAlpha)
114
    {
115
    float d = x-D;
116
    return (float)(Math.sqrt(R*R-d*d)-R*cosAlpha);
117
    }
118

    
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

    
121
  private float h(float R, float sinAlpha, float x)
122
    {
123
    return R*(sinAlpha-(float)Math.sin(x));
124
    }
125

    
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

    
128
  float[] computeBands(float H, int alpha, float dist, float K, int N)
129
    {
130
    float[] bands = new float[2*N];
131

    
132
    bands[0] = 1.0f;
133
    bands[1] = 0.0f;
134

    
135
    float beta = (float)Math.atan(dist*Math.tan(Math.PI*alpha/180));
136
    float sinBeta = (float)Math.sin(beta);
137
    float cosBeta = (float)Math.cos(beta);
138
    float R = cosBeta<1.0f ? H/(1.0f-cosBeta) : 0.0f;
139
    float D = R*sinBeta;
140
    float B = h(R,sinBeta,K*beta);
141

    
142
    if( D>1.0f )
143
      {
144
      for(int i=1; i<N; i++)
145
        {
146
        bands[2*i  ] = (float)(N-1-i)/(N-1);
147
        bands[2*i+1] = H*(1-bands[2*i]);
148
        }
149
      }
150
    else
151
      {
152
      int K2 = (int)((N-3)*K);
153
      int K1 = (N-3)-K2;
154

    
155
      for(int i=0; i<=K1; i++)
156
        {
157
        float angle = K*beta + (1-K)*beta*(K1-i)/(K1+1);
158
        float x = h(R,sinBeta,angle);
159
        bands[2*i+2] = 1.0f - x;
160
        bands[2*i+3] = g(R,D,x,cosBeta);
161
        }
162

    
163
      for(int i=0; i<=K2; i++)
164
        {
165
        float x = (1-B)*(i+1)/(K2+1) + B;
166
        bands[2*K1+2 + 2*i+2] = 1.0f - x;
167
        bands[2*K1+2 + 2*i+3] = g(R,D,f(D,B,x),cosBeta);
168
        }
169
      }
170

    
171
    bands[2*N-2] = 0.0f;
172
    bands[2*N-1] =    H;
173

    
174
    return bands;
175
    }
176

    
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178

    
179
  private void roundCorners(MeshBase mesh, Static3D center, Static3D[] vertices, float strength, float regionRadius)
180
    {
181
    Static4D reg= new Static4D(0,0,0,regionRadius);
182

    
183
    float centX = center.get0();
184
    float centY = center.get1();
185
    float centZ = center.get2();
186

    
187
    for (Static3D vertex : vertices)
188
      {
189
      float x = strength*(centX - vertex.get0());
190
      float y = strength*(centY - vertex.get1());
191
      float z = strength*(centZ - vertex.get2());
192

    
193
      VertexEffect effect = new VertexEffectDeform(new Static3D(x,y,z), RADIUS, vertex, reg);
194
      mesh.apply(effect);
195
      }
196
    }
197

    
198
///////////////////////////////////////////////////////////////////////////////////////////////////
199
// Compute (rx,ry) - coords of a point which is the result of rotation by angle 'radians' of the point
200
// (px,py) along axis Z. Center of rotation: (cx,cy). Rotation is counterclockwise!
201
// Write (rx,ry) to array[index] and array[index+1].
202

    
203
  private void writeVertex( float cx, float cy, float px, float py, float radians, float[] array, int index)
204
    {
205
    float vx = px-cx;
206
    float vy = py-cy;
207

    
208
    float sinA = (float)Math.sin(radians);
209
    float cosA = (float)Math.cos(radians);
210

    
211
    float rvx = vx*cosA - vy*sinA;
212
    float rvy = vx*sinA + vy*cosA;
213

    
214
    array[index  ] = rvx + cx;
215
    array[index+1] = rvy + cy;
216
    }
217

    
218
///////////////////////////////////////////////////////////////////////////////////////////////////
219

    
220
  MeshBase createFacesCube(int sizeIndex)
221
    {
222
    MeshBase[] meshes = new MeshPolygon[6];
223

    
224
    float E = 0.5f;
225
    int extraI, extraV, num;
226

    
227
    switch(sizeIndex)
228
      {
229
      case 0 : num = 6; extraI = 2; extraV = 2; break;
230
      case 1 : num = 5; extraI = 2; extraV = 2; break;
231
      case 2 : num = 5; extraI = 1; extraV = 2; break;
232
      default: num = 4; extraI = 1; extraV = 1; break;
233
      }
234

    
235
    float[] vertices = { -E,-E, +E,-E, +E,+E, -E,+E };
236
    float[] bands = computeBands(0.048f,35,E,0.7f,num);
237

    
238
    meshes[0] = new MeshPolygon(vertices,bands,extraI,extraV);
239
    meshes[0].setEffectAssociation(0,1,0);
240
    meshes[1] = meshes[0].copy(true);
241
    meshes[1].setEffectAssociation(0,2,0);
242
    meshes[2] = meshes[0].copy(true);
243
    meshes[2].setEffectAssociation(0,4,0);
244
    meshes[3] = meshes[0].copy(true);
245
    meshes[3].setEffectAssociation(0,8,0);
246
    meshes[4] = meshes[0].copy(true);
247
    meshes[4].setEffectAssociation(0,16,0);
248
    meshes[5] = meshes[0].copy(true);
249
    meshes[5].setEffectAssociation(0,32,0);
250

    
251
    return new MeshJoined(meshes);
252
    }
253

    
254
///////////////////////////////////////////////////////////////////////////////////////////////////
255

    
256
  MeshBase createFacesSkewbCorner()
257
    {
258
    MeshBase[] meshes = new MeshBase[6];
259

    
260
    float E = 0.5f;
261
    float F = SQ2/2;
262
    float G = SQ6/16;
263
    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
264
    float[] bands0 = computeBands(0.028f,35,E/3,0.7f,7);
265

    
266
    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
267
    meshes[0].setEffectAssociation(0,1,0);
268
    meshes[1] = meshes[0].copy(true);
269
    meshes[1].setEffectAssociation(0,2,0);
270
    meshes[2] = meshes[0].copy(true);
271
    meshes[2].setEffectAssociation(0,4,0);
272

    
273
    float[] vertices1 = { -F/2,-2*G, F/2,-2*G, 3*F/8,-G, 1*F/8,G, 0,2*G };
274
    float[] bands1 = computeBands(0,0,1,0,3);
275

    
276
    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
277
    meshes[3].setEffectAssociation(0,8,0);
278
    meshes[4] = meshes[3].copy(true);
279
    meshes[4].setEffectAssociation(0,16,0);
280
    meshes[5] = meshes[3].copy(true);
281
    meshes[5].setEffectAssociation(0,32,0);
282

    
283
    return new MeshJoined(meshes);
284
    }
285

    
286
///////////////////////////////////////////////////////////////////////////////////////////////////
287

    
288
  MeshBase createFacesSkewbFace()
289
    {
290
    MeshBase[] meshes = new MeshBase[5];
291

    
292
    float E = SQ2/4;
293
    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
294
    float[] bands0 = computeBands(0.051f,35,E/2,0.9f,7);
295

    
296
    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
297
    meshes[0].setEffectAssociation(0,1,0);
298

    
299
    float[] vertices1 = { -E,-SQ3*E, -E*0.7f,-SQ3*E, +E*0.7f,-SQ3*E, +E,-SQ3*E, 0,0 };
300
    float[] bands1 = computeBands(0,0,1,0,3);
301

    
302
    meshes[1] = new MeshPolygon(vertices1,bands1,0,0);
303
    meshes[1].setEffectAssociation(0,2,0);
304
    meshes[2] = meshes[1].copy(true);
305
    meshes[2].setEffectAssociation(0,4,0);
306
    meshes[3] = meshes[1].copy(true);
307
    meshes[3].setEffectAssociation(0,8,0);
308
    meshes[4] = meshes[1].copy(true);
309
    meshes[4].setEffectAssociation(0,16,0);
310

    
311
    return new MeshJoined(meshes);
312
    }
313

    
314
///////////////////////////////////////////////////////////////////////////////////////////////////
315

    
316
  MeshBase createFacesOcta()
317
    {
318
    MeshBase[] meshes = new MeshPolygon[8];
319

    
320
    float E = 0.75f;
321
    float F = 0.5f;
322
    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
323
    float[] bands = computeBands(0.05f,35,F,0.8f,6);
324

    
325
    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
326
    meshes[0].setEffectAssociation(0,1,0);
327
    meshes[1] = meshes[0].copy(true);
328
    meshes[1].setEffectAssociation(0,2,0);
329
    meshes[2] = meshes[0].copy(true);
330
    meshes[2].setEffectAssociation(0,4,0);
331
    meshes[3] = meshes[0].copy(true);
332
    meshes[3].setEffectAssociation(0,8,0);
333
    meshes[4] = meshes[0].copy(true);
334
    meshes[4].setEffectAssociation(0,16,0);
335
    meshes[5] = meshes[0].copy(true);
336
    meshes[5].setEffectAssociation(0,32,0);
337
    meshes[6] = meshes[0].copy(true);
338
    meshes[6].setEffectAssociation(0,64,0);
339
    meshes[7] = meshes[0].copy(true);
340
    meshes[7].setEffectAssociation(0,128,0);
341

    
342
    return new MeshJoined(meshes);
343
    }
344

    
345
///////////////////////////////////////////////////////////////////////////////////////////////////
346

    
347
  MeshBase createFacesTetra()
348
    {
349
    MeshBase[] meshes = new MeshBase[4];
350

    
351
    float E = 0.75f;
352
    float F = 0.5f;
353
    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
354
    float[] bands = computeBands(0.05f,35,F,0.8f,6);
355

    
356
    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
357
    meshes[0].setEffectAssociation(0,1,0);
358
    meshes[1] = meshes[0].copy(true);
359
    meshes[1].setEffectAssociation(0,2,0);
360
    meshes[2] = meshes[0].copy(true);
361
    meshes[2].setEffectAssociation(0,4,0);
362
    meshes[3] = meshes[0].copy(true);
363
    meshes[3].setEffectAssociation(0,8,0);
364

    
365
    return new MeshJoined(meshes);
366
    }
367

    
368
///////////////////////////////////////////////////////////////////////////////////////////////////
369

    
370
  MeshBase createFacesDino()
371
    {
372
    MeshBase[] meshes = new MeshPolygon[4];
373

    
374
    float E = 0.5f*SQ2;
375
    float F = 0.5f;
376
    float[] vertices0 = { -F,F/3, 0,-2*F/3, +F,F/3 };
377
    float[] bands0 = computeBands(0.028f,30,F/3,0.8f,7);
378

    
379
    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 5);
380
    meshes[0].setEffectAssociation(0,1,0);
381
    meshes[1] = meshes[0].copy(true);
382
    meshes[1].setEffectAssociation(0,2,0);
383

    
384
    float[] vertices1 = { -E/2,-E*(SQ3/6), E/2,-E*(SQ3/6), 0,E*(SQ3/3) };
385
    float[] bands1 = computeBands(0.02f,45,F/3,0.2f,3);
386

    
387
    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
388
    meshes[2].setEffectAssociation(0,4,0);
389
    meshes[3] = meshes[2].copy(true);
390
    meshes[3].setEffectAssociation(0,8,0);
391

    
392
    return new MeshJoined(meshes);
393
    }
394

    
395
///////////////////////////////////////////////////////////////////////////////////////////////////
396

    
397
  MeshBase createFacesHelicopterCorner()
398
    {
399
    MeshBase[] meshes = new MeshBase[6];
400

    
401
    float E = 0.5f;
402
    float F = SQ2/4;
403
    float G = 1.0f/12;
404
    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
405
    float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7);
406

    
407
    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
408
    meshes[0].setEffectAssociation(0,1,0);
409
    meshes[1] = meshes[0].copy(true);
410
    meshes[1].setEffectAssociation(0,2,0);
411
    meshes[2] = meshes[0].copy(true);
412
    meshes[2].setEffectAssociation(0,4,0);
413

    
414
    float[] vertices1 = { -F,-G, 0,-G, +F,-G, 0,2*G };
415
    float[] bands1 = computeBands(0.00f,0,0,0.0f,3);
416
    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
417
    meshes[3].setEffectAssociation(0,8,0);
418
    meshes[4] = meshes[3].copy(true);
419
    meshes[4].setEffectAssociation(0,16,0);
420
    meshes[5] = meshes[3].copy(true);
421
    meshes[5].setEffectAssociation(0,32,0);
422

    
423
    return new MeshJoined(meshes);
424
    }
425

    
426
///////////////////////////////////////////////////////////////////////////////////////////////////
427

    
428
  MeshBase createFacesHelicopterFace()
429
    {
430
    MeshBase[] meshes = new MeshBase[4];
431

    
432
    float E = 0.5f;
433
    float F = SQ2/4;
434
    float G = 1.0f/12;
435
    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
436
    float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7);
437

    
438
    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
439
    meshes[0].setEffectAssociation(0,1,0);
440

    
441
    float[] vertices1 = { -F,-G, +F,-G, 0,2*G};
442
    float[] bands1 = computeBands(0.01f,45,F,0.0f,3);
443

    
444
    meshes[1] = new MeshPolygon(vertices1, bands1, 1, 3);
445
    meshes[1].setEffectAssociation(0,2,0);
446

    
447
    float[] vertices2 = { -E/2,-F/3, +E/2,-F/3, 0,2*F/3};
448

    
449
    meshes[2] = new MeshPolygon(vertices2, bands1, 1, 3);
450
    meshes[2].setEffectAssociation(0,4,0);
451
    meshes[3] = meshes[2].copy(true);
452
    meshes[3].setEffectAssociation(0,8,0);
453

    
454
    return new MeshJoined(meshes);
455
    }
456

    
457
///////////////////////////////////////////////////////////////////////////////////////////////////
458

    
459
  MeshBase createFacesRediEdge()
460
    {
461
    MeshBase[] meshes = new MeshPolygon[6];
462

    
463
    float F = 0.25f;
464
    float[] vertices0 = { -F,+F, -F,-F, 0, -2*F, +F,-F, +F,+F };
465
    float[] bands0 = computeBands(0.038f,35,F,0.7f,7);
466

    
467
    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 2);
468
    meshes[0].setEffectAssociation(0,1,0);
469
    meshes[1] = meshes[0].copy(true);
470
    meshes[1].setEffectAssociation(0,2,0);
471

    
472
    float[] bands1 = computeBands(0.02f,35,F/2,0.2f,3);
473
    float[] vertices1 = { -F/2, +F/2, -F/2, -1.5f*F, 1.5f*F, +F/2 };
474

    
475
    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
476
    meshes[2].setEffectAssociation(0,4,0);
477
    meshes[3] = meshes[2].copy(true);
478
    meshes[3].setEffectAssociation(0,8,0);
479

    
480
    float X = 0.25f*SQ2;
481
    float Y = SQ6/16;
482
    float[] vertices2 = { -X, Y, -1.5f*X, -Y, +1.5f*X, -Y, +X, Y };
483

    
484
    meshes[4] = new MeshPolygon(vertices2, bands1, 1, 1);
485
    meshes[4].setEffectAssociation(0,16,0);
486
    meshes[5] = meshes[4].copy(true);
487
    meshes[5].setEffectAssociation(0,32,0);
488

    
489
    return new MeshJoined(meshes);
490
    }
491

    
492
///////////////////////////////////////////////////////////////////////////////////////////////////
493

    
494
  MeshBase createFacesRediCorner()
495
    {
496
    MeshBase[] meshes = new MeshBase[6];
497

    
498
    float E = 0.5f;
499
    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
500
    float[] bands0 = computeBands(0.06f,35,E,0.7f,6);
501

    
502
    meshes[0] = new MeshPolygon(vertices0,bands0,2,2);
503
    meshes[0].setEffectAssociation(0,1,0);
504
    meshes[1] = meshes[0].copy(true);
505
    meshes[1].setEffectAssociation(0,2,0);
506
    meshes[2] = meshes[0].copy(true);
507
    meshes[2].setEffectAssociation(0,4,0);
508

    
509
    float F = 0.5f;
510
    float X = 0.5f;
511
    float G = 0.72f;
512
    float[] vertices1 = { -E,+F, -E+X,0, -E,-F, -E*G,-F, +E*G,-F, +E,-F, +E-X,0, +E,+F, +E*G,+F, -E*G,+F };
513
    float[] bands1 = computeBands(0.0f,0,1.0f,0.0f,2);
514

    
515
    meshes[3] = new MeshPolygon(vertices1,bands1,0,0);
516
    meshes[3].setEffectAssociation(0,8,0);
517
    meshes[4] = meshes[3].copy(true);
518
    meshes[4].setEffectAssociation(0,16,0);
519
    meshes[5] = meshes[3].copy(true);
520
    meshes[5].setEffectAssociation(0,32,0);
521

    
522
    return new MeshJoined(meshes);
523
    }
524

    
525
///////////////////////////////////////////////////////////////////////////////////////////////////
526

    
527
  MeshBase createFacesIvyCorner()
528
    {
529
    MeshBase[] meshes = new MeshBase[6];
530

    
531
    final float angle = (float)Math.PI/(2*IVY_N);
532
    final float CORR  = 1.0f - 2*IVY_D;
533
    final float DIST  = -0.5f*CORR + IVY_D;
534
    float[] vertices  = new float[2*(IVY_N+1)+6];
535

    
536
    vertices[0] = (0.5f-IVY_M) * IVY_C;
537
    vertices[1] = (DIST-IVY_M) * IVY_C;
538
    vertices[2] = (0.5f-IVY_M) * IVY_C;
539
    vertices[3] = (0.5f-IVY_M) * IVY_C;
540
    vertices[4] = (DIST-IVY_M) * IVY_C;
541
    vertices[5] = (0.5f-IVY_M) * IVY_C;
542

    
543
    for(int i=0; i<=IVY_N; i++)
544
      {
545
      float ang = (IVY_N-i)*angle;
546
      float sin = (float)Math.sin(ang);
547
      float cos = (float)Math.cos(ang);
548

    
549
      vertices[2*i+6] = (CORR*(cos-0.5f)-IVY_M)*IVY_C;
550
      vertices[2*i+7] = (CORR*(sin-0.5f)-IVY_M)*IVY_C;
551
      }
552

    
553
    float[] bands0 = computeBands(+0.012f,20,0.2f,0.5f,7);
554
    float[] bands1 = computeBands(-0.100f,20,0.2f,0.0f,2);
555

    
556
    meshes[0] = new MeshPolygon(vertices,bands0,1,2);
557
    meshes[0].setEffectAssociation(0,1,0);
558
    meshes[1] = meshes[0].copy(true);
559
    meshes[1].setEffectAssociation(0,2,0);
560
    meshes[2] = meshes[0].copy(true);
561
    meshes[2].setEffectAssociation(0,4,0);
562
    meshes[3] = new MeshPolygon(vertices,bands1,1,2);
563
    meshes[3].setEffectAssociation(0,8,0);
564
    meshes[4] = meshes[3].copy(true);
565
    meshes[4].setEffectAssociation(0,16,0);
566
    meshes[5] = meshes[3].copy(true);
567
    meshes[5].setEffectAssociation(0,32,0);
568

    
569
    return new MeshJoined(meshes);
570
    }
571

    
572
///////////////////////////////////////////////////////////////////////////////////////////////////
573

    
574
  MeshBase createFacesIvyFace()
575
    {
576
    MeshBase[] meshes = new MeshBase[2];
577

    
578
    final float angle = (float)Math.PI/(2*IVY_N);
579
    final float CORR  = 1.0f - IVY_D*SQ2;
580
    float[] vertices = new float[4*IVY_N];
581

    
582
    for(int i=0; i<IVY_N; i++)
583
      {
584
      float sin = (float)Math.sin(i*angle);
585
      float cos = (float)Math.cos(i*angle);
586

    
587
      vertices[2*i          ] = CORR*(0.5f-cos);
588
      vertices[2*i+1        ] = CORR*(0.5f-sin);
589
      vertices[2*i  +2*IVY_N] = CORR*(cos-0.5f);
590
      vertices[2*i+1+2*IVY_N] = CORR*(sin-0.5f);
591
      }
592

    
593
    float[] bands0 = computeBands(+0.05f,35,0.5f,0.5f,5);
594
    float[] bands1 = computeBands(-0.10f,45,0.5f,0.0f,2);
595

    
596
    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
597
    meshes[0].setEffectAssociation(0,1,0);
598
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
599
    meshes[1].setEffectAssociation(0,2,0);
600

    
601
    return new MeshJoined(meshes);
602
    }
603

    
604
///////////////////////////////////////////////////////////////////////////////////////////////////
605

    
606
  MeshBase createFacesRexCorner()
607
    {
608
    MeshBase[] meshes = new MeshBase[2];
609

    
610
    final float angle = (float)Math.PI/(6*REX_N);
611
    float[] vertices = new float[6*REX_N];
612
    final float D = 0.5f - REX_D;
613
    final float F = D*SQ2*(SQ3-1);
614
    final float B = 2.5f;
615

    
616
    final float V1x = -F*0.5f;
617
    final float V1y = -F*SQ3/6;
618
    final float V2x = -V1x;
619
    final float V2y = V1y;
620
    final float V3x = 0.0f;
621
    final float V3y = -2*V1y;
622

    
623
    final float C1x = 0.0f;
624
    final float C1y = -F*(1+2*SQ3/3);
625
    final float C2x = B*V1x;
626
    final float C2y = B*V1y;
627
    final float C3x = B*V2x;
628
    final float C3y = B*V2y;
629

    
630
    for(int i=0; i<REX_N; i++)
631
      {
632
      writeVertex(C1x,C1y,V1x,V1y,-i*angle, vertices, 2*i          );
633
      writeVertex(C2x,C2y,V2x,V2y, i*angle, vertices, 2*i + 2*REX_N);
634
      writeVertex(C3x,C3y,V3x,V3y, i*angle, vertices, 2*i + 4*REX_N);
635
      }
636

    
637
    float[] bands0 = computeBands(+0.02f,10,0.5f,0.5f,5);
638
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
639

    
640
    meshes[0] = new MeshPolygon(vertices,bands0,1,1);
641
    meshes[0].setEffectAssociation(0,1,0);
642
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
643
    meshes[1].setEffectAssociation(0,2,0);
644

    
645
    return new MeshJoined(meshes);
646
    }
647

    
648
///////////////////////////////////////////////////////////////////////////////////////////////////
649

    
650
  MeshBase createFacesRexFace()
651
    {
652
    MeshBase[] meshes = new MeshBase[2];
653

    
654
    final float angle = (float)Math.PI/(6*REX_N);
655
    float[] vertices = new float[8*REX_N];
656
    final float D = 0.5f - REX_D;
657
    final float F = D*(SQ3-1);
658

    
659
    final float V1x = 0.0f;
660
    final float V1y = +F;
661
    final float V2x = -F;
662
    final float V2y = 0.0f;
663
    final float V3x = 0.0f;
664
    final float V3y = -F;
665
    final float V4x = +F;
666
    final float V4y = 0.0f;
667

    
668
    final float C1x = +D;
669
    final float C1y = -D;
670
    final float C2x = +D;
671
    final float C2y = +D;
672
    final float C3x = -D;
673
    final float C3y = +D;
674
    final float C4x = -D;
675
    final float C4y = -D;
676

    
677
    for(int i=0; i<REX_N; i++)
678
      {
679
      writeVertex(C1x,C1y,V1x,V1y, i*angle, vertices, 2*i          );
680
      writeVertex(C2x,C2y,V2x,V2y, i*angle, vertices, 2*i + 2*REX_N);
681
      writeVertex(C3x,C3y,V3x,V3y, i*angle, vertices, 2*i + 4*REX_N);
682
      writeVertex(C4x,C4y,V4x,V4y, i*angle, vertices, 2*i + 6*REX_N);
683
      }
684

    
685
    float[] bands0 = computeBands(+0.02f,10,0.5f,0.5f,5);
686
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
687

    
688
    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
689
    meshes[0].setEffectAssociation(0,1,0);
690
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
691
    meshes[1].setEffectAssociation(0,2,0);
692

    
693
    return new MeshJoined(meshes);
694
    }
695

    
696
///////////////////////////////////////////////////////////////////////////////////////////////////
697

    
698
  MeshBase createFacesRexEdge()
699
    {
700
    MeshBase[] meshes = new MeshBase[1];
701

    
702
    final float angle = (float)Math.PI/(6*REX_N);
703
    float[] vertices = new float[4*REX_N + 6];
704
    final float H = 1.0f - SQ3/2;
705
    final float D = 0.5f - REX_D;
706
    final float F = 0.5f*H;
707

    
708
    final float V1x = -D;
709
    final float V1y = +D + F - 0.5f;
710
    final float V2x = 0.0f;
711
    final float V2y = -F;
712

    
713
    final float C1x = -D;
714
    final float C1y = -D + F - 0.5f;
715
    final float C2x = +D;
716
    final float C2y = C1y;
717

    
718
    for(int i=0; i<REX_N; i++)
719
      {
720
      writeVertex(C1x,C1y,V1x,V1y,-i*angle, vertices, 2*i          );
721
      writeVertex(C2x,C2y,V2x,V2y,-i*angle, vertices, 2*i + 2*REX_N);
722
      }
723

    
724
    vertices[4*REX_N  ] = +D;
725
    vertices[4*REX_N+1] = +F-REX_D;
726
    vertices[4*REX_N+2] = +D;
727
    vertices[4*REX_N+3] = +F;
728
    vertices[4*REX_N+4] = -D;
729
    vertices[4*REX_N+5] = +F;
730

    
731
/*
732
    vertices[0] = V1x;
733
    vertices[1] = V1y;
734
    vertices[2] = V2x;
735
    vertices[3] = V2y;
736
    vertices[4] = +D;
737
    vertices[5] = +F-REX_D;
738
    vertices[6] = +D;
739
    vertices[7] = +F;
740
    vertices[8] = -D;
741
    vertices[9] = +F;
742
*/
743
    float[] bands0 = computeBands(+0.02f, 9,0.5f,0.5f,5);
744
    float[] bands1 = computeBands( 0.00f,45,0.5f,0.0f,2);
745

    
746
    meshes[0] = new MeshPolygon(vertices,bands0,1,2);
747
    meshes[0].setEffectAssociation(0,1,0);
748
 /*
749
    meshes[1] = meshes[0].copy(true);
750
    meshes[1].setEffectAssociation(0,2,0);
751
    meshes[2] = new MeshPolygon(vertices,bands1,0,0);
752
    meshes[2].setEffectAssociation(0,4,0);
753
    meshes[3] = meshes[2].copy(true);
754
    meshes[3].setEffectAssociation(0,8,0);
755
*/
756
    return new MeshJoined(meshes);
757
    }
758

    
759
///////////////////////////////////////////////////////////////////////////////////////////////////
760
// EFFECTS
761
///////////////////////////////////////////////////////////////////////////////////////////////////
762

    
763
  VertexEffect[] createVertexEffectsCube()
764
    {
765
    Static3D axisY   = new Static3D(0,1,0);
766
    Static3D axisX   = new Static3D(1,0,0);
767
    Static3D center  = new Static3D(0,0,0);
768
    Static1D angle90 = new Static1D(90);
769
    Static1D angle180= new Static1D(180);
770
    Static1D angle270= new Static1D(270);
771

    
772
    VertexEffect[] effect = new VertexEffect[6];
773

    
774
    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
775
    effect[1] = new VertexEffectRotate( angle180, axisX, center );
776
    effect[2] = new VertexEffectRotate( angle90 , axisX, center );
777
    effect[3] = new VertexEffectRotate( angle270, axisX, center );
778
    effect[4] = new VertexEffectRotate( angle270, axisY, center );
779
    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
780

    
781
    effect[0].setMeshAssociation(63,-1);  // all 6 sides
782
    effect[1].setMeshAssociation(32,-1);  // back
783
    effect[2].setMeshAssociation( 8,-1);  // bottom
784
    effect[3].setMeshAssociation( 4,-1);  // top
785
    effect[4].setMeshAssociation( 2,-1);  // left
786
    effect[5].setMeshAssociation( 1,-1);  // right
787

    
788
    return effect;
789
    }
790

    
791
///////////////////////////////////////////////////////////////////////////////////////////////////
792

    
793
  VertexEffect[] createVertexEffectsSkewbCorner()
794
    {
795
    float E = 0.5f;
796

    
797
    Static3D axisX  = new Static3D(1,0,0);
798
    Static3D axisY  = new Static3D(0,1,0);
799
    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
800
    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
801
    Static1D angle1 = new Static1D(+90);
802
    Static1D angle2 = new Static1D(-90);
803
    Static1D angle3 = new Static1D(-15);
804
    Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3)));
805
    Static1D angle5 = new Static1D(120);
806
    Static1D angle6 = new Static1D(240);
807
    Static3D center1= new Static3D(0,0,0);
808
    Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f);
809
    Static3D move1  = new Static3D(-E/4,-E/4,0);
810
    Static3D move2  = new Static3D(-0.5f+SQ2/4,-0.5f+SQ6/8,-0.5f);
811

    
812
    VertexEffect[] effect = new VertexEffect[10];
813

    
814
    effect[0] = new VertexEffectMove(move1);
815
    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
816
    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
817
    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
818
    effect[4] = new VertexEffectMove(move2);
819
    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
820
    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
821
    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
822
    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
823
    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
824

    
825
    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
826
    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
827
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
828
    effect[3].setMeshAssociation( 4,-1);  // mesh 2
829
    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
830
    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
831
    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
832
    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
833
    effect[8].setMeshAssociation(16,-1);  // mesh 4
834
    effect[9].setMeshAssociation(32,-1);  // mesh 5
835

    
836
    return effect;
837
    }
838

    
839
///////////////////////////////////////////////////////////////////////////////////////////////////
840

    
841
  VertexEffect[] createVertexEffectsSkewbFace()
842
    {
843
    Static3D center = new Static3D(0,0,0);
844
    Static3D axisX  = new Static3D(1,0,0);
845
    Static3D axisZ  = new Static3D(0,0,1);
846
    float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3));
847

    
848
    VertexEffect[] effect = new VertexEffect[6];
849

    
850
    effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center);
851
    effect[1] = new VertexEffectRotate( new Static1D(  135), axisZ, center);
852
    effect[2] = new VertexEffectRotate( new Static1D(   45), axisZ, center);
853
    effect[3] = new VertexEffectRotate( new Static1D(  -45), axisZ, center);
854
    effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center);
855
    effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) );
856

    
857
    effect[0].setMeshAssociation(30,-1);  // meshes 1,2,3,4
858
    effect[1].setMeshAssociation( 2,-1);  // mesh 1
859
    effect[2].setMeshAssociation( 5,-1);  // meshes 0,2
860
    effect[3].setMeshAssociation( 8,-1);  // mesh 3
861
    effect[4].setMeshAssociation(16,-1);  // mesh 4
862
    effect[5].setMeshAssociation(30,-1);  // meshes 1,2,3,4
863

    
864
    return effect;
865
    }
866

    
867
///////////////////////////////////////////////////////////////////////////////////////////////////
868

    
869
  VertexEffect[] createVertexEffectsOcta()
870
    {
871
    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
872
    Static1D angle1= new Static1D( 90);
873
    Static1D angle2= new Static1D(180);
874
    Static1D angle3= new Static1D(270);
875
    Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0);
876
    Static3D axisX = new Static3D(1,0,0);
877
    Static3D axisY = new Static3D(0,1,0);
878
    Static3D cent0 = new Static3D(0,0,0);
879
    Static3D cent1 = new Static3D(0,SQ2/2,0);
880
    Static3D flipY = new Static3D( 1,-1, 1);
881
    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
882

    
883
    VertexEffect[] effect = new VertexEffect[7];
884

    
885
    effect[0] = new VertexEffectScale(scale);
886
    effect[1] = new VertexEffectMove(move1);
887
    effect[2] = new VertexEffectRotate(alpha , axisX, cent1);
888
    effect[3] = new VertexEffectRotate(angle1, axisY, cent0);
889
    effect[4] = new VertexEffectRotate(angle2, axisY, cent0);
890
    effect[5] = new VertexEffectRotate(angle3, axisY, cent0);
891
    effect[6] = new VertexEffectScale(flipY);
892

    
893
    effect[3].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5
894
    effect[4].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6
895
    effect[5].setMeshAssociation (136,-1); // apply to meshes 3 & 7
896
    effect[6].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7
897

    
898
    return effect;
899
    }
900

    
901
///////////////////////////////////////////////////////////////////////////////////////////////////
902

    
903
  VertexEffect[] createVertexEffectsTetra()
904
    {
905
    Static3D flipZ = new Static3D( 1, 1,-1);
906
    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
907
    Static1D angle1= new Static1D( 90);
908
    Static1D angle2= new Static1D(180);
909
    Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0);
910
    Static3D axisX = new Static3D(1,0,0);
911
    Static3D axisY = new Static3D(0,1,0);
912
    Static3D axisZ = new Static3D(0,0,1);
913
    Static3D cent0 = new Static3D(0,0,0);
914
    Static3D cent1 = new Static3D(0,SQ2/4,0);
915
    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
916

    
917
    VertexEffect[] effect = new VertexEffect[7];
918

    
919
    effect[0] = new VertexEffectScale(scale);
920
    effect[1] = new VertexEffectRotate(angle2, axisZ, cent0);
921
    effect[2] = new VertexEffectMove(move1);
922
    effect[3] = new VertexEffectRotate(alpha , axisX, cent1);
923
    effect[4] = new VertexEffectScale(flipZ);
924
    effect[5] = new VertexEffectRotate(angle1, axisY, cent0);
925
    effect[6] = new VertexEffectRotate(angle2, axisZ, cent0);
926

    
927
    effect[4].setMeshAssociation(10,-1); // meshes 1 & 3
928
    effect[5].setMeshAssociation(12,-1); // meshes 2 & 3
929
    effect[6].setMeshAssociation(12,-1); // meshes 2 & 3
930

    
931
    return effect;
932
    }
933

    
934
///////////////////////////////////////////////////////////////////////////////////////////////////
935

    
936
  VertexEffect[] createVertexEffectsDino()
937
    {
938
    float E = 0.5f*SQ2;
939
    float F = 0.5f;
940
    final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2)));
941

    
942
    Static1D angle1 = new Static1D(-ANGLE);
943
    Static1D angle2 = new Static1D(+ANGLE);
944
    Static3D axisX  = new Static3D(1,0,0);
945
    Static3D axisY  = new Static3D(0,1,0);
946
    Static3D axisZ  = new Static3D(0,-1,1);
947
    Static3D center0= new Static3D(0,0,0);
948
    Static3D center1= new Static3D(0,-3*F,0);
949

    
950
    VertexEffect[] effect = new VertexEffect[10];
951

    
952
    effect[0] = new VertexEffectScale ( new Static3D(3,3,3) );
953
    effect[1] = new VertexEffectMove  ( new Static3D(0,-F,0) );
954
    effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 );
955
    effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) );
956
    effect[4] = new VertexEffectMove  ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) );
957
    effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 );
958
    effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) );
959
    effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 );
960
    effect[8] = new VertexEffectRotate( angle1           , axisZ, center1 );
961
    effect[9] = new VertexEffectRotate( angle2           , axisZ, center1 );
962

    
963
    effect[0].setMeshAssociation(15,-1);  // apply to meshes 0,1,2,3
964
    effect[1].setMeshAssociation( 3,-1);  // apply to meshes 0,1
965
    effect[2].setMeshAssociation( 2,-1);  // apply to mesh 1
966
    effect[3].setMeshAssociation( 2,-1);  // apply to mesh 0
967
    effect[4].setMeshAssociation(12,-1);  // apply to meshes 2,3
968
    effect[5].setMeshAssociation(12,-1);  // apply to meshes 2,3
969
    effect[6].setMeshAssociation( 8,-1);  // apply to mesh 3
970
    effect[7].setMeshAssociation(12,-1);  // apply to meshes 2,3
971
    effect[8].setMeshAssociation( 4,-1);  // apply to mesh 2
972
    effect[9].setMeshAssociation( 8,-1);  // apply to mesh 3
973

    
974
    return effect;
975
    }
976

    
977
///////////////////////////////////////////////////////////////////////////////////////////////////
978

    
979
  VertexEffect[] createVertexEffectsHelicopterCorner()
980
    {
981
    float E = 0.5f;
982

    
983
    Static3D axisX  = new Static3D(1,0,0);
984
    Static3D axisY  = new Static3D(0,1,0);
985
    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
986
    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
987
    Static1D angle1 = new Static1D(+90);
988
    Static1D angle2 = new Static1D(-90);
989
    Static1D angle3 = new Static1D(-135);
990
    Static1D angle4 = new Static1D(90);
991
    Static1D angle5 = new Static1D(120);
992
    Static1D angle6 = new Static1D(240);
993
    Static3D center1= new Static3D(0,0,0);
994
    Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f);
995
    Static3D move1  = new Static3D(-E/4,-E/4,0);
996
    Static3D move2  = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f);
997

    
998
    VertexEffect[] effect = new VertexEffect[10];
999

    
1000
    effect[0] = new VertexEffectMove(move1);
1001
    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
1002
    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
1003
    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
1004
    effect[4] = new VertexEffectMove(move2);
1005
    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
1006
    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
1007
    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
1008
    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
1009
    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
1010

    
1011
    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
1012
    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
1013
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1014
    effect[3].setMeshAssociation( 4,-1);  // mesh 2
1015
    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
1016
    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
1017
    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
1018
    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
1019
    effect[8].setMeshAssociation(16,-1);  // mesh 4
1020
    effect[9].setMeshAssociation(32,-1);  // mesh 5
1021

    
1022
    return effect;
1023
    }
1024

    
1025
///////////////////////////////////////////////////////////////////////////////////////////////////
1026

    
1027
  VertexEffect[] createVertexEffectsHelicopterFace()
1028
    {
1029
    float E = 0.5f;
1030
    float F = SQ2/4;
1031

    
1032
    Static3D move0  = new Static3D(-E/4, -E/4, 0);
1033
    Static3D move1  = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0);
1034
    Static3D move2  = new Static3D(-E/2, F/3, 0);
1035
    Static3D move3  = new Static3D(+E/2, F/3, 0);
1036
    Static3D move4  = new Static3D(+E/3,+E/3, 0);
1037
    Static1D angle1 = new Static1D(135);
1038
    Static1D angle2 = new Static1D(90);
1039
    Static1D angle3 = new Static1D(-90);
1040
    Static1D angle4 = new Static1D(-135);
1041
    Static3D axisX  = new Static3D(1,0,0);
1042
    Static3D axisY  = new Static3D(0,1,0);
1043
    Static3D axisZ  = new Static3D(0,0,1);
1044
    Static3D axis1  = new Static3D(1,-1,0);
1045
    Static3D center = new Static3D(0,0,0);
1046
    Static3D center1= new Static3D(-E/2,-E/2,0);
1047

    
1048
    VertexEffect[] effect = new VertexEffect[10];
1049

    
1050
    effect[0] = new VertexEffectMove(move0);
1051
    effect[1] = new VertexEffectRotate(angle1, axisZ, center);
1052
    effect[2] = new VertexEffectMove(move1);
1053
    effect[3] = new VertexEffectRotate(angle2, axis1, center1);
1054
    effect[4] = new VertexEffectMove(move2);
1055
    effect[5] = new VertexEffectMove(move3);
1056
    effect[6] = new VertexEffectRotate(angle3, axisZ, center);
1057
    effect[7] = new VertexEffectRotate(angle4, axisX, center);
1058
    effect[8] = new VertexEffectRotate(angle1, axisY, center);
1059
    effect[9] = new VertexEffectMove(move4);
1060

    
1061
    effect[0].setMeshAssociation( 1,-1);  // mesh 0
1062
    effect[1].setMeshAssociation( 2,-1);  // mesh 1
1063
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1064
    effect[3].setMeshAssociation( 2,-1);  // mesh 1
1065
    effect[4].setMeshAssociation( 4,-1);  // mesh 2
1066
    effect[5].setMeshAssociation( 8,-1);  // mesh 3
1067
    effect[6].setMeshAssociation( 8,-1);  // mesh 3
1068
    effect[7].setMeshAssociation( 4,-1);  // mesh 2
1069
    effect[8].setMeshAssociation( 8,-1);  // mesh 3
1070
    effect[9].setMeshAssociation(15,-1);  // meshes 0,1,2,3
1071

    
1072
    return effect;
1073
    }
1074

    
1075
///////////////////////////////////////////////////////////////////////////////////////////////////
1076

    
1077
  VertexEffect[] createVertexEffectsRediEdge()
1078
    {
1079
    Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f);
1080
    Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f);
1081
    Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f);
1082
    Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8);
1083
    Static3D flipZ = new Static3D(1,1,-1);
1084
    Static3D flipX = new Static3D(-1,1,1);
1085
    Static3D scale = new Static3D(2,2,2);
1086
    Static3D cent0 = new Static3D(0,0, 0);
1087
    Static3D cent1 = new Static3D(0,0, -1.5f);
1088
    Static3D axisX = new Static3D(1,0, 0);
1089
    Static3D axisY = new Static3D(0,1, 0);
1090
    Static3D axis  = new Static3D(0,SQ2/2,-SQ2/2);
1091
    Static1D angle1= new Static1D(90);
1092
    Static1D angle2= new Static1D(45);
1093
    Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) );
1094

    
1095
    VertexEffect[] effect = new VertexEffect[12];
1096

    
1097
    effect[0] = new VertexEffectScale(scale);
1098
    effect[1] = new VertexEffectMove(move0);
1099
    effect[2] = new VertexEffectScale(flipZ);
1100
    effect[3] = new VertexEffectRotate(angle1,axisX,cent0);
1101
    effect[4] = new VertexEffectMove(move1);
1102
    effect[5] = new VertexEffectRotate(angle1,axisY,cent0);
1103
    effect[6] = new VertexEffectMove(move2);
1104
    effect[7] = new VertexEffectScale(flipX);
1105
    effect[8] = new VertexEffectRotate(angle2,axisX,cent0);
1106
    effect[9] = new VertexEffectMove(move3);
1107
    effect[10]= new VertexEffectRotate(angle3,axis ,cent1);
1108
    effect[11]= new VertexEffectScale(flipX);
1109

    
1110
    effect[0].setMeshAssociation(63,-1);  // meshes 0,1,2,3,4,5
1111
    effect[1].setMeshAssociation( 3,-1);  // meshes 0,1
1112
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1113
    effect[3].setMeshAssociation( 2,-1);  // mesh 1
1114
    effect[4].setMeshAssociation(12,-1);  // meshes 2,3
1115
    effect[5].setMeshAssociation(60,-1);  // meshes 2,3,4,5
1116
    effect[6].setMeshAssociation(12,-1);  // meshes 2,3
1117
    effect[7].setMeshAssociation( 8,-1);  // mesh 3
1118
    effect[8].setMeshAssociation(48,-1);  // meshes 4,5
1119
    effect[9].setMeshAssociation(48,-1);  // meshes 4,5
1120
    effect[10].setMeshAssociation(48,-1); // meshes 4,5
1121
    effect[11].setMeshAssociation(32,-1); // mesh 5
1122

    
1123
    return effect;
1124
    }
1125

    
1126
///////////////////////////////////////////////////////////////////////////////////////////////////
1127

    
1128
  VertexEffect[] createVertexEffectsRediCorner()
1129
    {
1130
    Static3D axisY   = new Static3D(0,1,0);
1131
    Static3D axisX   = new Static3D(1,0,0);
1132
    Static3D axisZ   = new Static3D(0,0,1);
1133
    Static3D center  = new Static3D(0,0,0);
1134
    Static1D angle90 = new Static1D(90);
1135
    Static1D angle270= new Static1D(270);
1136
    Static1D angle45 = new Static1D(-45);
1137
    Static3D scale   = new Static3D(1.0f, SQ2, 1.0f);
1138

    
1139
    VertexEffect[] effect = new VertexEffect[7];
1140

    
1141
    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
1142
    effect[1] = new VertexEffectRotate( angle270, axisX, center );
1143
    effect[2] = new VertexEffectRotate( angle90 , axisY, center );
1144
    effect[3] = new VertexEffectScale(scale);
1145
    effect[4] = new VertexEffectRotate( angle45 , axisX, center );
1146
    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
1147
    effect[6] = new VertexEffectRotate( angle270, axisZ, center );
1148

    
1149
    effect[0].setMeshAssociation( 7,-1);  // 0,1,2
1150
    effect[1].setMeshAssociation( 2,-1);  // 1
1151
    effect[2].setMeshAssociation( 4,-1);  // 2
1152
    effect[3].setMeshAssociation(56,-1);  // 3,4,5
1153
    effect[4].setMeshAssociation(56,-1);  // 3,4,5
1154
    effect[5].setMeshAssociation(16,-1);  // 4
1155
    effect[6].setMeshAssociation(32,-1);  // 5
1156

    
1157
    return effect;
1158
    }
1159

    
1160
///////////////////////////////////////////////////////////////////////////////////////////////////
1161

    
1162
  VertexEffect[] createVertexEffectsIvyCorner()
1163
    {
1164
    Static3D axisX  = new Static3D(1,0,0);
1165
    Static3D axisY  = new Static3D(0,1,0);
1166
    Static1D angle1 = new Static1D(+90);
1167
    Static1D angle2 = new Static1D(-90);
1168
    Static3D center = new Static3D(0,0,0);
1169
    Static3D move1  = new Static3D(IVY_M-0.5f,IVY_M-0.5f,0);
1170

    
1171
    VertexEffect[] effect = new VertexEffect[5];
1172

    
1173
    effect[0] = new VertexEffectScale(1/IVY_C);
1174
    effect[1] = new VertexEffectMove(move1);
1175
    effect[2] = new VertexEffectScale(new Static3D(1,1,-1));
1176
    effect[3] = new VertexEffectRotate(angle1,axisX,center);
1177
    effect[4] = new VertexEffectRotate(angle2,axisY,center);
1178

    
1179
    effect[2].setMeshAssociation(54,-1);  // meshes 1,2,4,5
1180
    effect[3].setMeshAssociation(18,-1);  // meshes 1,4
1181
    effect[4].setMeshAssociation(36,-1);  // meshes 2,5
1182

    
1183
    return effect;
1184
    }
1185

    
1186
///////////////////////////////////////////////////////////////////////////////////////////////////
1187

    
1188
  VertexEffect[] createVertexEffectsRexEdge()
1189
    {
1190
    final float H = 1.0f - SQ3/2;
1191
    final float D = 0.5f - REX_D;
1192
    final float F = H*D;
1193

    
1194
    Static3D move  = new Static3D(0.0f,   -F, 0.0f);
1195
    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
1196
    Static3D axisX = new Static3D(1.0f, 0.0f, 0.0f);
1197
    Static3D axisY = new Static3D(0.0f, 1.0f, 0.0f);
1198

    
1199
    Static1D angle180 = new Static1D(180);
1200
    Static1D angle90  = new Static1D( 90);
1201

    
1202
    VertexEffect[] effect = new VertexEffect[3];
1203

    
1204
    effect[0] = new VertexEffectMove(move);
1205
    effect[1] = new VertexEffectRotate(angle180, axisY, center);
1206
    effect[2] = new VertexEffectRotate(angle90 , axisX, center);
1207

    
1208
    effect[1].setMeshAssociation(10,-1);  // meshes 1 & 3
1209
    effect[2].setMeshAssociation(10,-1);  // meshes 1 & 3
1210

    
1211
    return effect;
1212
    }
1213

    
1214
///////////////////////////////////////////////////////////////////////////////////////////////////
1215

    
1216
  VertexEffect[] createVertexEffectsRexCorner()
1217
    {
1218
    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
1219
    Static3D axisZ = new Static3D(0.0f, 0.0f, 1.0f);
1220
    Static1D angle = new Static1D(45);
1221

    
1222
    VertexEffect[] effect = new VertexEffect[1];
1223
    effect[0] = new VertexEffectRotate(angle, axisZ, center);
1224

    
1225
    return effect;
1226
    }
1227

    
1228
///////////////////////////////////////////////////////////////////////////////////////////////////
1229
// OBJECTS
1230
///////////////////////////////////////////////////////////////////////////////////////////////////
1231
// CUBE
1232

    
1233
  MeshBase createCubeMesh(int index)
1234
    {
1235
    MeshBase mesh = createFacesCube(index);
1236
    VertexEffect[] effects = createVertexEffectsCube();
1237
    for( VertexEffect effect : effects ) mesh.apply(effect);
1238

    
1239
    Static3D roundingCenter  = new Static3D(0,0,0);
1240
    Static3D[] vertices = new Static3D[8];
1241
    vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f);
1242
    vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f);
1243
    vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f);
1244
    vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f);
1245
    vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f);
1246
    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
1247
    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
1248
    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
1249

    
1250
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.12f);
1251

    
1252
    mesh.mergeEffComponents();
1253

    
1254
    return mesh;
1255
    }
1256

    
1257
///////////////////////////////////////////////////////////////////////////////////////////////////
1258
// SKEWB
1259

    
1260
  MeshBase createSkewbCornerMesh()
1261
    {
1262
    MeshBase mesh = createFacesSkewbCorner();
1263
    VertexEffect[] effects = createVertexEffectsSkewbCorner();
1264
    for( VertexEffect effect : effects ) mesh.apply(effect);
1265

    
1266
    float E = 0.5f;
1267
    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
1268

    
1269
    Static3D[] verticesType1 = new Static3D[1];
1270
    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
1271
    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
1272

    
1273
    Static3D[] verticesType2 = new Static3D[3];
1274
    verticesType2[0] = new Static3D(-E, 0, 0);
1275
    verticesType2[1] = new Static3D( 0,-E, 0);
1276
    verticesType2[2] = new Static3D( 0, 0,-E);
1277
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1278

    
1279
    mesh.mergeEffComponents();
1280

    
1281
    return mesh;
1282
    }
1283

    
1284
///////////////////////////////////////////////////////////////////////////////////////////////////
1285

    
1286
  MeshBase createSkewbFaceMesh()
1287
    {
1288
    MeshBase mesh = createFacesSkewbFace();
1289
    VertexEffect[] effects = createVertexEffectsSkewbFace();
1290
    for( VertexEffect effect : effects ) mesh.apply(effect);
1291

    
1292
    Static3D roundingCenter = new Static3D(0,0,-0.2f);
1293
    float E = SQ2/4;
1294
    Static3D[] vertices = new Static3D[4];
1295
    vertices[0] = new Static3D(-E*SQ2,      0, 0);
1296
    vertices[1] = new Static3D(+E*SQ2,      0, 0);
1297
    vertices[2] = new Static3D(     0, -E*SQ2, 0);
1298
    vertices[3] = new Static3D(     0, +E*SQ2, 0);
1299
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.10f);
1300

    
1301
    mesh.mergeEffComponents();
1302
    mesh.addEmptyTexComponent();
1303

    
1304
    return mesh;
1305
    }
1306

    
1307
///////////////////////////////////////////////////////////////////////////////////////////////////
1308
// SKEWB DIAMOND / PYRAMINX
1309

    
1310
  MeshBase createOctaMesh()
1311
    {
1312
    MeshBase mesh = createFacesOcta();
1313
    VertexEffect[] effects = createVertexEffectsOcta();
1314
    for( VertexEffect effect : effects ) mesh.apply(effect);
1315

    
1316
    Static3D roundingCenter = new Static3D(0,0,0);
1317
    Static3D[] vertices = new Static3D[6];
1318
    vertices[0] = new Static3D(    0, SQ2/2,    0 );
1319
    vertices[1] = new Static3D( 0.5f,     0, 0.5f );
1320
    vertices[2] = new Static3D(-0.5f,     0, 0.5f );
1321
    vertices[3] = new Static3D(    0,-SQ2/2,    0 );
1322
    vertices[4] = new Static3D(-0.5f,     0,-0.5f );
1323
    vertices[5] = new Static3D( 0.5f,     0,-0.5f );
1324

    
1325
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.20f);
1326

    
1327
    mesh.mergeEffComponents();
1328

    
1329
    return mesh;
1330
    }
1331

    
1332
///////////////////////////////////////////////////////////////////////////////////////////////////
1333

    
1334
  MeshBase createTetraMesh()
1335
    {
1336
    MeshBase mesh = createFacesTetra();
1337
    VertexEffect[] effects = createVertexEffectsTetra();
1338
    for( VertexEffect effect : effects ) mesh.apply(effect);
1339

    
1340
    Static3D roundingCenter = new Static3D(0,0,0);
1341
    Static3D[] verticesRound = new Static3D[4];
1342
    verticesRound[0] = new Static3D(-0.5f,+SQ2/4,   0 );
1343
    verticesRound[1] = new Static3D(+0.5f,+SQ2/4,   0 );
1344
    verticesRound[2] = new Static3D(    0,-SQ2/4,+0.5f);
1345
    verticesRound[3] = new Static3D(    0,-SQ2/4,-0.5f);
1346
    roundCorners(mesh,roundingCenter,verticesRound,0.08f,0.15f);
1347

    
1348
    mesh.mergeEffComponents();
1349
    mesh.addEmptyTexComponent();
1350
    mesh.addEmptyTexComponent();
1351
    mesh.addEmptyTexComponent();
1352
    mesh.addEmptyTexComponent();
1353

    
1354
    return mesh;
1355
    }
1356

    
1357
///////////////////////////////////////////////////////////////////////////////////////////////////
1358
// DINO
1359

    
1360
  MeshBase createDinoMesh()
1361
    {
1362
    MeshBase mesh = createFacesDino();
1363
    VertexEffect[] effects = createVertexEffectsDino();
1364
    for( VertexEffect effect : effects ) mesh.apply(effect);
1365

    
1366
    float F = 0.5f;
1367
    Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F);
1368
    Static3D[] verticesRound = new Static3D[4];
1369
    verticesRound[0] = new Static3D(     0,-3*F,    0 );
1370
    verticesRound[1] = new Static3D(     0,   0, -3*F );
1371
    verticesRound[2] = new Static3D(  -3*F,   0,    0 );
1372
    verticesRound[3] = new Static3D(  +3*F,   0,    0 );
1373
    roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f);
1374

    
1375
    mesh.mergeEffComponents();
1376

    
1377
    return mesh;
1378
    }
1379

    
1380
///////////////////////////////////////////////////////////////////////////////////////////////////
1381
// Helicopter
1382

    
1383
  MeshBase createHelicopterCornerMesh()
1384
    {
1385
    MeshBase mesh = createFacesHelicopterCorner();
1386
    VertexEffect[] effects = createVertexEffectsHelicopterCorner();
1387
    for( VertexEffect effect : effects ) mesh.apply(effect);
1388

    
1389
    float E = 0.5f;
1390
    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
1391

    
1392
    Static3D[] verticesType1 = new Static3D[1];
1393
    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
1394
    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
1395

    
1396
    Static3D[] verticesType2 = new Static3D[3];
1397
    verticesType2[0] = new Static3D(-E, 0, 0);
1398
    verticesType2[1] = new Static3D( 0,-E, 0);
1399
    verticesType2[2] = new Static3D( 0, 0,-E);
1400
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1401

    
1402
    mesh.mergeEffComponents();
1403

    
1404
    return mesh;
1405
    }
1406

    
1407
///////////////////////////////////////////////////////////////////////////////////////////////////
1408

    
1409
  MeshBase createHelicopterFaceMesh()
1410
    {
1411
    MeshBase mesh = createFacesHelicopterFace();
1412
    VertexEffect[] effects = createVertexEffectsHelicopterFace();
1413
    for( VertexEffect effect : effects ) mesh.apply(effect);
1414

    
1415
    float E = 0.5f;
1416
    Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
1417

    
1418
    Static3D[] verticesType1 = new Static3D[1];
1419
    verticesType1[0] = new Static3D(E/3,E/3,0.0f);
1420
    roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f);
1421

    
1422
    Static3D[] verticesType2 = new Static3D[2];
1423
    verticesType2[0] = new Static3D(-E+E/3, E/3  , 0);
1424
    verticesType2[1] = new Static3D( E/3  ,-E+E/3, 0);
1425
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1426

    
1427
    mesh.mergeEffComponents();
1428
    mesh.addEmptyTexComponent();
1429
    mesh.addEmptyTexComponent();
1430

    
1431
    return mesh;
1432
    }
1433

    
1434
///////////////////////////////////////////////////////////////////////////////////////////////////
1435
// Redi cube
1436

    
1437
  MeshBase createRediEdgeMesh()
1438
    {
1439
    MeshBase mesh = createFacesRediEdge();
1440
    VertexEffect[] effects = createVertexEffectsRediEdge();
1441
    for( VertexEffect effect : effects ) mesh.apply(effect);
1442

    
1443
    Static3D center = new Static3D(0.0f,-0.75f,-0.75f);
1444
    Static3D[] vertices = new Static3D[2];
1445
    vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f);
1446
    vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f);
1447
    roundCorners(mesh,center,vertices,0.06f,0.20f);
1448

    
1449
    mesh.mergeEffComponents();
1450

    
1451
    return mesh;
1452
    }
1453

    
1454
///////////////////////////////////////////////////////////////////////////////////////////////////
1455

    
1456
  MeshBase createRediCornerMesh()
1457
    {
1458
    MeshBase mesh = createFacesRediCorner();
1459
    VertexEffect[] effects = createVertexEffectsRediCorner();
1460
    for( VertexEffect effect : effects ) mesh.apply(effect);
1461

    
1462
    Static3D center = new Static3D(0,0,0);
1463
    Static3D[] vertices = new Static3D[8];
1464
    vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f);
1465
    vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f);
1466
    vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f);
1467
    vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f);
1468
    vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f);
1469
    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
1470
    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
1471
    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
1472

    
1473
    roundCorners(mesh,center,vertices,0.06f,0.12f);
1474

    
1475
    mesh.mergeEffComponents();
1476

    
1477
    return mesh;
1478
    }
1479

    
1480
///////////////////////////////////////////////////////////////////////////////////////////////////
1481

    
1482
  MeshBase createIvyCornerMesh()
1483
    {
1484
    MeshBase mesh = createFacesIvyCorner();
1485
    VertexEffect[] effects = createVertexEffectsIvyCorner();
1486
    for( VertexEffect effect : effects ) mesh.apply(effect);
1487

    
1488
    Static3D center = new Static3D(-0.5f,-0.5f,-0.5f);
1489
    Static3D[] vertices = new Static3D[4];
1490
    vertices[0] = new Static3D(+0.0f,+0.0f,+0.0f);
1491
    vertices[1] = new Static3D(-1.0f,+0.0f,+0.0f);
1492
    vertices[2] = new Static3D(+0.0f,-1.0f,+0.0f);
1493
    vertices[3] = new Static3D(+0.0f,+0.0f,-1.0f);
1494

    
1495
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1496

    
1497
    mesh.mergeEffComponents();
1498

    
1499
    return mesh;
1500
    }
1501

    
1502
///////////////////////////////////////////////////////////////////////////////////////////////////
1503

    
1504
  MeshBase createIvyFaceMesh()
1505
    {
1506
    MeshBase mesh = createFacesIvyFace();
1507

    
1508
    Static3D center = new Static3D(-0.0f,-0.0f,-0.5f);
1509
    Static3D[] vertices = new Static3D[2];
1510
    vertices[0] = new Static3D(-0.5f,+0.5f,+0.0f);
1511
    vertices[1] = new Static3D(+0.5f,-0.5f,+0.0f);
1512

    
1513
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1514

    
1515
    mesh.mergeEffComponents();
1516
    mesh.addEmptyTexComponent();
1517
    mesh.addEmptyTexComponent();
1518
    mesh.addEmptyTexComponent();
1519
    mesh.addEmptyTexComponent();
1520

    
1521
    return mesh;
1522
    }
1523

    
1524
///////////////////////////////////////////////////////////////////////////////////////////////////
1525

    
1526
  MeshBase createRexCornerMesh()
1527
    {
1528
    MeshBase mesh = createFacesRexCorner();
1529
    VertexEffect[] effects = createVertexEffectsRexCorner();
1530
    for( VertexEffect effect : effects ) mesh.apply(effect);
1531

    
1532
    Static3D center = new Static3D(0.0f,0.0f,-0.25f);
1533
    Static3D[] vertices = new Static3D[1];
1534
    vertices[0] = new Static3D(+0.25f,+0.25f,+0.0f);
1535
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1536

    
1537
    mesh.mergeEffComponents();
1538
    mesh.addEmptyTexComponent();
1539
    mesh.addEmptyTexComponent();
1540

    
1541
    return mesh;
1542
    }
1543

    
1544
///////////////////////////////////////////////////////////////////////////////////////////////////
1545

    
1546
  MeshBase createRexFaceMesh()
1547
    {
1548
    MeshBase mesh = createFacesRexFace();
1549

    
1550
    mesh.mergeEffComponents();
1551
    mesh.addEmptyTexComponent();
1552
    mesh.addEmptyTexComponent();
1553

    
1554
    return mesh;
1555
    }
1556

    
1557
///////////////////////////////////////////////////////////////////////////////////////////////////
1558

    
1559
  MeshBase createRexEdgeMesh()
1560
    {
1561
    MeshBase mesh = createFacesRexEdge();
1562
    VertexEffect[] effects = createVertexEffectsRexEdge();
1563
    for( VertexEffect effect : effects ) mesh.apply(effect);
1564

    
1565
    Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
1566
    Static3D[] vertices = new Static3D[2];
1567
    vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
1568
    vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
1569
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1570

    
1571
    mesh.mergeEffComponents();
1572

    
1573
    return mesh;
1574
    }
1575
  }
(1-1/5)