59 |
59 |
private static final float D = SQ3/3;
|
60 |
60 |
private static final float E = (SQ5+1)/4;
|
61 |
61 |
private static final float F = (SQ5-1)/4;
|
|
62 |
private static final float G = (SQ5+3)/4;
|
62 |
63 |
|
63 |
64 |
static final Static3D[] ROT_AXIS = new Static3D[]
|
64 |
65 |
{
|
... | ... | |
91 |
92 |
new Static4D( F, 0.5f, E, 0.0f )
|
92 |
93 |
};
|
93 |
94 |
|
|
95 |
// Colors of the faces of cubits. TODO
|
|
96 |
private static final int[][] mFaceMap = new int[][]
|
|
97 |
{
|
|
98 |
{ 24,24,24, 36,36,36,36,36 },
|
|
99 |
{ 24,24,24, 36,36,36,36,36 },
|
|
100 |
{ 24,24,24, 36,36,36,36,36 },
|
|
101 |
{ 24,24,24, 36,36,36,36,36 },
|
|
102 |
{ 24,24,24, 36,36,36,36,36 },
|
|
103 |
{ 24,24,24, 36,36,36,36,36 },
|
|
104 |
{ 24,24,24, 36,36,36,36,36 },
|
|
105 |
{ 24,24,24, 36,36,36,36,36 },
|
|
106 |
|
|
107 |
{ 0, 0,12,12, 36,36,36,36 },
|
|
108 |
{ 0, 0,12,12, 36,36,36,36 },
|
|
109 |
{ 0, 0,12,12, 36,36,36,36 },
|
|
110 |
{ 0, 0,12,12, 36,36,36,36 },
|
|
111 |
{ 0, 0,12,12, 36,36,36,36 },
|
|
112 |
{ 0, 0,12,12, 36,36,36,36 }
|
|
113 |
};
|
|
114 |
|
|
115 |
// centers of the 14 cubits.
|
|
116 |
static final float[][] CENTERS = new float[][]
|
|
117 |
{
|
|
118 |
{ 0.0f,-0.5f, G },
|
|
119 |
{ -E, E, E },
|
|
120 |
{ G, 0.0f, 0.5f },
|
|
121 |
{-0.5f, -G, 0.0f },
|
|
122 |
{ 0.0f, 0.5f, -G },
|
|
123 |
{ E, -E, -E },
|
|
124 |
{ -G, 0.0f,-0.5f },
|
|
125 |
{ 0.5f, G, 0.0f },
|
|
126 |
|
|
127 |
{ E/2, (E+0.5f)/2, (E+G)/2 },
|
|
128 |
{ -(E+G)/2, -E/2, (E+0.5f)/2 },
|
|
129 |
{ (E+0.5f)/2, -(E+G)/2, E/2 },
|
|
130 |
{ -E/2,-(E+0.5f)/2, -(E+G)/2 },
|
|
131 |
{ (E+G)/2, E/2,-(E+0.5f)/2 },
|
|
132 |
{-(E+0.5f)/2, (E+G)/2, -E/2 }
|
|
133 |
};
|
|
134 |
|
|
135 |
static final int[] QUAT_INDEX = new int[]
|
|
136 |
{
|
|
137 |
0, 11,11,11,11, 6,1,2, // TODO the four middle ones
|
|
138 |
0,1,4,9,5,2
|
|
139 |
};
|
|
140 |
|
94 |
141 |
private static final double[][] VERTICES_SMALL = new double[][]
|
95 |
142 |
{
|
96 |
143 |
{ 0.0 , 0.0 , 0.0 },
|
... | ... | |
140 |
187 |
{10,8,2,6}
|
141 |
188 |
};
|
142 |
189 |
|
143 |
|
// TODO
|
144 |
190 |
private static final float[][] STICKERS = new float[][]
|
145 |
191 |
{
|
146 |
|
{ -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f }
|
|
192 |
{ -0.14400357f, -0.47894150f, 0.50000000f,-0.011045523f, 0.37700626f, 0.36749030f,-0.26699730f, 0.36749026f, -0.46600536f, -0.24499352f }, // Big cubit 1st
|
|
193 |
{ 0.36327127f, 0.26393202f,-0.36327127f, 0.500000000f,-0.36327127f,-0.26393202f, 0.36327127f,-0.50000000f }, // Big cubit 2nd
|
|
194 |
{ -0.29389262f, -0.50000000f, 0.29389262f,-0.309017000f, 0.29389262f, 0.30901700f,-0.29389262f, 0.50000000f }, // Small cubit 1st
|
147 |
195 |
};
|
148 |
196 |
|
149 |
197 |
private static MeshBase[] mMeshes;
|
... | ... | |
221 |
269 |
mesh = mMeshes[1].copy(true);
|
222 |
270 |
}
|
223 |
271 |
|
224 |
|
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit), new Static3D(0,0,0) );
|
|
272 |
Static4D q = QUATS[getQuat(cubit)];
|
|
273 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( q, new Static3D(0,0,0) );
|
225 |
274 |
mesh.apply(quat,0xffffffff,0);
|
226 |
275 |
|
227 |
276 |
return mesh;
|
228 |
277 |
}
|
229 |
278 |
|
230 |
279 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
231 |
|
// TODO
|
232 |
280 |
|
233 |
|
private Static4D getQuat(int cubit)
|
|
281 |
float[][] getCubitPositions(int numLayers)
|
234 |
282 |
{
|
235 |
|
switch(cubit)
|
236 |
|
{
|
237 |
|
case 0:
|
238 |
|
case 1:
|
239 |
|
case 2:
|
240 |
|
case 3:
|
241 |
|
case 4:
|
242 |
|
case 5:
|
243 |
|
case 6:
|
244 |
|
case 7:
|
245 |
|
|
246 |
|
case 8:
|
247 |
|
case 9:
|
248 |
|
case 10:
|
249 |
|
case 11:
|
250 |
|
case 12:
|
251 |
|
case 13: return QUATS[0];
|
252 |
|
}
|
253 |
|
|
254 |
|
return null;
|
|
283 |
return CENTERS;
|
255 |
284 |
}
|
256 |
285 |
|
257 |
286 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
258 |
287 |
|
259 |
|
float[][] getCubitPositions(int numLayers)
|
|
288 |
private int getQuat(int cubit)
|
260 |
289 |
{
|
261 |
|
float[][] tmp = new float[14][];
|
262 |
|
|
263 |
|
// TODO
|
264 |
|
|
265 |
|
return tmp;
|
|
290 |
return QUAT_INDEX[cubit];
|
266 |
291 |
}
|
267 |
292 |
|
268 |
293 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
269 |
|
// TODO
|
270 |
294 |
|
271 |
295 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
|
272 |
296 |
{
|
273 |
|
float R = 0.10f;
|
274 |
|
float S = 0.08f;
|
|
297 |
int COLORS = FACE_COLORS.length;
|
|
298 |
int stickerType = face/COLORS;
|
|
299 |
float R,S;
|
|
300 |
|
|
301 |
switch(stickerType)
|
|
302 |
{
|
|
303 |
case 0: R = 0.09f; S = 0.08f; break;
|
|
304 |
case 1: R = 0.10f; S = 0.08f; break;
|
|
305 |
case 2: R = 0.11f; S = 0.08f; break;
|
|
306 |
default: R = 0.00f; S = 0.00f; break;
|
|
307 |
}
|
275 |
308 |
|
276 |
309 |
FactorySticker factory = FactorySticker.getInstance();
|
277 |
|
factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], S, FACE_COLORS[face], R);
|
|
310 |
factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[stickerType], S, FACE_COLORS[face%COLORS], R);
|
278 |
311 |
}
|
279 |
312 |
|
280 |
313 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
281 |
|
// TODO
|
282 |
314 |
|
283 |
315 |
int getFaceColor(int cubit, int cubitface, int size)
|
284 |
316 |
{
|
285 |
|
return CUBITS[cubit].mRotationRow[cubitface/2] == (cubitface%2==0 ? (1<<(size-1)):1) ? cubitface : NUM_FACES;
|
|
317 |
return mFaceMap[cubit][cubitface];
|
286 |
318 |
}
|
287 |
319 |
|
288 |
320 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
289 |
|
// TODO
|
290 |
321 |
|
291 |
322 |
float returnMultiplier()
|
292 |
323 |
{
|
293 |
|
return getNumLayers();
|
|
324 |
return 1.0f;
|
294 |
325 |
}
|
295 |
326 |
|
296 |
327 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Progress with Skewb Ultimate.