Project

General

Profile

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

examples / src / main / java / org / distorted / examples / meshfile / FactoryCubit.java @ 7cd30f7c

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 'angle' of the point
200
// (px,py) along axis Z. Center of rotation: (cx,cy).
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 angle, float[] array, int index)
204
    {
205
    float vx = px-cx;
206
    float vy = py-cy;
207

    
208
    double radAngle = Math.PI*angle/180;
209
    float sinA = (float)Math.sin(radAngle);
210
    float cosA = (float)Math.cos(radAngle);
211

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

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

    
219
///////////////////////////////////////////////////////////////////////////////////////////////////
220

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

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

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

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

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

    
252
    return new MeshJoined(meshes);
253
    }
254

    
255
///////////////////////////////////////////////////////////////////////////////////////////////////
256

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

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

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

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

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

    
284
    return new MeshJoined(meshes);
285
    }
286

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

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

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

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

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

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

    
312
    return new MeshJoined(meshes);
313
    }
314

    
315
///////////////////////////////////////////////////////////////////////////////////////////////////
316

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

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

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

    
343
    return new MeshJoined(meshes);
344
    }
345

    
346
///////////////////////////////////////////////////////////////////////////////////////////////////
347

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

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

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

    
366
    return new MeshJoined(meshes);
367
    }
368

    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

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

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

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

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

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

    
393
    return new MeshJoined(meshes);
394
    }
395

    
396
///////////////////////////////////////////////////////////////////////////////////////////////////
397

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

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

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

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

    
424
    return new MeshJoined(meshes);
425
    }
426

    
427
///////////////////////////////////////////////////////////////////////////////////////////////////
428

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

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

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

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

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

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

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

    
455
    return new MeshJoined(meshes);
456
    }
457

    
458
///////////////////////////////////////////////////////////////////////////////////////////////////
459

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

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

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

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

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

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

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

    
490
    return new MeshJoined(meshes);
491
    }
492

    
493
///////////////////////////////////////////////////////////////////////////////////////////////////
494

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

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

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

    
510
    float F = 0.5f;
511
    float X = 0.5f;
512
    float G = 0.72f;
513
    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 };
514
    float[] bands1 = computeBands(0.0f,0,1.0f,0.0f,2);
515

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

    
523
    return new MeshJoined(meshes);
524
    }
525

    
526
///////////////////////////////////////////////////////////////////////////////////////////////////
527

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

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

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

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

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

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

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

    
570
    return new MeshJoined(meshes);
571
    }
572

    
573
///////////////////////////////////////////////////////////////////////////////////////////////////
574

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

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

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

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

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

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

    
602
    return new MeshJoined(meshes);
603
    }
604

    
605
///////////////////////////////////////////////////////////////////////////////////////////////////
606

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

    
611
    final float angle = (float)Math.PI/(6*REX_N);
612
    float[] vertices = new float[6*REX_N];
613
    final float H = SQ2*(SQ3/3 - 0.5f);
614
    final float D = 0.5f - REX_D;
615
    final float F = H*D;
616
    final float B = (float)Math.sqrt(12/(H*H) - 0.75f) - 0.5f;
617

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

    
625
    final float C1x = 0.0f;
626
    final float C1y = -D*( (SQ3/6)*H - (float)Math.sqrt(4.0f-0.25f*H*H) );
627
    final float C2x = B*V2x;
628
    final float C2y = B*V2y;
629
    final float C3x = B*V3x;
630
    final float C3y = B*V3y;
631

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

    
639
    float[] bands0 = computeBands(+0.03f,35,0.5f,0.5f,5);
640
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
641

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

    
647
    return new MeshJoined(meshes);
648
    }
649

    
650
///////////////////////////////////////////////////////////////////////////////////////////////////
651

    
652
  MeshBase createFacesRexFace()
653
    {
654
    MeshBase[] meshes = new MeshBase[2];
655

    
656
    final float angle = (float)Math.PI/(6*REX_N);
657
    float[] vertices = new float[8*REX_N];
658
    final float H = SQ3/2 - 0.5f;
659
    final float D = 0.5f - REX_D;
660
    final float F = H*D;
661

    
662
    final float V1x = 0.0f;
663
    final float V1y = +F;
664
    final float V2x = +F;
665
    final float V2y = 0.0f;
666
    final float V3x = 0.0f;
667
    final float V3y = -F;
668
    final float V4x = -F;
669
    final float V4y = 0.0f;
670

    
671
    final float C1x = -D;
672
    final float C1y = -D;
673
    final float C2x = -D;
674
    final float C2y = +D;
675
    final float C3x = +D;
676
    final float C3y = +D;
677
    final float C4x = +D;
678
    final float C4y = -D;
679

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

    
688
    float[] bands0 = computeBands(+0.03f,35,0.5f,0.5f,5);
689
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
690

    
691
    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
692
    meshes[0].setEffectAssociation(0,1,0);
693
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
694
    meshes[1].setEffectAssociation(0,2,0);
695

    
696
    return new MeshJoined(meshes);
697
    }
698

    
699
///////////////////////////////////////////////////////////////////////////////////////////////////
700

    
701
  MeshBase createFacesRexEdge()
