Revision 7dc57f89
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistySkewb.java | ||
---|---|---|
116 | 116 |
|
117 | 117 |
private static final double[][] VERTICES_CORNER = new double[][] |
118 | 118 |
{ |
119 |
// TODO |
|
119 |
{-0.5f, 0.0f, 0.0f}, |
|
120 |
{ 0.0f,-0.5f, 0.0f}, |
|
121 |
{ 0.0f, 0.0f,-0.5f}, |
|
122 |
{-0.5f,-0.5f,-0.5f}, |
|
123 |
{ 0.0f, 0.0f, 0.0f} |
|
120 | 124 |
}; |
121 | 125 |
|
122 | 126 |
private static final int[][] VERT_INDEXES_CORNER = new int[][] |
123 | 127 |
{ |
124 |
// TODO |
|
128 |
{0,1,4}, |
|
129 |
{2,0,4}, |
|
130 |
{1,2,4}, |
|
131 |
{3,1,0}, |
|
132 |
{3,2,1}, |
|
133 |
{3,0,2} |
|
125 | 134 |
}; |
126 | 135 |
|
127 | 136 |
private static final double[][] VERTICES_EDGE = new double[][] |
... | ... | |
142 | 151 |
|
143 | 152 |
private static final double[][] VERTICES_FACE = new double[][] |
144 | 153 |
{ |
145 |
// TODO |
|
154 |
{-0.5f, 0.0f, 0.0f }, |
|
155 |
{ 0.0f,-0.5f, 0.0f }, |
|
156 |
{ 0.5f, 0.0f, 0.0f }, |
|
157 |
{ 0.0f, 0.5f, 0.0f }, |
|
158 |
{ 0.0f, 0.0f,-0.5f } |
|
146 | 159 |
}; |
147 | 160 |
|
148 | 161 |
private static final int[][] VERT_INDEXES_FACE = new int[][] |
149 | 162 |
{ |
150 |
// TODO |
|
163 |
{0,1,2,3}, |
|
164 |
{4,1,0}, |
|
165 |
{4,2,1}, |
|
166 |
{4,3,2}, |
|
167 |
{4,0,3} |
|
168 |
}; |
|
169 |
|
|
170 |
|
|
171 |
private static final float[][] STICKERS = new float[][] |
|
172 |
{ |
|
173 |
{ -0.5f, 0.25f, 0.25f, -0.5f, 0.25f, 0.25f }, |
|
174 |
{ 0.0f, -1.0f/3, 0.50f, 1.0f/6, -0.5f, 1.0f/6 }, |
|
175 |
{ -0.5f, 0.0f, 0.00f, -0.5f, 0.50f, 0.0f, 0.0f, 0.5f } |
|
151 | 176 |
}; |
152 | 177 |
|
153 | 178 |
private static MeshBase[] mMeshes; |
... | ... | |
478 | 503 |
{ |
479 | 504 |
if( mMeshes[0]==null ) |
480 | 505 |
{ |
481 |
mMeshes[0] = FactoryCubit.getInstance().createSkewbCornerMesh(); |
|
506 |
float[][] bands= new float[][] |
|
507 |
{ |
|
508 |
{0.028f,35,0.16f,0.7f,7,3,3}, |
|
509 |
{0.000f, 0,1.00f,0.0f,3,1,5} |
|
510 |
}; |
|
511 |
int[] bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
512 |
float[][] corners = new float[][] { {0.08f,0.15f}, {0.08f,0.20f} }; |
|
513 |
int[] cornerIndexes = new int[] { 1,1,1,0,0 }; |
|
514 |
float[][] centers = new float[][] { {-0.25f, -0.25f, -0.25f} }; |
|
515 |
int[] centerIndexes = new int[] { 0,0,0,-1,0 }; |
|
516 |
|
|
517 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
518 |
factory.createNewFaceTransform(VERTICES_CORNER,VERT_INDEXES_CORNER); |
|
519 |
mMeshes[0] = factory.createRoundedSolid(VERTICES_CORNER, VERT_INDEXES_CORNER, |
|
520 |
bands, bandIndexes, |
|
521 |
corners, cornerIndexes, |
|
522 |
centers, centerIndexes, |
|
523 |
getNumCubitFaces() ); |
|
524 |
//mMeshes[0] = FactoryCubit.getInstance().createSkewbCornerMesh(); |
|
482 | 525 |
} |
483 | 526 |
mesh = mMeshes[0].copy(true); |
484 | 527 |
} |
... | ... | |
511 | 554 |
{ |
512 | 555 |
if( mMeshes[2]==null ) |
513 | 556 |
{ |
514 |
mMeshes[2] = FactoryCubit.getInstance().createSkewbFaceMesh(); |
|
557 |
float[][] bands= new float[][] |
|
558 |
{ |
|
559 |
{0.051f,35,SQ2/8,0.9f, 7,3,3}, |
|
560 |
{0.000f, 0, 1,0.0f, 3,0,0} |
|
561 |
}; |
|
562 |
int[] bandIndexes = new int[] { 0,1,1,1,1 }; |
|
563 |
float[][] corners = new float[][] { {0.06f,0.10f} }; |
|
564 |
int[] cornerIndexes = new int[] { 0,0,0,0,0 }; |
|
565 |
float[][] centers = new float[][] { {0,0,-0.2f} }; |
|
566 |
int[] centerIndexes = new int[] { 0,0,0,0,-1 }; |
|
567 |
|
|
568 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
569 |
factory.createNewFaceTransform(VERTICES_FACE,VERT_INDEXES_FACE); |
|
570 |
mMeshes[2] = factory.createRoundedSolid(VERTICES_FACE, VERT_INDEXES_FACE, |
|
571 |
bands, bandIndexes, |
|
572 |
corners, cornerIndexes, |
|
573 |
centers, centerIndexes, |
|
574 |
getNumCubitFaces() ); |
|
515 | 575 |
} |
516 | 576 |
mesh = mMeshes[2].copy(true); |
517 | 577 |
} |
... | ... | |
550 | 610 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top) |
551 | 611 |
{ |
552 | 612 |
int COLORS = FACE_COLORS.length; |
553 |
float R,S;
|
|
554 |
float[] vertices;
|
|
613 |
float R=0.0f,S=0.0f;
|
|
614 |
int cubitType = face/COLORS;
|
|
555 | 615 |
|
556 |
if( face<COLORS ) |
|
557 |
{ |
|
558 |
float E = 0.5f; |
|
559 |
R = 0.023f; |
|
560 |
S = 0.035f; |
|
561 |
vertices = new float[] { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4}; |
|
562 |
} |
|
563 |
else if( face<2*COLORS ) |
|
564 |
{ |
|
565 |
float E = 0.5f; |
|
566 |
R = 0.025f; |
|
567 |
S = 0.05f; |
|
568 |
vertices = new float[] { -E,E/3, 0,-2*E/3, +E,E/3 }; |
|
569 |
} |
|
570 |
else |
|
616 |
switch(cubitType) |
|
571 | 617 |
{ |
572 |
float E = SQ2/4; |
|
573 |
R = 0.055f; |
|
574 |
S = 0.035f; |
|
575 |
vertices = new float[] { -E,-E, +E,-E, +E,+E, -E,+E }; |
|
618 |
case 0: R = 0.025f; S = 0.045f; break; |
|
619 |
case 1: R = 0.025f; S = 0.035f; break; |
|
620 |
case 2: R = 0.055f; S = 0.035f; break; |
|
576 | 621 |
} |
577 | 622 |
|
578 | 623 |
FactorySticker factory = FactorySticker.getInstance(); |
579 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%COLORS], R);
|
|
624 |
factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[cubitType], S, FACE_COLORS[face%COLORS], R);
|
|
580 | 625 |
} |
581 | 626 |
|
582 | 627 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Convert the Skewb.