Revision b03776e1
Added by Leszek Koltunski 8 months ago
src/main/java/org/distorted/objectlib/main/TwistyObjectGhost.java | ||
---|---|---|
28 | 28 |
private final Static3D[] mAxis; |
29 | 29 |
private final int mNumAxis; |
30 | 30 |
private final int mMaxNumLayers; |
31 |
|
|
32 | 31 |
private final int mGhostAngle; |
33 | 32 |
private final int mGhostOrigAxis; |
34 | 33 |
private final int[] mGhostRowState; |
34 |
|
|
35 | 35 |
private Static4D[] mGhostOrigQuat; |
36 | 36 |
private Static1D[] mGhostEffectAngle; |
37 | 37 |
private VertexEffectRotate[] mGhostEffect; |
... | ... | |
196 | 196 |
|
197 | 197 |
if( !mGhostBlocked || axis==mGhostAxisParallelTo ) |
198 | 198 |
{ |
199 |
if( mGhostAxisParallelTo!=axis ) |
|
200 |
{ |
|
201 |
mGhostAxis.set(mAxis[axis]); |
|
202 |
mGhostAxisParallelTo = axis; |
|
203 |
mGhostAxisInverted = false; |
|
204 |
|
|
205 |
for(int l=0; l<mMaxNumLayers; l++) |
|
206 |
mGhostEffect[l].setMeshAssociation( 1<<(mGhostAxisParallelTo*mMaxNumLayers + l), -1); |
|
207 |
} |
|
208 |
|
|
209 |
int m = mGhostAxisInverted ? -1 : 1; |
|
199 | 210 |
boolean oldBlocked = mGhostBlocked; |
200 | 211 |
mGhostBlocked = false; |
201 | 212 |
|
... | ... | |
204 | 215 |
if( ((rowBitmap>>r)&0x1) != 0 ) |
205 | 216 |
{ |
206 | 217 |
mGhostRowState[r] -= move; |
207 |
mGhostEffectAngle[r].set(mGhostRowState[r]*mGhostAngle); |
|
218 |
mGhostEffectAngle[r].set( m*mGhostRowState[r]*mGhostAngle);
|
|
208 | 219 |
} |
209 | 220 |
|
210 | 221 |
if( mGhostRowState[r] != mGhostRowState[0] ) mGhostBlocked = true; |
211 | 222 |
} |
212 | 223 |
|
213 | 224 |
if( oldBlocked && !mGhostBlocked ) computeNewRotationAxis(axis); |
214 |
|
|
215 |
if( mGhostAxisParallelTo!=axis ) |
|
216 |
{ |
|
217 |
mGhostAxis.set(mAxis[axis]); |
|
218 |
mGhostAxisParallelTo = axis; |
|
219 |
mGhostAxisInverted = false; |
|
220 |
|
|
221 |
for(int l=0; l<mMaxNumLayers; l++) |
|
222 |
mGhostEffect[l].setMeshAssociation( 1<<(mGhostAxisParallelTo*mMaxNumLayers + l), -1); |
|
223 |
} |
|
224 | 225 |
} |
225 | 226 |
} |
226 | 227 |
|
... | ... | |
356 | 357 |
for( int r=0; r<mMaxNumLayers; r++ ) |
357 | 358 |
{ |
358 | 359 |
mGhostEffectAngle[r].set(mGhostRowState[r]*mGhostAngle); |
360 |
android.util.Log.e("D","reinitializeGhostStuff rowState["+r+"] : "+mGhostRowState[r]); |
|
359 | 361 |
mGhostEffect[r].setMeshAssociation(1<<(mGhostAxisParallelTo*mMaxNumLayers + r), -1); |
360 | 362 |
if( mGhostRowState[r] != mGhostRowState[0] ) mGhostBlocked = true; |
361 | 363 |
} |
... | ... | |
438 | 440 |
|
439 | 441 |
if( wasInverted^mGhostAxisInverted ) |
440 | 442 |
{ |
441 |
int num = mMaxNumLayers/2; |
|
443 |
int len = mGhostRowState.length; |
|
444 |
int num = len/2; |
|
442 | 445 |
int m = mGhostAxisInverted ? -1 : 1; |
443 | 446 |
|
444 | 447 |
for(int i=0; i<num; i++) |
445 | 448 |
{ |
446 |
int e = mMaxNumLayers-1-i;
|
|
449 |
int e = len-1-i;
|
|
447 | 450 |
int t = mGhostRowState[e]; |
448 | 451 |
mGhostRowState[e] = -mGhostRowState[i]; |
449 | 452 |
mGhostRowState[i] = -t; |
... | ... | |
451 | 454 |
mGhostEffectAngle[e].set( m*mGhostRowState[e]*mGhostAngle); |
452 | 455 |
mGhostEffectAngle[i].set( m*mGhostRowState[i]*mGhostAngle); |
453 | 456 |
} |
457 |
|
|
458 |
if( (len%2)==1 ) |
|
459 |
{ |
|
460 |
int index = (len-1)/2; |
|
461 |
mGhostRowState[index] *= -1; |
|
462 |
mGhostEffectAngle[index].set(m*mGhostRowState[index]*mGhostAngle); |
|
463 |
} |
|
454 | 464 |
} |
455 | 465 |
|
456 | 466 |
for(int l=0; l<mMaxNumLayers; l++) |
Also available in: Unified diff
GhostCubes - staircase model finished