702
    {
703
    MeshBase[] meshes = new MeshBase[4];
704

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

    
711
    final float V1x = -D;
712
    final float V1y = +D - D*SQ3/2;
713
    final float V2x = 0.0f;
714
    final float V2y = D*(SQ3-1) - D*SQ3/2;
715

    
716
    final float C1x = -D;
717
    final float C1y = -D - D*SQ3/2;
718
    final float C2x = +D;
719
    final float C2y = C1y;
720

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

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

    
732
    float[] bands0 = computeBands(+0.03f,35,0.5f,0.5f,5);
733
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
734

    
735
    meshes[0] = new MeshPolygon(vertices,bands0,1,2);
736
    meshes[0].setEffectAssociation(0,1,0);
737
    meshes[1] = meshes[0].copy(true);
738
    meshes[1].setEffectAssociation(0,2,0);
739
    meshes[2] = new MeshPolygon(vertices,bands1,0,0);
740
    meshes[2].setEffectAssociation(0,4,0);
741
    meshes[3] = meshes[2].copy(true);
742
    meshes[3].setEffectAssociation(0,8,0);
743

    
744
    return new MeshJoined(meshes);
745
    }
746

    
747
///////////////////////////////////////////////////////////////////////////////////////////////////
748
// EFFECTS
749
///////////////////////////////////////////////////////////////////////////////////////////////////
750

    
751
  VertexEffect[] createVertexEffectsCube()
752
    {
753
    Static3D axisY   = new Static3D(0,1,0);
754
    Static3D axisX   = new Static3D(1,0,0);
755
    Static3D center  = new Static3D(0,0,0);
756
    Static1D angle90 = new Static1D(90);
757
    Static1D angle180= new Static1D(180);
758
    Static1D angle270= new Static1D(270);
759

    
760
    VertexEffect[] effect = new VertexEffect[6];
761

    
762
    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
763
    effect[1] = new VertexEffectRotate( angle180, axisX, center );
764
    effect[2] = new VertexEffectRotate( angle90 , axisX, center );
765
    effect[3] = new VertexEffectRotate( angle270, axisX, center );
766
    effect[4] = new VertexEffectRotate( angle270, axisY, center );
767
    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
768

    
769
    effect[0].setMeshAssociation(63,-1);  // all 6 sides
770
    effect[1].setMeshAssociation(32,-1);  // back
771
    effect[2].setMeshAssociation( 8,-1);  // bottom
772
    effect[3].setMeshAssociation( 4,-1);  // top
773
    effect[4].setMeshAssociation( 2,-1);  // left
774
    effect[5].setMeshAssociation( 1,-1);  // right
775

    
776
    return effect;
777
    }
778

    
779
///////////////////////////////////////////////////////////////////////////////////////////////////
780

    
781
  VertexEffect[] createVertexEffectsSkewbCorner()
782
    {
783
    float E = 0.5f;
784

    
785
    Static3D axisX  = new Static3D(1,0,0);
786
    Static3D axisY  = new Static3D(0,1,0);
787
    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
788
    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
789
    Static1D angle1 = new Static1D(+90);
790
    Static1D angle2 = new Static1D(-90);
791
    Static1D angle3 = new Static1D(-15);
792
    Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3)));
793
    Static1D angle5 = new Static1D(120);
794
    Static1D angle6 = new Static1D(240);
795
    Static3D center1= new Static3D(0,0,0);
796
    Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f);
797
    Static3D move1  = new Static3D(-E/4,-E/4,0);
798
    Static3D move2  = new Static3D(-0.5f+SQ2/4,-0.5f+SQ6/8,-0.5f);
799

    
800
    VertexEffect[] effect = new VertexEffect[10];
801

    
802
    effect[0] = new VertexEffectMove(move1);
803
    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
804
    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
805
    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
806
    effect[4] = new VertexEffectMove(move2);
807
    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
808
    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
809
    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
810
    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
811
    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
812

    
813
    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
814
    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
815
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
816
    effect[3].setMeshAssociation( 4,-1);  // mesh 2
817
    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
818
    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
819
    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
820
    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
821
    effect[8].setMeshAssociation(16,-1);  // mesh 4
822
    effect[9].setMeshAssociation(32,-1);  // mesh 5
823

    
824
    return effect;
825
    }
826

    
827
///////////////////////////////////////////////////////////////////////////////////////////////////
828

    
829
  VertexEffect[] createVertexEffectsSkewbFace()
830
    {
831
    Static3D center = new Static3D(0,0,0);
832
    Static3D axisX  = new Static3D(1,0,0);
833
    Static3D axisZ  = new Static3D(0,0,1);
834
    float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3));
835

    
836
    VertexEffect[] effect = new VertexEffect[6];
837

    
838
    effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center);
839
    effect[1] = new VertexEffectRotate( new Static1D(  135), axisZ, center);
840
    effect[2] = new VertexEffectRotate( new Static1D(   45), axisZ, center);
841
    effect[3] = new VertexEffectRotate( new Static1D(  -45), axisZ, center);
842
    effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center);
843
    effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) );
844

    
845
    effect[0].setMeshAssociation(30,-1);  // meshes 1,2,3,4
846
    effect[1].setMeshAssociation( 2,-1);  // mesh 1
847
    effect[2].setMeshAssociation( 5,-1);  // meshes 0,2
848
    effect[3].setMeshAssociation( 8,-1);  // mesh 3
849
    effect[4].setMeshAssociation(16,-1);  // mesh 4
