Revision d62785d7
Added by Leszek Koltunski 27 days ago
src/main/java/org/distorted/objectlib/main/TwistyObjectGhost.java | ||
---|---|---|
85 | 85 |
|
86 | 86 |
for(int l=0; l<mMaxNumLayers; l++) |
87 | 87 |
{ |
88 |
mEffectAngle[l] = new Static1D(mRowState[l]* mGhostAngle);
|
|
88 |
mEffectAngle[l] = new Static1D(mRowState[l]*mGhostAngle); |
|
89 | 89 |
mEffect[l] = new VertexEffectRotate(mEffectAngle[l], mGhostAxis, new Static3D(0, 0, 0)); |
90 | 90 |
effects.apply(mEffect[l]); |
91 | 91 |
mOrigQuat[l] = computeQuaternion(mGhostOrigAxis, mRowState[l]*mGhostAngle); |
... | ... | |
103 | 103 |
|
104 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
105 | 105 |
|
106 |
public Static4D getCubitGhostQuat(int cubit) |
|
106 |
public Static4D getCubitOrigGhostQuat(int cubit)
|
|
107 | 107 |
{ |
108 |
if( mGhostAngle !=0 )
|
|
108 |
if( mGhostAngle!=0 ) |
|
109 | 109 |
{ |
110 | 110 |
int rowBitmap = mObject.getCubitRowBitmap(cubit,mGhostOrigAxis); |
111 | 111 |
int row = deBitmapize(rowBitmap); |
... | ... | |
115 | 115 |
return null; |
116 | 116 |
} |
117 | 117 |
|
118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
119 |
|
|
120 |
public Static4D getCubitCurrGhostQuat(int cubit) |
|
121 |
{ |
|
122 |
if( mGhostAngle!=0 ) |
|
123 |
{ |
|
124 |
int rowBitmap = mObject.getCubitRowBitmap(cubit,mAxisParallelTo); |
|
125 |
int row = deBitmapize(rowBitmap); |
|
126 |
return computeQuaternion(mAxisParallelTo, mRowState[row]*mGhostAngle); |
|
127 |
} |
|
128 |
|
|
129 |
return null; |
|
130 |
} |
|
131 |
|
|
118 | 132 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
119 | 133 |
// is the ghost currently blocked along the 'axis' ? |
120 | 134 |
|
... | ... | |
159 | 173 |
if( mNumRot<maxU ) mNumRot = maxU; |
160 | 174 |
} |
161 | 175 |
|
176 |
|
|
177 |
android.util.Log.e("D", "nearest: "+mNumRot); |
|
178 |
|
|
162 | 179 |
return mNumRot*mGhostAngle; |
163 | 180 |
} |
164 | 181 |
} |
... | ... | |
173 | 190 |
|
174 | 191 |
int onRemoveRotation(int axis, int rowBitmap, float angleInDegrees) |
175 | 192 |
{ |
193 |
android.util.Log.e("D", "onRemove: "+angleInDegrees+" numRot: "+mNumRot+" inverted: "+mAxisInverted); |
|
194 |
|
|
176 | 195 |
int nonGhostAngle = (int)angleInDegrees; |
177 | 196 |
|
178 | 197 |
if( mGhostAngle !=0 && nonGhostAngle!=0 ) |
... | ... | |
205 | 224 |
if( ((rowBitmap>>r)&0x1) != 0 ) |
206 | 225 |
{ |
207 | 226 |
mRowState[r] += mNumRot; |
208 |
mEffectAngle[r].set( m* mRowState[r]*mGhostAngle);
|
|
227 |
mEffectAngle[r].set( m*mRowState[r]*mGhostAngle );
|
|
209 | 228 |
} |
210 | 229 |
|
211 | 230 |
boolean oldBlocked = mBlocked; |
... | ... | |
442 | 461 |
boolean wasInverted = mAxisInverted; |
443 | 462 |
mAxisInverted = isAxisInverted(); |
444 | 463 |
|
445 |
if( wasInverted^ mAxisInverted)
|
|
464 |
if( wasInverted^mAxisInverted )
|
|
446 | 465 |
{ |
447 | 466 |
int len = mRowState.length; |
448 | 467 |
int num = len/2; |
... | ... | |
455 | 474 |
mRowState[e] = -mRowState[i]; |
456 | 475 |
mRowState[i] = -t; |
457 | 476 |
|
458 |
mEffectAngle[e].set( m* mRowState[e]* mGhostAngle);
|
|
459 |
mEffectAngle[i].set( m* mRowState[i]* mGhostAngle);
|
|
477 |
mEffectAngle[e].set( m*mRowState[e]*mGhostAngle );
|
|
478 |
mEffectAngle[i].set( m*mRowState[i]*mGhostAngle );
|
|
460 | 479 |
} |
461 | 480 |
|
462 | 481 |
if( (len%2)==1 ) |
... | ... | |
468 | 487 |
} |
469 | 488 |
|
470 | 489 |
for(int l=0; l<mMaxNumLayers; l++) |
471 |
mEffect[l].setMeshAssociation( 1<<(mAxisParallelTo *mMaxNumLayers + l), -1);
|
|
490 |
mEffect[l].setMeshAssociation( 1<<(mAxisParallelTo*mMaxNumLayers+l), -1);
|
|
472 | 491 |
} |
473 | 492 |
|
474 | 493 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyGhostAbstract.java | ||
---|---|---|
65 | 65 |
abstract float[] getCornerPressStrength(); |
66 | 66 |
abstract float[][] getOriginalPositions(); |
67 | 67 |
abstract float[] distsToFace(); |
68 |
abstract float[][] getBands(); |
|
68 | 69 |
|
69 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 | 71 |
|
... | ... | |
170 | 171 |
{ |
171 | 172 |
float[] op = orig[p]; |
172 | 173 |
QuatHelper.rotateVectorByQuat(tmp, op[0], op[1], op[2], 1, mPlanesRotQuat); |
173 |
// TODO: rotate (tmp[0],tmp[1],tmp[2]) by appropriate quat(ghostAxis,ghostAngle^layer) |
|
174 |
// TODO: rotate (tmp[0],tmp[1],tmp[2]) by appropriate quat(ghostAxis,ghostAngle^layer) ?
|
|
174 | 175 |
mPositions[p] = new float[] {tmp[0],tmp[1],tmp[2]}; |
175 | 176 |
} |
176 | 177 |
} |
... | ... | |
286 | 287 |
float[][] vert = shape.getVertices(); |
287 | 288 |
float[][] pos = getCubitPositions(); |
288 | 289 |
int[] indices = FactoryShape.produceBandIndices(vert, pos[variant], ind, getFaceAxis(), getDist() ); |
289 |
|
|
290 |
int N = 5; |
|
291 |
int E = 1; |
|
292 |
float height = isInIconMode() ? 0.001f : 0.02f; |
|
293 |
float[][] bands = { {height,35,0.3f,0.5f,N,E,E}, {0.001f,35,0.3f,0.5f,N,E,E} }; |
|
290 |
float[][] bands= getBands(); |
|
294 | 291 |
return new ObjectFaceShape(bands,indices,null); |
295 | 292 |
} |
296 | 293 |
|
src/main/java/org/distorted/objectlib/objects/TwistyGhostCube.java | ||
---|---|---|
75 | 75 |
int getBasicAngle() { return 4; } |
76 | 76 |
float[] getCornerPressStrength() { return new float[] {0.009f,0.10f}; }; |
77 | 77 |
|
78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
79 |
|
|
80 |
float[][] getBands() |
|
81 |
{ |
|
82 |
int N=5; |
|
83 |
int E=1; |
|
84 |
float height = isInIconMode() ? 0.001f : 0.02f; |
|
85 |
|
|
86 |
return new float[][] { {height,35,0.3f,0.5f,N,E,E}, {0.001f,35,0.3f,0.5f,N,E,E} }; |
|
87 |
} |
|
88 |
|
|
78 | 89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
79 | 90 |
|
80 | 91 |
float[] distsToFace() |
src/main/java/org/distorted/objectlib/objects/TwistyGhostPyramid.java | ||
---|---|---|
57 | 57 |
@Override public int[] getColorTable() { return FACE_COLORS; } |
58 | 58 |
@Override public int[] getGhostRowState() { return new int[] { 1,0 }; } |
59 | 59 |
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
|
|
62 |
float[][] getBands() |
|
63 |
{ |
|
64 |
int N=5; |
|
65 |
int E=1; |
|
66 |
float height = isInIconMode() ? 0.001f : 0.012f; |
|
67 |
|
|
68 |
return new float[][] { {height,35,0.2f,0.5f,N,E,E}, {0.001f,35,0.3f,0.5f,N,E,E} }; |
|
69 |
} |
|
70 |
|
|
60 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 72 |
|
62 | 73 |
float[] getPlanesVector() |
Also available in: Unified diff
fixes to touch control of ghosts