Revision 6968a6ef
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/control/RubikControlWhole.java | ||
---|---|---|
46 | 46 |
private static final int NUM_NODE = 4; |
47 | 47 |
private static final int NUM_EFFE = 4; |
48 | 48 |
|
49 |
private static final int D1 = 2600; // time it takes for the finger to appear |
|
50 |
private static final int D2 = 250; // finger press |
|
51 |
private static final int D3 =10000; // finger triangle |
|
52 |
private static final int D4 = 3000; // fingers approach |
|
53 |
private static final int D5 =10000; // fingers circle |
|
54 |
|
|
55 |
private static final int[] DUR = { D1, D2, D3, D2, D1/4, 3*D1/4, D1/4, D2, D4, D5, D4, D2, D1 }; |
|
56 |
|
|
49 | 57 |
private final RubikControl mControl; |
50 | 58 |
private DistortedEffects[] mEffects; |
51 | 59 |
private DistortedNode[] mNodes; |
... | ... | |
53 | 61 |
private int mStageFinished, mWidth, mHeight; |
54 | 62 |
|
55 | 63 |
private MeshQuad mQuad; |
56 |
private DistortedTexture mTextureHand, mTextureShad, mTextureCirc;
|
|
64 |
private DistortedTexture mTextureShad, mTextureCirc; |
|
57 | 65 |
|
58 | 66 |
private Dynamic3D mDynMoveHand1, mDynMoveShad1; |
59 | 67 |
private Dynamic3D mDynScaleHand1, mDynScaleShad1; |
60 | 68 |
private MatrixEffectMove mMoveHand1, mMoveShad1; |
61 | 69 |
private MatrixEffectScale mScaleHand1, mScaleShad1; |
62 | 70 |
|
71 |
private Dynamic3D mDynMoveHand2, mDynMoveShad2; |
|
72 |
private Dynamic3D mDynScaleHand2, mDynScaleShad2; |
|
73 |
private MatrixEffectMove mMoveHand2, mMoveShad2; |
|
74 |
private MatrixEffectScale mScaleHand2, mScaleShad2; |
|
75 |
|
|
63 | 76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 77 |
|
65 | 78 |
private Bitmap openBitmap(RubikActivity act, int resource) |
... | ... | |
78 | 91 |
|
79 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
80 | 93 |
|
81 |
private void createEffectsStage1() |
|
94 |
private void resetDynamics1(int stage) |
|
95 |
{ |
|
96 |
int dur = DUR[stage-1]; |
|
97 |
|
|
98 |
mDynMoveHand1.removeAll(); |
|
99 |
mDynMoveShad1.removeAll(); |
|
100 |
mDynScaleHand1.removeAll(); |
|
101 |
mDynScaleShad1.removeAll(); |
|
102 |
|
|
103 |
mDynMoveHand1.setDuration(dur); |
|
104 |
mDynMoveShad1.setDuration(dur); |
|
105 |
mDynScaleHand1.setDuration(dur); |
|
106 |
mDynScaleShad1.setDuration(dur); |
|
107 |
mDynMoveHand1.resetToBeginning(); |
|
108 |
mDynMoveShad1.resetToBeginning(); |
|
109 |
mDynScaleHand1.resetToBeginning(); |
|
110 |
mDynScaleShad1.resetToBeginning(); |
|
111 |
|
|
112 |
mStageFinished = stage; |
|
113 |
} |
|
114 |
|
|
115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
116 |
|
|
117 |
private void resetDynamics2(int stage) |
|
118 |
{ |
|
119 |
int dur = DUR[stage-1]; |
|
120 |
|
|
121 |
mDynMoveHand2.removeAll(); |
|
122 |
mDynMoveShad2.removeAll(); |
|
123 |
mDynScaleHand2.removeAll(); |
|
124 |
mDynScaleShad2.removeAll(); |
|
125 |
|
|
126 |
mDynMoveHand2.setDuration(dur); |
|
127 |
mDynMoveShad2.setDuration(dur); |
|
128 |
mDynScaleHand2.setDuration(dur); |
|
129 |
mDynScaleShad2.setDuration(dur); |
|
130 |
mDynMoveHand2.resetToBeginning(); |
|
131 |
mDynMoveShad2.resetToBeginning(); |
|
132 |
mDynScaleHand2.resetToBeginning(); |
|
133 |
mDynScaleShad2.resetToBeginning(); |
|
134 |
} |
|
135 |
|
|
136 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
137 |
// first finger appears and approaches the screen |
|
138 |
|
|
139 |
private void setEffectsStage1() |
|
82 | 140 |
{ |
141 |
resetDynamics1(1); |
|
142 |
resetDynamics2(1); |
|
143 |
|
|
83 | 144 |
float x0 = mWidth*0.55f; |
84 | 145 |
float x1 = mWidth*0.45f; |
85 | 146 |
float x2 = mWidth*0.35f; |
... | ... | |
112 | 173 |
mDynScaleHand1.add(pointSc); |
113 | 174 |
mDynScaleShad1.add(pointSc); |
114 | 175 |
|
115 |
mStageFinished = 1;
|
|
176 |
mMoveHand1.notifyWhenFinished(this);
|
|
116 | 177 |
} |
117 | 178 |
|
118 | 179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
180 |
// first finger touches the screen |
|
119 | 181 |
|
120 |
private void createEffectsStage2()
|
|
182 |
private void setEffectsStage2()
|
|
121 | 183 |
{ |
184 |
resetDynamics1(2); |
|
185 |
|
|
122 | 186 |
float x2 = mWidth*0.35f; |
123 | 187 |
float y1 = mHeight*0.28f; |
124 | 188 |
float z = 0; |
125 | 189 |
float d = mWidth*0.01f; |
126 | 190 |
float sS = mWidth*0.0001f; |
127 |
float sF = mWidth*0.16f; |
|
191 |
float sF = mWidth*0.14f; |
|
192 |
float sH = mWidth*0.33f; |
|
128 | 193 |
|
129 | 194 |
Static3D point3h = new Static3D(-x2 +d,-y1 +d, z); |
130 | 195 |
Static3D scaleS = new Static3D(sS,sS,sS); |
131 | 196 |
Static3D scaleF = new Static3D(sF,sF,sF); |
197 |
Static3D pointH = new Static3D(sH,sH,sH); |
|
132 | 198 |
|
133 |
mDynMoveHand1.removeAll(); |
|
134 | 199 |
mDynMoveHand1.add(point3h); |
135 |
mDynMoveShad1.removeAll(); |
|
136 | 200 |
mDynMoveShad1.add(point3h); |
137 |
mDynScaleShad1.removeAll();
|
|
201 |
mDynScaleHand1.add(pointH);
|
|
138 | 202 |
mDynScaleShad1.add(scaleS); |
139 | 203 |
mDynScaleShad1.add(scaleF); |
140 |
mDynScaleShad1.resetToBeginning(); |
|
141 | 204 |
|
142 |
mNodes[0].changeInputSurface(mTextureCirc);
|
|
205 |
mScaleShad1.notifyWhenFinished(this);
|
|
143 | 206 |
|
144 |
mStageFinished = 2;
|
|
207 |
mNodes[0].changeInputSurface(mTextureCirc);
|
|
145 | 208 |
} |
146 | 209 |
|
147 | 210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
211 |
// first finger moves across the screen in a triangular fashion |
|
148 | 212 |
|
149 |
private void reloadEffectsStage1()
|
|
213 |
private void setEffectsStage3()
|
|
150 | 214 |
{ |
151 |
mDynMoveHand1.resetToBeginning(); |
|
152 |
mDynMoveShad1.resetToBeginning(); |
|
215 |
resetDynamics1(3); |
|
216 |
|
|
217 |
float x2 = mWidth*0.35f; |
|
218 |
|
|
219 |
float y1 = mHeight*0.28f; |
|
220 |
float z = 0; |
|
221 |
float d = mWidth*0.01f; |
|
222 |
float sH = mWidth*0.33f; |
|
223 |
float sF = mWidth*0.14f; |
|
224 |
|
|
225 |
Static3D scaleS = new Static3D(sF,sF,sF); |
|
226 |
Static3D pointH = new Static3D(sH,sH,sH); |
|
227 |
Static3D point1 = new Static3D(-x2 +d,-y1 +d, z); |
|
228 |
Static3D point2 = new Static3D( +d,-y1 +d, z); |
|
229 |
Static3D point3 = new Static3D(+x2 +d,-y1 +d, z); |
|
230 |
Static3D point4 = new Static3D(+x2 +d, +d, z); |
|
231 |
Static3D point5 = new Static3D(+x2 +d,+y1 +d, z); |
|
232 |
Static3D point6 = new Static3D( +d, +d, z); |
|
233 |
|
|
234 |
mDynScaleHand1.add(pointH); |
|
235 |
mDynScaleShad1.add(scaleS); |
|
236 |
|
|
237 |
mDynMoveHand1.add(point1); |
|
238 |
mDynMoveHand1.add(point1); |
|
239 |
mDynMoveHand1.add(point2); |
|
240 |
mDynMoveHand1.add(point3); |
|
241 |
mDynMoveHand1.add(point3); |
|
242 |
mDynMoveHand1.add(point4); |
|
243 |
mDynMoveHand1.add(point5); |
|
244 |
mDynMoveHand1.add(point5); |
|
245 |
mDynMoveHand1.add(point6); |
|
246 |
mDynMoveHand1.add(point1); |
|
247 |
mDynMoveHand1.add(point1); |
|
248 |
|
|
249 |
mDynMoveShad1.add(point1); |
|
250 |
mDynMoveShad1.add(point1); |
|
251 |
mDynMoveShad1.add(point2); |
|
252 |
mDynMoveShad1.add(point3); |
|
253 |
mDynMoveShad1.add(point3); |
|
254 |
mDynMoveShad1.add(point4); |
|
255 |
mDynMoveShad1.add(point5); |
|
256 |
mDynMoveShad1.add(point5); |
|
257 |
mDynMoveShad1.add(point6); |
|
258 |
mDynMoveShad1.add(point1); |
|
259 |
mDynMoveShad1.add(point1); |
|
260 |
|
|
153 | 261 |
mMoveHand1.notifyWhenFinished(this); |
154 | 262 |
} |
155 | 263 |
|
264 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
265 |
// first finger un-touches the screen |
|
266 |
|
|
267 |
private void setEffectsStage4() |
|
268 |
{ |
|
269 |
resetDynamics1(4); |
|
270 |
|
|
271 |
float x2 = mWidth*0.35f; |
|
272 |
float y1 = mHeight*0.28f; |
|
273 |
float z = 0; |
|
274 |
float d = mWidth*0.01f; |
|
275 |
float sF = mWidth*0.0001f; |
|
276 |
float sS = mWidth*0.14f; |
|
277 |
float sH = mWidth*0.33f; |
|
278 |
|
|
279 |
Static3D point3h = new Static3D(-x2 +d,-y1 +d, z); |
|
280 |
Static3D scaleS = new Static3D(sS,sS,sS); |
|
281 |
Static3D scaleF = new Static3D(sF,sF,sF); |
|
282 |
Static3D pointH = new Static3D(sH,sH,sH); |
|
283 |
|
|
284 |
mDynMoveHand1.add(point3h); |
|
285 |
mDynMoveShad1.add(point3h); |
|
286 |
mDynScaleHand1.add(pointH); |
|
287 |
mDynScaleShad1.add(scaleS); |
|
288 |
mDynScaleShad1.add(scaleF); |
|
289 |
|
|
290 |
mScaleShad1.notifyWhenFinished(this); |
|
291 |
} |
|
292 |
|
|
293 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
294 |
// first finger un-touches the screen (part2) |
|
295 |
|
|
296 |
private void setEffectsStage5() |
|
297 |
{ |
|
298 |
resetDynamics1(5); |
|
299 |
|
|
300 |
float x2 = mWidth*0.35f; |
|
301 |
float y1 = mHeight*0.28f; |
|
302 |
float z = 0; |
|
303 |
float d = mWidth*0.01f; |
|
304 |
float s = mWidth*0.33f; |
|
305 |
|
|
306 |
Static3D pointH = new Static3D(-x2 ,-y1 , z); |
|
307 |
Static3D point0 = new Static3D(-x2 +d,-y1 +d, z); |
|
308 |
Static3D pointS = new Static3D(-x2+2*d,-y1+2*d, z); |
|
309 |
Static3D pointSc = new Static3D(s,s,s); |
|
310 |
|
|
311 |
mDynScaleHand1.add(pointSc); |
|
312 |
mDynScaleShad1.add(pointSc); |
|
313 |
mDynMoveHand1.add(point0); |
|
314 |
mDynMoveHand1.add(pointH); |
|
315 |
mDynMoveShad1.add(point0); |
|
316 |
mDynMoveShad1.add(pointS); |
|
317 |
|
|
318 |
mMoveShad1.notifyWhenFinished(this); |
|
319 |
mNodes[0].changeInputSurface(mTextureShad); |
|
320 |
} |
|
321 |
|
|
322 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
323 |
// second finger appears |
|
324 |
|
|
325 |
private void setEffectsStage6() |
|
326 |
{ |
|
327 |
resetDynamics1(6); |
|
328 |
resetDynamics2(6); |
|
329 |
|
|
330 |
float x0 = mWidth*0.55f; |
|
331 |
float x1 = mWidth*0.45f; |
|
332 |
float x2 = mWidth*0.35f; |
|
333 |
float y1 = mHeight*0.28f; |
|
334 |
float z = 0; |
|
335 |
float d = mWidth*0.01f; |
|
336 |
float s = mWidth*0.33f; |
|
337 |
|
|
338 |
Static3D pointH = new Static3D(-x2 ,-y1 , z); |
|
339 |
Static3D pointS = new Static3D(-x2+2*d,-y1+2*d, z); |
|
340 |
Static3D pointSc= new Static3D(s,s,s); |
|
341 |
|
|
342 |
mDynScaleHand1.add(pointSc); |
|
343 |
mDynScaleShad1.add(pointSc); |
|
344 |
mDynMoveHand1.add(pointH); |
|
345 |
mDynMoveShad1.add(pointS); |
|
346 |
|
|
347 |
Static3D point0h = new Static3D( x0 , y1 , z); |
|
348 |
Static3D point1h = new Static3D( x1 , y1 , z); |
|
349 |
Static3D point2h = new Static3D( x2 , y1 , z); |
|
350 |
Static3D point0s = new Static3D( x0+2*d, y1+2*d, z); |
|
351 |
Static3D point1s = new Static3D( x1+2*d, y1+2*d, z); |
|
352 |
Static3D point2s = new Static3D( x2+2*d, y1+2*d, z); |
|
353 |
Static3D pointSm= new Static3D(-s,s,s); |
|
354 |
|
|
355 |
mDynMoveHand2.add(point0h); |
|
356 |
mDynMoveHand2.add(point1h); |
|
357 |
mDynMoveHand2.add(point2h); |
|
358 |
mDynMoveHand2.add(point2h); |
|
359 |
mDynMoveShad2.add(point0s); |
|
360 |
mDynMoveShad2.add(point1s); |
|
361 |
mDynMoveShad2.add(point2s); |
|
362 |
mDynMoveShad2.add(point2s); |
|
363 |
mDynScaleHand2.add(pointSm); |
|
364 |
mDynScaleShad2.add(pointSm); |
|
365 |
|
|
366 |
mMoveHand2.notifyWhenFinished(this); |
|
367 |
} |
|
368 |
|
|
369 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
370 |
// both fingers touch the screen (part1) |
|
371 |
|
|
372 |
private void setEffectsStage7() |
|
373 |
{ |
|
374 |
resetDynamics1(7); |
|
375 |
resetDynamics2(7); |
|
376 |
|
|
377 |
float x2 = mWidth*0.35f; |
|
378 |
float y1 = mHeight*0.28f; |
|
379 |
float z = 0; |
|
380 |
float d = mWidth*0.01f; |
|
381 |
float s = mWidth*0.33f; |
|
382 |
|
|
383 |
Static3D point1H = new Static3D(-x2 ,-y1 , z); |
|
384 |
Static3D point1F = new Static3D(-x2 +d,-y1 +d, z); |
|
385 |
Static3D point1S = new Static3D(-x2+2*d,-y1+2*d, z); |
|
386 |
Static3D point1Sc= new Static3D(s,s,s); |
|
387 |
|
|
388 |
mDynScaleHand1.add(point1Sc); |
|
389 |
mDynScaleShad1.add(point1Sc); |
|
390 |
mDynMoveHand1.add(point1H); |
|
391 |
mDynMoveHand1.add(point1F); |
|
392 |
mDynMoveShad1.add(point1S); |
|
393 |
mDynMoveShad1.add(point1F); |
|
394 |
|
|
395 |
Static3D point2H = new Static3D( x2 , y1 , z); |
|
396 |
Static3D point2F = new Static3D( x2 +d, y1 +d, z); |
|
397 |
Static3D point2S = new Static3D( x2+2*d, y1+2*d, z); |
|
398 |
Static3D point2Sc= new Static3D(-s,s,s); |
|
399 |
|
|
400 |
mDynScaleHand2.add(point2Sc); |
|
401 |
mDynScaleShad2.add(point2Sc); |
|
402 |
mDynMoveHand2.add(point2H); |
|
403 |
mDynMoveHand2.add(point2F); |
|
404 |
mDynMoveShad2.add(point2S); |
|
405 |
mDynMoveShad2.add(point2F); |
|
406 |
|
|
407 |
mMoveHand2.notifyWhenFinished(this); |
|
408 |
} |
|
409 |
|
|
410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
411 |
// both fingers touch the screen (part2) |
|
412 |
|
|
413 |
private void setEffectsStage8() |
|
414 |
{ |
|
415 |
resetDynamics1(8); |
|
416 |
resetDynamics2(8); |
|
417 |
|
|
418 |
float x2 = mWidth*0.35f; |
|
419 |
float y1 = mHeight*0.28f; |
|
420 |
float z = 0; |
|
421 |
float d = mWidth*0.01f; |
|
422 |
float sS = mWidth*0.0001f; |
|
423 |
float sF = mWidth*0.14f; |
|
424 |
float sH = mWidth*0.33f; |
|
425 |
|
|
426 |
Static3D point1h= new Static3D(-x2 +d,-y1 +d, z); |
|
427 |
Static3D point2h= new Static3D( x2 +d, y1 +d, z); |
|
428 |
Static3D scale1S = new Static3D( sS,sS,sS); |
|
429 |
Static3D scale1F = new Static3D( sF,sF,sF); |
|
430 |
Static3D point1H = new Static3D( sH,sH,sH); |
|
431 |
Static3D scale2S = new Static3D(-sS,sS,sS); |
|
432 |
Static3D scale2F = new Static3D(-sF,sF,sF); |
|
433 |
Static3D point2H = new Static3D(-sH,sH,sH); |
|
434 |
|
|
435 |
mDynMoveHand1.add(point1h); |
|
436 |
mDynMoveShad1.add(point1h); |
|
437 |
mDynScaleHand1.add(point1H); |
|
438 |
mDynScaleShad1.add(scale1S); |
|
439 |
mDynScaleShad1.add(scale1F); |
|
440 |
|
|
441 |
mDynMoveHand2.add(point2h); |
|
442 |
mDynMoveShad2.add(point2h); |
|
443 |
mDynScaleHand2.add(point2H); |
|
444 |
mDynScaleShad2.add(scale2S); |
|
445 |
mDynScaleShad2.add(scale2F); |
|
446 |
|
|
447 |
mScaleShad1.notifyWhenFinished(this); |
|
448 |
|
|
449 |
mNodes[0].changeInputSurface(mTextureCirc); |
|
450 |
mNodes[1].changeInputSurface(mTextureCirc); |
|
451 |
} |
|
452 |
|
|
453 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
454 |
// both fingers approach each other |
|
455 |
|
|
456 |
private void setEffectsStage9() |
|
457 |
{ |
|
458 |
resetDynamics1(9); |
|
459 |
resetDynamics2(9); |
|
460 |
|
|
461 |
float x2 = mWidth*0.35f; |
|
462 |
float y1 = mHeight*0.28f; |
|
463 |
float z = 0; |
|
464 |
float d = mWidth*0.01f; |
|
465 |
float f = 0.60f; |
|
466 |
float sF = mWidth*0.14f; |
|
467 |
float sH = mWidth*0.33f; |
|
468 |
|
|
469 |
Static3D point1s= new Static3D(-x2 +d,-y1 +d, z); |
|
470 |
Static3D point2s= new Static3D( x2 +d, y1 +d, z); |
|
471 |
Static3D point1f= new Static3D((-x2 +d)*f,(-y1 +d)*f, z); |
|
472 |
Static3D point2f= new Static3D(( x2 +d)*f,( y1 +d)*f, z); |
|
473 |
Static3D scale1F = new Static3D( sF,sF,sF); |
|
474 |
Static3D point1H = new Static3D( sH,sH,sH); |
|
475 |
Static3D scale2F = new Static3D(-sF,sF,sF); |
|
476 |
Static3D point2H = new Static3D(-sH,sH,sH); |
|
477 |
|
|
478 |
mDynMoveHand1.add(point1s); |
|
479 |
mDynMoveHand1.add(point1f); |
|
480 |
mDynMoveShad1.add(point1s); |
|
481 |
mDynMoveShad1.add(point1f); |
|
482 |
mDynScaleHand1.add(point1H); |
|
483 |
mDynScaleShad1.add(scale1F); |
|
484 |
|
|
485 |
mDynMoveHand2.add(point2s); |
|
486 |
mDynMoveHand2.add(point2f); |
|
487 |
mDynMoveShad2.add(point2s); |
|
488 |
mDynMoveShad2.add(point2f); |
|
489 |
mDynScaleHand2.add(point2H); |
|
490 |
mDynScaleShad2.add(scale2F); |
|
491 |
|
|
492 |
mMoveShad1.notifyWhenFinished(this); |
|
493 |
} |
|
494 |
|
|
495 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
496 |
// both fingers go around |
|
497 |
|
|
498 |
private void setEffectsStage10() |
|
499 |
{ |
|
500 |
resetDynamics1(10); |
|
501 |
resetDynamics2(10); |
|
502 |
|
|
503 |
float sF = mWidth*0.14f; |
|
504 |
float sH = mWidth*0.33f; |
|
505 |
float x2 = mWidth*0.35f; |
|
506 |
float y1 = mHeight*0.28f; |
|
507 |
float z = 0; |
|
508 |
float d = mWidth*0.01f; |
|
509 |
float f = 0.60f; |
|
510 |
|
|
511 |
Static3D scale1F = new Static3D( sF,sF,sF); |
|
512 |
Static3D point1H = new Static3D( sH,sH,sH); |
|
513 |
Static3D scale2F = new Static3D(-sF,sF,sF); |
|
514 |
Static3D point2H = new Static3D(-sH,sH,sH); |
|
515 |
|
|
516 |
Static3D point0= new Static3D((-x2 +d)*f,(-y1 +d)*f, z); |
|
517 |
Static3D point1= new Static3D((-x2 +d)*f,( y1 +d)*f, z); |
|
518 |
Static3D point2= new Static3D(( x2 +d)*f,( y1 +d)*f, z); |
|
519 |
Static3D point3= new Static3D(( x2 +d)*f,(-y1 +d)*f, z); |
|
520 |
|
|
521 |
mDynMoveHand1.add(point0); |
|
522 |
mDynMoveHand1.add(point1); |
|
523 |
mDynMoveHand1.add(point2); |
|
524 |
mDynMoveHand1.add(point3); |
|
525 |
mDynMoveHand1.add(point0); |
|
526 |
mDynMoveShad1.add(point0); |
|
527 |
mDynMoveShad1.add(point1); |
|
528 |
mDynMoveShad1.add(point2); |
|
529 |
mDynMoveShad1.add(point3); |
|
530 |
mDynMoveShad1.add(point0); |
|
531 |
mDynScaleHand1.add(point1H); |
|
532 |
mDynScaleShad1.add(scale1F); |
|
533 |
|
|
534 |
mDynMoveHand2.add(point2); |
|
535 |
mDynMoveHand2.add(point3); |
|
536 |
mDynMoveHand2.add(point0); |
|
537 |
mDynMoveHand2.add(point1); |
|
538 |
mDynMoveHand2.add(point2); |
|
539 |
mDynMoveShad2.add(point2); |
|
540 |
mDynMoveShad2.add(point3); |
|
541 |
mDynMoveShad2.add(point0); |
|
542 |
mDynMoveShad2.add(point1); |
|
543 |
mDynMoveShad2.add(point2); |
|
544 |
mDynScaleHand2.add(point2H); |
|
545 |
mDynScaleShad2.add(scale2F); |
|
546 |
|
|
547 |
mDynMoveHand1.setConvexity(1.0f); |
|
548 |
mDynMoveHand2.setConvexity(1.0f); |
|
549 |
mDynMoveShad1.setConvexity(1.0f); |
|
550 |
mDynMoveShad2.setConvexity(1.0f); |
|
551 |
|
|
552 |
mMoveShad1.notifyWhenFinished(this); |
|
553 |
} |
|
554 |
|
|
555 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
556 |
// both fingers move away from each other |
|
557 |
|
|
558 |
private void setEffectsStage11() |
|
559 |
{ |
|
560 |
resetDynamics1(11); |
|
561 |
resetDynamics2(11); |
|
562 |
|
|
563 |
float x2 = mWidth*0.35f; |
|
564 |
float y1 = mHeight*0.28f; |
|
565 |
float z = 0; |
|
566 |
float d = mWidth*0.01f; |
|
567 |
float f = 0.60f; |
|
568 |
float sF = mWidth*0.14f; |
|
569 |
float sH = mWidth*0.33f; |
|
570 |
|
|
571 |
Static3D point1s= new Static3D(-x2 +d,-y1 +d, z); |
|
572 |
Static3D point2s= new Static3D( x2 +d, y1 +d, z); |
|
573 |
Static3D point1f= new Static3D((-x2 +d)*f,(-y1 +d)*f, z); |
|
574 |
Static3D point2f= new Static3D(( x2 +d)*f,( y1 +d)*f, z); |
|
575 |
Static3D scale1F= new Static3D( sF,sF,sF); |
|
576 |
Static3D point1H= new Static3D( sH,sH,sH); |
|
577 |
Static3D scale2F= new Static3D(-sF,sF,sF); |
|
578 |
Static3D point2H= new Static3D(-sH,sH,sH); |
|
579 |
|
|
580 |
mDynMoveHand1.add(point1f); |
|
581 |
mDynMoveHand1.add(point1s); |
|
582 |
mDynMoveShad1.add(point1f); |
|
583 |
mDynMoveShad1.add(point1s); |
|
584 |
mDynScaleHand1.add(point1H); |
|
585 |
mDynScaleShad1.add(scale1F); |
|
586 |
|
|
587 |
mDynMoveHand2.add(point2f); |
|
588 |
mDynMoveHand2.add(point2s); |
|
589 |
mDynMoveShad2.add(point2f); |
|
590 |
mDynMoveShad2.add(point2s); |
|
591 |
mDynScaleHand2.add(point2H); |
|
592 |
mDynScaleShad2.add(scale2F); |
|
593 |
|
|
594 |
mDynMoveHand1.setConvexity(0.0f); |
|
595 |
mDynMoveHand2.setConvexity(0.0f); |
|
596 |
mDynMoveShad1.setConvexity(0.0f); |
|
597 |
mDynMoveShad2.setConvexity(0.0f); |
|
598 |
|
|
599 |
mMoveShad1.notifyWhenFinished(this); |
|
600 |
} |
|
601 |
|
|
602 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
603 |
// both fingers un-touch the screen (part1) |
|
604 |
|
|
605 |
private void setEffectsStage12() |
|
606 |
{ |
|
607 |
resetDynamics1(12); |
|
608 |
resetDynamics2(12); |
|
609 |
|
|
610 |
float x2 = mWidth*0.35f; |
|
611 |
float y1 = mHeight*0.28f; |
|
612 |
float z = 0; |
|
613 |
float d = mWidth*0.01f; |
|
614 |
float sS = mWidth*0.0001f; |
|
615 |
float sF = mWidth*0.14f; |
|
616 |
float sH = mWidth*0.33f; |
|
617 |
|
|
618 |
Static3D point1h= new Static3D(-x2 +d,-y1 +d, z); |
|
619 |
Static3D point2h= new Static3D( x2 +d, y1 +d, z); |
|
620 |
Static3D scale1S = new Static3D( sS,sS,sS); |
|
621 |
Static3D scale1F = new Static3D( sF,sF,sF); |
|
622 |
Static3D point1H = new Static3D( sH,sH,sH); |
|
623 |
Static3D scale2S = new Static3D(-sS,sS,sS); |
|
624 |
Static3D scale2F = new Static3D(-sF,sF,sF); |
|
625 |
Static3D point2H = new Static3D(-sH,sH,sH); |
|
626 |
|
|
627 |
mDynMoveHand1.add(point1h); |
|
628 |
mDynMoveShad1.add(point1h); |
|
629 |
mDynScaleHand1.add(point1H); |
|
630 |
mDynScaleShad1.add(scale1F); |
|
631 |
mDynScaleShad1.add(scale1S); |
|
632 |
|
|
633 |
mDynMoveHand2.add(point2h); |
|
634 |
mDynMoveShad2.add(point2h); |
|
635 |
mDynScaleHand2.add(point2H); |
|
636 |
mDynScaleShad2.add(scale2F); |
|
637 |
mDynScaleShad2.add(scale2S); |
|
638 |
|
|
639 |
mScaleShad1.notifyWhenFinished(this); |
|
640 |
} |
|
641 |
|
|
642 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
643 |
// both fingers un-touch the screen (part2) |
|
644 |
|
|
645 |
private void setEffectsStage13() |
|
646 |
{ |
|
647 |
resetDynamics1(13); |
|
648 |
resetDynamics2(13); |
|
649 |
|
|
650 |
float x0 = mWidth*0.55f; |
|
651 |
float x1 = mWidth*0.45f; |
|
652 |
float x2 = mWidth*0.35f; |
|
653 |
float y1 = mHeight*0.28f; |
|
654 |
float z = 0; |
|
655 |
float d = mWidth*0.01f; |
|
656 |
float s = mWidth*0.33f; |
|
657 |
|
|
658 |
Static3D point1_0 = new Static3D(-x2 +d,-y1 +d, z); |
|
659 |
Static3D point11H = new Static3D(-x2 ,-y1 , z); |
|
660 |
Static3D point12H = new Static3D(-x1 ,-y1 , z); |
|
661 |
Static3D point13H = new Static3D(-x0 ,-y1 , z); |
|
662 |
Static3D point11S = new Static3D(-x2+2*d,-y1+2*d, z); |
|
663 |
Static3D point12S = new Static3D(-x1+2*d,-y1+2*d, z); |
|
664 |
Static3D point13S = new Static3D(-x0+2*d,-y1+2*d, z); |
|
665 |
Static3D point1Sc = new Static3D( s,s,s); |
|
666 |
|
|
667 |
mDynScaleHand1.add(point1Sc); |
|
668 |
mDynScaleShad1.add(point1Sc); |
|
669 |
mDynMoveHand1.add(point1_0); |
|
670 |
mDynMoveHand1.add(point11H); |
|
671 |
mDynMoveHand1.add(point11H); |
|
672 |
mDynMoveHand1.add(point12H); |
|
673 |
mDynMoveHand1.add(point13H); |
|
674 |
mDynMoveShad1.add(point1_0); |
|
675 |
mDynMoveShad1.add(point11S); |
|
676 |
mDynMoveShad1.add(point11S); |
|
677 |
mDynMoveShad1.add(point12S); |
|
678 |
mDynMoveShad1.add(point13S); |
|
679 |
|
|
680 |
Static3D point2_0 = new Static3D( x2 +d, y1 +d, z); |
|
681 |
Static3D point21H = new Static3D( x2 , y1 , z); |
|
682 |
Static3D point22H = new Static3D( x1 , y1 , z); |
|
683 |
Static3D point23H = new Static3D( x0 , y1 , z); |
|
684 |
Static3D point21S = new Static3D( x2+2*d, y1+2*d, z); |
|
685 |
Static3D point22S = new Static3D( x1+2*d, y1+2*d, z); |
|
686 |
Static3D point23S = new Static3D( x0+2*d, y1+2*d, z); |
|
687 |
Static3D point2Sc= new Static3D(-s,s,s); |
|
688 |
|
|
689 |
mDynScaleHand2.add(point2Sc); |
|
690 |
mDynScaleShad2.add(point2Sc); |
|
691 |
mDynMoveHand2.add(point2_0); |
|
692 |
mDynMoveHand2.add(point21H); |
|
693 |
mDynMoveHand2.add(point21H); |
|
694 |
mDynMoveHand2.add(point22H); |
|
695 |
mDynMoveHand2.add(point23H); |
|
696 |
mDynMoveShad2.add(point2_0); |
|
697 |
mDynMoveShad2.add(point21S); |
|
698 |
mDynMoveShad2.add(point21S); |
|
699 |
mDynMoveShad2.add(point22S); |
|
700 |
mDynMoveShad2.add(point23S); |
|
701 |
|
|
702 |
mMoveHand2.notifyWhenFinished(this); |
|
703 |
|
|
704 |
mNodes[0].changeInputSurface(mTextureShad); |
|
705 |
mNodes[1].changeInputSurface(mTextureShad); |
|
706 |
} |
|
707 |
|
|
156 | 708 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
157 | 709 |
|
158 | 710 |
private void createEffects() |
159 | 711 |
{ |
160 |
if( mEffects==null ) |
|
161 |
{ |
|
162 |
mEffects = new DistortedEffects[NUM_EFFE]; |
|
163 |
for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects(); |
|
164 |
|
|
165 |
int time = 3000; |
|
166 |
|
|
167 |
mDynMoveHand1 = new Dynamic3D(time,0.5f); |
|
168 |
mDynMoveHand1.setMode(Dynamic.MODE_PATH); |
|
169 |
mDynMoveHand1.setConvexity(0.0f); |
|
170 |
mDynMoveShad1 = new Dynamic3D(time,0.5f); |
|
171 |
mDynMoveShad1.setMode(Dynamic.MODE_PATH); |
|
172 |
mDynMoveShad1.setConvexity(0.0f); |
|
173 |
mDynScaleHand1 = new Dynamic3D(time,0.5f); |
|
174 |
mDynScaleHand1.setMode(Dynamic.MODE_PATH); |
|
175 |
mDynScaleHand1.setConvexity(0.0f); |
|
176 |
mDynScaleShad1 = new Dynamic3D(time,0.5f); |
|
177 |
mDynScaleShad1.setMode(Dynamic.MODE_PATH); |
|
178 |
mDynScaleShad1.setConvexity(0.0f); |
|
179 |
|
|
180 |
mMoveHand1 = new MatrixEffectMove(mDynMoveHand1); |
|
181 |
mMoveShad1 = new MatrixEffectMove(mDynMoveShad1); |
|
182 |
mScaleHand1= new MatrixEffectScale(mDynScaleHand1); |
|
183 |
mScaleShad1= new MatrixEffectScale(mDynScaleShad1); |
|
184 |
|
|
185 |
mMoveHand1.notifyWhenFinished(this); |
|
186 |
|
|
187 |
mEffects[0].apply(mScaleShad1); |
|
188 |
mEffects[0].apply(mMoveShad1); |
|
189 |
mEffects[2].apply(mScaleHand1); |
|
190 |
mEffects[2].apply(mMoveHand1); |
|
191 |
|
|
192 |
DistortedScreen screen = mControl.getScreen(); |
|
193 |
mWidth = screen.getWidth(); |
|
194 |
mHeight= screen.getHeight(); |
|
195 |
|
|
196 |
createEffectsStage1(); |
|
197 |
} |
|
198 |
else reloadEffectsStage1(); |
|
712 |
mEffects = new DistortedEffects[NUM_EFFE]; |
|
713 |
for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects(); |
|
714 |
|
|
715 |
int time = DUR[0]; |
|
716 |
|
|
717 |
mDynMoveHand1 = new Dynamic3D(time,0.5f); |
|
718 |
mDynMoveHand1.setMode(Dynamic.MODE_PATH); |
|
719 |
mDynMoveHand1.setConvexity(0.0f); |
|
720 |
mDynMoveShad1 = new Dynamic3D(time,0.5f); |
|
721 |
mDynMoveShad1.setMode(Dynamic.MODE_PATH); |
|
722 |
mDynMoveShad1.setConvexity(0.0f); |
|
723 |
mDynScaleHand1 = new Dynamic3D(time,0.5f); |
|
724 |
mDynScaleHand1.setMode(Dynamic.MODE_PATH); |
|
725 |
mDynScaleHand1.setConvexity(0.0f); |
|
726 |
mDynScaleShad1 = new Dynamic3D(time,0.5f); |
|
727 |
mDynScaleShad1.setMode(Dynamic.MODE_PATH); |
|
728 |
mDynScaleShad1.setConvexity(0.0f); |
|
729 |
|
|
730 |
mMoveHand1 = new MatrixEffectMove(mDynMoveHand1); |
|
731 |
mMoveShad1 = new MatrixEffectMove(mDynMoveShad1); |
|
732 |
mScaleHand1= new MatrixEffectScale(mDynScaleHand1); |
|
733 |
mScaleShad1= new MatrixEffectScale(mDynScaleShad1); |
|
734 |
|
|
735 |
mEffects[0].apply(mScaleShad1); |
|
736 |
mEffects[0].apply(mMoveShad1); |
|
737 |
mEffects[2].apply(mScaleHand1); |
|
738 |
mEffects[2].apply(mMoveHand1); |
|
739 |
|
|
740 |
mDynMoveHand2 = new Dynamic3D(time,0.5f); |
|
741 |
mDynMoveHand2.setMode(Dynamic.MODE_PATH); |
|
742 |
mDynMoveHand2.setConvexity(0.0f); |
|
743 |
mDynMoveShad2 = new Dynamic3D(time,0.5f); |
|
744 |
mDynMoveShad2.setMode(Dynamic.MODE_PATH); |
|
745 |
mDynMoveShad2.setConvexity(0.0f); |
|
746 |
mDynScaleHand2 = new Dynamic3D(time,0.5f); |
|
747 |
mDynScaleHand2.setMode(Dynamic.MODE_PATH); |
|
748 |
mDynScaleHand2.setConvexity(0.0f); |
|
749 |
mDynScaleShad2 = new Dynamic3D(time,0.5f); |
|
750 |
mDynScaleShad2.setMode(Dynamic.MODE_PATH); |
|
751 |
mDynScaleShad2.setConvexity(0.0f); |
|
752 |
|
|
753 |
mMoveHand2 = new MatrixEffectMove(mDynMoveHand2); |
|
754 |
mMoveShad2 = new MatrixEffectMove(mDynMoveShad2); |
|
755 |
mScaleHand2= new MatrixEffectScale(mDynScaleHand2); |
|
756 |
mScaleShad2= new MatrixEffectScale(mDynScaleShad2); |
|
757 |
|
|
758 |
mEffects[1].apply(mScaleShad2); |
|
759 |
mEffects[1].apply(mMoveShad2); |
|
760 |
mEffects[3].apply(mScaleHand2); |
|
761 |
mEffects[3].apply(mMoveHand2); |
|
762 |
|
|
763 |
DistortedScreen screen = mControl.getScreen(); |
|
764 |
mWidth = screen.getWidth(); |
|
765 |
mHeight= screen.getHeight(); |
|
199 | 766 |
} |
200 | 767 |
|
201 | 768 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
220 | 787 |
mTextureCirc.setTexture(bmpCirc); |
221 | 788 |
mTextureShad = new DistortedTexture(); |
222 | 789 |
mTextureShad.setTexture(bmpShad); |
223 |
mTextureHand = new DistortedTexture();
|
|
224 |
mTextureHand.setTexture(bmpHand);
|
|
790 |
DistortedTexture textureHand = new DistortedTexture();
|
|
791 |
textureHand.setTexture(bmpHand);
|
|
225 | 792 |
|
226 | 793 |
mNodes[0]= new DistortedNode(mTextureShad,mEffects[0],mQuad); |
227 | 794 |
mNodes[1]= new DistortedNode(mTextureShad,mEffects[1],mQuad); |
228 |
mNodes[2]= new DistortedNode(mTextureHand,mEffects[2],mQuad);
|
|
229 |
mNodes[3]= new DistortedNode(mTextureHand,mEffects[3],mQuad);
|
|
795 |
mNodes[2]= new DistortedNode( textureHand,mEffects[2],mQuad);
|
|
796 |
mNodes[3]= new DistortedNode( textureHand,mEffects[3],mQuad);
|
|
230 | 797 |
} |
231 | 798 |
else |
232 | 799 |
{ |
... | ... | |
245 | 812 |
|
246 | 813 |
DistortedNode[] getNodes() |
247 | 814 |
{ |
248 |
createEffects(); |
|
815 |
if( mEffects==null ) createEffects();
|
|
249 | 816 |
createNodes(); |
817 |
setEffectsStage1(); |
|
250 | 818 |
|
251 | 819 |
return mNodes; |
252 | 820 |
} |
... | ... | |
272 | 840 |
{ |
273 | 841 |
switch( mStageFinished ) |
274 | 842 |
{ |
275 |
case 1: createEffectsStage2(); |
|
276 |
break; |
|
277 |
case 2: mEffectID = -1; |
|
278 |
mControl.effectFinished(mEffectID); |
|
279 |
break; |
|
843 |
case 1: setEffectsStage2(); break; |
|
844 |
case 2: setEffectsStage3(); break; |
|
845 |
case 3: setEffectsStage4(); break; |
|
846 |
case 4: setEffectsStage5(); break; |
|
847 |
case 5: setEffectsStage6(); break; |
|
848 |
case 6: setEffectsStage7(); break; |
|
849 |
case 7: setEffectsStage8(); break; |
|
850 |
case 8: setEffectsStage9(); break; |
|
851 |
case 9: setEffectsStage10();break; |
|
852 |
case 10: setEffectsStage11();break; |
|
853 |
case 11: setEffectsStage12();break; |
|
854 |
case 12: setEffectsStage13();break; |
|
855 |
default: mEffectID = -1; |
|
856 |
mControl.effectFinished(mEffectID); |
|
857 |
break; |
|
280 | 858 |
} |
281 | 859 |
} |
282 | 860 |
} |
Also available in: Unified diff
Progress with RubikControl - finger movements during all 13 sub-stages of the 'whole' stage finished.
Next: actually move the cube.