850
    effect[5].setMeshAssociation(30,-1);  // meshes 1,2,3,4
851

    
852
    return effect;
853
    }
854

    
855
///////////////////////////////////////////////////////////////////////////////////////////////////
856

    
857
  VertexEffect[] createVertexEffectsOcta()
858
    {
859
    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
860
    Static1D angle1= new Static1D( 90);
861
    Static1D angle2= new Static1D(180);
862
    Static1D angle3= new Static1D(270);
863
    Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0);
864
    Static3D axisX = new Static3D(1,0,0);
865
    Static3D axisY = new Static3D(0,1,0);
866
    Static3D cent0 = new Static3D(0,0,0);
867
    Static3D cent1 = new Static3D(0,SQ2/2,0);
868
    Static3D flipY = new Static3D( 1,-1, 1);
869
    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
870

    
871
    VertexEffect[] effect = new VertexEffect[7];
872

    
873
    effect[0] = new VertexEffectScale(scale);
874
    effect[1] = new VertexEffectMove(move1);
875
    effect[2] = new VertexEffectRotate(alpha , axisX, cent1);
876
    effect[3] = new VertexEffectRotate(angle1, axisY, cent0);
877
    effect[4] = new VertexEffectRotate(angle2, axisY, cent0);
878
    effect[5] = new VertexEffectRotate(angle3, axisY, cent0);
879
    effect[6] = new VertexEffectScale(flipY);
880

    
881
    effect[3].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5
882
    effect[4].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6
883
    effect[5].setMeshAssociation (136,-1); // apply to meshes 3 & 7
884
    effect[6].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7
885

    
886
    return effect;
887
    }
888

    
889
///////////////////////////////////////////////////////////////////////////////////////////////////
890

    
891
  VertexEffect[] createVertexEffectsTetra()
892
    {
893
    Static3D flipZ = new Static3D( 1, 1,-1);
894
    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
895
    Static1D angle1= new Static1D( 90);
896
    Static1D angle2= new Static1D(180);
897
    Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0);
898
    Static3D axisX = new Static3D(1,0,0);
899
    Static3D axisY = new Static3D(0,1,0);
900
    Static3D axisZ = new Static3D(0,0,1);
901
    Static3D cent0 = new Static3D(0,0,0);
902
    Static3D cent1 = new Static3D(0,SQ2/4,0);
903
    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
904

    
905
    VertexEffect[] effect = new VertexEffect[7];
906

    
907
    effect[0] = new VertexEffectScale(scale);
908
    effect[1] = new VertexEffectRotate(angle2, axisZ, cent0);
909
    effect[2] = new VertexEffectMove(move1);
910
    effect[3] = new VertexEffectRotate(alpha , axisX, cent1);
911
    effect[4] = new VertexEffectScale(flipZ);
912
    effect[5] = new VertexEffectRotate(angle1, axisY, cent0);
913
    effect[6] = new VertexEffectRotate(angle2, axisZ, cent0);
914

    
915
    effect[4].setMeshAssociation(10,-1); // meshes 1 & 3
916
    effect[5].setMeshAssociation(12,-1); // meshes 2 & 3
917
    effect[6].setMeshAssociation(12,-1); // meshes 2 & 3
918

    
919
    return effect;
920
    }
921

    
922
///////////////////////////////////////////////////////////////////////////////////////////////////
923

    
924
  VertexEffect[] createVertexEffectsDino()
925
    {
926
    float E = 0.5f*SQ2;
927
    float F = 0.5f;
928
    final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2)));
929

    
930
    Static1D angle1 = new Static1D(-ANGLE);
931
    Static1D angle2 = new Static1D(+ANGLE);
932
    Static3D axisX  = new Static3D(1,0,0);
933
    Static3D axisY  = new Static3D(0,1,0);
934
    Static3D axisZ  = new Static3D(0,-1,1);
935
    Static3D center0= new Static3D(0,0,0);
936
    Static3D center1= new Static3D(0,-3*F,0);
937

    
938
    VertexEffect[] effect = new VertexEffect[10];
939

    
940
    effect[0] = new VertexEffectScale ( new Static3D(3,3,3) );
941
    effect[1] = new VertexEffectMove  ( new Static3D(0,-F,0) );
942
    effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 );
943
    effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) );
944
    effect[4] = new VertexEffectMove  ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) );
945
    effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 );
946
    effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) );
947
    effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 );
948
    effect[8] = new VertexEffectRotate( angle1           , axisZ, center1 );
949
    effect[9] = new VertexEffectRotate( angle2           , axisZ, center1 );
950

    
951
    effect[0].setMeshAssociation(15,-1);  // apply to meshes 0,1,2,3
952
    effect[1].setMeshAssociation( 3,-1);  // apply to meshes 0,1
953
    effect[2].setMeshAssociation( 2,-1);  // apply to mesh 1
954
    effect[3].setMeshAssociation( 2,-1);  // apply to mesh 0
955
    effect[4].setMeshAssociation(12,-1);  // apply to meshes 2,3
956
    effect[5].setMeshAssociation(12,-1);  // apply to meshes 2,3
957
    effect[6].setMeshAssociation( 8,-1);  // apply to mesh 3
958
    effect[7].setMeshAssociation(12,-1);  // apply to meshes 2,3
959
    effect[8].setMeshAssociation( 4,-1);  // apply to mesh 2
