30 |
30 |
private final int mMaxNumLayers;
|
31 |
31 |
private final int mGhostAngle;
|
32 |
32 |
private final int mGhostOrigAxis;
|
33 |
|
private final int[] mGhostRowState;
|
34 |
|
|
35 |
|
private Static4D[] mGhostOrigQuat;
|
36 |
|
private Static1D[] mGhostEffectAngle;
|
37 |
|
private VertexEffectRotate[] mGhostEffect;
|
38 |
|
private int[] mGhostOrigCubitRot;
|
39 |
|
private int[] mGhostCurrCubitRot;
|
40 |
|
private boolean mGhostBlocked;
|
|
33 |
private final int[] mRowState;
|
|
34 |
|
|
35 |
private Static4D[] mOrigQuat;
|
|
36 |
private Static1D[] mEffectAngle;
|
|
37 |
private VertexEffectRotate[] mEffect;
|
|
38 |
private int[] mOrigCubitRot;
|
|
39 |
private int[] mCurrCubitRot;
|
|
40 |
private boolean mBlocked;
|
41 |
41 |
private Static3D mGhostAxis;
|
42 |
|
private int mGhostAxisParallelTo;
|
43 |
|
private boolean mGhostAxisInverted;
|
|
42 |
private int mAxisParallelTo;
|
|
43 |
private boolean mAxisInverted;
|
44 |
44 |
|
45 |
45 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
46 |
46 |
|
... | ... | |
59 |
59 |
if( maxNumLayers<numLayer ) maxNumLayers = numLayer;
|
60 |
60 |
mMaxNumLayers = maxNumLayers;
|
61 |
61 |
|
62 |
|
mGhostAngle = controllable.getGhostAngle();
|
|
62 |
mGhostAngle = controllable.getGhostAngle();
|
63 |
63 |
mGhostOrigAxis = controllable.getGhostAxis();
|
64 |
64 |
|
65 |
65 |
int[] state = controllable.getGhostRowState();
|
66 |
|
mGhostRowState = new int[mMaxNumLayers];
|
|
66 |
mRowState = new int[mMaxNumLayers];
|
67 |
67 |
|
68 |
68 |
if( state!=null )
|
69 |
|
for(int i=0; i<mMaxNumLayers; i++) mGhostRowState[i] = state[i];
|
|
69 |
for(int i=0; i<mMaxNumLayers; i++) mRowState[i] = state[i];
|
70 |
70 |
|
71 |
|
if( mGhostAngle!=0 )
|
|
71 |
if( mGhostAngle !=0 )
|
72 |
72 |
{
|
73 |
|
mGhostBlocked = true;
|
74 |
|
mGhostAxisInverted= false;
|
|
73 |
mBlocked = true;
|
|
74 |
mAxisInverted = false;
|
75 |
75 |
mGhostAxis = new Static3D(mAxis[mGhostOrigAxis]);
|
76 |
|
mGhostEffect = new VertexEffectRotate[mMaxNumLayers];
|
77 |
|
mGhostEffectAngle = new Static1D[mMaxNumLayers];
|
78 |
|
mGhostOrigQuat = new Static4D[mMaxNumLayers];
|
|
76 |
mEffect = new VertexEffectRotate[mMaxNumLayers];
|
|
77 |
mEffectAngle = new Static1D[mMaxNumLayers];
|
|
78 |
mOrigQuat = new Static4D[mMaxNumLayers];
|
79 |
79 |
|
80 |
80 |
for(int l=0; l<mMaxNumLayers; l++)
|
81 |
81 |
{
|
82 |
|
mGhostEffectAngle[l] = new Static1D(mGhostRowState[l]*mGhostAngle);
|
83 |
|
mGhostEffect[l] = new VertexEffectRotate(mGhostEffectAngle[l], mGhostAxis, new Static3D(0, 0, 0));
|
84 |
|
effects.apply(mGhostEffect[l]);
|
85 |
|
mGhostOrigQuat[l] = computeQuaternion(mGhostOrigAxis,mGhostRowState[l]*mGhostAngle);
|
|
82 |
mEffectAngle[l] = new Static1D(mRowState[l]* mGhostAngle);
|
|
83 |
mEffect[l] = new VertexEffectRotate(mEffectAngle[l], mGhostAxis, new Static3D(0, 0, 0));
|
|
84 |
effects.apply(mEffect[l]);
|
|
85 |
mOrigQuat[l] = computeQuaternion(mGhostOrigAxis, mRowState[l]*mGhostAngle);
|
86 |
86 |
}
|
87 |
87 |
|
88 |
|
mGhostAxisParallelTo = mGhostOrigAxis;
|
|
88 |
mAxisParallelTo = mGhostOrigAxis;
|
89 |
89 |
|
90 |
|
mGhostOrigCubitRot = new int[mNumCubits];
|
91 |
|
mGhostCurrCubitRot = new int[mNumCubits];
|
|
90 |
mOrigCubitRot = new int[mNumCubits];
|
|
91 |
mCurrCubitRot = new int[mNumCubits];
|
92 |
92 |
|
93 |
93 |
reinitializeGhostStuff();
|
94 |
|
for(int c=0; c<mNumCubits; c++) mGhostOrigCubitRot[c] = mGhostCurrCubitRot[c];
|
|
94 |
for(int c=0; c<mNumCubits; c++) mOrigCubitRot[c] = mCurrCubitRot[c];
|
95 |
95 |
}
|
96 |
96 |
}
|
97 |
97 |
|
... | ... | |
99 |
99 |
|
100 |
100 |
public Static4D getCubitGhostQuat(int cubit)
|
101 |
101 |
{
|
102 |
|
if( mGhostAngle!=0 )
|
|
102 |
if( mGhostAngle !=0 )
|
103 |
103 |
{
|
104 |
104 |
int rowBitmap = mObject.getCubitRowBitmap(cubit,mGhostOrigAxis);
|
105 |
105 |
int row = deBitmapize(rowBitmap);
|
106 |
|
return mGhostOrigQuat[row];
|
|
106 |
return mOrigQuat[row];
|
107 |
107 |
}
|
108 |
108 |
|
109 |
109 |
return null;
|
... | ... | |
114 |
114 |
|
115 |
115 |
boolean ghostBlocked(int axis)
|
116 |
116 |
{
|
117 |
|
return mGhostBlocked && axis!=mGhostAxisParallelTo;
|
|
117 |
return mBlocked && axis!= mAxisParallelTo;
|
118 |
118 |
}
|
119 |
119 |
|
120 |
120 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
123 |
123 |
|
124 |
124 |
int nearestGhostAngle(int axis, int row, float angle)
|
125 |
125 |
{
|
126 |
|
if( mGhostAngle!=0 )
|
|
126 |
if( mGhostAngle !=0 )
|
127 |
127 |
{
|
128 |
128 |
int intAngle = (int)angle;
|
129 |
129 |
int basicDeg = 360/mBasicAngles[axis][row];
|
130 |
130 |
int numRot = (int)(angle/basicDeg + 0.5f);
|
131 |
131 |
if( angle< -(basicDeg*0.5) ) numRot -= 1;
|
132 |
132 |
int distToNormalAngle = Math.abs(intAngle-numRot*basicDeg);
|
133 |
|
int numRotGhost = (int)(angle/mGhostAngle + 0.5f);
|
134 |
|
if( angle< -(mGhostAngle*0.5) ) numRotGhost -= 1;
|
135 |
|
int distToGhostAngle = Math.abs(intAngle-numRotGhost*mGhostAngle);
|
|
133 |
int numRotGhost = (int)(angle/ mGhostAngle + 0.5f);
|
|
134 |
if( angle< -(mGhostAngle *0.5) ) numRotGhost -= 1;
|
|
135 |
int distToGhostAngle = Math.abs(intAngle-numRotGhost* mGhostAngle);
|
136 |
136 |
|
137 |
|
if( distToNormalAngle>distToGhostAngle && (!mGhostBlocked || axis==mGhostAxisParallelTo) )
|
|
137 |
if( distToNormalAngle>distToGhostAngle && (!mBlocked || axis== mAxisParallelTo) )
|
138 |
138 |
{
|
139 |
139 |
int numRows = mBasicAngles[axis].length;
|
140 |
|
int thisRow = mGhostRowState[row];
|
|
140 |
int thisRow = mRowState[row];
|
141 |
141 |
|
142 |
|
boolean can1U = (row==numRows-1 || thisRow>=mGhostRowState[row+1]) && (row==0 || thisRow>=mGhostRowState[row-1]);
|
143 |
|
boolean can1D = (row==numRows-1 || thisRow<=mGhostRowState[row+1]) && (row==0 || thisRow<=mGhostRowState[row-1]);
|
144 |
|
boolean can2U = (row==numRows-1 || thisRow> mGhostRowState[row+1]) && (row==0 || thisRow> mGhostRowState[row-1]);
|
145 |
|
boolean can2D = (row==numRows-1 || thisRow< mGhostRowState[row+1]) && (row==0 || thisRow< mGhostRowState[row-1]);
|
|
142 |
boolean can1U = (row==numRows-1 || thisRow>=mRowState[row+1]) && (row==0 || thisRow>=mRowState[row-1]);
|
|
143 |
boolean can1D = (row==numRows-1 || thisRow<=mRowState[row+1]) && (row==0 || thisRow<=mRowState[row-1]);
|
|
144 |
boolean can2U = (row==numRows-1 || thisRow> mRowState[row+1]) && (row==0 || thisRow> mRowState[row-1]);
|
|
145 |
boolean can2D = (row==numRows-1 || thisRow< mRowState[row+1]) && (row==0 || thisRow< mRowState[row-1]);
|
146 |
146 |
|
147 |
147 |
int maxU = can2U ? -2 : (can1U ? -1 : 0);
|
148 |
148 |
int maxD = can2D ? 2 : (can1D ? 1 : 0);
|
... | ... | |
150 |
150 |
if( numRotGhost>maxD ) numRotGhost = maxD;
|
151 |
151 |
if( numRotGhost<maxU ) numRotGhost = maxU;
|
152 |
152 |
|
153 |
|
return numRotGhost*mGhostAngle;
|
|
153 |
return numRotGhost* mGhostAngle;
|
154 |
154 |
}
|
155 |
155 |
}
|
156 |
156 |
|
... | ... | |
166 |
166 |
{
|
167 |
167 |
int nonGhostAngle = (int)angleInDegrees;
|
168 |
168 |
|
169 |
|
if( mGhostAngle!=0 && nonGhostAngle!=0 )
|
|
169 |
if( mGhostAngle !=0 && nonGhostAngle!=0 )
|
170 |
170 |
{
|
171 |
171 |
int basicDeg = 360/mBasicAngles[axis][0];
|
172 |
172 |
|
173 |
173 |
if( (nonGhostAngle%basicDeg)==0 )
|
174 |
174 |
{
|
175 |
|
if( mGhostBlocked && axis!=mGhostAxisParallelTo ) computeNewGhostAxis(axis,angleInDegrees);
|
|
175 |
if( mBlocked && axis!= mAxisParallelTo) computeNewGhostAxis(axis,angleInDegrees);
|
176 |
176 |
return nonGhostAngle;
|
177 |
177 |
}
|
178 |
178 |
|
... | ... | |
180 |
180 |
|
181 |
181 |
for(int m=1; m<3; m++)
|
182 |
182 |
{
|
183 |
|
if( ((nonGhostAngle+m*mGhostAngle)%basicDeg)==0 ) { move = m; break; }
|
184 |
|
if( ((nonGhostAngle-m*mGhostAngle)%basicDeg)==0 ) { move =-m; break; }
|
|
183 |
if( ((nonGhostAngle+m* mGhostAngle)%basicDeg)==0 ) { move = m; break; }
|
|
184 |
if( ((nonGhostAngle-m* mGhostAngle)%basicDeg)==0 ) { move =-m; break; }
|
185 |
185 |
}
|
186 |
186 |
|
187 |
|
nonGhostAngle += move*mGhostAngle;
|
|
187 |
nonGhostAngle += move* mGhostAngle;
|
188 |
188 |
|
189 |
|
if( !mGhostBlocked || axis==mGhostAxisParallelTo )
|
|
189 |
if( !mBlocked || axis== mAxisParallelTo)
|
190 |
190 |
{
|
191 |
|
if( mGhostAxisParallelTo!=axis )
|
|
191 |
if( mAxisParallelTo !=axis )
|
192 |
192 |
{
|
193 |
193 |
mGhostAxis.set(mAxis[axis]);
|
194 |
|
mGhostAxisParallelTo = axis;
|
195 |
|
mGhostAxisInverted = false;
|
|
194 |
mAxisParallelTo = axis;
|
|
195 |
mAxisInverted = false;
|
196 |
196 |
|
197 |
197 |
for(int l=0; l<mMaxNumLayers; l++)
|
198 |
|
mGhostEffect[l].setMeshAssociation( 1<<(mGhostAxisParallelTo*mMaxNumLayers + l), -1);
|
|
198 |
mEffect[l].setMeshAssociation( 1<<(mAxisParallelTo *mMaxNumLayers + l), -1);
|
199 |
199 |
}
|
200 |
200 |
|
201 |
|
int m = mGhostAxisInverted ? -1 : 1;
|
202 |
|
boolean oldBlocked = mGhostBlocked;
|
203 |
|
mGhostBlocked = false;
|
|
201 |
int m = mAxisInverted ? -1 : 1;
|
|
202 |
boolean oldBlocked = mBlocked;
|
|
203 |
mBlocked = false;
|
204 |
204 |
|
205 |
205 |
for(int r=0; r<mMaxNumLayers; r++)
|
206 |
206 |
{
|
207 |
207 |
if( ((rowBitmap>>r)&0x1) != 0 )
|
208 |
208 |
{
|
209 |
|
mGhostRowState[r] -= move;
|
210 |
|
mGhostEffectAngle[r].set( m*mGhostRowState[r]*mGhostAngle);
|
|
209 |
mRowState[r] -= move;
|
|
210 |
mEffectAngle[r].set( m* mRowState[r]*mGhostAngle);
|
211 |
211 |
}
|
212 |
212 |
|
213 |
|
if( mGhostRowState[r] != mGhostRowState[0] ) mGhostBlocked = true;
|
|
213 |
if( mRowState[r] != mRowState[0] ) mBlocked = true;
|
214 |
214 |
}
|
215 |
215 |
|
216 |
|
if( oldBlocked && !mGhostBlocked ) computeNewRotationAxis(axis);
|
|
216 |
if( oldBlocked && !mBlocked) computeNewRotationAxis(axis);
|
217 |
217 |
}
|
218 |
218 |
}
|
219 |
219 |
|
... | ... | |
233 |
233 |
|
234 |
234 |
boolean ghostNotSolved()
|
235 |
235 |
{
|
236 |
|
if( mGhostAngle!=0 )
|
|
236 |
if( mGhostAngle !=0 )
|
237 |
237 |
{
|
238 |
|
int first=mGhostCurrCubitRot[0]-mGhostOrigCubitRot[0];
|
|
238 |
int first= mCurrCubitRot[0]- mOrigCubitRot[0];
|
239 |
239 |
|
240 |
240 |
for( int c=1; c<mNumCubits; c++ )
|
241 |
|
if( mGhostCurrCubitRot[c]-mGhostOrigCubitRot[c] != first ) return true;
|
|
241 |
if( mCurrCubitRot[c]- mOrigCubitRot[c] != first ) return true;
|
242 |
242 |
}
|
243 |
243 |
|
244 |
244 |
return false;
|
... | ... | |
249 |
249 |
|
250 |
250 |
void solve()
|
251 |
251 |
{
|
252 |
|
if( mGhostAngle!=0 )
|
|
252 |
if( mGhostAngle !=0 )
|
253 |
253 |
{
|
254 |
254 |
mGhostAxis.set(mAxis[mGhostOrigAxis]);
|
255 |
|
mGhostAxisParallelTo = mGhostOrigAxis;
|
256 |
|
mGhostAxisInverted = false;
|
|
255 |
mAxisParallelTo = mGhostOrigAxis;
|
|
256 |
mAxisInverted = false;
|
257 |
257 |
|
258 |
258 |
int[] state = mObject.getGhostRowState();
|
259 |
259 |
|
260 |
260 |
if( state!=null )
|
261 |
|
for(int i=0; i<mMaxNumLayers; i++) mGhostRowState[i] = state[i];
|
|
261 |
for(int i=0; i<mMaxNumLayers; i++) mRowState[i] = state[i];
|
262 |
262 |
|
263 |
263 |
reinitializeGhostStuff();
|
264 |
264 |
}
|
... | ... | |
269 |
269 |
|
270 |
270 |
void restoreGhostStuff(String key, OperatingSystemInterface os)
|
271 |
271 |
{
|
272 |
|
if( mGhostAngle!=0 )
|
|
272 |
if( mGhostAngle !=0 )
|
273 |
273 |
{
|
274 |
274 |
int defAxis = mObject.getGhostAxis();
|
275 |
275 |
int[] defState= mObject.getGhostRowState();
|
276 |
276 |
|
277 |
277 |
int m = os.getInt(key+"_ghostInverted",1);
|
278 |
|
mGhostAxisParallelTo = os.getInt(key + "_ghostAxis", defAxis);
|
279 |
|
for(int l=0; l<mMaxNumLayers; l++) mGhostRowState[l] = os.getInt(key + "_ghostBitmap"+l, defState!=null ? defState[l] : 0 );
|
280 |
|
Static3D axis = mAxis[mGhostAxisParallelTo];
|
|
278 |
mAxisParallelTo = os.getInt(key + "_ghostAxis", defAxis);
|
|
279 |
for(int l=0; l<mMaxNumLayers; l++) mRowState[l] = os.getInt(key + "_ghostBitmap"+l, defState!=null ? defState[l] : 0 );
|
|
280 |
Static3D axis = mAxis[mAxisParallelTo];
|
281 |
281 |
|
282 |
282 |
mGhostAxis.set(m*axis.get0(),m*axis.get1(), m*axis.get2());
|
283 |
|
mGhostAxisInverted = (m==-1);
|
|
283 |
mAxisInverted = (m==-1);
|
284 |
284 |
|
285 |
285 |
reinitializeGhostStuff();
|
286 |
286 |
}
|
... | ... | |
291 |
291 |
|
292 |
292 |
void saveGhostStuff(String key, OperatingSystemInterface os)
|
293 |
293 |
{
|
294 |
|
if( mGhostAngle!=0 )
|
|
294 |
if( mGhostAngle !=0 )
|
295 |
295 |
{
|
296 |
|
os.putInt(key + "_ghostInverted", mGhostAxisInverted ? -1 : 1);
|
297 |
|
os.putInt(key + "_ghostAxis", mGhostAxisParallelTo);
|
298 |
|
for(int l=0; l<mMaxNumLayers; l++) os.putInt(key + "_ghostBitmap"+l, mGhostRowState[l]);
|
|
296 |
os.putInt(key + "_ghostInverted", mAxisInverted ? -1 : 1);
|
|
297 |
os.putInt(key + "_ghostAxis", mAxisParallelTo);
|
|
298 |
for(int l=0; l<mMaxNumLayers; l++) os.putInt(key + "_ghostBitmap"+l, mRowState[l]);
|
299 |
299 |
}
|
300 |
300 |
}
|
301 |
301 |
|
... | ... | |
304 |
304 |
|
305 |
305 |
void removeGhostStuff(String key, OperatingSystemInterface os)
|
306 |
306 |
{
|
307 |
|
if( mGhostAngle!=0 )
|
|
307 |
if( mGhostAngle !=0 )
|
308 |
308 |
{
|
309 |
309 |
os.remove(key + "_ghostInverted");
|
310 |
310 |
os.remove(key + "_ghostAxis");
|
... | ... | |
318 |
318 |
|
319 |
319 |
private boolean isAxisInverted()
|
320 |
320 |
{
|
321 |
|
Static3D a = mAxis[mGhostAxisParallelTo];
|
|
321 |
Static3D a = mAxis[mAxisParallelTo];
|
322 |
322 |
float x = mGhostAxis.get0();
|
323 |
323 |
float y = mGhostAxis.get1();
|
324 |
324 |
float z = mGhostAxis.get2();
|
... | ... | |
342 |
342 |
|
343 |
343 |
private void reinitializeGhostStuff()
|
344 |
344 |
{
|
345 |
|
if( mGhostAngle!=0 )
|
|
345 |
if( mGhostAngle !=0 )
|
346 |
346 |
{
|
347 |
|
mGhostBlocked=false;
|
|
347 |
mBlocked =false;
|
348 |
348 |
|
349 |
349 |
for( int r=0; r<mMaxNumLayers; r++ )
|
350 |
350 |
{
|
351 |
|
mGhostEffectAngle[r].set(mGhostRowState[r]*mGhostAngle);
|
352 |
|
mGhostEffect[r].setMeshAssociation(1<<(mGhostAxisParallelTo*mMaxNumLayers + r), -1);
|
353 |
|
if( mGhostRowState[r] != mGhostRowState[0] ) mGhostBlocked = true;
|
|
351 |
mEffectAngle[r].set(mRowState[r]* mGhostAngle);
|
|
352 |
mEffect[r].setMeshAssociation(1<<(mAxisParallelTo *mMaxNumLayers + r), -1);
|
|
353 |
if( mRowState[r] != mRowState[0] ) mBlocked = true;
|
354 |
354 |
}
|
355 |
355 |
|
356 |
356 |
computeGhostCubitRotated();
|
... | ... | |
381 |
381 |
|
382 |
382 |
private void computeGhostCubitRotated()
|
383 |
383 |
{
|
384 |
|
if( mGhostAngle!=0 )
|
|
384 |
if( mGhostAngle !=0 )
|
385 |
385 |
for(int c=0; c<mNumCubits; c++)
|
386 |
386 |
{
|
387 |
|
int rowBitmap = mObject.getCubitRowBitmap(c,mGhostAxisParallelTo);
|
|
387 |
int rowBitmap = mObject.getCubitRowBitmap(c, mAxisParallelTo);
|
388 |
388 |
int row = deBitmapize(rowBitmap);
|
389 |
|
mGhostCurrCubitRot[c] = mGhostRowState[row];
|
|
389 |
mCurrCubitRot[c] = mRowState[row];
|
390 |
390 |
}
|
391 |
391 |
}
|
392 |
392 |
|
... | ... | |
423 |
423 |
|
424 |
424 |
QuatHelper.rotateVectorByQuat(tmp,x,y,z,0,quat);
|
425 |
425 |
|
426 |
|
mGhostAxisParallelTo = pullTowardsExistingAxis(tmp);
|
|
426 |
mAxisParallelTo = pullTowardsExistingAxis(tmp);
|
427 |
427 |
mGhostAxis.set(tmp[0],tmp[1],tmp[2]);
|
428 |
428 |
|
429 |
|
boolean wasInverted = mGhostAxisInverted;
|
430 |
|
mGhostAxisInverted = isAxisInverted();
|
|
429 |
boolean wasInverted = mAxisInverted;
|
|
430 |
mAxisInverted = isAxisInverted();
|
431 |
431 |
|
432 |
|
if( wasInverted^mGhostAxisInverted )
|
|
432 |
if( wasInverted^ mAxisInverted)
|
433 |
433 |
{
|
434 |
|
int len = mGhostRowState.length;
|
|
434 |
int len = mRowState.length;
|
435 |
435 |
int num = len/2;
|
436 |
|
int m = mGhostAxisInverted ? -1 : 1;
|
|
436 |
int m = mAxisInverted ? -1 : 1;
|
437 |
437 |
|
438 |
438 |
for(int i=0; i<num; i++)
|
439 |
439 |
{
|
440 |
440 |
int e = len-1-i;
|
441 |
|
int t = mGhostRowState[e];
|
442 |
|
mGhostRowState[e] = -mGhostRowState[i];
|
443 |
|
mGhostRowState[i] = -t;
|
|
441 |
int t = mRowState[e];
|
|
442 |
mRowState[e] = -mRowState[i];
|
|
443 |
mRowState[i] = -t;
|
444 |
444 |
|
445 |
|
mGhostEffectAngle[e].set( m*mGhostRowState[e]*mGhostAngle);
|
446 |
|
mGhostEffectAngle[i].set( m*mGhostRowState[i]*mGhostAngle);
|
|
445 |
mEffectAngle[e].set( m* mRowState[e]* mGhostAngle);
|
|
446 |
mEffectAngle[i].set( m* mRowState[i]* mGhostAngle);
|
447 |
447 |
}
|
448 |
448 |
|
449 |
449 |
if( (len%2)==1 )
|
450 |
450 |
{
|
451 |
451 |
int index = (len-1)/2;
|
452 |
|
mGhostRowState[index] *= -1;
|
453 |
|
mGhostEffectAngle[index].set(m*mGhostRowState[index]*mGhostAngle);
|
|
452 |
mRowState[index] *= -1;
|
|
453 |
mEffectAngle[index].set(m* mRowState[index]* mGhostAngle);
|
454 |
454 |
}
|
455 |
455 |
}
|
456 |
456 |
|
457 |
457 |
for(int l=0; l<mMaxNumLayers; l++)
|
458 |
|
mGhostEffect[l].setMeshAssociation( 1<<(mGhostAxisParallelTo*mMaxNumLayers + l), -1);
|
|
458 |
mEffect[l].setMeshAssociation( 1<<(mAxisParallelTo *mMaxNumLayers + l), -1);
|
459 |
459 |
}
|
460 |
460 |
|
461 |
461 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
463 |
463 |
|
464 |
464 |
private void computeNewRotationAxis(int axis)
|
465 |
465 |
{
|
466 |
|
int newLevel = mGhostRowState[0];
|
|
466 |
int newLevel = mRowState[0];
|
467 |
467 |
|
468 |
468 |
if( newLevel!=0 )
|
469 |
469 |
{
|
470 |
|
Static4D quat = computeQuaternion(axis,newLevel*mGhostAngle);
|
|
470 |
Static4D quat = computeQuaternion(axis,newLevel* mGhostAngle);
|
471 |
471 |
mObject.rotateCameraQuat(quat);
|
472 |
472 |
|
473 |
|
int len = mGhostRowState.length;
|
|
473 |
int len = mRowState.length;
|
474 |
474 |
for(int s=0; s<len; s++)
|
475 |
475 |
{
|
476 |
|
mGhostRowState[s] = 0;
|
477 |
|
mGhostEffectAngle[s].set(0);
|
|
476 |
mRowState[s] = 0;
|
|
477 |
mEffectAngle[s].set(0);
|
478 |
478 |
}
|
479 |
479 |
}
|
480 |
480 |
}
|
Correct cuts in the Ghost Pyramid