Revision d32fe3d9
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
46 | 46 |
import org.distorted.objectlib.helpers.FactoryCubit; |
47 | 47 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
48 | 48 |
import org.distorted.objectlib.helpers.ObjectShape; |
49 |
import org.distorted.objectlib.main.TwistyObject; |
|
50 |
import org.distorted.objectlib.objects.TwistyContainer; |
|
49 | 51 |
|
50 | 52 |
import java.io.DataInputStream; |
51 | 53 |
import java.io.IOException; |
... | ... | |
62 | 64 |
|
63 | 65 |
class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener |
64 | 66 |
{ |
65 |
private static final float SQ2 = (float)Math.sqrt(2); |
|
66 | 67 |
private static final float SQ3 = (float)Math.sqrt(3); |
67 |
private static final float SQ5 = (float)Math.sqrt(5); |
|
68 | 68 |
private final float DEFAULT_SCALE = 0.3f; |
69 | 69 |
|
70 | 70 |
private final GLSurfaceView mView; |
... | ... | |
289 | 289 |
|
290 | 290 |
private void createMesh() |
291 | 291 |
{ |
292 |
int mode =24; |
|
293 |
int numComponents = 0; |
|
294 |
float[][] vertices = null; |
|
295 |
int[][] vertIndexes = null; |
|
296 |
float[][] bands = null; |
|
297 |
int[] bandIndexes = null; |
|
298 |
float[][] corners = null; |
|
299 |
int[] cornerIndexes = null; |
|
300 |
float[][] centers = null; |
|
301 |
int[] centerIndexes = null; |
|
302 |
float[] convexCenter= null; |
|
303 |
|
|
304 |
///// CUBE //////////////////////////////////////////////////////////////////////////////// |
|
305 |
|
|
306 |
if( mode==0 ) |
|
307 |
{ |
|
308 |
vertices = new float[][] |
|
309 |
{ |
|
310 |
{ 0.5f, 0.5f, 0.5f }, |
|
311 |
{ 0.5f, 0.5f,-0.5f }, |
|
312 |
{ 0.5f,-0.5f, 0.5f }, |
|
313 |
{ 0.5f,-0.5f,-0.5f }, |
|
314 |
{-0.5f, 0.5f, 0.5f }, |
|
315 |
{-0.5f, 0.5f,-0.5f }, |
|
316 |
{-0.5f,-0.5f, 0.5f }, |
|
317 |
{-0.5f,-0.5f,-0.5f }, |
|
318 |
}; |
|
319 |
|
|
320 |
vertIndexes = new int[][] |
|
321 |
{ |
|
322 |
{2,3,1,0}, // counterclockwise! |
|
323 |
{7,6,4,5}, |
|
324 |
{4,0,1,5}, |
|
325 |
{7,3,2,6}, |
|
326 |
{6,2,0,4}, |
|
327 |
{3,7,5,1} |
|
328 |
}; |
|
329 |
|
|
330 |
bands = new float[][] |
|
331 |
{ |
|
332 |
{0.05f,40,0.5f,0.2f,5, 2,2} |
|
333 |
}; |
|
334 |
|
|
335 |
bandIndexes = new int[] { 0,0,0,0,0,0 }; |
|
336 |
|
|
337 |
corners = new float[][] |
|
338 |
{ |
|
339 |
{ 0.01f, 0.10f } |
|
340 |
}; |
|
341 |
|
|
342 |
cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
343 |
|
|
344 |
centers = new float[][] |
|
345 |
{ |
|
346 |
{ 0.0f, 0.0f, 0.0f } |
|
347 |
}; |
|
348 |
|
|
349 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
350 |
|
|
351 |
numComponents = 8; |
|
352 |
} |
|
353 |
|
|
354 |
///// TETRAHEDRON ////////////////////////////////////////////////////////////////////////// |
|
355 |
|
|
356 |
else if( mode==1 ) |
|
357 |
{ |
|
358 |
vertices = new float[][] |
|
359 |
{ |
|
360 |
{-0.5f, SQ2/4, 0.0f}, |
|
361 |
{ 0.5f, SQ2/4, 0.0f}, |
|
362 |
{ 0.0f,-SQ2/4, 0.5f}, |
|
363 |
{ 0.0f,-SQ2/4,-0.5f} |
|
364 |
}; |
|
365 |
|
|
366 |
vertIndexes = new int[][] |
|
367 |
{ |
|
368 |
{2,1,0}, // counterclockwise! |
|
369 |
{2,3,1}, |
|
370 |
{3,2,0}, |
|
371 |
{3,0,1} |
|
372 |
}; |
|
373 |
|
|
374 |
bands = new float[][] |
|
375 |
{ |
|
376 |
{0.05f,30,0.6f,0.5f,5, 2,2} |
|
377 |
}; |
|
378 |
|
|
379 |
bandIndexes = new int[] { 0,0,0,0 }; |
|
380 |
|
|
381 |
corners = new float[][] |
|
382 |
{ |
|
383 |
{ 0.02f, 0.10f } |
|
384 |
}; |
|
385 |
|
|
386 |
cornerIndexes = new int[] { 0,0,0,0 }; |
|
387 |
|
|
388 |
centers = new float[][] |
|
389 |
{ |
|
390 |
{ 0.0f, 0.0f, 0.0f } |
|
391 |
}; |
|
392 |
|
|
393 |
centerIndexes = new int[] { 0,0,0,0 }; |
|
394 |
|
|
395 |
numComponents = 4; |
|
396 |
} |
|
397 |
|
|
398 |
///// DINO //////////////////////////////////////////////////////////////////////////////// |
|
399 |
|
|
400 |
else if( mode==2 ) |
|
401 |
{ |
|
402 |
vertices = new float[][] |
|
403 |
{ |
|
404 |
{-1.5f, 0.0f, 0.0f}, |
|
405 |
{ 1.5f, 0.0f, 0.0f}, |
|
406 |
{ 0.0f,-1.5f, 0.0f}, |
|
407 |
{ 0.0f, 0.0f,-1.5f} |
|
408 |
}; |
|
409 |
|
|
410 |
vertIndexes = new int[][] |
|
411 |
{ |
|
412 |
{2,1,0}, // counterclockwise! |
|
413 |
{3,0,1}, |
|
414 |
{2,3,1}, |
|
415 |
{3,2,0}, |
|
416 |
}; |
|
417 |
|
|
418 |
bands = new float[][] |
|
419 |
{ |
|
420 |
{0.035f,30,0.16f,0.8f,6,2,2}, |
|
421 |
{0.010f,45,0.16f,0.2f,6,2,2} |
|
422 |
}; |
|
423 |
|
|
424 |
bandIndexes = new int[] { 0,0,1,1 }; |
|
425 |
|
|
426 |
corners = new float[][] |
|
427 |
{ |
|
428 |
{0.07f,0.40f}, |
|
429 |
{0.05f,0.30f} |
|
430 |
}; |
|
431 |
|
|
432 |
cornerIndexes = new int[] { 0,0,1,1 }; |
|
433 |
|
|
434 |
centers = new float[][] |
|
435 |
{ |
|
436 |
{ 0.0f,-0.75f,-0.75f } |
|
437 |
}; |
|
438 |
|
|
439 |
centerIndexes = new int[] { 0,0,0,0 }; |
|
440 |
|
|
441 |
numComponents = 4; |
|
442 |
} |
|
443 |
|
|
444 |
///// OCTAHEDRON //////////////////////////////////////////////////////////////////////////// |
|
445 |
|
|
446 |
else if( mode==3 ) |
|
447 |
{ |
|
448 |
vertices = new float[][] |
|
449 |
{ |
|
450 |
{ 0.5f, 0.0f, 0.5f}, |
|
451 |
{ 0.5f, 0.0f,-0.5f}, |
|
452 |
{-0.5f, 0.0f,-0.5f}, |
|
453 |
{-0.5f, 0.0f, 0.5f}, |
|
454 |
{ 0.0f, SQ2/2, 0.0f}, |
|
455 |
{ 0.0f, -SQ2/2, 0.0f}, |
|
456 |
}; |
|
457 |
|
|
458 |
vertIndexes = new int[][] |
|
459 |
{ |
|
460 |
{3,0,4}, // counterclockwise! |
|
461 |
{0,1,4}, |
|
462 |
{1,2,4}, |
|
463 |
{2,3,4}, |
|
464 |
{5,0,3}, |
|
465 |
{5,1,0}, |
|
466 |
{5,2,1}, |
|
467 |
{5,3,2} |
|
468 |
}; |
|
469 |
|
|
470 |
bands = new float[][] |
|
471 |
{ |
|
472 |
{0.05f,17,0.5f,0.2f,5, 2,2} |
|
473 |
}; |
|
474 |
|
|
475 |
bandIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
476 |
|
|
477 |
corners = new float[][] |
|
478 |
{ |
|
479 |
{ 0.03f, 0.12f } |
|
480 |
}; |
|
481 |
|
|
482 |
cornerIndexes = new int[] { 0,0,0,0,0,0 }; |
|
483 |
|
|
484 |
centers = new float[][] |
|
485 |
{ |
|
486 |
{ 0.0f, 0.0f, 0.0f } |
|
487 |
}; |
|
488 |
|
|
489 |
centerIndexes = new int[] { 0,0,0,0,0,0 }; |
|
490 |
|
|
491 |
numComponents = 8; |
|
492 |
} |
|
493 |
|
|
494 |
///// KILOMINX EDGE //////////////////////////////////////////////////////////////////////// |
|
495 |
|
|
496 |
else if( mode==4 ) |
|
497 |
{ |
|
498 |
float SQ5 = (float)Math.sqrt(5); |
|
499 |
float SIN18= (SQ5-1)/4; |
|
500 |
float COS18= 0.25f*(float)Math.sqrt(10.0+2.0*SQ5); |
|
501 |
float H = 1.0f; |
|
502 |
float L = 2.0f; |
|
503 |
float X = H*(float)Math.sqrt((5+SQ5)/10); |
|
504 |
float Y = H*(float)Math.sqrt((5-SQ5)/10); |
|
505 |
float D = H*SIN18/COS18; |
|
506 |
|
|
507 |
vertices = new float[][] |
|
508 |
{ |
|
509 |
{ 0.0f, Y, L/2}, |
|
510 |
{ X, 0.0f, L/2}, |
|
511 |
{ 0.0f, -Y, L/2}, |
|
512 |
{ -X, 0.0f, L/2}, |
|
513 |
{ 0.0f, Y, -L/2 +D}, |
|
514 |
{ X, 0.0f,-L/2 }, |
|
515 |
{ 0.0f, -Y, -L/2-D }, |
|
516 |
{ -X, 0.0f,-L/2 } |
|
517 |
}; |
|
518 |
|
|
519 |
vertIndexes = new int[][] |
|
520 |
{ |
|
521 |
{3,2,1,0}, // counterclockwise! |
|
522 |
{0,1,5,4}, |
|
523 |
{3,0,4,7}, |
|
524 |
{2,1,5,6}, |
|
525 |
{3,2,6,7}, |
|
526 |
{4,5,6,7} |
|
527 |
}; |
|
528 |
|
|
529 |
bands = new float[][] |
|
530 |
{ |
|
531 |
{0.04f,13,(float)(L/3),(float)L/8, 5,2,3}, |
|
532 |
{0.00f, 0,(float)(L/2),(float)L/4, 5,2,3} |
|
533 |
}; |
|
534 |
|
|
535 |
bandIndexes = new int[] { 1,0,0,1,1,1 }; |
|
536 |
|
|
537 |
corners = new float[][] |
|
538 |
{ |
|
539 |
{ 0.04f, 0.12f } |
|
540 |
}; |
|
541 |
|
|
542 |
cornerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 }; |
|
543 |
|
|
544 |
centers = new float[][] |
|
545 |
{ |
|
546 |
{ 0.0f, 0.0f, 0.0f } |
|
547 |
}; |
|
548 |
|
|
549 |
centerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 }; |
|
550 |
|
|
551 |
numComponents = 6; |
|
552 |
} |
|
553 |
|
|
554 |
///// IVY_CORNER //////////////////////////////////////////////////////////////////////// |
|
555 |
|
|
556 |
else if( mode==5 ) |
|
557 |
{ |
|
558 |
int IVY_N = 8; |
|
559 |
final float IVY_D = 0.003f; |
|
560 |
final float angle = (float)Math.PI/(2*IVY_N); |
|
561 |
final float CORR = 1.0f - 2*IVY_D; |
|
562 |
|
|
563 |
vertices = new float[3*IVY_N+7][3]; |
|
564 |
vertIndexes = new int[6][IVY_N+4]; |
|
565 |
|
|
566 |
vertices[0][0] = 0.0f; |
|
567 |
vertices[0][1] = 0.0f; |
|
568 |
vertices[0][2] = 0.0f; |
|
569 |
vertices[1][0] =-1.0f; |
|
570 |
vertices[1][1] = 0.0f; |
|
571 |
vertices[1][2] = 0.0f; |
|
572 |
vertices[2][0] = 0.0f; |
|
573 |
vertices[2][1] =-1.0f; |
|
574 |
vertices[2][2] = 0.0f; |
|
575 |
vertices[3][0] = 0.0f; |
|
576 |
vertices[3][1] = 0.0f; |
|
577 |
vertices[3][2] =-1.0f; |
|
578 |
|
|
579 |
vertIndexes[0][0] = 2; |
|
580 |
vertIndexes[0][1] = 0; |
|
581 |
vertIndexes[0][2] = 1; |
|
582 |
vertIndexes[3][0] = 2; |
|
583 |
vertIndexes[3][1] = 0; |
|
584 |
vertIndexes[3][2] = 1; |
|
585 |
|
|
586 |
vertIndexes[1][0] = 3; |
|
587 |
vertIndexes[1][1] = 0; |
|
588 |
vertIndexes[1][2] = 2; |
|
589 |
vertIndexes[4][0] = 3; |
|
590 |
vertIndexes[4][1] = 0; |
|
591 |
vertIndexes[4][2] = 2; |
|
592 |
|
|
593 |
vertIndexes[2][0] = 1; |
|
594 |
vertIndexes[2][1] = 0; |
|
595 |
vertIndexes[2][2] = 3; |
|
596 |
vertIndexes[5][0] = 1; |
|
597 |
vertIndexes[5][1] = 0; |
|
598 |
vertIndexes[5][2] = 3; |
|
599 |
|
|
600 |
int N1 = 4; |
|
601 |
int N2 = N1 + IVY_N + 1; |
|
602 |
int N3 = N2 + IVY_N + 1; |
|
603 |
|
|
604 |
for(int i=0; i<=IVY_N; i++) |
|
605 |
{ |
|
606 |
float cos1 = (float)Math.cos((IVY_N-i)*angle); |
|
607 |
float sin1 = (float)Math.sin((IVY_N-i)*angle); |
|
608 |
float cos2 = (float)Math.cos(( i)*angle); |
|
609 |
float sin2 = (float)Math.sin(( i)*angle); |
|
610 |
|
|
611 |
vertices[N1+i][0] = CORR*(cos1-0.5f) - 0.5f; |
|
612 |
vertices[N1+i][1] = CORR*(sin1-0.5f) - 0.5f; |
|
613 |
vertices[N1+i][2] = 0.0f; |
|
614 |
|
|
615 |
vertices[N2+i][0] = 0.0f; |
|
616 |
vertices[N2+i][1] = CORR*(sin2-0.5f) - 0.5f; |
|
617 |
vertices[N2+i][2] = CORR*(cos2-0.5f) - 0.5f; |
|
618 |
|
|
619 |
vertices[N3+i][0] = CORR*(cos2-0.5f) - 0.5f; |
|
620 |
vertices[N3+i][1] = 0.0f; |
|
621 |
vertices[N3+i][2] = CORR*(sin2-0.5f) - 0.5f; |
|
622 |
|
|
623 |
vertIndexes[0][i+3] = N1 + i; |
|
624 |
vertIndexes[1][i+3] = N2 + i; |
|
625 |
vertIndexes[2][i+3] = N3 + i; |
|
626 |
vertIndexes[3][i+3] = N1 + i; |
|
627 |
vertIndexes[4][i+3] = N2 + i; |
|
628 |
vertIndexes[5][i+3] = N3 + i; |
|
629 |
} |
|
630 |
|
|
631 |
bands = new float[][] |
|
632 |
{ |
|
633 |
{+0.012f,20,0.2f,0.5f,7,1,2}, |
|
634 |
{-0.100f,20,0.2f,0.0f,2,1,2} |
|
635 |
}; |
|
292 |
Static4D quat = new Static4D(0,0,0,1); |
|
293 |
Static3D move = new Static3D(0,0,0); |
|
294 |
float scale = 1.0f; |
|
295 |
int variant = 1; |
|
636 | 296 |
|
637 |
bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
297 |
int[] numLayers = new int[] {2,2,2,2}; |
|
298 |
TwistyObject puzzle = new TwistyContainer(numLayers,MESH_NICE,quat,move,scale,null); |
|
638 | 299 |
|
639 |
corners = new float[][] |
|
640 |
{ |
|
641 |
{ 0.04f, 0.12f } |
|
642 |
}; |
|
643 |
|
|
644 |
cornerIndexes = new int[3*IVY_N+7]; |
|
645 |
|
|
646 |
centers = new float[][] |
|
647 |
{ |
|
648 |
{-0.5f,-0.5f,-0.5f} |
|
649 |
}; |
|
650 |
|
|
651 |
centerIndexes = new int[3*IVY_N+7]; |
|
652 |
|
|
653 |
for(int i=0; i<4; i++) |
|
654 |
{ |
|
655 |
cornerIndexes[i] = 0; |
|
656 |
centerIndexes[i] = 0; |
|
657 |
} |
|
658 |
for(int i=4; i<3*IVY_N+7; i++) |
|
659 |
{ |
|
660 |
cornerIndexes[i] = -1; |
|
661 |
centerIndexes[i] = -1; |
|
662 |
} |
|
663 |
|
|
664 |
float C = 0.5f - SQ2/4; |
|
665 |
convexCenter = new float[] {-C,-C,-C}; |
|
666 |
|
|
667 |
numComponents = 6; |
|
668 |
} |
|
669 |
|
|
670 |
///// IVY_FACE //////////////////////////////////////////////////////////////////////// |
|
671 |
|
|
672 |
else if( mode==6 ) |
|
673 |
{ |
|
674 |
int IVY_N = 6; |
|
675 |
final float IVY_D = 0.003f; |
|
676 |
final float angle = (float)Math.PI/(2*IVY_N); |
|
677 |
final float CORR = 1.0f - 2*IVY_D; |
|
678 |
|
|
679 |
vertices = new float[2*IVY_N][3]; |
|
680 |
vertIndexes= new int[2][2*IVY_N]; |
|
681 |
|
|
682 |
for(int i=0; i<IVY_N; i++) |
|
683 |
{ |
|
684 |
float cos = (float)Math.cos(i*angle); |
|
685 |
float sin = (float)Math.sin(i*angle); |
|
686 |
|
|
687 |
vertices[i ][0] = CORR*(0.5f-cos); |
|
688 |
vertices[i ][1] = CORR*(0.5f-sin); |
|
689 |
vertices[i ][2] = 0.0f; |
|
690 |
vertices[i+IVY_N][0] = CORR*(cos-0.5f); |
|
691 |
vertices[i+IVY_N][1] = CORR*(sin-0.5f); |
|
692 |
vertices[i+IVY_N][2] = 0.0f; |
|
693 |
|
|
694 |
vertIndexes[0][i ] = i; |
|
695 |
vertIndexes[0][i+IVY_N] = i+IVY_N; |
|
696 |
vertIndexes[1][i ] = i; |
|
697 |
vertIndexes[1][i+IVY_N] = i+IVY_N; |
|
698 |
} |
|
699 |
|
|
700 |
bands = new float[][] |
|
701 |
{ |
|
702 |
{+0.012f,20,0.2f,0.5f,7,1,2}, |
|
703 |
{-0.100f,20,0.2f,0.0f,2,1,2}, |
|
704 |
}; |
|
705 |
|
|
706 |
bandIndexes = new int[] { 0,1 }; |
|
707 |
|
|
708 |
corners = new float[][] |
|
709 |
{ |
|
710 |
{0.03f,0.10f} |
|
711 |
}; |
|
712 |
|
|
713 |
centers = new float[][] |
|
714 |
{ |
|
715 |
{-0.0f,-0.0f,-0.5f} |
|
716 |
}; |
|
717 |
|
|
718 |
cornerIndexes = new int[2*IVY_N]; |
|
719 |
centerIndexes = new int[2*IVY_N]; |
|
720 |
|
|
721 |
for(int i=0; i<2*IVY_N; i++) |
|
722 |
{ |
|
723 |
cornerIndexes[i] = -1; |
|
724 |
centerIndexes[i] = -1; |
|
725 |
} |
|
726 |
|
|
727 |
cornerIndexes[0 ] = 0; |
|
728 |
cornerIndexes[IVY_N] = 0; |
|
729 |
centerIndexes[0 ] = 0; |
|
730 |
centerIndexes[IVY_N] = 0; |
|
731 |
|
|
732 |
numComponents = 2; |
|
733 |
} |
|
734 |
|
|
735 |
///// SKEWB Ultimate SMALL ///////////////////////////////////////////////////////////// |
|
736 |
|
|
737 |
else if( mode==7 ) |
|
738 |
{ |
|
739 |
float S = (SQ5+1)/4; |
|
740 |
|
|
741 |
vertices = new float[][] |
|
742 |
{ |
|
743 |
{ 0.0f , 0.0f , 0.0f }, |
|
744 |
{ -0.5f*S , 0.5f*S+0.25f, -0.25f }, |
|
745 |
{-0.25f , -S/2 , (-2*S-1)/4 }, |
|
746 |
{ 0.5f*S+0.25f, 0.25f , -S/2 }, |
|
747 |
{ 0.0f , 0.5f , -S-0.5f }, |
|
748 |
{ 0.0f , 0.5f , 0.0f }, |
|
749 |
{ -0.5f*S ,-0.5f*S+0.25f, -0.25f }, |
|
750 |
{ 0.5f*S ,-0.5f*S+0.25f, -0.25f } |
|
751 |
}; |
|
752 |
|
|
753 |
vertIndexes = new int[][] |
|
754 |
{ |
|
755 |
{6,0,5,1}, // counterclockwise! |
|
756 |
{0,7,3,5}, |
|
757 |
{0,6,2,7}, |
|
758 |
{4,3,5,1}, |
|
759 |
{4,2,7,3}, |
|
760 |
{4,1,6,2}, |
|
761 |
}; |
|
762 |
|
|
763 |
bands = new float[][] |
|
764 |
{ |
|
765 |
{0.04f,17,0.5f,0.2f,5, 2,2}, |
|
766 |
{0.01f, 1,0.5f,0.2f,5, 2,2} |
|
767 |
}; |
|
768 |
|
|
769 |
bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
300 |
ObjectShape shape = puzzle.getObjectShape(variant); |
|
301 |
ObjectFaceShape face= puzzle.getObjectFaceShape(variant); |
|
770 | 302 |
|
771 |
corners = new float[][] |
|
772 |
{ |
|
773 |
{ 0.013f, 0.08f } |
|
774 |
}; |
|
775 |
|
|
776 |
cornerIndexes = new int[] { 0, 0, 0, 0,-1,0,0,0 }; |
|
777 |
|
|
778 |
centers = new float[][] |
|
779 |
{ |
|
780 |
{ 0.0f,-0.5f, (float)(-S-0.5) } |
|
781 |
}; |
|
782 |
|
|
783 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
784 |
|
|
785 |
numComponents = 8; |
|
786 |
} |
|
787 |
|
|
788 |
///// SKEWB Ultimate BIG /////////////////////////////////////////////////////////////// |
|
789 |
|
|
790 |
else if( mode==8 ) |
|
791 |
{ |
|
792 |
float S = (SQ5+1)/4; |
|
793 |
|
|
794 |
vertices = new float[][] |
|
795 |
{ |
|
796 |
{-S/2 ,-S/2+0.25f, 0.25f}, |
|
797 |
{ S/2 , S/2-0.25f, -0.25f}, |
|
798 |
{-S , 0.00f, 0.00f}, |
|
799 |
{ 0.25f, S/2 ,-S/2-0.25f}, |
|
800 |
{-S/2 ,-S/2-0.25f, 0.25f}, |
|
801 |
{ S/2+0.25f, -0.25f,-S/2 }, |
|
802 |
{-S , -0.50f, 0.00f}, |
|
803 |
{ 0.50f, 0.00f,-S }, |
|
804 |
{-S +0.25f, S/2 ,-S/2-0.25f}, |
|
805 |
{ 0.25f,-S/2-0.50f,-S/2+0.25f}, |
|
806 |
{-S/2 ,-S/2-0.25f,-S -0.25f} |
|
807 |
}; |
|
808 |
|
|
809 |
vertIndexes = new int[][] |
|
810 |
{ |
|
811 |
{0,1,3,8,2}, // counterclockwise! |
|
812 |
{0,4,9,5,1}, |
|
813 |
{ 0,2,6,4}, |
|
814 |
{ 1,5,7,3}, |
|
815 |
{10,9,4,6}, |
|
816 |
{10,9,5,7}, |
|
817 |
{10,8,3,7}, |
|
818 |
{10,8,2,6} |
|
819 |
}; |
|
820 |
|
|
821 |
bands = new float[][] |
|
822 |
{ |
|
823 |
{0.04f,17,0.5f,0.2f,5, 2,2}, |
|
824 |
{0.04f,17,0.5f,0.2f,5, 2,2}, |
|
825 |
{0.01f, 1,0.5f,0.2f,5, 2,2} |
|
826 |
}; |
|
827 |
|
|
828 |
bandIndexes = new int[] { 0,0,1,1,2,2,2,2 }; |
|
829 |
|
|
830 |
corners = new float[][] |
|
831 |
{ |
|
832 |
{ 0.013f, 0.08f } |
|
833 |
}; |
|
834 |
|
|
835 |
cornerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 }; |
|
836 |
|
|
837 |
centers = new float[][] |
|
838 |
{ |
|
839 |
{ (float)(-S/2), 0.25f, (float)(-S/2-0.5) } |
|
840 |
}; |
|
841 |
|
|
842 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,0 }; |
|
843 |
|
|
844 |
numComponents = 8; |
|
845 |
} |
|
846 |
|
|
847 |
///// SQUARE-1 MIDDLE /////////////////////////////////////////////////////////////// |
|
848 |
|
|
849 |
else if( mode==9 ) |
|
850 |
{ |
|
851 |
final float X = 3*(2-SQ3)/2; |
|
852 |
|
|
853 |
vertices = new float[][] |
|
854 |
{ |
|
855 |
{ -1.5f-X, 0.5f, 1.5f }, |
|
856 |
{ 0.0f, 0.5f, 1.5f }, |
|
857 |
{ 0.0f, 0.5f,-1.5f }, |
|
858 |
{ -1.5f+X, 0.5f,-1.5f }, |
|
859 |
{ -1.5f-X,-0.5f, 1.5f }, |
|
860 |
{ 0.0f,-0.5f, 1.5f }, |
|
861 |
{ 0.0f,-0.5f,-1.5f }, |
|
862 |
{ -1.5f+X,-0.5f,-1.5f } |
|
863 |
}; |
|
864 |
|
|
865 |
vertIndexes = new int[][] |
|
866 |
{ |
|
867 |
{0,1,2,3}, // counterclockwise! |
|
868 |
{4,5,6,7}, |
|
869 |
{4,5,1,0}, |
|
870 |
{5,6,2,1}, |
|
871 |
{6,7,3,2}, |
|
872 |
{7,4,0,3} |
|
873 |
}; |
|
874 |
|
|
875 |
bands = new float[][] |
|
876 |
{ |
|
877 |
{0.040f,35,0.8f,1.0f,5,2,1}, |
|
878 |
{0.020f,35,0.8f,1.0f,5,2,1}, |
|
879 |
{0.001f,35,0.8f,1.0f,5,2,1} |
|
880 |
}; |
|
881 |
|
|
882 |
bandIndexes = new int[] { 2,2,1,1,0,2 }; |
|
883 |
|
|
884 |
corners = new float[][] |
|
885 |
{ |
|
886 |
{0.04f,0.05f} |
|
887 |
}; |
|
888 |
|
|
889 |
cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
890 |
|
|
891 |
centers = new float[][] |
|
892 |
{ |
|
893 |
{ -0.75f, 0.0f, 0.0f} |
|
894 |
}; |
|
895 |
|
|
896 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
897 |
|
|
898 |
numComponents = 6; |
|
899 |
} |
|
900 |
|
|
901 |
///// SQUARE-1 EDGE /////////////////////////////////////////////////////////////// |
|
902 |
|
|
903 |
else if( mode==10 ) |
|
904 |
{ |
|
905 |
final float X = 3*(2-SQ3)/2; |
|
906 |
|
|
907 |
vertices = new float[][] |
|
908 |
{ |
|
909 |
{ -X, 0.5f, 0.0f }, |
|
910 |
{ +X, 0.5f, 0.0f }, |
|
911 |
{0.0f, 0.5f,-1.5f }, |
|
912 |
{ -X,-0.5f, 0.0f }, |
|
913 |
{ +X,-0.5f, 0.0f }, |
|
914 |
{0.0f,-0.5f,-1.5f }, |
|
915 |
}; |
|
916 |
|
|
917 |
vertIndexes = new int[][] |
|
918 |
{ |
|
919 |
{0,1,2}, // counterclockwise! |
|
920 |
{3,4,5}, |
|
921 |
{3,4,1,0}, |
|
922 |
{4,5,2,1}, |
|
923 |
{5,3,0,2} |
|
924 |
}; |
|
925 |
|
|
926 |
bands = new float[][] |
|
927 |
{ |
|
928 |
{0.038f,35,0.5f,0.9f, 5,2,1}, |
|
929 |
{0.001f,35,0.5f,0.9f, 5,2,1} |
|
930 |
}; |
|
931 |
|
|
932 |
bandIndexes = new int[] { 0,1,0,1,1 }; |
|
933 |
|
|
934 |
corners = new float[][] |
|
935 |
{ |
|
936 |
{0.06f,0.20f} |
|
937 |
}; |
|
938 |
|
|
939 |
cornerIndexes = new int[] { 0,0,-1,0,0,-1 }; |
|
940 |
|
|
941 |
centers = new float[][] |
|
942 |
{ |
|
943 |
{ 0.0f, 0.0f,-0.5f} |
|
944 |
}; |
|
945 |
|
|
946 |
centerIndexes = new int[] { 0,0,-1,0,0,-1 }; |
|
947 |
|
|
948 |
numComponents = 6; |
|
949 |
} |
|
950 |
|
|
951 |
///// SQUARE-1 CORNER /////////////////////////////////////////////////////////////// |
|
952 |
|
|
953 |
else if( mode==11 ) |
|
954 |
{ |
|
955 |
final float X = 3*(2-SQ3)/2; |
|
956 |
|
|
957 |
vertices = new float[][] |
|
958 |
{ |
|
959 |
{ X-1.5f, 0.5f, 0.0f }, |
|
960 |
{ 0.0f, 0.5f, 0.0f }, |
|
961 |
{ 0.0f, 0.5f,X-1.5f }, |
|
962 |
{ -1.5f, 0.5f, -1.5f }, |
|
963 |
{ X-1.5f,-0.5f, 0.0f }, |
|
964 |
{ 0.0f,-0.5f, 0.0f }, |
|
965 |
{ 0.0f,-0.5f,X-1.5f }, |
|
966 |
{ -1.5f,-0.5f, -1.5f } |
|
967 |
}; |
|
968 |
|
|
969 |
vertIndexes = new int[][] |
|
970 |
{ |
|
971 |
{0,1,2,3}, // counterclockwise! |
|
972 |
{4,5,6,7}, |
|
973 |
{4,5,1,0}, |
|
974 |
{5,6,2,1}, |
|
975 |
{7,4,0,3}, |
|
976 |
{6,7,3,2} |
|
977 |
}; |
|
978 |
|
|
979 |
bands = new float[][] |
|
980 |
{ |
|
981 |
{0.038f,35,0.9f,1.0f, 5,2,1}, |
|
982 |
{0.001f,35,0.9f,1.0f, 5,2,1} |
|
983 |
}; |
|
984 |
|
|
985 |
bandIndexes = new int[] { 0,1,0,0,1,1 }; |
|
986 |
|
|
987 |
corners = new float[][] |
|
988 |
{ |
|
989 |
{0.08f,0.20f} |
|
990 |
}; |
|
991 |
|
|
992 |
cornerIndexes = new int[] { 0,0,0,-1,0,0,0,-1 }; |
|
993 |
|
|
994 |
centers = new float[][] |
|
995 |
{ |
|
996 |
{ -0.5f, 0.0f,-0.5f} |
|
997 |
}; |
|
998 |
|
|
999 |
centerIndexes = new int[] { -1,0,-1,-1,-1,0,-1,-1 }; |
|
1000 |
|
|
1001 |
numComponents = 6; |
|
1002 |
} |
|
1003 |
|
|
1004 |
///// SQUARE-2 CORNER /////////////////////////////////////////////////////////////// |
|
1005 |
|
|
1006 |
else if( mode==12 ) |
|
1007 |
{ |
|
1008 |
final float X = 3*(2-SQ3)/2; |
|
1009 |
final float Z = 0.75f - X/2; |
|
1010 |
|
|
1011 |
vertices = new float[][] |
|
1012 |
{ |
|
1013 |
{ X-1.5f+Z, 0.5f, 0.0f }, |
|
1014 |
{ Z, 0.5f, 0.0f }, |
|
1015 |
{ -1.5f+Z, 0.5f, -1.5f }, |
|
1016 |
{ X-1.5f+Z,-0.5f, 0.0f }, |
|
1017 |
{ Z,-0.5f, 0.0f }, |
|
1018 |
{ -1.5f+Z,-0.5f, -1.5f } |
|
1019 |
}; |
|
1020 |
|
|
1021 |
vertIndexes = new int[][] |
|
1022 |
{ |
|
1023 |
{0,1,2}, // counterclockwise! |
|
1024 |
{5,4,3}, |
|
1025 |
{3,4,1,0}, |
|
1026 |
{4,5,2,1}, |
|
1027 |
{5,3,0,2} |
|
1028 |
}; |
|
1029 |
|
|
1030 |
bands = new float[][] |
|
1031 |
{ |
|
1032 |
{0.040f,35,0.9f,1.0f, 5,2,1}, |
|
1033 |
{0.001f,35,0.9f,1.0f, 5,2,1} |
|
1034 |
}; |
|
1035 |
|
|
1036 |
bandIndexes = new int[] { 0,0,0,1,1 }; |
|
1037 |
|
|
1038 |
corners = new float[][] |
|
1039 |
{ |
|
1040 |
{0.05f,0.13f} |
|
1041 |
}; |
|
1042 |
|
|
1043 |
cornerIndexes = new int[] { 0,0,-1,0,0,-1 }; |
|
1044 |
|
|
1045 |
centers = new float[][] |
|
1046 |
{ |
|
1047 |
{ 0.0f, 0.0f,-0.5f} |
|
1048 |
}; |
|
1049 |
|
|
1050 |
centerIndexes = new int[] { 0,0,-1,0,0,-1 }; |
|
1051 |
|
|
1052 |
numComponents = 5; |
|
1053 |
} |
|
1054 |
|
|
1055 |
///// REDI CORNER /////////////////////////////////////////////////////////////// |
|
1056 |
|
|
1057 |
else if( mode==13 ) |
|
1058 |
{ |
|
1059 |
vertices = new float[][] |
|
1060 |
{ |
|
1061 |
{ 0.0f, 0.0f, 0.0f }, |
|
1062 |
{-0.5f, 0.5f, 0.5f }, |
|
1063 |
{-0.5f,-0.5f, 0.5f }, |
|
1064 |
{ 0.5f, 0.5f, 0.5f }, |
|
1065 |
{ 0.5f,-0.5f, 0.5f }, |
|
1066 |
{ 0.5f, 0.5f,-0.5f }, |
|
1067 |
{ 0.5f,-0.5f,-0.5f }, |
|
1068 |
{-0.5f, 0.5f,-0.5f }, |
|
1069 |
}; |
|
1070 |
|
|
1071 |
vertIndexes = new int[][] |
|
1072 |
{ |
|
1073 |
{ 2,4,3,1 }, |
|
1074 |
{ 1,3,5,7 }, |
|
1075 |
{ 4,6,5,3 }, |
|
1076 |
|
|
1077 |
{ 2,4,0 }, |
|
1078 |
{ 5,7,0 }, |
|
1079 |
{ 4,6,0 }, |
|
1080 |
{ 7,1,0 }, |
|
1081 |
{ 1,2,0 }, |
|
1082 |
{ 6,5,0 } |
|
1083 |
}; |
|
1084 |
|
|
1085 |
bands = new float[][] |
|
1086 |
{ |
|
1087 |
{0.06f,35,0.5f,0.7f,5,2,2}, |
|
1088 |
{0.01f,35,0.2f,0.4f,5,2,2} |
|
1089 |
}; |
|
1090 |
|
|
1091 |
bandIndexes = new int[] { 0,0,0,1,1,1,1,1,1 }; |
|
1092 |
|
|
1093 |
corners = new float[][] |
|
1094 |
{ |
|
1095 |
{0.06f,0.12f} |
|
1096 |
}; |
|
1097 |
|
|
1098 |
cornerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 }; |
|
1099 |
|
|
1100 |
centers = new float[][] |
|
1101 |
{ |
|
1102 |
{ 0.0f, 0.0f, 0.0f} |
|
1103 |
}; |
|
1104 |
|
|
1105 |
centerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 }; |
|
1106 |
|
|
1107 |
numComponents = 9; |
|
1108 |
} |
|
1109 |
|
|
1110 |
///// JING CORNER /////////////////////////////////////////////////////////////// |
|
1111 |
|
|
1112 |
else if( mode==14 ) |
|
1113 |
{ |
|
1114 |
final float F = 0.24f; |
|
1115 |
final float X = F/2; |
|
1116 |
final float Y = F*SQ2/2; |
|
1117 |
final float Z =-F/2; |
|
1118 |
|
|
1119 |
vertices = new float[][] |
|
1120 |
{ |
|
1121 |
{ 0.0f, 0.0f, 0.0f }, |
|
1122 |
{ X, Y, Z }, |
|
1123 |
{ 0.0f, 2*Y, 2*Z }, |
|
1124 |
{ -X, Y, Z }, |
|
1125 |
{ 0.0f, 0.0f, -F }, |
|
1126 |
{ X, Y, Z-F }, |
|
1127 |
{ 0.0f, 2*Y, 2*Z-F }, |
|
1128 |
{ -X, Y, Z-F }, |
|
1129 |
}; |
|
1130 |
|
|
1131 |
vertIndexes = new int[][] |
|
1132 |
{ |
|
1133 |
{0,1,2,3}, |
|
1134 |
{1,0,4,5}, |
|
1135 |
{7,4,0,3}, |
|
1136 |
{1,5,6,2}, |
|
1137 |
{7,3,2,6}, |
|
1138 |
{4,7,6,5} |
|
1139 |
}; |
|
1140 |
|
|
1141 |
bands = new float[][] |
|
1142 |
{ |
|
1143 |
{0.015f,35,0.5f*F,F,5,1,1}, |
|
1144 |
{0.001f,35,0.5f*F,F,5,1,1} |
|
1145 |
}; |
|
1146 |
|
|
1147 |
bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
1148 |
|
|
1149 |
corners = new float[][] |
|
1150 |
{ |
|
1151 |
{0.08f,0.20f*F}, |
|
1152 |
{0.07f,0.20f*F} |
|
1153 |
}; |
|
1154 |
|
|
1155 |
cornerIndexes = new int[] { 0,1,1,-1,1,-1,-1,-1 }; |
|
1156 |
|
|
1157 |
centers = new float[][] |
|
1158 |
{ |
|
1159 |
{ 0.0f, Y, Z-F/2} |
|
1160 |
}; |
|
1161 |
|
|
1162 |
centerIndexes = new int[] { 0,0,0,-1,0,-1,-1,-1 }; |
|
1163 |
|
|
1164 |
numComponents = 6; |
|
1165 |
} |
|
1166 |
|
|
1167 |
///// JING EDGE /////////////////////////////////////////////////////////////// |
|
1168 |
|
|
1169 |
else if( mode==15 ) |
|
1170 |
{ |
|
1171 |
final float F = 0.24f; |
|
1172 |
final float X = F/2; |
|
1173 |
final float Y = F*SQ2/2; |
|
1174 |
final float Z =-F/2; |
|
1175 |
|
|
1176 |
vertices = new float[][] |
|
1177 |
{ |
|
1178 |
{ 0.0f, 0.0f, 0.5f-F }, |
|
1179 |
{ X, Y, Z+0.5f-F }, |
|
1180 |
{ 0.0f, 2*Y, 2*Z+0.5f-F }, |
|
1181 |
{ -X, Y, Z+0.5f-F }, |
|
1182 |
{ 0.0f, 0.0f, -0.5f+F }, |
|
1183 |
{ X, Y, -Z-0.5f+F }, |
|
1184 |
{ 0.0f, 2*Y,-2*Z-0.5f+F }, |
|
1185 |
{ -X, Y, -Z-0.5f+F }, |
|
1186 |
}; |
|
1187 |
|
|
1188 |
vertIndexes = new int[][] |
|
1189 |
{ |
|
1190 |
{0,4,5,1}, |
|
1191 |
{3,7,4,0}, |
|
1192 |
{0,1,2,3}, |
|
1193 |
{4,7,6,5}, |
|
1194 |
{1,5,6,2}, |
|
1195 |
{2,6,7,3} |
|
1196 |
}; |
|
1197 |
|
|
1198 |
bands = new float[][] |
|
1199 |
{ |
|
1200 |
{0.015f,35,0.5f*F,F,5,1,1}, |
|
1201 |
{0.001f,35,0.5f*F,F,5,1,1} |
|
1202 |
}; |
|
1203 |
|
|
1204 |
bandIndexes = new int[] { 0,0,1,1,1,1 }; |
|
1205 |
|
|
1206 |
corners = new float[][] |
|
1207 |
{ |
|
1208 |
{0.07f,0.20f*F} |
|
1209 |
}; |
|
1210 |
|
|
1211 |
cornerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 }; |
|
1212 |
|
|
1213 |
centers = new float[][] |
|
1214 |
{ |
|
1215 |
{ 0, F*SQ2/2, 0 } |
|
1216 |
}; |
|
1217 |
|
|
1218 |
centerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 }; |
|
1219 |
|
|
1220 |
numComponents = 6; |
|
1221 |
} |
|
1222 |
|
|
1223 |
///// JING FACE /////////////////////////////////////////////////////////////// |
|
1224 |
|
|
1225 |
else if( mode==16 ) |
|
1226 |
{ |
|
1227 |
final float F = 0.24f; |
|
1228 |
final float L = (1-3*F); |
|
1229 |
final float X = L/2; |
|
1230 |
final float Y = L*SQ2/2; |
|
1231 |
final float Z =-L/2; |
|
1232 |
final float D = F/L; |
|
1233 |
|
|
1234 |
vertices = new float[][] |
|
1235 |
{ |
|
1236 |
{ 0.0f, -2*Y/3, -2*Z/3 }, |
|
1237 |
{ X, Y/3, Z/3 }, |
|
1238 |
{ -X, Y/3, Z/3 }, |
|
1239 |
{ 0.0f, -2*Y/3, -2*Z/3+2*D*Z }, |
|
1240 |
{ X-D*X, Y/3-D*Y, Z/3+D*Z }, |
|
1241 |
{ -X+D*X, Y/3-D*Y, Z/3+D*Z }, |
|
1242 |
}; |
|
1243 |
|
|
1244 |
vertIndexes = new int[][] |
|
1245 |
{ |
|
1246 |
{0,1,2}, |
|
1247 |
{3,5,4}, |
|
1248 |
{0,3,4,1}, |
|
1249 |
{5,3,0,2}, |
|
1250 |
{4,5,2,1} |
|
1251 |
}; |
|
1252 |
|
|
1253 |
bands = new float[][] |
|
1254 |
{ |
|
1255 |
{0.025f,35,0.20f*(1-3*F),0.6f*(1-3*F),5,1,1}, |
|
1256 |
{0.001f,35,0.05f*(1-3*F),0.1f*(1-3*F),5,1,1} |
|
1257 |
}; |
|
1258 |
|
|
1259 |
bandIndexes = new int[] { 0,1,1,1,1,1 }; |
|
1260 |
|
|
1261 |
corners = new float[][] |
|
1262 |
{ |
|
1263 |
{0.04f,0.15f} |
|
1264 |
}; |
|
1265 |
|
|
1266 |
cornerIndexes = new int[] { 0,0,0,-1,-1,-1 }; |
|
1267 |
|
|
1268 |
centers = new float[][] |
|
1269 |
{ |
|
1270 |
{ 0, -2*Y/3, 4*Z/3 } |
|
1271 |
}; |
|
1272 |
|
|
1273 |
centerIndexes = new int[] { 0,0,0,-1,-1,-1 }; |
|
1274 |
|
|
1275 |
numComponents = 6; |
|
1276 |
} |
|
1277 |
|
|
1278 |
///// REX PETAL /////////////////////////////////////////////////////////////// |
|
1279 |
|
|
1280 |
else if( mode==17 ) |
|
1281 |
{ |
|
1282 |
final float REX_D = 0.2f; |
|
1283 |
float G = (1-REX_D)*SQ2/2; |
|
1284 |
vertices = new float[][] {{-0.10f,0.70f,0},{-0.70f,0.10f,0},{+0.65f,-0.71f,0},{+0.71f,-0.65f,0},{0,0.05f,-0.2f} }; |
|
1285 |
vertIndexes = new int[][] { {0,1,2,3},{0,3,4},{3,2,4},{2,1,4},{1,0,4} }; |
|
1286 |
centers= new float[][] { {0.0f,0.0f,-G} }; |
|
1287 |
corners= new float[][] { {0.03f,0.30f} }; |
|
1288 |
cornerIndexes = new int[] {-1,-1,0,0,-1}; |
|
1289 |
centerIndexes = new int[] {-1,-1,0,0,-1}; |
|
1290 |
bandIndexes = new int[] { 0,1,1,1,1 }; |
|
1291 |
bands = new float[][] { {+0.016f,10,G/3,0.5f,5,1,1},{ +0.0f,45,0.1f,0.1f,2,0,0} }; |
|
1292 |
|
|
1293 |
numComponents = 5; |
|
1294 |
} |
|
1295 |
|
|
1296 |
///// TRAJBER'S FACE /////////////////////////////////////////////////////////////// |
|
1297 |
|
|
1298 |
else if( mode==18 ) |
|
1299 |
{ |
|
1300 |
final float CUT = 1.0f/6; |
|
1301 |
final float LEN = 1.5f; |
|
1302 |
|
|
1303 |
final float A = SQ2*CUT*LEN; |
|
1304 |
final float B = 2*CUT*LEN; |
|
1305 |
|
|
1306 |
vertices = new float[][] |
|
1307 |
{ |
|
1308 |
{ 0.01f, 0.01f, 0}, |
|
1309 |
{ A, A, -A}, |
|
1310 |
{ A, -A, -A}, |
|
1311 |
{ B, 0, 0}, |
|
1312 |
{ 0, 0, -B}, |
|
1313 |
{ A+B, A, -A}, |
|
1314 |
{ A+B, -A, -A}, |
|
1315 |
{ A, A, -A-B}, |
|
1316 |
{ A, -A, -A-B}, |
|
1317 |
|
|
1318 |
{ LEN , A, SQ2*A-LEN}, |
|
1319 |
{ LEN , -A, SQ2*A-LEN}, |
|
1320 |
{ LEN-SQ2*A, A, -LEN}, |
|
1321 |
{ LEN-SQ2*A, -A, -LEN} |
|
1322 |
}; |
|
1323 |
|
|
1324 |
vertIndexes = new int[][] |
|
1325 |
{ |
|
1326 |
{0,3,5,1}, |
|
1327 |
{0,2,6,3}, |
|
1328 |
{0,4,8,2}, |
|
1329 |
{0,1,7,4}, |
|
1330 |
{3,6,10,9,5}, |
|
1331 |
{2,8,12,10,6}, |
|
1332 |
{4,7,11,12,8}, |
|
1333 |
{1,5,9,11,7}, |
|
1334 |
{9,10,12,11} |
|
1335 |
}; |
|
1336 |
|
|
1337 |
bands = new float[][] { {0.05f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,3,0,0} }; |
|
1338 |
bandIndexes = new int[] { 0,0,0,0,1,1,1,1,1 }; |
|
1339 |
corners = new float[][] { {0.03f,0.10f} }; |
|
1340 |
cornerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 }; |
|
1341 |
centers = new float[][] { { LEN/2, 0.0f, -LEN/2} }; |
|
1342 |
centerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 }; |
|
1343 |
|
|
1344 |
numComponents = 9; |
|
1345 |
} |
|
1346 |
|
|
1347 |
///// TRAJBER'S EDGE /////////////////////////////////////////////////////////////// |
|
1348 |
|
|
1349 |
else if( mode==19 ) |
|
1350 |
{ |
|
1351 |
final float CUT = 1.0f/6; |
|
1352 |
final float LEN = 1.5f; |
|
1353 |
|
|
1354 |
final float A = SQ2*CUT*LEN; |
|
1355 |
final float B = LEN-2*LEN*CUT; |
|
1356 |
|
|
1357 |
vertices = new float[][] |
|
1358 |
{ |
|
1359 |
{ -B, 0, 0}, |
|
1360 |
{ -B+A, SQ2*A, -A}, |
|
1361 |
{ -B+A,-SQ2*A, -A}, |
|
1362 |
{ B, 0, 0}, |
|
1363 |
{ B-A, SQ2*A, -A}, |
|
1364 |
{ B-A,-SQ2*A, -A}, |
|
1365 |
{ 0, SQ2*A, -B}, |
|
1366 |
{ 0,-SQ2*A, -B}, |
|
1367 |
}; |
|
1368 |
|
|
1369 |
vertIndexes = new int[][] |
|
1370 |
{ |
|
1371 |
{0,3,4,1}, |
|
1372 |
{0,2,5,3}, |
|
1373 |
{1,4,6}, |
|
1374 |
{2,7,5}, |
|
1375 |
{0,1,6,7,2}, |
|
1376 |
{3,5,7,6,4} |
|
1377 |
}; |
|
1378 |
|
|
1379 |
bands = new float[][] { {0.03f,35,0.15f,0.3f,3,1,1},{0.00f,35,0.15f,0.3f,3,0,0} }; |
|
1380 |
bandIndexes = new int[] { 0,0,1,1,1,1 }; |
|
1381 |
corners = new float[][] { {0.02f,0.10f} }; |
|
1382 |
cornerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 }; |
|
1383 |
centers = new float[][] { { 0, 0, -LEN/2} }; |
|
1384 |
centerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 }; |
|
1385 |
|
|
1386 |
numComponents = 9; |
|
1387 |
} |
|
1388 |
|
|
1389 |
///// TRAJBER'S CORNER /////////////////////////////////////////////////////////////// |
|
1390 |
|
|
1391 |
else if( mode==20 ) |
|
1392 |
{ |
|
1393 |
final float CUT = 1.0f/6; |
|
1394 |
final float LEN = 1.5f; |
|
1395 |
|
|
1396 |
final float A = SQ2*CUT*LEN; |
|
1397 |
final float C = LEN-2*LEN*CUT; |
|
1398 |
final float L = C-A; |
|
1399 |
|
|
1400 |
vertices = new float[][] |
|
1401 |
{ |
|
1402 |
{ -L, -(SQ2/3)*L, L/3 }, |
|
1403 |
{ L, -(SQ2/3)*L, L/3 }, |
|
1404 |
{ 0,(2*SQ2/3)*L,-2*L/3 }, |
|
1405 |
{ 0, -(SQ2/3)*L,-2*L/3 }, |
|
1406 |
}; |
|
1407 |
|
|
1408 |
vertIndexes = new int[][] |
|
1409 |
{ |
|
1410 |
{0,1,2}, |
|
1411 |
{0,1,3}, |
|
1412 |
{0,2,3}, |
|
1413 |
{1,3,2}, |
|
1414 |
}; |
|
1415 |
|
|
1416 |
bands = new float[][] { {0.05f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,4,0,0} }; |
|
1417 |
bandIndexes = new int[] { 0,1,1,1 }; |
|
1418 |
corners = new float[][] { {0.02f,0.10f} }; |
|
1419 |
cornerIndexes= new int[] { 0,0,0,-1 }; |
|
1420 |
centers = new float[][] { {0, -(SQ2/3)*L,-2*L/3} }; |
|
1421 |
centerIndexes= new int[] { 0,0,0,-1 }; |
|
1422 |
|
|
1423 |
numComponents = 9; |
|
1424 |
} |
|
1425 |
|
|
1426 |
///// WINDMILL CORNER /////////////////////////////////////////////////////////////// |
|
1427 |
|
|
1428 |
else if( mode==21 ) |
|
1429 |
{ |
|
1430 |
final float X = 1.8f; // the cut goes from a corner and splits the opposing side 1.2 / 1.8 |
|
1431 |
final float h = 3*X*X/(X*X+9); |
|
1432 |
final float d = h*X/3; |
|
1433 |
final float l = X/2; |
|
1434 |
|
|
1435 |
vertices = new float[][] |
|
1436 |
{ |
|
1437 |
{ -l, 0.5f, 0.0f }, |
|
1438 |
{ l, 0.5f, 0.0f }, |
|
1439 |
{ l,-0.5f, 0.0f }, |
|
1440 |
{ -l,-0.5f, 0.0f }, |
|
1441 |
{ d-l, 0.5f, -h }, |
|
1442 |
{ d-l,-0.5f, -h }, |
|
1443 |
}; |
|
1444 |
|
|
1445 |
vertIndexes = new int[][] |
|
1446 |
{ |
|
1447 |
{ 3,2,1,0 }, |
|
1448 |
{ 0,1,4 }, |
|
1449 |
{ 5,2,3 }, |
|
1450 |
{ 5,3,0,4 }, |
|
1451 |
{ 2,5,4,1 }, |
|
1452 |
}; |
|
1453 |
|
|
1454 |
bands = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} }; |
|
1455 |
bandIndexes = new int[] { 0,0,0,1,1 }; |
|
1456 |
corners = new float[][] { {0.05f,0.10f} }; |
|
1457 |
cornerIndexes= new int[] { 0,0,0,0,-1,-1 }; |
|
1458 |
centers = new float[][] { { d-l, 0.0f,-h } }; |
|
1459 |
centerIndexes= new int[] { 0,0,0,0,-1,-1 }; |
|
1460 |
|
|
1461 |
numComponents = 5; |
|
1462 |
} |
|
1463 |
|
|
1464 |
///// WINDMILL EDGE /////////////////////////////////////////////////////////////// |
|
1465 |
|
|
1466 |
else if( mode==22 ) |
|
1467 |
{ |
|
1468 |
final float X = 1.8f; // the cut goes from a corner and splits the opposing side 1.2 / 1.8 |
|
1469 |
final float h = 3*X*X/(X*X+9); |
|
1470 |
final float d = h*X/3; |
|
1471 |
final float H = 3*h/X; |
|
1472 |
final float l = (3-X)/2; |
|
1473 |
|
|
1474 |
vertices = new float[][] |
|
1475 |
{ |
|
1476 |
{ -l, 0.5f, 0.0f }, |
|
1477 |
{ l, 0.5f, 0.0f }, |
|
1478 |
{ l,-0.5f, 0.0f }, |
|
1479 |
{ -l,-0.5f, 0.0f }, |
|
1480 |
{h-l, 0.5f, -H }, |
|
1481 |
{d+l, 0.5f, -h }, |
|
1482 |
{d+l,-0.5f, -h }, |
|
1483 |
{h-l,-0.5f, -H } |
|
1484 |
}; |
|
1485 |
|
|
1486 |
vertIndexes = new int[][] |
|
1487 |
{ |
|
1488 |
{ 3,2,1,0 }, |
|
1489 |
{ 0,1,5,4 }, |
|
1490 |
{ 7,6,2,3 }, |
|
1491 |
{ 2,6,5,1 }, |
|
1492 |
{ 6,7,4,5 }, |
|
1493 |
{ 7,3,0,4 } |
|
1494 |
}; |
|
1495 |
|
|
1496 |
bands = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} }; |
|
1497 |
bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
1498 |
corners = new float[][] { {0.05f,0.10f} }; |
|
1499 |
cornerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 }; |
|
1500 |
centers = new float[][] { {h-l, 0.5f, -H } }; |
|
1501 |
centerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 }; |
|
1502 |
|
|
1503 |
numComponents = 6; |
|
1504 |
} |
|
1505 |
|
|
1506 |
///// Pyramorphics corner /////////////////////////////////////////////////////////////// |
|
1507 |
|
|
1508 |
else if( mode==23 ) |
|
1509 |
{ |
|
1510 |
final float Y = SQ2/2; |
|
1511 |
final float Z = 1.0f; |
|
1512 |
|
|
1513 |
vertices = new float[][] |
|
1514 |
{ |
|
1515 |
{0.0f, 2*Y/3, 2*Z/3 }, |
|
1516 |
{0.0f, 2*Y/3, -Z/3 }, |
|
1517 |
{ Z/2, -Y/3, Z/6 }, |
|
1518 |
{-Z/2, -Y/3, Z/6 }, |
|
1519 |
{0.0f, -Y/3, -Z/3 } |
|
1520 |
}; |
|
1521 |
|
|
1522 |
vertIndexes = new int[][] { {3,2,0},{2,1,0},{1,3,0},{1,2,4},{3,1,4},{2,3,4} }; |
|
1523 |
bands = new float[][] { {0.03f,40,0.2f,0.4f,5,1,1}, {0.001f,40,0.2f,0.4f,5,1,1} }; |
|
1524 |
bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
1525 |
corners = new float[][] { {0.08f,0.13f} }; |
|
1526 |
cornerIndexes= new int[] { 0,0,0,0,-1 }; |
|
1527 |
centers = new float[][] { { 0.0f,0.0f,0.0f } }; |
|
1528 |
centerIndexes= new int[] { 0,0,0,0,-1 }; |
|
1529 |
} |
|
1530 |
|
|
1531 |
///// Pyramorphics face /////////////////////////////////////////////////////////////// |
|
1532 |
|
|
1533 |
else if( mode==24 ) |
|
1534 |
{ |
|
1535 |
final float X = 1.0f; |
|
1536 |
final float Y = SQ2/2; |
|
1537 |
final float Z = 0.5f; |
|
1538 |
|
|
1539 |
vertices = new float[][] |
|
1540 |
{ |
|
1541 |
{-X/2, Y/3, Z/3 }, |
|
1542 |
{ X/2, Y/3, Z/3 }, |
|
1543 |
{0.0f,-2*Y/3,-2*Z/3 }, |
|
1544 |
{0.0f, Y/3,-2*Z/3 } |
|
1545 |
}; |
|
1546 |
|
|
1547 |
vertIndexes = new int[][] { {0,2,1},{0,1,3},{2,3,1},{2,0,3} }; |
|
1548 |
bands = new float[][] { {0.03f,30,0.15f,0.5f,5,1,2}, {0.001f,30,0.25f,0.5f,5,1,2} }; |
|
1549 |
bandIndexes = new int[] { 0,1,1,1 }; |
|
1550 |
corners = new float[][] { {0.09f,0.13f} }; |
|
1551 |
cornerIndexes= new int[] { 0,0,0,-1 }; |
|
1552 |
centers = new float[][] { { 0.0f, Y/3,-2*Z/3 } }; |
|
1553 |
centerIndexes= new int[] { 0,0,0,-1 }; |
|
1554 |
} |
|
1555 |
|
|
1556 |
///// END DEFINITIONS ///////////////////////////////////////////////////////////////// |
|
303 |
int[][] indices = shape.getVertIndices(); |
|
304 |
int numComponents = indices.length; |
|
305 |
int[] outer = new int[numComponents]; |
|
1557 | 306 |
|
1558 | 307 |
FactoryCubit factory = FactoryCubit.getInstance(); |
1559 | 308 |
factory.clear(); |
1560 |
|
|
1561 |
ObjectShape shape = new ObjectShape(vertices,vertIndexes); |
|
1562 |
ObjectFaceShape face= new ObjectFaceShape(bands,bandIndexes,corners,cornerIndexes,centers,centerIndexes,convexCenter); |
|
1563 |
|
|
1564 |
int[] outer = new int[vertIndexes.length]; |
|
1565 |
|
|
1566 | 309 |
factory.createNewFaceTransform(shape,outer); |
1567 | 310 |
mMesh = factory.createRoundedSolid(shape,face,MESH_NICE,numComponents); |
1568 | 311 |
|
1569 | 312 |
int numEff = mMesh.getNumEffComponents(); |
1570 | 313 |
|
1571 |
for(int i=0; i<numEff; i++) |
|
1572 |
{ |
|
1573 |
mMesh.setEffectAssociation(i, 0, i); |
|
1574 |
} |
|
314 |
for(int i=0; i<numEff; i++) mMesh.setEffectAssociation(i, 0, i); |
|
1575 | 315 |
} |
1576 | 316 |
|
1577 | 317 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Fix a bug in FactoryCubit: before sometimes it would incorrectly rotate a 'collapsed sticker' face if the face was flipped.
Also: polish up the Container.