960
    effect[9].setMeshAssociation( 8,-1);  // apply to mesh 3
961

    
962
    return effect;
963
    }
964

    
965
///////////////////////////////////////////////////////////////////////////////////////////////////
966

    
967
  VertexEffect[] createVertexEffectsHelicopterCorner()
968
    {
969
    float E = 0.5f;
970

    
971
    Static3D axisX  = new Static3D(1,0,0);
972
    Static3D axisY  = new Static3D(0,1,0);
973
    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
974
    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
975
    Static1D angle1 = new Static1D(+90);
976
    Static1D angle2 = new Static1D(-90);
977
    Static1D angle3 = new Static1D(-135);
978
    Static1D angle4 = new Static1D(90);
979
    Static1D angle5 = new Static1D(120);
980
    Static1D angle6 = new Static1D(240);
981
    Static3D center1= new Static3D(0,0,0);
982
    Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f);
983
    Static3D move1  = new Static3D(-E/4,-E/4,0);
984
    Static3D move2  = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f);
985

    
986
    VertexEffect[] effect = new VertexEffect[10];
987

    
988
    effect[0] = new VertexEffectMove(move1);
989
    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
990
    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
991
    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
992
    effect[4] = new VertexEffectMove(move2);
993
    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
994
    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
995
    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
996
    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
997
    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
998

    
999
    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
1000
    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
1001
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1002
    effect[3].setMeshAssociation( 4,-1);  // mesh 2
1003
    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
1004
    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
1005
    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
1006
    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
1007
    effect[8].setMeshAssociation(16,-1);  // mesh 4
1008
    effect[9].setMeshAssociation(32,-1);  // mesh 5
1009

    
1010
    return effect;
1011
    }
1012

    
1013
///////////////////////////////////////////////////////////////////////////////////////////////////
1014

    
1015
  VertexEffect[] createVertexEffectsHelicopterFace()
1016
    {
1017
    float E = 0.5f;
1018
    float F = SQ2/4;
1019

    
1020
    Static3D move0  = new Static3D(-E/4, -E/4, 0);
1021
    Static3D move1  = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0);
1022
    Static3D move2  = new Static3D(-E/2, F/3, 0);
1023
    Static3D move3  = new Static3D(+E/2, F/3, 0);
1024
    Static3D move4  = new Static3D(+E/3,+E/3, 0);
1025
    Static1D angle1 = new Static1D(135);
1026
    Static1D angle2 = new Static1D(90);
1027
    Static1D angle3 = new Static1D(-90);
1028
    Static1D angle4 = new Static1D(-135);
1029
    Static3D axisX  = new Static3D(1,0,0);
1030
    Static3D axisY  = new Static3D(0,1,0);
1031
    Static3D axisZ  = new Static3D(0,0,1);
1032
    Static3D axis1  = new Static3D(1,-1,0);
1033
    Static3D center = new Static3D(0,0,0);
1034
    Static3D center1= new Static3D(-E/2,-E/2,0);
1035

    
1036
    VertexEffect[] effect = new VertexEffect[10];
1037

    
1038
    effect[0] = new VertexEffectMove(move0);
1039
    effect[1] = new VertexEffectRotate(angle1, axisZ, center);
1040
    effect[2] = new VertexEffectMove(move1);
1041
    effect[3] = new VertexEffectRotate(angle2, axis1, center1);
1042
    effect[4] = new VertexEffectMove(move2);
1043
    effect[5] = new VertexEffectMove(move3);
1044
    effect[6] = new VertexEffectRotate(angle3, axisZ, center);
1045
    effect[7] = new VertexEffectRotate(angle4, axisX, center);
1046
    effect[8] = new VertexEffectRotate(angle1, axisY, center);
1047
    effect[9] = new VertexEffectMove(move4);
1048

    
1049
    effect[0].setMeshAssociation( 1,-1);  // mesh 0
1050
    effect[1].setMeshAssociation( 2,-1);  // mesh 1
1051
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1052
    effect[3].setMeshAssociation( 2,-1);  // mesh 1
1053
    effect[4].setMeshAssociation( 4,-1);  // mesh 2
1054
    effect[5].setMeshAssociation( 8,-1);  // mesh 3
1055
    effect[6].setMeshAssociation( 8,-1);  // mesh 3
1056
    effect[7].setMeshAssociation( 4,-1);  // mesh 2
1057
    effect[8].setMeshAssociation( 8,-1);  // mesh 3
1058
    effect[9].setMeshAssociation(15,-1);  // meshes 0,1,2,3
1059

    
1060
    return effect;
1061
    }
1062

    
1063
///////////////////////////////////////////////////////////////////////////////////////////////////
1064

    
1065
  VertexEffect[] createVertexEffectsRediEdge()
1066
    {
1067
    Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f);
1068
    Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f);
1069
    Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f);
1070
    Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8);
1071
    Static3D flipZ = new Static3D(1,1,-1);
1072
    Static3D flipX = new Static3D(-1,1,1);
1073
    Static3D scale = new Static3D(2,2,2);
1074
    Static3D cent0 = new Static3D(0,0, 0);
1075
    Static3D cent1 = new Static3D(0,0, -1.5f);
1076
    Static3D axisX = new Static3D(1,0, 0);
1077
    Static3D axisY = new Static3D(0,1, 0);
