Revision 62efeeae
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/TwistyUltimate.java | ||
---|---|---|
95 | 95 |
// Colors of the faces of cubits. TODO |
96 | 96 |
private static final int[][] mFaceMap = new int[][] |
97 | 97 |
{ |
98 |
{ 24,24,24, 36,36,36,36,36 },
|
|
98 |
{ 25,25,25, 36,36,36,36,36 },
|
|
99 | 99 |
{ 24,24,24, 36,36,36,36,36 }, |
100 | 100 |
{ 24,24,24, 36,36,36,36,36 }, |
101 | 101 |
{ 24,24,24, 36,36,36,36,36 }, |
... | ... | |
116 | 116 |
static final float[][] CENTERS = new float[][] |
117 | 117 |
{ |
118 | 118 |
{ 0.0f,-0.5f, G }, |
119 |
{ E, -E, -E }, |
|
120 |
{ -G, 0.0f,-0.5f }, |
|
121 |
{ 0.5f, G, 0.0f }, |
|
122 |
|
|
119 | 123 |
{ -E, E, E }, |
120 | 124 |
{ G, 0.0f, 0.5f }, |
121 | 125 |
{-0.5f, -G, 0.0f }, |
122 | 126 |
{ 0.0f, 0.5f, -G }, |
123 |
{ E, -E, -E }, |
|
124 |
{ -G, 0.0f,-0.5f }, |
|
125 |
{ 0.5f, G, 0.0f }, |
|
126 | 127 |
|
127 | 128 |
{ E/2, (E+0.5f)/2, (E+G)/2 }, |
128 | 129 |
{ -(E+G)/2, -E/2, (E+0.5f)/2 }, |
... | ... | |
132 | 133 |
{-(E+0.5f)/2, (E+G)/2, -E/2 } |
133 | 134 |
}; |
134 | 135 |
|
135 |
static final int[] QUAT_INDEX = new int[]
|
|
136 |
private static final double[][] VERTICES_SMALL_LEFT = new double[][]
|
|
136 | 137 |
{ |
137 |
0, 11,11,11,11, 6,1,2, // TODO the four middle ones |
|
138 |
0,1,4,9,5,2 |
|
138 |
{ 0.000, 0.000, 0.000}, |
|
139 |
{ - 0.250,-SQ5/8 - 0.125,-SQ5/8 - 0.375}, |
|
140 |
{ SQ5/8 + 0.125,-SQ5/8 - 0.375, + 0.250}, |
|
141 |
{ SQ5/8 + 0.375, + 0.250,-SQ5/8 - 0.125}, |
|
142 |
{ SQ5/4 + 0.250,-SQ5/4 - 0.250,-SQ5/4 - 0.250}, |
|
143 |
{ SQ5/8 - 0.125, + 0.250,-SQ5/8 - 0.125}, |
|
144 |
{ - 0.250,-SQ5/8 - 0.125,-SQ5/8 + 0.125}, |
|
145 |
{ SQ5/8 + 0.125,-SQ5/8 + 0.125, + 0.250} |
|
139 | 146 |
}; |
140 | 147 |
|
141 |
private static final double[][] VERTICES_SMALL = new double[][] |
|
148 |
private static final int[][] VERT_INDEXES_SMALL_LEFT = new int[][] |
|
149 |
{ |
|
150 |
{6,0,5,1}, // counterclockwise! |
|
151 |
{0,7,3,5}, |
|
152 |
{0,6,2,7}, |
|
153 |
{1,5,3,4}, |
|
154 |
{3,7,2,4}, |
|
155 |
{2,6,1,4}, |
|
156 |
}; |
|
157 |
|
|
158 |
private static final double[][] VERTICES_SMALL_RIGHT = new double[][] |
|
142 | 159 |
{ |
143 | 160 |
{ 0.0 , 0.0 , 0.0 }, |
144 | 161 |
{ -0.5*E , 0.5*E+0.25, -0.25 }, |
... | ... | |
150 | 167 |
{ 0.5*E ,-0.5*E+0.25, -0.25 } |
151 | 168 |
}; |
152 | 169 |
|
153 |
private static final int[][] VERT_INDEXES_SMALL = new int[][] |
|
170 |
private static final int[][] VERT_INDEXES_SMALL_RIGHT = new int[][]
|
|
154 | 171 |
{ |
155 | 172 |
{6,0,5,1}, // counterclockwise! |
156 | 173 |
{0,7,3,5}, |
... | ... | |
187 | 204 |
{10,8,2,6} |
188 | 205 |
}; |
189 | 206 |
|
207 |
private static final int[] QUAT_INDEX = new int[] |
|
208 |
{ |
|
209 |
0,6,1,2,0,4,6,5,0,1,4,9,5,2 |
|
210 |
}; |
|
211 |
|
|
190 | 212 |
private static final float[][] STICKERS = new float[][] |
191 | 213 |
{ |
192 | 214 |
{ -0.14400357f, -0.47894150f, 0.50000000f,-0.011045523f, 0.37700626f, 0.36749030f,-0.26699730f, 0.36749026f, -0.46600536f, -0.24499352f }, // Big cubit 1st |
... | ... | |
212 | 234 |
{ |
213 | 235 |
FactoryCubit factory = FactoryCubit.getInstance(); |
214 | 236 |
factory.clear(); |
215 |
mMeshes = new MeshBase[2];
|
|
237 |
mMeshes = new MeshBase[3];
|
|
216 | 238 |
} |
217 | 239 |
|
218 | 240 |
MeshBase mesh; |
219 | 241 |
|
220 |
if( cubit<8 )
|
|
242 |
if( cubit<4 )
|
|
221 | 243 |
{ |
222 | 244 |
if( mMeshes[0]==null ) |
223 | 245 |
{ |
... | ... | |
233 | 255 |
int[] centerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
234 | 256 |
|
235 | 257 |
FactoryCubit factory = FactoryCubit.getInstance(); |
236 |
factory.createNewFaceTransform(VERTICES_SMALL,VERT_INDEXES_SMALL);
|
|
237 |
mMeshes[0] = factory.createRoundedSolid(VERTICES_SMALL, VERT_INDEXES_SMALL,
|
|
258 |
factory.createNewFaceTransform(VERTICES_SMALL_RIGHT,VERT_INDEXES_SMALL_RIGHT);
|
|
259 |
mMeshes[0] = factory.createRoundedSolid(VERTICES_SMALL_RIGHT, VERT_INDEXES_SMALL_RIGHT,
|
|
238 | 260 |
bands, bandIndexes, |
239 | 261 |
corners, cornerIndexes, |
240 | 262 |
centers, centerIndexes, |
... | ... | |
242 | 264 |
} |
243 | 265 |
mesh = mMeshes[0].copy(true); |
244 | 266 |
} |
245 |
else |
|
267 |
else if( cubit<8 )
|
|
246 | 268 |
{ |
247 | 269 |
if( mMeshes[1]==null ) |
270 |
{ |
|
271 |
float[][] bands= new float[][] |
|
272 |
{ |
|
273 |
{0.04f,17,0.5f,0.2f,5, 2,2}, |
|
274 |
{0.01f, 1,0.5f,0.2f,5, 2,2} |
|
275 |
}; |
|
276 |
int[] bandIndexes = new int[] { 0,0,0,1,1,1 }; |
|
277 |
float[][] corners = new float[][] { { 0.013f, 0.08f } }; |
|
278 |
int[] cornerIndexes = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 }; |
|
279 |
float[][] centers = new float[][] { { 0.0f,-0.5f, -(SQ5+3)/4 } }; |
|
280 |
int[] centerIndexes = new int[] { 0,0,0,0,0,0,0,0 }; |
|
281 |
|
|
282 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
283 |
factory.createNewFaceTransform(VERTICES_SMALL_LEFT,VERT_INDEXES_SMALL_LEFT); |
|
284 |
mMeshes[1] = factory.createRoundedSolid(VERTICES_SMALL_LEFT, VERT_INDEXES_SMALL_LEFT, |
|
285 |
bands, bandIndexes, |
|
286 |
corners, cornerIndexes, |
|
287 |
centers, centerIndexes, |
|
288 |
getNumCubitFaces() ); |
|
289 |
} |
|
290 |
mesh = mMeshes[1].copy(true); |
|
291 |
} |
|
292 |
else |
|
293 |
{ |
|
294 |
if( mMeshes[2]==null ) |
|
248 | 295 |
{ |
249 | 296 |
float[][] bands= new float[][] |
250 | 297 |
{ |
... | ... | |
260 | 307 |
|
261 | 308 |
FactoryCubit factory = FactoryCubit.getInstance(); |
262 | 309 |
factory.createNewFaceTransform(VERTICES_BIG,VERT_INDEXES_BIG); |
263 |
mMeshes[1] = factory.createRoundedSolid(VERTICES_BIG, VERT_INDEXES_BIG,
|
|
310 |
mMeshes[2] = factory.createRoundedSolid(VERTICES_BIG, VERT_INDEXES_BIG,
|
|
264 | 311 |
bands, bandIndexes, |
265 | 312 |
corners, cornerIndexes, |
266 | 313 |
centers, centerIndexes, |
267 | 314 |
getNumCubitFaces() ); |
268 | 315 |
} |
269 |
mesh = mMeshes[1].copy(true);
|
|
316 |
mesh = mMeshes[2].copy(true);
|
|
270 | 317 |
} |
271 | 318 |
|
272 |
Static4D q = QUATS[getQuat(cubit)]; |
|
319 |
Static4D q = QUATS[getQuatIndex(cubit)];
|
|
273 | 320 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( q, new Static3D(0,0,0) ); |
274 | 321 |
mesh.apply(quat,0xffffffff,0); |
275 | 322 |
|
... | ... | |
285 | 332 |
|
286 | 333 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
287 | 334 |
|
288 |
private int getQuat(int cubit) |
|
335 |
private int getQuatIndex(int cubit)
|
|
289 | 336 |
{ |
290 | 337 |
return QUAT_INDEX[cubit]; |
291 | 338 |
} |
... | ... | |
300 | 347 |
|
301 | 348 |
switch(stickerType) |
302 | 349 |
{ |
303 |
case 0: R = 0.09f; S = 0.08f; break;
|
|
304 |
case 1: R = 0.10f; S = 0.08f; break;
|
|
350 |
case 0: R = 0.08f; S = 0.07f; break;
|
|
351 |
case 1: R = 0.13f; S = 0.09f; break;
|
|
305 | 352 |
case 2: R = 0.11f; S = 0.08f; break; |
306 | 353 |
default: R = 0.00f; S = 0.00f; break; |
307 | 354 |
} |
... | ... | |
373 | 420 |
|
374 | 421 |
float getScreenRatio() |
375 | 422 |
{ |
376 |
return 0.5f;
|
|
423 |
return 0.67f;
|
|
377 | 424 |
} |
378 | 425 |
|
379 | 426 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with Skewb Ultimate.