49 |
49 |
private int[][] mBasicAngle;
|
50 |
50 |
private float[][] mCuts;
|
51 |
51 |
private float[][] mPosition;
|
|
52 |
private int[] mQuatIndex;
|
52 |
53 |
|
53 |
54 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
54 |
55 |
|
... | ... | |
157 |
158 |
{
|
158 |
159 |
if( mPosition==null )
|
159 |
160 |
{
|
160 |
|
final float DIST_CORNER = 1.0f;
|
161 |
|
final float DIST_EDGE = 1.5f;
|
|
161 |
float SHORT_EDGE = 1.5f-0.75f*SQ2;
|
|
162 |
float LONG_EDGE = 1.5f*(SQ2-1);
|
|
163 |
|
|
164 |
final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
|
|
165 |
final float DIST_EDGE = LONG_EDGE+SHORT_EDGE;
|
|
166 |
final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
|
162 |
167 |
|
163 |
168 |
mPosition = new float[][]
|
164 |
169 |
{
|
... | ... | |
182 |
187 |
{ 0.0f, DIST_EDGE,-DIST_EDGE },
|
183 |
188 |
{ DIST_EDGE, 0.0f,-DIST_EDGE },
|
184 |
189 |
{ 0.0f,-DIST_EDGE,-DIST_EDGE },
|
185 |
|
{-DIST_EDGE, 0.0f,-DIST_EDGE }
|
|
190 |
{-DIST_EDGE, 0.0f,-DIST_EDGE },
|
|
191 |
|
|
192 |
{ 0, 0, DIST_CENTER },
|
|
193 |
{ 0, 0,-DIST_CENTER },
|
|
194 |
{ 0, DIST_CENTER, 0 },
|
|
195 |
{ 0,-DIST_CENTER, 0 },
|
|
196 |
{ DIST_CENTER, 0, 0 },
|
|
197 |
{-DIST_CENTER, 0, 0 },
|
186 |
198 |
};
|
187 |
199 |
}
|
188 |
200 |
|
... | ... | |
190 |
202 |
}
|
191 |
203 |
|
192 |
204 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
193 |
|
// TODO
|
194 |
205 |
|
195 |
206 |
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
196 |
207 |
{
|
197 |
|
switch(cubit)
|
|
208 |
if( mQuatIndex==null )
|
198 |
209 |
{
|
199 |
|
case 0: return mObjectQuats[0]; // unit quat
|
200 |
|
case 1: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
201 |
|
case 2: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
202 |
|
case 3: return mObjectQuats[9]; // 180 along X
|
203 |
|
case 4: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
204 |
|
case 5: return mObjectQuats[11]; // 180 along Y
|
205 |
|
case 6: return mObjectQuats[10]; // 180 along Z
|
206 |
|
case 7: return new Static4D(SQ2/2,0,-SQ2/2,0); // 180 along (SQ2/2,0,-SQ2/2)
|
207 |
|
|
208 |
|
case 8: return mObjectQuats[0];
|
209 |
|
case 9: return mObjectQuats[2];
|
210 |
|
case 10: return mObjectQuats[10];
|
211 |
|
case 11: return mObjectQuats[8];
|
212 |
|
case 12: return mObjectQuats[1];
|
213 |
|
case 13: return mObjectQuats[4];
|
214 |
|
case 14: return mObjectQuats[6];
|
215 |
|
case 15: return mObjectQuats[7];
|
216 |
|
case 16: return mObjectQuats[11];
|
217 |
|
case 17: return mObjectQuats[5];
|
218 |
|
case 18: return mObjectQuats[9];
|
219 |
|
case 19: return mObjectQuats[3];
|
|
210 |
mQuatIndex = new int[] { 0,1,3,2,8,9,16,23,
|
|
211 |
0,15,3,17,10,37,36,8,1,24,2,22,
|
|
212 |
0,2,1,3,10,8 };
|
220 |
213 |
}
|
221 |
214 |
|
222 |
|
return null;
|
|
215 |
return mObjectQuats[mQuatIndex[cubit]];
|
223 |
216 |
}
|
224 |
217 |
|
225 |
218 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
226 |
|
// TODO
|
227 |
219 |
|
228 |
220 |
public ObjectShape getObjectShape(int variant)
|
229 |
221 |
{
|
230 |
|
if( variant==0 )
|
231 |
|
{
|
232 |
|
float[][] vertices =
|
233 |
|
{
|
234 |
|
{ 0.0f, 0.0f, 0.0f },
|
235 |
|
{-0.5f, 0.5f, 0.5f },
|
236 |
|
{-0.5f,-0.5f, 0.5f },
|
237 |
|
{ 0.5f, 0.5f, 0.5f },
|
238 |
|
{ 0.5f,-0.5f, 0.5f },
|
239 |
|
{ 0.5f, 0.5f,-0.5f },
|
240 |
|
{ 0.5f,-0.5f,-0.5f },
|
241 |
|
{-0.5f, 0.5f,-0.5f },
|
242 |
|
};
|
|
222 |
float SHORT_EDGE = 1.5f-0.75f*SQ2;
|
|
223 |
float LONG_EDGE = 1.5f*(SQ2-1);
|
|
224 |
float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
|
|
225 |
float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
|
|
226 |
float Z = SHORT_EDGE;
|
243 |
227 |
|
244 |
|
int[][] indices =
|
|
228 |
float[][] vertices =
|
245 |
229 |
{
|
246 |
|
{ 2,4,3,1 },
|
247 |
|
{ 1,3,5,7 },
|
248 |
|
{ 4,6,5,3 },
|
249 |
|
|
250 |
|
{ 0,4,2 },
|
251 |
|
{ 0,7,5 },
|
252 |
|
{ 0,6,4 },
|
253 |
|
{ 0,1,7 },
|
254 |
|
{ 0,2,1 },
|
255 |
|
{ 0,5,6 }
|
|
230 |
{ -X,-Y,-Z },
|
|
231 |
{ -X,-Y,+Z },
|
|
232 |
{ -X,+Y,-Z },
|
|
233 |
{ -X,+Y,+Z },
|
|
234 |
{ +X,-Y,-Z },
|
|
235 |
{ +X,-Y,+Z },
|
|
236 |
{ +X,+Y,-Z },
|
|
237 |
{ +X,+Y,+Z },
|
256 |
238 |
};
|
257 |
239 |
|
258 |
|
return new ObjectShape(vertices, indices);
|
259 |
|
}
|
260 |
|
else
|
261 |
|
{
|
262 |
|
float[][] vertices =
|
|
240 |
int[][] indices =
|
263 |
241 |
{
|
264 |
|
{-0.5f, 0.0f, 0.0f},
|
265 |
|
{ 0.5f, 0.0f, 0.0f},
|
266 |
|
{-0.5f,-1.0f, 0.0f},
|
267 |
|
{ 0.5f,-1.0f, 0.0f},
|
268 |
|
{ 0.0f,-1.5f, 0.0f},
|
269 |
|
{-0.5f, 0.0f,-1.0f},
|
270 |
|
{ 0.5f, 0.0f,-1.0f},
|
271 |
|
{ 0.0f, 0.0f,-1.5f},
|
|
242 |
{1,5,7,3},
|
|
243 |
{3,7,6,2},
|
|
244 |
{5,4,6,7},
|
|
245 |
{0,1,3,2},
|
|
246 |
{4,0,2,6},
|
|
247 |
{0,4,5,1}
|
272 |
248 |
};
|
273 |
249 |
|
274 |
|
int[][] indices =
|
275 |
|
{
|
276 |
|
{ 0,2,4,3,1 },
|
277 |
|
{ 0,1,6,7,5 },
|
278 |
|
{ 1,3,6 },
|
279 |
|
{ 5,2,0 },
|
280 |
|
{ 4,7,6,3 },
|
281 |
|
{ 2,5,7,4 }
|
282 |
|
};
|
283 |
|
|
284 |
|
return new ObjectShape(vertices, indices);
|
285 |
|
}
|
|
250 |
return new ObjectShape(vertices, indices);
|
286 |
251 |
}
|
287 |
252 |
|
288 |
253 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
289 |
|
// TODO
|
290 |
254 |
|
291 |
255 |
public ObjectFaceShape getObjectFaceShape(int variant)
|
292 |
256 |
{
|
|
257 |
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
|
258 |
float h2 = 0.001f;
|
|
259 |
float[][] bands = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
|
|
260 |
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
|
261 |
float[][] corners = { {0.04f,0.10f} };
|
|
262 |
|
293 |
263 |
if( variant==0 )
|
294 |
264 |
{
|
295 |
|
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
296 |
|
float h2 = isInIconMode() ? 0.001f : 0.01f;
|
297 |
|
|
298 |
|
float[][] bands = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} };
|
299 |
|
int[] bandIndices = { 0,0,0,1,1,1,1,1,1 };
|
300 |
|
float[][] corners = { {0.06f,0.12f} };
|
301 |
|
int[] cornerIndices = { -1,0,-1,0,0,0,-1,-1 };
|
302 |
|
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
303 |
|
int[] centerIndices = { -1,0,-1,0,0,0,-1,-1 };
|
304 |
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
|
265 |
int[] bandIndices = { 0,0,0,1,1,1 };
|
|
266 |
int[] indices = { -1,0,0,0,0,0,0,0 };
|
|
267 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
268 |
}
|
|
269 |
if( variant==1 )
|
|
270 |
{
|
|
271 |
int[] bandIndices = { 0,0,1,1,1,1 };
|
|
272 |
int[] indices = { -1,0,0,0,-1,0,0,0 };
|
|
273 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
305 |
274 |
}
|
306 |
275 |
else
|
307 |
276 |
{
|
308 |
|
float h1 = isInIconMode() ? 0.001f : 0.038f;
|
309 |
|
float h2 = isInIconMode() ? 0.001f : 0.020f;
|
310 |
|
|
311 |
|
float[][] bands = { {h1,35,0.250f,0.7f,7,2,2}, {h2,35,0.125f,0.2f,3,1,2}, {h2,35,0.125f,0.2f,3,1,1} };
|
312 |
|
int[] bandIndices = { 0,0,1,1,2,2 };
|
313 |
|
float[][] corners = { {0.06f,0.20f} };
|
314 |
|
int[] cornerIndices = { 0,0,-1,-1,-1,-1,-1,-1 };
|
315 |
|
float[][] centers = { { 0.0f,-0.75f,-0.75f} };
|
316 |
|
int[] centerIndices = { 0,0,-1,-1,-1,-1,-1,-1 };
|
317 |
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
|
277 |
int[] bandIndices = { 0,1,1,1,1,1 };
|
|
278 |
int[] indices = { -1,0,-1,0,-1,0,-1,0 };
|
|
279 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
318 |
280 |
}
|
319 |
281 |
}
|
320 |
282 |
|
Progess with Mixup.