1078
    Static3D axis  = new Static3D(0,SQ2/2,-SQ2/2);
1079
    Static1D angle1= new Static1D(90);
1080
    Static1D angle2= new Static1D(45);
1081
    Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) );
1082

    
1083
    VertexEffect[] effect = new VertexEffect[12];
1084

    
1085
    effect[0] = new VertexEffectScale(scale);
1086
    effect[1] = new VertexEffectMove(move0);
1087
    effect[2] = new VertexEffectScale(flipZ);
1088
    effect[3] = new VertexEffectRotate(angle1,axisX,cent0);
1089
    effect[4] = new VertexEffectMove(move1);
1090
    effect[5] = new VertexEffectRotate(angle1,axisY,cent0);
1091
    effect[6] = new VertexEffectMove(move2);
1092
    effect[7] = new VertexEffectScale(flipX);
1093
    effect[8] = new VertexEffectRotate(angle2,axisX,cent0);
1094
    effect[9] = new VertexEffectMove(move3);
1095
    effect[10]= new VertexEffectRotate(angle3,axis ,cent1);
1096
    effect[11]= new VertexEffectScale(flipX);
1097

    
1098
    effect[0].setMeshAssociation(63,-1);  // meshes 0,1,2,3,4,5
1099
    effect[1].setMeshAssociation( 3,-1);  // meshes 0,1
1100
    effect[2].setMeshAssociation( 2,-1);  // mesh 1
1101
    effect[3].setMeshAssociation( 2,-1);  // mesh 1
1102
    effect[4].setMeshAssociation(12,-1);  // meshes 2,3
1103
    effect[5].setMeshAssociation(60,-1);  // meshes 2,3,4,5
1104
    effect[6].setMeshAssociation(12,-1);  // meshes 2,3
1105
    effect[7].setMeshAssociation( 8,-1);  // mesh 3
1106
    effect[8].setMeshAssociation(48,-1);  // meshes 4,5
1107
    effect[9].setMeshAssociation(48,-1);  // meshes 4,5
1108
    effect[10].setMeshAssociation(48,-1); // meshes 4,5
1109
    effect[11].setMeshAssociation(32,-1); // mesh 5
1110

    
1111
    return effect;
1112
    }
1113

    
1114
///////////////////////////////////////////////////////////////////////////////////////////////////
1115

    
1116
  VertexEffect[] createVertexEffectsRediCorner()
1117
    {
1118
    Static3D axisY   = new Static3D(0,1,0);
1119
    Static3D axisX   = new Static3D(1,0,0);
1120
    Static3D axisZ   = new Static3D(0,0,1);
1121
    Static3D center  = new Static3D(0,0,0);
1122
    Static1D angle90 = new Static1D(90);
1123
    Static1D angle270= new Static1D(270);
1124
    Static1D angle45 = new Static1D(-45);
1125
    Static3D scale   = new Static3D(1.0f, SQ2, 1.0f);
1126

    
1127
    VertexEffect[] effect = new VertexEffect[7];
1128

    
1129
    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
1130
    effect[1] = new VertexEffectRotate( angle270, axisX, center );
1131
    effect[2] = new VertexEffectRotate( angle90 , axisY, center );
1132
    effect[3] = new VertexEffectScale(scale);
1133
    effect[4] = new VertexEffectRotate( angle45 , axisX, center );
1134
    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
1135
    effect[6] = new VertexEffectRotate( angle270, axisZ, center );
1136

    
1137
    effect[0].setMeshAssociation( 7,-1);  // 0,1,2
1138
    effect[1].setMeshAssociation( 2,-1);  // 1
1139
    effect[2].setMeshAssociation( 4,-1);  // 2
1140
    effect[3].setMeshAssociation(56,-1);  // 3,4,5
1141
    effect[4].setMeshAssociation(56,-1);  // 3,4,5
1142
    effect[5].setMeshAssociation(16,-1);  // 4
1143
    effect[6].setMeshAssociation(32,-1);  // 5
1144

    
1145
    return effect;
1146
    }
1147

    
1148
///////////////////////////////////////////////////////////////////////////////////////////////////
1149

    
1150
  VertexEffect[] createVertexEffectsIvyCorner()
1151
    {
1152
    Static3D axisX  = new Static3D(1,0,0);
1153
    Static3D axisY  = new Static3D(0,1,0);
1154
    Static1D angle1 = new Static1D(+90);
1155
    Static1D angle2 = new Static1D(-90);
1156
    Static3D center = new Static3D(0,0,0);
1157
    Static3D move1  = new Static3D(IVY_M-0.5f,IVY_M-0.5f,0);
1158

    
1159
    VertexEffect[] effect = new VertexEffect[5];
1160

    
1161
    effect[0] = new VertexEffectScale(1/IVY_C);
1162
    effect[1] = new VertexEffectMove(move1);
1163
    effect[2] = new VertexEffectScale(new Static3D(1,1,-1));
1164
    effect[3] = new VertexEffectRotate(angle1,axisX,center);
1165
    effect[4] = new VertexEffectRotate(angle2,axisY,center);
1166

    
1167
    effect[2].setMeshAssociation(54,-1);  // meshes 1,2,4,5
1168
    effect[3].setMeshAssociation(18,-1);  // meshes 1,4
1169
    effect[4].setMeshAssociation(36,-1);  // meshes 2,5
1170

    
1171
    return effect;
1172
    }
