Revision a57e6870
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java | ||
---|---|---|
80 | 80 |
|
81 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
82 | 82 |
|
83 |
TwistyBandagedAbstract(int size, Static4D quat, Static3D move, DistortedTexture texture,
|
|
83 |
TwistyBandagedAbstract(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
|
|
84 | 84 |
MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth) |
85 | 85 |
{ |
86 |
super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
|
|
86 |
super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
|
|
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
128 | 128 |
|
129 | 129 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
130 | 130 |
|
131 |
protected int[] getSolvedQuats(int cubit, int numLayers) |
|
131 |
protected int[] getSolvedQuats(int cubit, int[] numLayers)
|
|
132 | 132 |
{ |
133 | 133 |
if( mQuats==null ) initializeQuats(); |
134 | 134 |
int status = retCubitSolvedStatus(cubit,numLayers); |
... | ... | |
161 | 161 |
|
162 | 162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
163 | 163 |
|
164 |
protected ObjectShape getObjectShape(int cubit, int numLayers) |
|
164 |
protected ObjectShape getObjectShape(int cubit, int[] numLayers)
|
|
165 | 165 |
{ |
166 | 166 |
int variant = getCubitVariant(cubit,numLayers); |
167 | 167 |
|
... | ... | |
225 | 225 |
|
226 | 226 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
227 | 227 |
|
228 |
protected Static4D getQuat(int cubit, int numLayers) |
|
228 |
protected Static4D getQuat(int cubit, int[] numLayers)
|
|
229 | 229 |
{ |
230 | 230 |
if( mInitQuats ==null ) |
231 | 231 |
{ |
... | ... | |
245 | 245 |
|
246 | 246 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
247 | 247 |
|
248 |
protected int getNumCubitVariants(int numLayers) |
|
248 |
protected int getNumCubitVariants(int[] numLayers)
|
|
249 | 249 |
{ |
250 | 250 |
return mDimensions.length; |
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
254 | 254 |
|
255 |
protected int getCubitVariant(int cubit, int numLayers) |
|
255 |
protected int getCubitVariant(int cubit, int[] numLayers)
|
|
256 | 256 |
{ |
257 | 257 |
float[][] pos = getPositions(); |
258 | 258 |
|
... | ... | |
308 | 308 |
|
309 | 309 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
310 | 310 |
|
311 |
protected float[][] getCubitPositions(int size)
|
|
311 |
protected float[][] getCubitPositions(int[] numLayers)
|
|
312 | 312 |
{ |
313 | 313 |
int numCubits = getNumCubits(); |
314 | 314 |
float[][] tmp = new float[numCubits][]; |
... | ... | |
331 | 331 |
|
332 | 332 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
333 | 333 |
|
334 |
protected float[][] getCuts(int numLayers) |
|
334 |
protected float[][] getCuts(int[] numLayers)
|
|
335 | 335 |
{ |
336 |
if( numLayers<2 ) return null; |
|
336 |
int numL = numLayers[0]; |
|
337 |
|
|
338 |
if( numL<2 ) return null; |
|
337 | 339 |
|
338 | 340 |
if( mCuts==null ) |
339 | 341 |
{ |
340 |
mCuts = new float[3][numLayers-1];
|
|
342 |
mCuts = new float[3][numL-1]; |
|
341 | 343 |
|
342 |
for(int i=0; i<numLayers-1; i++)
|
|
344 |
for(int i=0; i<numL-1; i++) |
|
343 | 345 |
{ |
344 |
float cut = (2-numLayers)*0.5f + i;
|
|
346 |
float cut = (2-numL)*0.5f + i; |
|
345 | 347 |
mCuts[0][i] = cut; |
346 | 348 |
mCuts[1][i] = cut; |
347 | 349 |
mCuts[2][i] = cut; |
... | ... | |
353 | 355 |
|
354 | 356 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
355 | 357 |
|
356 |
private void getLayerRotatable(int numLayers) |
|
358 |
private void getLayerRotatable(int[] numLayers)
|
|
357 | 359 |
{ |
358 | 360 |
if( mLayerRotatable==null ) |
359 | 361 |
{ |
360 | 362 |
int numAxis = ROT_AXIS.length; |
361 |
boolean[] tmp = new boolean[numLayers]; |
|
362 |
for(int i=0; i<numLayers; i++) tmp[i] = true; |
|
363 | 363 |
mLayerRotatable = new boolean[numAxis][]; |
364 |
for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp; |
|
364 |
|
|
365 |
for(int i=0; i<numAxis; i++) |
|
366 |
{ |
|
367 |
mLayerRotatable[i] = new boolean[numLayers[i]]; |
|
368 |
for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true; |
|
369 |
} |
|
365 | 370 |
} |
366 | 371 |
} |
367 | 372 |
|
... | ... | |
374 | 379 |
|
375 | 380 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
376 | 381 |
|
377 |
protected int getNumStickerTypes(int numLayers) |
|
382 |
protected int getNumStickerTypes(int[] numLayers)
|
|
378 | 383 |
{ |
379 | 384 |
return NUM_STICKERS; |
380 | 385 |
} |
... | ... | |
416 | 421 |
|
417 | 422 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
418 | 423 |
|
419 |
protected int getFaceColor(int cubit, int cubitface, int numLayers) |
|
424 |
protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
|
|
420 | 425 |
{ |
421 | 426 |
if( mFaceMap==null ) |
422 | 427 |
{ |
... | ... | |
453 | 458 |
for(int i=0; i<len; i++) position += pos[3*i+posIndex]; |
454 | 459 |
position /= len; |
455 | 460 |
|
456 |
boolean reaches = multiplier*position + dim[dimIndex]*0.5f > (numLayers-1)*0.5f; |
|
461 |
boolean reaches = multiplier*position + dim[dimIndex]*0.5f > (numLayers[0]-1)*0.5f;
|
|
457 | 462 |
|
458 | 463 |
return reaches ? stickerIndex*NUM_FACE_COLORS + face : NUM_TEXTURES; |
459 | 464 |
} |
... | ... | |
472 | 477 |
{ |
473 | 478 |
if( mMovement==null ) |
474 | 479 |
{ |
475 |
int numLayers = getNumLayers(); |
|
480 |
int[] numLayers = getNumLayers();
|
|
476 | 481 |
if( mCuts==null ) getCuts(numLayers); |
477 | 482 |
getLayerRotatable(numLayers); |
478 |
mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED); |
|
483 |
mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
|
|
479 | 484 |
} |
480 | 485 |
return mMovement; |
481 | 486 |
} |
Also available in: Unified diff
make numLayers into an int[] (preparation for Cuboids)
Caution: because of previous changes to cubit order in cube, the Solver is broken!