Revision db9903e8
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/examples/meshfile/FactoryCubit.java | ||
|---|---|---|
| 705 | 705 |
center.set( centers[cent][0], centers[cent][1], centers[cent][2]); |
| 706 | 706 |
|
| 707 | 707 |
int corn = cornerIndexes[v]; |
| 708 |
float strength = corners[corn][0]; |
|
| 709 |
float radius = corners[corn][1]; |
|
| 710 | 708 |
|
| 711 |
roundCorners(mesh, center, staticVert, strength, radius); |
|
| 709 |
if( corn>=0 ) |
|
| 710 |
{
|
|
| 711 |
float strength = corners[corn][0]; |
|
| 712 |
float radius = corners[corn][1]; |
|
| 713 |
roundCorners(mesh, center, staticVert, strength, radius); |
|
| 714 |
} |
|
| 712 | 715 |
} |
| 713 | 716 |
} |
| 714 | 717 |
} |
| src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
|---|---|---|
| 57 | 57 |
{
|
| 58 | 58 |
private static final float SQ2 = (float)Math.sqrt(2); |
| 59 | 59 |
private static final float SQ3 = (float)Math.sqrt(3); |
| 60 |
private static final float SQ5 = (float)Math.sqrt(5); |
|
| 60 | 61 |
private final float DEFAULT_SCALE = 0.3f; |
| 61 | 62 |
|
| 62 | 63 |
private final GLSurfaceView mView; |
| ... | ... | |
| 252 | 253 |
|
| 253 | 254 |
private void createMesh() |
| 254 | 255 |
{
|
| 255 |
int mode = 6;
|
|
| 256 |
int mode = 8;
|
|
| 256 | 257 |
int numComponents = 0; |
| 257 | 258 |
double[][] vertices = null; |
| 258 | 259 |
int[][] vertIndexes = null; |
| ... | ... | |
| 690 | 691 |
numComponents = 2; |
| 691 | 692 |
} |
| 692 | 693 |
|
| 694 |
///// SKEWB Ultimate SMALL ///////////////////////////////////////////////////////////// |
|
| 695 |
|
|
| 696 |
else if( mode==7 ) |
|
| 697 |
{
|
|
| 698 |
double S = (SQ5+1)/4; |
|
| 699 |
|
|
| 700 |
vertices = new double[][] |
|
| 701 |
{
|
|
| 702 |
{ 0.0 , 0.0 , 0.0 },
|
|
| 703 |
{ -0.5*S , 0.5*S+0.25, -0.25 },
|
|
| 704 |
{-0.25 , -S/2 , (-2*S-1)/4},
|
|
| 705 |
{ 0.5*S+0.25, 0.25 , -S/2 },
|
|
| 706 |
{ 0.0 , 0.5 , -S-0.5 },
|
|
| 707 |
{ 0.0 , 0.5 , 0.0 },
|
|
| 708 |
{ -0.5*S ,-0.5*S+0.25, -0.25 },
|
|
| 709 |
{ 0.5*S ,-0.5*S+0.25, -0.25 }
|
|
| 710 |
}; |
|
| 711 |
|
|
| 712 |
vertIndexes = new int[][] |
|
| 713 |
{
|
|
| 714 |
{6,0,5,1}, // counterclockwise!
|
|
| 715 |
{0,7,3,5},
|
|
| 716 |
{0,6,2,7},
|
|
| 717 |
{4,3,5,1},
|
|
| 718 |
{4,2,7,3},
|
|
| 719 |
{4,1,6,2},
|
|
| 720 |
}; |
|
| 721 |
|
|
| 722 |
bands = new float[][] |
|
| 723 |
{
|
|
| 724 |
{0.04f,17,0.5f,0.2f,5, 2,2},
|
|
| 725 |
{0.01f, 1,0.5f,0.2f,5, 2,2}
|
|
| 726 |
}; |
|
| 727 |
|
|
| 728 |
bandIndexes = new int[] { 0,0,0,1,1,1 };
|
|
| 729 |
|
|
| 730 |
corners = new float[][] |
|
| 731 |
{
|
|
| 732 |
{ 0.013f, 0.08f }
|
|
| 733 |
}; |
|
| 734 |
|
|
| 735 |
cornerIndexes = new int[] { 0, 0, 0, 0,-1,0,0,0 };
|
|
| 736 |
|
|
| 737 |
centers = new float[][] |
|
| 738 |
{
|
|
| 739 |
{ 0.0f,-0.5f, (float)(-S-0.5) }
|
|
| 740 |
}; |
|
| 741 |
|
|
| 742 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
|
|
| 743 |
|
|
| 744 |
numComponents = 8; |
|
| 745 |
} |
|
| 746 |
|
|
| 747 |
///// SKEWB Ultimate BIG /////////////////////////////////////////////////////////////// |
|
| 748 |
|
|
| 749 |
else if( mode==8 ) |
|
| 750 |
{
|
|
| 751 |
double S = (SQ5+1)/4; |
|
| 752 |
|
|
| 753 |
vertices = new double[][] |
|
| 754 |
{
|
|
| 755 |
{-S/2 ,-S/2+0.25, 0.25},
|
|
| 756 |
{ S/2 , S/2-0.25, -0.25},
|
|
| 757 |
{-S , 0.00, 0.00},
|
|
| 758 |
{ 0.25, S/2 ,-S/2-0.25},
|
|
| 759 |
{-S/2 ,-S/2-0.25, 0.25},
|
|
| 760 |
{ S/2+0.25, -0.25,-S/2 },
|
|
| 761 |
{-S , -0.50, 0.00},
|
|
| 762 |
{ 0.50, 0.00,-S },
|
|
| 763 |
{-S +0.25, S/2 ,-S/2-0.25},
|
|
| 764 |
{ 0.25,-S/2-0.50,-S/2+0.25},
|
|
| 765 |
{-S/2 ,-S/2-0.25,-S -0.25}
|
|
| 766 |
}; |
|
| 767 |
|
|
| 768 |
vertIndexes = new int[][] |
|
| 769 |
{
|
|
| 770 |
{0,1,3,8,2}, // counterclockwise!
|
|
| 771 |
{0,4,9,5,1},
|
|
| 772 |
{ 0,2,6,4},
|
|
| 773 |
{ 1,5,7,3},
|
|
| 774 |
{10,9,4,6},
|
|
| 775 |
{10,9,5,7},
|
|
| 776 |
{10,8,3,7},
|
|
| 777 |
{10,8,2,6}
|
|
| 778 |
}; |
|
| 779 |
|
|
| 780 |
bands = new float[][] |
|
| 781 |
{
|
|
| 782 |
{0.04f,17,0.5f,0.2f,5, 2,2},
|
|
| 783 |
{0.04f,17,0.5f,0.2f,5, 2,2},
|
|
| 784 |
{0.01f, 1,0.5f,0.2f,5, 2,2}
|
|
| 785 |
}; |
|
| 786 |
|
|
| 787 |
bandIndexes = new int[] { 0,0,1,1,2,2,2,2 };
|
|
| 788 |
|
|
| 789 |
corners = new float[][] |
|
| 790 |
{
|
|
| 791 |
{ 0.013f, 0.08f }
|
|
| 792 |
}; |
|
| 793 |
|
|
| 794 |
cornerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 };
|
|
| 795 |
|
|
| 796 |
centers = new float[][] |
|
| 797 |
{
|
|
| 798 |
{ (float)(-S/2), 0.25f, (float)(-S/2-0.5) }
|
|
| 799 |
}; |
|
| 800 |
|
|
| 801 |
centerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,0 };
|
|
| 802 |
|
|
| 803 |
numComponents = 8; |
|
| 804 |
} |
|
| 805 |
|
|
| 806 |
///// END DEFINITIONS ///////////////////////////////////////////////////////////////// |
|
| 807 |
|
|
| 693 | 808 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 694 | 809 |
|
| 695 | 810 |
factory.clear(); |
Also available in: Unified diff
2 Skewb Ultimate cubits.