1173

    
1174
///////////////////////////////////////////////////////////////////////////////////////////////////
1175

    
1176
  VertexEffect[] createVertexEffectsRexEdge()
1177
    {
1178
    final float H = 1.0f - SQ3/2;
1179
    final float D = 0.5f - REX_D;
1180
    final float F = H*D;
1181

    
1182
    Static3D move  = new Static3D(0.0f,   -F, 0.0f);
1183
    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
1184
    Static3D axisX = new Static3D(1.0f, 0.0f, 0.0f);
1185
    Static3D axisY = new Static3D(0.0f, 1.0f, 0.0f);
1186

    
1187
    Static1D angle180 = new Static1D(180);
1188
    Static1D angle90  = new Static1D( 90);
1189

    
1190
    VertexEffect[] effect = new VertexEffect[3];
1191

    
1192
    effect[0] = new VertexEffectMove(move);
1193
    effect[1] = new VertexEffectRotate(angle180, axisY, center);
1194
    effect[2] = new VertexEffectRotate(angle90 , axisX, center);
1195

    
1196
    effect[1].setMeshAssociation(10,-1);  // meshes 1 & 3
1197
    effect[2].setMeshAssociation(10,-1);  // meshes 1 & 3
1198

    
1199
    return effect;
1200
    }
1201

    
1202
///////////////////////////////////////////////////////////////////////////////////////////////////
1203

    
1204
  VertexEffect[] createVertexEffectsRexCorner()
1205
    {
1206
    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
1207
    Static3D axisZ = new Static3D(0.0f, 0.0f, 1.0f);
1208
    Static1D angle = new Static1D(45);
1209

    
1210
    VertexEffect[] effect = new VertexEffect[1];
1211
    effect[0] = new VertexEffectRotate(angle, axisZ, center);
1212

    
1213
    return effect;
1214
    }
1215

    
1216
///////////////////////////////////////////////////////////////////////////////////////////////////
1217
// OBJECTS
1218
///////////////////////////////////////////////////////////////////////////////////////////////////
1219
// CUBE
1220

    
1221
  MeshBase createCubeMesh(int index)
1222
    {
1223
    MeshBase mesh = createFacesCube(index);
1224
    VertexEffect[] effects = createVertexEffectsCube();
1225
    for( VertexEffect effect : effects ) mesh.apply(effect);
1226

    
1227
    Static3D roundingCenter  = new Static3D(0,0,0);
1228
    Static3D[] vertices = new Static3D[8];
1229
    vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f);
1230
    vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f);
1231
    vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f);
1232
    vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f);
1233
    vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f);
1234
    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
1235
    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
1236
    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
1237

    
1238
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.12f);
1239

    
1240
    mesh.mergeEffComponents();
1241

    
1242
    return mesh;
1243
    }
1244

    
1245
///////////////////////////////////////////////////////////////////////////////////////////////////
1246
// SKEWB
1247

    
1248
  MeshBase createSkewbCornerMesh()
1249
    {
1250
    MeshBase mesh = createFacesSkewbCorner();
1251
    VertexEffect[] effects = createVertexEffectsSkewbCorner();
1252
    for( VertexEffect effect : effects ) mesh.apply(effect);
1253

    
1254
    float E = 0.5f;
1255
    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
1256

    
1257
    Static3D[] verticesType1 = new Static3D[1];
1258
    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
1259
    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
1260

    
1261
    Static3D[] verticesType2 = new Static3D[3];
1262
    verticesType2[0] = new Static3D(-E, 0, 0);
1263
    verticesType2[1] = new Static3D( 0,-E, 0);
1264
    verticesType2[2] = new Static3D( 0, 0,-E);
1265
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1266

    
1267
    mesh.mergeEffComponents();
1268

    
1269
    return mesh;
1270
    }
1271

    
1272
///////////////////////////////////////////////////////////////////////////////////////////////////
1273

    
1274
  MeshBase createSkewbFaceMesh()
1275
    {
1276
    MeshBase mesh = createFacesSkewbFace();
1277
    VertexEffect[] effects = createVertexEffectsSkewbFace();
1278
    for( VertexEffect effect : effects ) mesh.apply(effect);
1279

    
1280
    Static3D roundingCenter = new Static3D(0,0,-0.2f);
1281
    float E = SQ2/4;
1282
    Static3D[] vertices = new Static3D[4];
1283
    vertices[0] = new Static3D(-E*SQ2,      0, 0);
1284
    vertices[1] = new Static3D(+E*SQ2,      0, 0);
1285
    vertices[2] = new Static3D(     0, -E*SQ2, 0);
1286
    vertices[3] = new Static3D(     0, +E*SQ2, 0);
1287
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.10f);
1288

    
1289
    mesh.mergeEffComponents();
1290
    mesh.addEmptyTexComponent();
1291

    
1292
    return mesh;
1293
    }
1294

    
1295
///////////////////////////////////////////////////////////////////////////////////////////////////
1296
// SKEWB DIAMOND / PYRAMINX
1297

    
1298
  MeshBase createOctaMesh()
