Revision 6e7146df
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/objects/TwistyMegaminx.java | ||
---|---|---|
180 | 180 |
{ |
181 | 181 |
float E = 2.0f*(numLayers/6.0f - MEGA_D)/(0.5f*(numLayers-1)); |
182 | 182 |
int N = (numCubitsPerCorner-1)/3; |
183 |
int b1 = (part-1) % N;
|
|
184 |
int b2 = (part-1) / N;
|
|
185 |
Static4D pri = mCurrV[b2];
|
|
186 |
Static4D sec = mCurrV[(b2+2)%3];
|
|
183 |
int block = (part-1) % N;
|
|
184 |
int index = (part-1) / N;
|
|
185 |
Static4D pri = mCurrV[index];
|
|
186 |
Static4D sec = mCurrV[(index+2)%3];
|
|
187 | 187 |
|
188 |
int multP = (b1 % ((numLayers-3)/2)) + 1;
|
|
189 |
int multS = (b1 / ((numLayers-3)/2));
|
|
188 |
int multP = (block % ((numLayers-3)/2)) + 1;
|
|
189 |
int multS = (block / ((numLayers-3)/2));
|
|
190 | 190 |
|
191 | 191 |
pos.set( corn.get0()*D + (pri.get0()*multP + sec.get0()*multS)*E, |
192 | 192 |
corn.get1()*D + (pri.get1()*multP + sec.get1()*multS)*E, |
... | ... | |
318 | 318 |
|
319 | 319 |
int getFaceColor(int cubit, int cubitface, int numLayers) |
320 | 320 |
{ |
321 |
if( cubitface<0 || cubitface>2 ) return NUM_TEXTURES*NUM_FACES; |
|
322 |
|
|
321 | 323 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
322 |
int type = cubit % numCubitsPerCorner;
|
|
324 |
int part = cubit % numCubitsPerCorner;
|
|
323 | 325 |
int corner= cubit / numCubitsPerCorner; |
324 | 326 |
|
325 |
if( type==0 )
|
|
327 |
if( part==0 )
|
|
326 | 328 |
{ |
327 |
return cubitface>=0 && cubitface<3 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES;
|
|
329 |
return mCornerFaceMap[corner][cubitface];
|
|
328 | 330 |
} |
329 | 331 |
else |
330 | 332 |
{ |
331 | 333 |
int N = (numCubitsPerCorner-1)/3; |
332 |
int block = (type-1) % N;
|
|
333 |
int index = (type-1) / N;
|
|
334 |
int block = (part-1) % N;
|
|
335 |
int index = (part-1) / N;
|
|
334 | 336 |
|
335 |
if( index< (numLayers-1)/2 )
|
|
337 |
if( block< (numLayers-1)/2 )
|
|
336 | 338 |
{ |
337 |
return ( cubitface>2 || cubitface==((block+2)%3) ) ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface]; |
|
339 |
switch(index) |
|
340 |
{ |
|
341 |
case 0: return cubitface==1 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface]; |
|
342 |
case 1: return cubitface==0 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface]; |
|
343 |
case 2: return cubitface==2 ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface]; |
|
344 |
} |
|
338 | 345 |
} |
339 | 346 |
else |
340 | 347 |
{ |
341 |
return ( cubitface>2 || cubitface==block ) ? NUM_TEXTURES*NUM_FACES : mCornerFaceMap[corner][cubitface]; |
|
348 |
switch(index) |
|
349 |
{ |
|
350 |
case 0: return cubitface==0 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES; |
|
351 |
case 1: return cubitface==2 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES; |
|
352 |
case 2: return cubitface==1 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES*NUM_FACES; |
|
353 |
} |
|
342 | 354 |
} |
343 | 355 |
} |
356 |
|
|
357 |
return NUM_TEXTURES*NUM_FACES; |
|
344 | 358 |
} |
345 | 359 |
|
346 | 360 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with Megaminx.