1299
    {
1300
    MeshBase mesh = createFacesOcta();
1301
    VertexEffect[] effects = createVertexEffectsOcta();
1302
    for( VertexEffect effect : effects ) mesh.apply(effect);
1303

    
1304
    Static3D roundingCenter = new Static3D(0,0,0);
1305
    Static3D[] vertices = new Static3D[6];
1306
    vertices[0] = new Static3D(    0, SQ2/2,    0 );
1307
    vertices[1] = new Static3D( 0.5f,     0, 0.5f );
1308
    vertices[2] = new Static3D(-0.5f,     0, 0.5f );
1309
    vertices[3] = new Static3D(    0,-SQ2/2,    0 );
1310
    vertices[4] = new Static3D(-0.5f,     0,-0.5f );
1311
    vertices[5] = new Static3D( 0.5f,     0,-0.5f );
1312

    
1313
    roundCorners(mesh,roundingCenter,vertices,0.06f,0.20f);
1314

    
1315
    mesh.mergeEffComponents();
1316

    
1317
    return mesh;
1318
    }
1319

    
1320
///////////////////////////////////////////////////////////////////////////////////////////////////
1321

    
1322
  MeshBase createTetraMesh()
1323
    {
1324
    MeshBase mesh = createFacesTetra();
1325
    VertexEffect[] effects = createVertexEffectsTetra();
1326
    for( VertexEffect effect : effects ) mesh.apply(effect);
1327

    
1328
    Static3D roundingCenter = new Static3D(0,0,0);
1329
    Static3D[] verticesRound = new Static3D[4];
1330
    verticesRound[0] = new Static3D(-0.5f,+SQ2/4,   0 );
1331
    verticesRound[1] = new Static3D(+0.5f,+SQ2/4,   0 );
1332
    verticesRound[2] = new Static3D(    0,-SQ2/4,+0.5f);
1333
    verticesRound[3] = new Static3D(    0,-SQ2/4,-0.5f);
1334
    roundCorners(mesh,roundingCenter,verticesRound,0.08f,0.15f);
1335

    
1336
    mesh.mergeEffComponents();
1337
    mesh.addEmptyTexComponent();
1338
    mesh.addEmptyTexComponent();
1339
    mesh.addEmptyTexComponent();
1340
    mesh.addEmptyTexComponent();
1341

    
1342
    return mesh;
1343
    }
1344

    
1345
///////////////////////////////////////////////////////////////////////////////////////////////////
1346
// DINO
1347

    
1348
  MeshBase createDinoMesh()
1349
    {
1350
    MeshBase mesh = createFacesDino();
1351
    VertexEffect[] effects = createVertexEffectsDino();
1352
    for( VertexEffect effect : effects ) mesh.apply(effect);
1353

    
1354
    float F = 0.5f;
1355
    Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F);
1356
    Static3D[] verticesRound = new Static3D[4];
1357
    verticesRound[0] = new Static3D(     0,-3*F,    0 );
1358
    verticesRound[1] = new Static3D(     0,   0, -3*F );
1359
    verticesRound[2] = new Static3D(  -3*F,   0,    0 );
1360
    verticesRound[3] = new Static3D(  +3*F,   0,    0 );
1361
    roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f);
1362

    
1363
    mesh.mergeEffComponents();
1364

    
1365
    return mesh;
1366
    }
1367

    
1368
///////////////////////////////////////////////////////////////////////////////////////////////////
1369
// Helicopter
1370

    
1371
  MeshBase createHelicopterCornerMesh()
1372
    {
1373
    MeshBase mesh = createFacesHelicopterCorner();
1374
    VertexEffect[] effects = createVertexEffectsHelicopterCorner();
1375
    for( VertexEffect effect : effects ) mesh.apply(effect);
1376

    
1377
    float E = 0.5f;
1378
    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
1379

    
1380
    Static3D[] verticesType1 = new Static3D[1];
1381
    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
1382
    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
1383

    
1384
    Static3D[] verticesType2 = new Static3D[3];
1385
    verticesType2[0] = new Static3D(-E, 0, 0);
1386
    verticesType2[1] = new Static3D( 0,-E, 0);
1387
    verticesType2[2] = new Static3D( 0, 0,-E);
1388
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1389

    
1390
    mesh.mergeEffComponents();
1391

    
1392
    return mesh;
1393
    }
1394

    
1395
///////////////////////////////////////////////////////////////////////////////////////////////////
1396

    
1397
  MeshBase createHelicopterFaceMesh()
1398
    {
1399
    MeshBase mesh = createFacesHelicopterFace();
1400
    VertexEffect[] effects = createVertexEffectsHelicopterFace();
1401
    for( VertexEffect effect : effects ) mesh.apply(effect);
1402

    
1403
    float E = 0.5f;
1404
    Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
1405

    
1406
    Static3D[] verticesType1 = new Static3D[1];
1407
    verticesType1[0] = new Static3D(E/3,E/3,0.0f);
1408
    roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f);
1409

    
1410
    Static3D[] verticesType2 = new Static3D[2];
1411
    verticesType2[0] = new Static3D(-E+E/3, E/3  , 0);
1412
    verticesType2[1] = new Static3D( E/3  ,-E+E/3, 0);
1413
    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
1414

    
1415
    mesh.mergeEffComponents();
1416
    mesh.addEmptyTexComponent();
1417
    mesh.addEmptyTexComponent();
1418

    
1419
    return mesh;
1420
    }
1421

    
1422
///////////////////////////////////////////////////////////////////////////////////////////////////
1423
// Redi cube
1424

    
1425
  MeshBase createRediEdgeMesh()
1426
    {
1427
    MeshBase mesh = createFacesRediEdge();
1428
    VertexEffect[] effects = createVertexEffectsRediEdge();
1429
    for( VertexEffect effect : effects ) mesh.apply(effect);
1430

    
1431
    Static3D center = new Static3D(0.0f,-0.75f,-0.75f);
1432
    Static3D[] vertices = new Static3D[2];
1433
    vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f);
1434
    vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f);
1435
    roundCorners(mesh,center,vertices,0.06f,0.20f);
1436

    
1437
    mesh.mergeEffComponents();
1438

    
1439
    return mesh;
1440
    }
1441

    
1442
///////////////////////////////////////////////////////////////////////////////////////////////////
1443

    
1444
  MeshBase createRediCornerMesh()
1445
    {
1446
    MeshBase mesh = createFacesRediCorner();
1447
    VertexEffect[] effects = createVertexEffectsRediCorner();
1448
    for( VertexEffect effect : effects ) mesh.apply(effect);
1449

    
1450
    Static3D center = new Static3D(0,0,0);
1451
    Static3D[] vertices = new Static3D[8];
1452
    vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f);
1453
    vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f);
1454
    vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f);
1455
    vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f);
1456
    vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f);
1457
    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
1458
    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
1459
    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
1460

    
1461
    roundCorners(mesh,center,vertices,0.06f,0.12f);
1462

    
1463
    mesh.mergeEffComponents();
1464

    
1465
    return mesh;
1466
    }
1467

    
1468
///////////////////////////////////////////////////////////////////////////////////////////////////
1469

    
1470
  MeshBase createIvyCornerMesh()
1471
    {
1472
    MeshBase mesh = createFacesIvyCorner();
1473
    VertexEffect[] effects = createVertexEffectsIvyCorner();
1474
    for( VertexEffect effect : effects ) mesh.apply(effect);
1475

    
1476
    Static3D center = new Static3D(-0.5f,-0.5f,-0.5f);
1477
    Static3D[] vertices = new Static3D[4];
1478
    vertices[0] = new Static3D(+0.0f,+0.0f,+0.0f);
1479
    vertices[1] = new Static3D(-1.0f,+0.0f,+0.0f);
1480
    vertices[2] = new Static3D(+0.0f,-1.0f,+0.0f);
1481
    vertices[3] = new Static3D(+0.0f,+0.0f,-1.0f);
1482

    
1483
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1484

    
1485
    mesh.mergeEffComponents();
1486

    
1487
    return mesh;
1488
    }
1489

    
1490
///////////////////////////////////////////////////////////////////////////////////////////////////
1491

    
1492
  MeshBase createIvyFaceMesh()
1493
    {
1494
    MeshBase mesh = createFacesIvyFace();
1495

    
1496
    Static3D center = new Static3D(-0.0f,-0.0f,-0.5f);
1497
    Static3D[] vertices = new Static3D[2];
1498
    vertices[0] = new Static3D(-0.5f,+0.5f,+0.0f);
1499
    vertices[1] = new Static3D(+0.5f,-0.5f,+0.0f);
1500

    
1501
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1502

    
1503
    mesh.mergeEffComponents();
1504
    mesh.addEmptyTexComponent();
1505
    mesh.addEmptyTexComponent();
1506
    mesh.addEmptyTexComponent();
1507
    mesh.addEmptyTexComponent();
1508

    
1509
    return mesh;
1510
    }
1511

    
1512
///////////////////////////////////////////////////////////////////////////////////////////////////
1513

    
1514
  MeshBase createRexCornerMesh()
1515
    {
1516
    MeshBase mesh = createFacesRexCorner();
1517
    VertexEffect[] effects = createVertexEffectsRexCorner();
1518
    for( VertexEffect effect : effects ) mesh.apply(effect);
1519

    
1520
    Static3D center = new Static3D(0.0f,0.0f,-0.25f);
1521
    Static3D[] vertices = new Static3D[1];
1522
    vertices[0] = new Static3D(+0.25f,+0.25f,+0.0f);
1523
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1524

    
1525
    mesh.mergeEffComponents();
1526
    mesh.addEmptyTexComponent();
1527
    mesh.addEmptyTexComponent();
1528

    
1529
    return mesh;
1530
    }
1531

    
1532
///////////////////////////////////////////////////////////////////////////////////////////////////
1533

    
1534
  MeshBase createRexFaceMesh()
1535
    {
1536
    MeshBase mesh = createFacesRexFace();
1537

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

    
1542
    return mesh;
1543
    }
1544

    
1545
///////////////////////////////////////////////////////////////////////////////////////////////////
1546

    
1547
  MeshBase createRexEdgeMesh()
1548
    {
1549
    MeshBase mesh = createFacesRexEdge();
1550
    VertexEffect[] effects = createVertexEffectsRexEdge();
1551
    for( VertexEffect effect : effects ) mesh.apply(effect);
1552

    
1553
    Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
1554
    Static3D[] vertices = new Static3D[2];
1555
    vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
1556
    vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
1557
    roundCorners(mesh,center,vertices,0.03f,0.10f);
1558

    
1559
    mesh.mergeEffComponents();
1560

    
1561
    return mesh;
1562
    }
1563
  }
(1-1/5)