Revision 2afc6754
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/control/RubikControl.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2021 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Magic Cube. // |
|
5 |
// // |
|
6 |
// Magic Cube is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Magic Cube is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.control; |
|
21 |
|
|
22 |
import org.distorted.objectlib.helpers.BlockController; |
|
23 |
import org.distorted.library.main.DistortedNode; |
|
24 |
import org.distorted.library.main.DistortedScreen; |
|
25 |
import org.distorted.library.message.EffectListener; |
|
26 |
import org.distorted.library.type.Static4D; |
|
27 |
|
|
28 |
import org.distorted.objectlib.main.TwistyObject; |
|
29 |
|
|
30 |
import org.distorted.main.RubikActivity; |
|
31 |
import org.distorted.main.RubikSurfaceView; |
|
32 |
|
|
33 |
import java.lang.ref.WeakReference; |
|
34 |
|
|
35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
36 |
|
|
37 |
public class RubikControl implements EffectListener |
|
38 |
{ |
|
39 |
private static RubikControl mControl; |
|
40 |
|
|
41 |
WeakReference<RubikActivity> mRefAct; |
|
42 |
boolean mWholeReturned, mRotateReturned; |
|
43 |
|
|
44 |
RubikControlWhole mWhole; |
|
45 |
RubikControlRotate mRotate; |
|
46 |
|
|
47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
48 |
|
|
49 |
DistortedScreen getScreen() |
|
50 |
{ |
|
51 |
RubikActivity act = mRefAct.get(); |
|
52 |
return act!=null ? act.getScreen() : null; |
|
53 |
} |
|
54 |
|
|
55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
56 |
|
|
57 |
TwistyObject getObject() |
|
58 |
{ |
|
59 |
RubikActivity act = mRefAct.get(); |
|
60 |
return act!=null ? act.getObject() : null; |
|
61 |
} |
|
62 |
|
|
63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
64 |
|
|
65 |
Static4D getCurrQuat() |
|
66 |
{ |
|
67 |
RubikActivity act = mRefAct.get(); |
|
68 |
return act!=null ? act.getCurrQuat() : null; |
|
69 |
} |
|
70 |
|
|
71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
72 |
|
|
73 |
RubikSurfaceView getSurfaceView() |
|
74 |
{ |
|
75 |
RubikActivity act = mRefAct.get(); |
|
76 |
return act!=null ? act.getSurfaceView() : null; |
|
77 |
} |
|
78 |
|
|
79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
80 |
|
|
81 |
private void addWholeObjects() |
|
82 |
{ |
|
83 |
DistortedScreen screen = getScreen(); |
|
84 |
DistortedNode[] nodes = mWhole.getNodes(); |
|
85 |
|
|
86 |
if( screen!=null && nodes!=null ) |
|
87 |
{ |
|
88 |
for (DistortedNode node : nodes) screen.attach(node); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
93 |
|
|
94 |
private void removeWholeObjects() |
|
95 |
{ |
|
96 |
DistortedScreen screen = getScreen(); |
|
97 |
DistortedNode[] nodes = mWhole.returnNodes(); |
|
98 |
|
|
99 |
if( screen!=null && nodes!=null ) |
|
100 |
{ |
|
101 |
for (DistortedNode node : nodes) screen.detach(node); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
106 |
|
|
107 |
private void addRotateObjects() |
|
108 |
{ |
|
109 |
DistortedScreen screen = getScreen(); |
|
110 |
DistortedNode[] screenNodes = mRotate.getScreenNodes(); |
|
111 |
|
|
112 |
if( screen!=null && screenNodes!=null ) |
|
113 |
{ |
|
114 |
for (DistortedNode node : screenNodes) screen.attach(node); |
|
115 |
} |
|
116 |
|
|
117 |
DistortedNode object = getObject(); |
|
118 |
DistortedNode[] objectNodes = mRotate.getObjectNodes(); |
|
119 |
|
|
120 |
if( object!=null && objectNodes!=null ) |
|
121 |
{ |
|
122 |
for (DistortedNode node : objectNodes) object.attach(node); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
127 |
|
|
128 |
private void removeRotateObjects() |
|
129 |
{ |
|
130 |
DistortedScreen screen = getScreen(); |
|
131 |
DistortedNode[] screenNodes = mRotate.returnScreenNodes(); |
|
132 |
|
|
133 |
if( screen!=null && screenNodes!=null ) |
|
134 |
{ |
|
135 |
for (DistortedNode node : screenNodes) screen.detach(node); |
|
136 |
} |
|
137 |
|
|
138 |
DistortedNode object = getObject(); |
|
139 |
DistortedNode[] objectNodes = mRotate.returnObjectNodes(); |
|
140 |
|
|
141 |
if( object!=null && objectNodes!=null ) |
|
142 |
{ |
|
143 |
for (DistortedNode node : objectNodes) object.detach(node); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
148 |
|
|
149 |
private void finishWhole() |
|
150 |
{ |
|
151 |
removeWholeObjects(); |
|
152 |
|
|
153 |
mWholeReturned = true; |
|
154 |
|
|
155 |
if( !mRotateReturned ) addRotateObjects(); |
|
156 |
} |
|
157 |
|
|
158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
159 |
|
|
160 |
private void finishRotate() |
|
161 |
{ |
|
162 |
removeRotateObjects(); |
|
163 |
|
|
164 |
mRotateReturned= true; |
|
165 |
|
|
166 |
RubikActivity act = mRefAct.get(); |
|
167 |
if( act!=null ) act.unblockEverything(); |
|
168 |
} |
|
169 |
|
|
170 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
171 |
|
|
172 |
RubikActivity getActivity() |
|
173 |
{ |
|
174 |
return mRefAct.get(); |
|
175 |
} |
|
176 |
|
|
177 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
178 |
|
|
179 |
private RubikControl() |
|
180 |
{ |
|
181 |
mWhole = new RubikControlWhole(this); |
|
182 |
mRotate= new RubikControlRotate(this); |
|
183 |
} |
|
184 |
|
|
185 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
186 |
// PUBLIC |
|
187 |
|
|
188 |
public static RubikControl getInstance() |
|
189 |
{ |
|
190 |
if( mControl==null ) mControl = new RubikControl(); |
|
191 |
|
|
192 |
return mControl; |
|
193 |
} |
|
194 |
|
|
195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
196 |
|
|
197 |
public void postDrawFrame(long time) |
|
198 |
{ |
|
199 |
mWhole.postDrawFrame(time); |
|
200 |
} |
|
201 |
|
|
202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
203 |
|
|
204 |
public void effectFinished(long effectID) |
|
205 |
{ |
|
206 |
if( effectID==mWhole.getEffectID() ) finishWhole(); |
|
207 |
if( effectID==mRotate.getEffectID() ) finishRotate(); |
|
208 |
} |
|
209 |
|
|
210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
211 |
|
|
212 |
public void animateAll(RubikActivity act) |
|
213 |
{ |
|
214 |
act.blockEverything(BlockController.CONTROL_PLACE_0); |
|
215 |
mRefAct = new WeakReference<>(act); |
|
216 |
|
|
217 |
mWholeReturned = false; |
|
218 |
mRotateReturned= false; |
|
219 |
|
|
220 |
addWholeObjects(); |
|
221 |
} |
|
222 |
|
|
223 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
224 |
|
|
225 |
public void animateRotate(RubikActivity act) |
|
226 |
{ |
|
227 |
act.blockEverything(BlockController.CONTROL_PLACE_1); |
|
228 |
mRefAct = new WeakReference<>(act); |
|
229 |
|
|
230 |
mWholeReturned = true; |
|
231 |
mRotateReturned= false; |
|
232 |
|
|
233 |
addRotateObjects(); |
|
234 |
} |
|
235 |
} |
src/main/java/org/distorted/control/RubikControlRotate.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2021 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Magic Cube. // |
|
5 |
// // |
|
6 |
// Magic Cube is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Magic Cube is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.control; |
|
21 |
|
|
22 |
import android.graphics.Bitmap; |
|
23 |
import android.graphics.BitmapFactory; |
|
24 |
|
|
25 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
26 |
import org.distorted.library.effect.MatrixEffectScale; |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedNode; |
|
29 |
import org.distorted.library.main.DistortedScreen; |
|
30 |
import org.distorted.library.main.DistortedTexture; |
|
31 |
import org.distorted.library.mesh.MeshQuad; |
|
32 |
import org.distorted.library.message.EffectListener; |
|
33 |
import org.distorted.library.type.Dynamic; |
|
34 |
import org.distorted.library.type.Dynamic3D; |
|
35 |
import org.distorted.library.type.Dynamic4D; |
|
36 |
import org.distorted.library.type.Static3D; |
|
37 |
import org.distorted.library.type.Static4D; |
|
38 |
import org.distorted.library.main.QuatHelper; |
|
39 |
|
|
40 |
import org.distorted.objectlib.main.TwistyObject; |
|
41 |
|
|
42 |
import org.distorted.main.R; |
|
43 |
import org.distorted.main.RubikActivity; |
|
44 |
|
|
45 |
import java.io.IOException; |
|
46 |
import java.io.InputStream; |
|
47 |
|
|
48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
49 |
|
|
50 |
class RubikControlRotate implements EffectListener |
|
51 |
{ |
|
52 |
private static final int NUM_SCREEN = 0; |
|
53 |
private static final int NUM_OBJECT = 1; |
|
54 |
|
|
55 |
private static Static4D INIT_QUAT; |
|
56 |
|
|
57 |
private final RubikControl mControl; |
|
58 |
private DistortedEffects[] mScreenEffects, mObjectEffects; |
|
59 |
private DistortedNode[] mScreenNodes, mObjectNodes; |
|
60 |
private long mScreenEffectID, mObjectEffectID, mCubeEffectID; |
|
61 |
private Static4D mObjRotQuat; |
|
62 |
|
|
63 |
private Dynamic3D mDynamic3; |
|
64 |
private Dynamic4D mDynamic4; |
|
65 |
private MatrixEffectScale mScale; |
|
66 |
private MatrixEffectQuaternion mQuaternion; |
|
67 |
private MeshQuad mScreenQuad, mObjectQuad; |
|
68 |
|
|
69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
70 |
|
|
71 |
private Bitmap openBitmap(RubikActivity act, int resource) |
|
72 |
{ |
|
73 |
try( InputStream is = act.getResources().openRawResource(resource) ) |
|
74 |
{ |
|
75 |
return BitmapFactory.decodeStream(is); |
|
76 |
} |
|
77 |
catch( IOException e ) |
|
78 |
{ |
|
79 |
// ignore |
|
80 |
} |
|
81 |
|
|
82 |
return null; |
|
83 |
} |
|
84 |
|
|
85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
86 |
|
|
87 |
private void computeInitQuat() |
|
88 |
{ |
|
89 |
double alphaZ = 0;//-Math.PI* 0.1250f; |
|
90 |
double alphaY = 0;//-Math.PI* 0.0625f; |
|
91 |
|
|
92 |
alphaY /= 2; |
|
93 |
alphaZ /= 2; |
|
94 |
|
|
95 |
float sinZ = (float)Math.sin(alphaZ); |
|
96 |
float cosZ = (float)Math.cos(alphaZ); |
|
97 |
float sinY = (float)Math.sin(alphaY); |
|
98 |
float cosY = (float)Math.cos(alphaY); |
|
99 |
|
|
100 |
Static4D qZ = new Static4D(0,0,sinZ,cosZ); |
|
101 |
Static4D qY = new Static4D(0,sinY,0,cosY); |
|
102 |
|
|
103 |
INIT_QUAT = QuatHelper.quatMultiply(qY,qZ); |
|
104 |
} |
|
105 |
|
|
106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
107 |
// Take 3D vector 'ax', rotate it by quaternion 'objQuat' to get vector V1. |
|
108 |
// Take 3D vector (1,0,0) and rotate it by INIT_QUAT to get vector V2. |
|
109 |
// Return a quaternion Q such that if we rotate V1 by Q, we get V2. |
|
110 |
|
|
111 |
private Static4D computeQuat(Static3D ax, Static4D objQuat, float x, float y, float z) |
|
112 |
{ |
|
113 |
Static4D ax4D = new Static4D( ax.get0(), ax.get1(), ax.get2(), 0); |
|
114 |
Static4D axRo = QuatHelper.rotateVectorByQuat(ax4D,objQuat); |
|
115 |
return QuatHelper.retRotationQuat(axRo.get0(),axRo.get1(),axRo.get2(),x,y,z); |
|
116 |
} |
|
117 |
|
|
118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
119 |
|
|
120 |
private void computeRotQuat() |
|
121 |
{ |
|
122 |
TwistyObject object = mControl.getObject(); |
|
123 |
Static3D[] axis = object.getRotationAxis(); |
|
124 |
int chosen=-1,numAxis = axis.length; |
|
125 |
float cos,maxCos = -1.0f; |
|
126 |
Static4D quat; |
|
127 |
|
|
128 |
Static4D objCurrQuat = mControl.getCurrQuat(); |
|
129 |
Static4D axisX = new Static4D(1,0,0,0); |
|
130 |
Static4D rotAxisX = QuatHelper.rotateVectorByQuat(axisX,INIT_QUAT); |
|
131 |
|
|
132 |
float axX = rotAxisX.get0(); |
|
133 |
float axY = rotAxisX.get1(); |
|
134 |
float axZ = rotAxisX.get2(); |
|
135 |
|
|
136 |
for (int a=0; a<numAxis; a++) |
|
137 |
{ |
|
138 |
quat = computeQuat(axis[a],objCurrQuat,axX,axY,axZ); |
|
139 |
cos = quat.get3(); |
|
140 |
|
|
141 |
android.util.Log.e("D", "axis="+a+" "+quat.get0()+" "+quat.get1()+" "+quat.get2()+" "+quat.get3() ); |
|
142 |
|
|
143 |
if (cos > maxCos) |
|
144 |
{ |
|
145 |
maxCos = cos; |
|
146 |
chosen = a; |
|
147 |
if( mObjRotQuat==null ) mObjRotQuat = new Static4D(quat); |
|
148 |
else mObjRotQuat.set(quat); |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
android.util.Log.e("D", "axis chosen: "+chosen); |
|
153 |
|
|
154 |
|
|
155 |
android.util.Log.e("D", mObjRotQuat.get0()+" "+mObjRotQuat.get1()+" "+mObjRotQuat.get2()+" "+mObjRotQuat.get3() ); |
|
156 |
} |
|
157 |
|
|
158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
159 |
|
|
160 |
private void setScreenEffectsStage1() |
|
161 |
{ |
|
162 |
mDynamic3.resetToBeginning(); |
|
163 |
mScale.notifyWhenFinished(mControl); |
|
164 |
} |
|
165 |
|
|
166 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
167 |
// the whole cube rotates so that its axis is alignled according to the Euler angles defined in |
|
168 |
// computeInitQuat() |
|
169 |
|
|
170 |
private void setObjectEffectsStage1() |
|
171 |
{ |
|
172 |
TwistyObject obj = mControl.getObject(); |
|
173 |
obj.apply(mQuaternion,0); |
|
174 |
mDynamic4.resetToBeginning(); |
|
175 |
mQuaternion.notifyWhenFinished(this); |
|
176 |
|
|
177 |
|
|
178 |
Static4D d = mDynamic4.getPoint(1); |
|
179 |
|
|
180 |
android.util.Log.e("D", "set: "+d.get0()+" "+d.get1()+" "+d.get2()+" "+d.get3() ); |
|
181 |
|
|
182 |
} |
|
183 |
|
|
184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
185 |
|
|
186 |
private void setObjectEffectsStage2() |
|
187 |
{ |
|
188 |
|
|
189 |
} |
|
190 |
|
|
191 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
192 |
|
|
193 |
private void createScreenEffects() |
|
194 |
{ |
|
195 |
mScreenEffects = new DistortedEffects[NUM_SCREEN]; |
|
196 |
mScreenEffects[0]= new DistortedEffects(); |
|
197 |
|
|
198 |
DistortedScreen screen = mControl.getScreen(); |
|
199 |
int wid = screen.getWidth(); |
|
200 |
|
|
201 |
Static3D scaleStart= new Static3D(1,1,1); |
|
202 |
Static3D scaleEnd = new Static3D(wid,wid,wid); |
|
203 |
|
|
204 |
mDynamic3 = new Dynamic3D(10000,0.5f); |
|
205 |
mDynamic3.add(scaleStart); |
|
206 |
mDynamic3.add(scaleEnd ); |
|
207 |
mDynamic3.add(scaleStart); |
|
208 |
mDynamic3.setMode(Dynamic.MODE_PATH); |
|
209 |
|
|
210 |
mScale = new MatrixEffectScale(mDynamic3); |
|
211 |
mScreenEffectID = mScale.getID(); |
|
212 |
mScreenEffects[0].apply(mScale); |
|
213 |
} |
|
214 |
|
|
215 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
216 |
|
|
217 |
private void createObjectEffects() |
|
218 |
{ |
|
219 |
mObjectEffects = new DistortedEffects[NUM_OBJECT]; |
|
220 |
mObjectEffects[0]= new DistortedEffects(); |
|
221 |
|
|
222 |
mDynamic4 = new Dynamic4D(5000,0.5f); |
|
223 |
mDynamic4.add(new Static4D(0,0,0,1)); |
|
224 |
mDynamic4.add(mObjRotQuat); |
|
225 |
mDynamic4.add(mObjRotQuat); |
|
226 |
mDynamic4.add(mObjRotQuat); |
|
227 |
mDynamic4.setMode(Dynamic.MODE_PATH); |
|
228 |
|
|
229 |
android.util.Log.e("D", "create: "+mObjRotQuat.get0()+" "+mObjRotQuat.get1()+" "+mObjRotQuat.get2()+" "+mObjRotQuat.get3() ); |
|
230 |
|
|
231 |
TwistyObject obj = mControl.getObject(); |
|
232 |
Static3D ax = obj.getRotationAxis()[0]; |
|
233 |
Static4D axis = new Static4D(ax.get0(), ax.get1(), ax.get2(), 0); |
|
234 |
|
|
235 |
Static4D v1 = QuatHelper.rotateVectorByQuat( new Static4D(1,0,0,0), INIT_QUAT); |
|
236 |
Static4D v2 = QuatHelper.rotateVectorByQuat( axis , mObjRotQuat); |
|
237 |
|
|
238 |
android.util.Log.e("D", "v1: "+v1.get0()+" "+v1.get1()+" "+v1.get2()+" "+v1.get3()); |
|
239 |
android.util.Log.e("D", "v2: "+v2.get0()+" "+v2.get1()+" "+v2.get2()+" "+v2.get3()); |
|
240 |
android.util.Log.e("D", "ax: "+ax.get0()+" "+ax.get1()+" "+ax.get2()); |
|
241 |
|
|
242 |
|
|
243 |
Static3D center = new Static3D(0,0,0); |
|
244 |
mQuaternion = new MatrixEffectQuaternion(mDynamic4, center); |
|
245 |
mCubeEffectID = mQuaternion.getID(); |
|
246 |
|
|
247 |
DistortedScreen screen = mControl.getScreen(); |
|
248 |
int wid = screen.getWidth(); |
|
249 |
Static3D scaleFactor = new Static3D(wid,wid*0.1f,10); |
|
250 |
MatrixEffectScale scale = new MatrixEffectScale(scaleFactor); |
|
251 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion(INIT_QUAT,center); |
|
252 |
|
|
253 |
mObjectEffects[0].apply(scale); |
|
254 |
mObjectEffects[0].apply(quat); |
|
255 |
} |
|
256 |
|
|
257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
258 |
|
|
259 |
private void createScreenNodes() |
|
260 |
{ |
|
261 |
if( mScreenNodes==null ) |
|
262 |
{ |
|
263 |
mScreenNodes= new DistortedNode[NUM_SCREEN]; |
|
264 |
mScreenQuad = new MeshQuad(); |
|
265 |
} |
|
266 |
|
|
267 |
DistortedTexture texture = new DistortedTexture(); |
|
268 |
texture.setColorARGB(0xff00ff00); |
|
269 |
mScreenNodes[0] = new DistortedNode(texture, mScreenEffects[0], mScreenQuad); |
|
270 |
} |
|
271 |
|
|
272 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
273 |
|
|
274 |
private void createObjectNodes() |
|
275 |
{ |
|
276 |
if( mObjectNodes==null ) |
|
277 |
{ |
|
278 |
mObjectNodes= new DistortedNode[NUM_OBJECT]; |
|
279 |
mObjectQuad = new MeshQuad(); |
|
280 |
} |
|
281 |
|
|
282 |
RubikActivity act = mControl.getActivity(); |
|
283 |
|
|
284 |
if( act!=null ) |
|
285 |
{ |
|
286 |
Bitmap bmpArrow = openBitmap(act, R.drawable.ui_axis_arrow); |
|
287 |
DistortedTexture textureArrow = new DistortedTexture(); |
|
288 |
|
|
289 |
if( bmpArrow!=null ) textureArrow.setTexture(bmpArrow); |
|
290 |
|
|
291 |
mObjectNodes[0] = new DistortedNode(textureArrow, mObjectEffects[0], mObjectQuad); |
|
292 |
} |
|
293 |
else |
|
294 |
{ |
|
295 |
android.util.Log.e("D", "Activity NULL!!"); |
|
296 |
} |
|
297 |
} |
|
298 |
|
|
299 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
300 |
|
|
301 |
long getEffectID() |
|
302 |
{ |
|
303 |
return mObjectEffectID; |
|
304 |
} |
|
305 |
|
|
306 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
307 |
|
|
308 |
DistortedNode[] getScreenNodes() |
|
309 |
{ |
|
310 |
if( NUM_SCREEN>0 ) |
|
311 |
{ |
|
312 |
if( mScreenEffects==null ) createScreenEffects(); |
|
313 |
createScreenNodes(); |
|
314 |
setScreenEffectsStage1(); |
|
315 |
} |
|
316 |
|
|
317 |
return mScreenNodes; |
|
318 |
} |
|
319 |
|
|
320 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
321 |
|
|
322 |
DistortedNode[] returnScreenNodes() |
|
323 |
{ |
|
324 |
return mScreenNodes; |
|
325 |
} |
|
326 |
|
|
327 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
328 |
|
|
329 |
DistortedNode[] getObjectNodes() |
|
330 |
{ |
|
331 |
if( NUM_OBJECT>0 ) |
|
332 |
{ |
|
333 |
if( INIT_QUAT==null ) computeInitQuat(); |
|
334 |
computeRotQuat(); |
|
335 |
if( mObjectEffects==null ) createObjectEffects(); |
|
336 |
createObjectNodes(); |
|
337 |
setObjectEffectsStage1(); |
|
338 |
} |
|
339 |
|
|
340 |
return mObjectNodes; |
|
341 |
} |
|
342 |
|
|
343 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
344 |
|
|
345 |
DistortedNode[] returnObjectNodes() |
|
346 |
{ |
|
347 |
return mObjectNodes; |
|
348 |
} |
|
349 |
|
|
350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
351 |
|
|
352 |
RubikControlRotate(RubikControl control) |
|
353 |
{ |
|
354 |
mControl = control; |
|
355 |
} |
|
356 |
|
|
357 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
358 |
|
|
359 |
@Override |
|
360 |
public void effectFinished(long effectID) |
|
361 |
{ |
|
362 |
if( effectID==mCubeEffectID) |
|
363 |
{ |
|
364 |
setObjectEffectsStage2(); |
|
365 |
|
|
366 |
TwistyObject obj = mControl.getObject(); |
|
367 |
obj.remove(mCubeEffectID); |
|
368 |
mObjectEffectID = -1; |
|
369 |
mControl.effectFinished(mObjectEffectID); |
|
370 |
} |
|
371 |
} |
|
372 |
} |
src/main/java/org/distorted/control/RubikControlWhole.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2021 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Magic Cube. // |
|
5 |
// // |
|
6 |
// Magic Cube is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Magic Cube is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.control; |
|
21 |
|
|
22 |
import android.graphics.Bitmap; |
|
23 |
import android.graphics.BitmapFactory; |
|
24 |
|
|
25 |
import org.distorted.library.effect.MatrixEffectMove; |
|
26 |
import org.distorted.library.effect.MatrixEffectScale; |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedNode; |
|
29 |
import org.distorted.library.main.DistortedScreen; |
|
30 |
import org.distorted.library.main.DistortedTexture; |
|
31 |
import org.distorted.library.mesh.MeshQuad; |
|
32 |
import org.distorted.library.type.Dynamic; |
|
33 |
import org.distorted.library.type.Dynamic3D; |
|
34 |
import org.distorted.library.type.Static3D; |
|
35 |
|
|
36 |
import org.distorted.main.R; |
|
37 |
import org.distorted.main.RubikActivity; |
|
38 |
import org.distorted.main.RubikSurfaceView; |
|
39 |
|
|
40 |
import java.io.IOException; |
|
41 |
import java.io.InputStream; |
|
42 |
|
|
43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
44 |
|
|
45 |
class RubikControlWhole |
|
46 |
{ |
|
47 |
private static final int NUM_NODE = 4; |
|
48 |
private static final int NUM_EFFE = 4; |
|
49 |
|
|
50 |
private static final int D1 = 2600; // time it takes for the finger to appear |
|
51 |
private static final int D2 = 250; // finger press |
|
52 |
private static final int D3 =10000; // finger triangle |
|
53 |
private static final int D4 = 3000; // fingers approach |
|
54 |
private static final int D5 = 8000; // fingers circle |
|
55 |
|
|
56 |
private static final int[] DUR = { D1, D2, D3, D2, D1/4, 3*D1/4, D1/4, D2, D4, D5, D4, D2, D1 }; |
|
57 |
private static final int[] DYN = { 2, 1, 1, 1, 2, 2, 4, 2, 2, 2, 2, 2, 4}; |
|
58 |
|
|
59 |
private float X0, X1, X2, Y1, D, s001, s014, s033, F; |
|
60 |
private int mWidth, mHeight; |
|
61 |
|
|
62 |
private final RubikControl mControl; |
|
63 |
private DistortedEffects[] mEffects; |
|
64 |
private DistortedNode[] mNodes; |
|
65 |
private long mEffectID; |
|
66 |
private int mCurrentStage; |
|
67 |
|
|
68 |
private MeshQuad mQuad; |
|
69 |
private DistortedTexture mTextureShad, mTextureCirc; |
|
70 |
private Dynamic3D mDynMoveHand1, mDynMoveShad1; |
|
71 |
private Dynamic3D mDynScaleHand1, mDynScaleShad1; |
|
72 |
private Dynamic3D mDynMoveHand2, mDynMoveShad2; |
|
73 |
private Dynamic3D mDynScaleHand2, mDynScaleShad2; |
|
74 |
private Dynamic3D mDyn1, mDyn2, mDyn3, mDyn4; |
|
75 |
private Static3D mPosition1, mPosition2, mPosition3, mPosition4; |
|
76 |
private float[] tmpBuffer; |
|
77 |
private long mLastTime, mDiffTime; |
|
78 |
|
|
79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
80 |
|
|
81 |
private void setPostFrame(boolean on) |
|
82 |
{ |
|
83 |
RubikActivity act = mControl.getActivity(); |
|
84 |
act.setControlState(on); |
|
85 |
mLastTime = -1; |
|
86 |
} |
|
87 |
|
|
88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
89 |
|
|
90 |
private Bitmap openBitmap(RubikActivity act, int resource) |
|
91 |
{ |
|
92 |
try( InputStream is = act.getResources().openRawResource(resource) ) |
|
93 |
{ |
|
94 |
return BitmapFactory.decodeStream(is); |
|
95 |
} |
|
96 |
catch( IOException e ) |
|
97 |
{ |
|
98 |
// ignore |
|
99 |
} |
|
100 |
|
|
101 |
return null; |
|
102 |
} |
|
103 |
|
|
104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
105 |
|
|
106 |
private void resetDynamics1(int stage) |
|
107 |
{ |
|
108 |
int dur = DUR[stage-1]; |
|
109 |
|
|
110 |
mDynMoveHand1.removeAll(); |
|
111 |
mDynMoveShad1.removeAll(); |
|
112 |
mDynScaleHand1.removeAll(); |
|
113 |
mDynScaleShad1.removeAll(); |
|
114 |
|
|
115 |
mDynMoveHand1.setDuration(dur); |
|
116 |
mDynMoveShad1.setDuration(dur); |
|
117 |
mDynScaleHand1.setDuration(dur); |
|
118 |
mDynScaleShad1.setDuration(dur); |
|
119 |
mDynMoveHand1.resetToBeginning(); |
|
120 |
mDynMoveShad1.resetToBeginning(); |
|
121 |
mDynScaleHand1.resetToBeginning(); |
|
122 |
mDynScaleShad1.resetToBeginning(); |
|
123 |
|
|
124 |
mCurrentStage = stage; |
|
125 |
} |
|
126 |
|
|
127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
128 |
|
|
129 |
private void resetDynamics2(int stage) |
|
130 |
{ |
|
131 |
int dur = DUR[stage-1]; |
|
132 |
|
|
133 |
mDynMoveHand2.removeAll(); |
|
134 |
mDynMoveShad2.removeAll(); |
|
135 |
mDynScaleHand2.removeAll(); |
|
136 |
mDynScaleShad2.removeAll(); |
|
137 |
|
|
138 |
mDynMoveHand2.setDuration(dur); |
|
139 |
mDynMoveShad2.setDuration(dur); |
|
140 |
mDynScaleHand2.setDuration(dur); |
|
141 |
mDynScaleShad2.setDuration(dur); |
|
142 |
mDynMoveHand2.resetToBeginning(); |
|
143 |
mDynMoveShad2.resetToBeginning(); |
|
144 |
mDynScaleHand2.resetToBeginning(); |
|
145 |
mDynScaleShad2.resetToBeginning(); |
|
146 |
} |
|
147 |
|
|
148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
149 |
|
|
150 |
private void resetDynamics3(int stage) |
|
151 |
{ |
|
152 |
int dur = DUR[stage-1]; |
|
153 |
|
|
154 |
mDyn1.removeAll(); |
|
155 |
mDyn2.removeAll(); |
|
156 |
mDyn1.setDuration(dur); |
|
157 |
mDyn2.setDuration(dur); |
|
158 |
mDyn1.resetToBeginning(); |
|
159 |
mDyn2.resetToBeginning(); |
|
160 |
} |
|
161 |
|
|
162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
163 |
|
|
164 |
private void resetDynamics4(int stage) |
|
165 |
{ |
|
166 |
int dur = DUR[stage-1]; |
|
167 |
|
|
168 |
mDyn3.removeAll(); |
|
169 |
mDyn4.removeAll(); |
|
170 |
mDyn3.setDuration(dur); |
|
171 |
mDyn4.setDuration(dur); |
|
172 |
mDyn3.resetToBeginning(); |
|
173 |
mDyn4.resetToBeginning(); |
|
174 |
} |
|
175 |
|
|
176 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
177 |
// first finger appears and approaches the screen |
|
178 |
|
|
179 |
private void setEffectsStage1() |
|
180 |
{ |
|
181 |
resetDynamics1(1); |
|
182 |
resetDynamics2(1); |
|
183 |
resetDynamics3(1); |
|
184 |
|
|
185 |
Static3D point0h = new Static3D(-X0 ,-Y1 , 0); |
|
186 |
Static3D point1h = new Static3D(-X1 ,-Y1 , 0); |
|
187 |
Static3D point2h = new Static3D(-X2 ,-Y1 , 0); |
|
188 |
Static3D point3h = new Static3D(-X2 +D,-Y1 +D, 0); |
|
189 |
Static3D point0s = new Static3D(-X0+2*D,-Y1+2*D, 0); |
|
190 |
Static3D point1s = new Static3D(-X1+2*D,-Y1+2*D, 0); |
|
191 |
Static3D point2s = new Static3D(-X2+2*D,-Y1+2*D, 0); |
|
192 |
Static3D point3s = new Static3D(-X2 +D,-Y1 +D, 0); |
|
193 |
|
|
194 |
Static3D pointSc = new Static3D(s033,s033,s033); |
|
195 |
|
|
196 |
mDyn1.add(point0h); |
|
197 |
mDyn1.add(point1h); |
|
198 |
mDyn1.add(point2h); |
|
199 |
mDyn1.add(point2h); |
|
200 |
mDyn1.add(point3h); |
|
201 |
mDyn2.add(point0s); |
|
202 |
mDyn2.add(point1s); |
|
203 |
mDyn2.add(point2s); |
|
204 |
mDyn2.add(point2s); |
|
205 |
mDyn2.add(point3s); |
|
206 |
|
|
207 |
mPosition1.set(point0h); |
|
208 |
mPosition2.set(point0s); |
|
209 |
|
|
210 |
mDynMoveHand1.add(mPosition1); |
|
211 |
mDynMoveShad1.add(mPosition2); |
|
212 |
|
|
213 |
mDynScaleHand1.add(pointSc); |
|
214 |
mDynScaleShad1.add(pointSc); |
|
215 |
|
|
216 |
setPostFrame(true); |
|
217 |
} |
|
218 |
|
|
219 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
220 |
// first finger touches the screen |
|
221 |
|
|
222 |
private void setEffectsStage2() |
|
223 |
{ |
|
224 |
resetDynamics1(2); |
|
225 |
resetDynamics3(2); |
|
226 |
|
|
227 |
Static3D point3h = new Static3D(-X2 +D,-Y1 +D, 0); |
|
228 |
Static3D scaleS = new Static3D(s001,s001,s001); |
|
229 |
Static3D scaleF = new Static3D(s014,s014,s014); |
|
230 |
Static3D pointH = new Static3D(s033,s033,s033); |
|
231 |
|
|
232 |
mPosition1.set(scaleS); |
|
233 |
mDyn1.add(scaleS); |
|
234 |
mDyn1.add(scaleF); |
|
235 |
|
|
236 |
mDynMoveHand1.add(point3h); |
|
237 |
mDynMoveShad1.add(point3h); |
|
238 |
mDynScaleHand1.add(pointH); |
|
239 |
mDynScaleShad1.add(mPosition1); |
|
240 |
|
|
241 |
mNodes[0].changeInputSurface(mTextureCirc); |
|
242 |
} |
|
243 |
|
|
244 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
245 |
// first finger moves across the screen in a triangular fashion |
|
246 |
|
|
247 |
private void setEffectsStage3() |
|
248 |
{ |
|
249 |
resetDynamics1(3); |
|
250 |
resetDynamics3(3); |
|
251 |
|
|
252 |
Static3D scaleS = new Static3D(s014,s014,s014); |
|
253 |
Static3D pointH = new Static3D(s033,s033,s033); |
|
254 |
Static3D point1 = new Static3D(-X2 +D,-Y1 +D, 0); |
|
255 |
Static3D point2 = new Static3D( +D,-Y1 +D, 0); |
|
256 |
Static3D point3 = new Static3D(+X2 +D,-Y1 +D, 0); |
|
257 |
Static3D point4 = new Static3D(+X2 +D, +D, 0); |
|
258 |
Static3D point5 = new Static3D(+X2 +D,+Y1 +D, 0); |
|
259 |
Static3D point6 = new Static3D( +D, +D, 0); |
|
260 |
|
|
261 |
mDynScaleHand1.add(pointH); |
|
262 |
mDynScaleShad1.add(scaleS); |
|
263 |
|
|
264 |
mDyn1.add(point1); |
|
265 |
mDyn1.add(point1); |
|
266 |
mDyn1.add(point2); |
|
267 |
mDyn1.add(point3); |
|
268 |
mDyn1.add(point3); |
|
269 |
mDyn1.add(point4); |
|
270 |
mDyn1.add(point5); |
|
271 |
mDyn1.add(point5); |
|
272 |
mDyn1.add(point6); |
|
273 |
mDyn1.add(point1); |
|
274 |
mDyn1.add(point1); |
|
275 |
|
|
276 |
mPosition1.set(point1); |
|
277 |
|
|
278 |
mDynMoveHand1.add(mPosition1); |
|
279 |
mDynMoveShad1.add(mPosition1); |
|
280 |
|
|
281 |
RubikSurfaceView view = mControl.getSurfaceView(); |
|
282 |
float x = point1.get0() + mWidth*0.5f; |
|
283 |
float y = mHeight*0.5f - point1.get1(); |
|
284 |
|
|
285 |
/* |
|
286 |
view.prepareDown(); |
|
287 |
view.actionDown(x,y); |
|
288 |
|
|
289 |
*/ |
|
290 |
} |
|
291 |
|
|
292 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
293 |
// first finger un-touches the screen |
|
294 |
|
|
295 |
private void setEffectsStage4() |
|
296 |
{ |
|
297 |
resetDynamics1(4); |
|
298 |
resetDynamics3(4); |
|
299 |
|
|
300 |
Static3D point3h = new Static3D(-X2+D,-Y1+D, 0); |
|
301 |
Static3D scaleS = new Static3D(s014,s014,s014); |
|
302 |
Static3D scaleF = new Static3D(s001,s001,s001); |
|
303 |
Static3D pointH = new Static3D(s033,s033,s033); |
|
304 |
|
|
305 |
mDyn1.add(scaleS); |
|
306 |
mDyn1.add(scaleF); |
|
307 |
mPosition1.set(scaleS); |
|
308 |
|
|
309 |
mDynMoveHand1.add(point3h); |
|
310 |
mDynMoveShad1.add(point3h); |
|
311 |
mDynScaleHand1.add(pointH); |
|
312 |
mDynScaleShad1.add(mPosition1); |
|
313 |
} |
|
314 |
|
|
315 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
316 |
// first finger un-touches the screen (part2) |
|
317 |
|
|
318 |
private void setEffectsStage5() |
|
319 |
{ |
|
320 |
resetDynamics1(5); |
|
321 |
resetDynamics3(5); |
|
322 |
|
|
323 |
Static3D pointH = new Static3D(-X2 ,-Y1 , 0); |
|
324 |
Static3D point0 = new Static3D(-X2 +D,-Y1 +D, 0); |
|
325 |
Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0); |
|
326 |
Static3D pointSc = new Static3D(s033,s033,s033); |
|
327 |
|
|
328 |
mPosition1.set(point0); |
|
329 |
mPosition2.set(point0); |
|
330 |
|
|
331 |
mDyn1.add(point0); |
|
332 |
mDyn1.add(pointH); |
|
333 |
mDyn2.add(point0); |
|
334 |
mDyn2.add(pointS); |
|
335 |
|
|
336 |
mDynScaleHand1.add(pointSc); |
|
337 |
mDynScaleShad1.add(pointSc); |
|
338 |
mDynMoveHand1.add(mPosition1); |
|
339 |
mDynMoveShad1.add(mPosition2); |
|
340 |
|
|
341 |
mNodes[0].changeInputSurface(mTextureShad); |
|
342 |
} |
|
343 |
|
|
344 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
345 |
// second finger appears |
|
346 |
|
|
347 |
private void setEffectsStage6() |
|
348 |
{ |
|
349 |
resetDynamics1(6); |
|
350 |
resetDynamics2(6); |
|
351 |
resetDynamics3(6); |
|
352 |
|
|
353 |
Static3D pointH = new Static3D(-X2 ,-Y1 , 0); |
|
354 |
Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0); |
|
355 |
Static3D pointSc= new Static3D(s033,s033,s033); |
|
356 |
|
|
357 |
mDynScaleHand1.add(pointSc); |
|
358 |
mDynScaleShad1.add(pointSc); |
|
359 |
mDynMoveHand1.add(pointH); |
|
360 |
mDynMoveShad1.add(pointS); |
|
361 |
|
|
362 |
Static3D point0h = new Static3D( X0 , Y1 , 0); |
|
363 |
Static3D point1h = new Static3D( X1 , Y1 , 0); |
|
364 |
Static3D point2h = new Static3D( X2 , Y1 , 0); |
|
365 |
Static3D point0s = new Static3D( X0+2*D, Y1+2*D, 0); |
|
366 |
Static3D point1s = new Static3D( X1+2*D, Y1+2*D, 0); |
|
367 |
Static3D point2s = new Static3D( X2+2*D, Y1+2*D, 0); |
|
368 |
Static3D pointSm = new Static3D(-s033,s033,s033); |
|
369 |
|
|
370 |
mPosition1.set(point0h); |
|
371 |
mPosition2.set(point0s); |
|
372 |
|
|
373 |
mDyn1.add(point0h); |
|
374 |
mDyn1.add(point1h); |
|
375 |
mDyn1.add(point2h); |
|
376 |
mDyn1.add(point2h); |
|
377 |
mDyn2.add(point0s); |
|
378 |
mDyn2.add(point1s); |
|
379 |
mDyn2.add(point2s); |
|
380 |
mDyn2.add(point2s); |
|
381 |
|
|
382 |
mDynScaleHand2.add(pointSm); |
|
383 |
mDynScaleShad2.add(pointSm); |
|
384 |
mDynMoveHand2.add(mPosition1); |
|
385 |
mDynMoveShad2.add(mPosition2); |
|
386 |
} |
|
387 |
|
|
388 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
389 |
// both fingers touch the screen (part1) |
|
390 |
|
|
391 |
private void setEffectsStage7() |
|
392 |
{ |
|
393 |
resetDynamics1(7); |
|
394 |
resetDynamics2(7); |
|
395 |
resetDynamics3(7); |
|
396 |
resetDynamics4(7); |
|
397 |
|
|
398 |
Static3D point1Sc= new Static3D( s033,s033,s033); |
|
399 |
Static3D point2Sc= new Static3D(-s033,s033,s033); |
|
400 |
mDynScaleHand1.add(point1Sc); |
|
401 |
mDynScaleShad1.add(point1Sc); |
|
402 |
mDynScaleHand2.add(point2Sc); |
|
403 |
mDynScaleShad2.add(point2Sc); |
|
404 |
|
|
405 |
Static3D point1H = new Static3D(-X2 ,-Y1 , 0); |
|
406 |
Static3D point1F = new Static3D(-X2 +D,-Y1 +D, 0); |
|
407 |
Static3D point1S = new Static3D(-X2+2*D,-Y1+2*D, 0); |
|
408 |
|
|
409 |
mDyn1.add(point1H); |
|
410 |
mDyn1.add(point1F); |
|
411 |
mDyn2.add(point1S); |
|
412 |
mDyn2.add(point1F); |
|
413 |
|
|
414 |
mPosition1.set(point1H); |
|
415 |
mPosition2.set(point1S); |
|
416 |
mDynMoveHand1.add(mPosition1); |
|
417 |
mDynMoveShad1.add(mPosition2); |
|
418 |
|
|
419 |
Static3D point2H = new Static3D( X2 , Y1 , 0); |
|
420 |
Static3D point2F = new Static3D( X2 +D, Y1 +D, 0); |
|
421 |
Static3D point2S = new Static3D( X2+2*D, Y1+2*D, 0); |
|
422 |
|
|
423 |
mDyn3.add(point2H); |
|
424 |
mDyn3.add(point2F); |
|
425 |
mDyn4.add(point2S); |
|
426 |
mDyn4.add(point2F); |
|
427 |
|
|
428 |
mPosition3.set(point2H); |
|
429 |
mPosition4.set(point2S); |
|
430 |
mDynMoveHand2.add(mPosition3); |
|
431 |
mDynMoveShad2.add(mPosition4); |
|
432 |
} |
|
433 |
|
|
434 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
435 |
// both fingers touch the screen (part2) |
|
436 |
|
|
437 |
private void setEffectsStage8() |
|
438 |
{ |
|
439 |
resetDynamics1(8); |
|
440 |
resetDynamics2(8); |
|
441 |
resetDynamics3(8); |
|
442 |
|
|
443 |
Static3D point1h= new Static3D(-X2 +D,-Y1 +D, 0); |
|
444 |
Static3D point2h= new Static3D( X2 +D, Y1 +D, 0); |
|
445 |
Static3D scale1S = new Static3D( s001,s001,s001); |
|
446 |
Static3D scale1F = new Static3D( s014,s014,s014); |
|
447 |
Static3D point1H = new Static3D( s033,s033,s033); |
|
448 |
Static3D scale2S = new Static3D(-s001,s001,s001); |
|
449 |
Static3D scale2F = new Static3D(-s014,s014,s014); |
|
450 |
Static3D point2H = new Static3D(-s033,s033,s033); |
|
451 |
|
|
452 |
mPosition1.set(scale1S); |
|
453 |
mDyn1.add(scale1S); |
|
454 |
mDyn1.add(scale1F); |
|
455 |
|
|
456 |
mDynMoveHand1.add(point1h); |
|
457 |
mDynMoveShad1.add(point1h); |
|
458 |
mDynScaleHand1.add(point1H); |
|
459 |
mDynScaleShad1.add(mPosition1); |
|
460 |
|
|
461 |
mPosition2.set(scale2S); |
|
462 |
mDyn2.add(scale2S); |
|
463 |
mDyn2.add(scale2F); |
|
464 |
|
|
465 |
mDynMoveHand2.add(point2h); |
|
466 |
mDynMoveShad2.add(point2h); |
|
467 |
mDynScaleHand2.add(point2H); |
|
468 |
mDynScaleShad2.add(mPosition2); |
|
469 |
|
|
470 |
mNodes[0].changeInputSurface(mTextureCirc); |
|
471 |
mNodes[1].changeInputSurface(mTextureCirc); |
|
472 |
} |
|
473 |
|
|
474 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
475 |
// both fingers approach each other |
|
476 |
|
|
477 |
private void setEffectsStage9() |
|
478 |
{ |
|
479 |
resetDynamics1(9); |
|
480 |
resetDynamics2(9); |
|
481 |
resetDynamics3(9); |
|
482 |
|
|
483 |
Static3D point1s = new Static3D(-X2+D,-Y1+D, 0); |
|
484 |
Static3D point2s = new Static3D( X2+D, Y1+D, 0); |
|
485 |
Static3D point1f = new Static3D(-Y1*F,-Y1*F, 0); |
|
486 |
Static3D point2f = new Static3D( Y1*F, Y1*F, 0); |
|
487 |
Static3D scale1F = new Static3D( s014,s014,s014); |
|
488 |
Static3D point1H = new Static3D( s033,s033,s033); |
|
489 |
Static3D scale2F = new Static3D(-s014,s014,s014); |
|
490 |
Static3D point2H = new Static3D(-s033,s033,s033); |
|
491 |
|
|
492 |
mDynScaleHand1.add(point1H); |
|
493 |
mDynScaleShad1.add(scale1F); |
|
494 |
mDynScaleHand2.add(point2H); |
|
495 |
mDynScaleShad2.add(scale2F); |
|
496 |
|
|
497 |
mDyn1.add(point1s); |
|
498 |
mDyn1.add(point1f); |
|
499 |
mDyn2.add(point2s); |
|
500 |
mDyn2.add(point2f); |
|
501 |
|
|
502 |
mPosition1.set(point1s); |
|
503 |
mPosition2.set(point2s); |
|
504 |
|
|
505 |
mDynMoveHand1.add(mPosition1); |
|
506 |
mDynMoveShad1.add(mPosition1); |
|
507 |
mDynMoveHand2.add(mPosition2); |
|
508 |
mDynMoveShad2.add(mPosition2); |
|
509 |
|
|
510 |
float x1 = point1s.get0() + mWidth*0.5f; |
|
511 |
float y1 = mHeight*0.5f - point1s.get1(); |
|
512 |
float x2 = point2s.get0() + mWidth*0.5f; |
|
513 |
float y2 = mHeight*0.5f - point2s.get1(); |
|
514 |
|
|
515 |
RubikSurfaceView view = mControl.getSurfaceView(); |
|
516 |
|
|
517 |
/* |
|
518 |
view.prepareDown(); |
|
519 |
view.prepareDown2(); |
|
520 |
view.actionDown(x1,y1); |
|
521 |
view.actionDown2(x1,y1,x2,y2); |
|
522 |
|
|
523 |
*/ |
|
524 |
} |
|
525 |
|
|
526 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
527 |
// both fingers go around |
|
528 |
|
|
529 |
private void setEffectsStage10() |
|
530 |
{ |
|
531 |
resetDynamics1(10); |
|
532 |
resetDynamics2(10); |
|
533 |
resetDynamics3(10); |
|
534 |
|
|
535 |
Static3D scale1F = new Static3D( s014,s014,s014); |
|
536 |
Static3D point1H = new Static3D( s033,s033,s033); |
|
537 |
Static3D scale2F = new Static3D(-s014,s014,s014); |
|
538 |
Static3D point2H = new Static3D(-s033,s033,s033); |
|
539 |
|
|
540 |
Static3D point0= new Static3D(-Y1*F,-Y1*F, 0); |
|
541 |
Static3D point1= new Static3D(-Y1*F, Y1*F, 0); |
|
542 |
Static3D point2= new Static3D( Y1*F, Y1*F, 0); |
|
543 |
Static3D point3= new Static3D( Y1*F,-Y1*F, 0); |
|
544 |
|
|
545 |
mDynScaleHand1.add(point1H); |
|
546 |
mDynScaleShad1.add(scale1F); |
|
547 |
mDynScaleHand2.add(point2H); |
|
548 |
mDynScaleShad2.add(scale2F); |
|
549 |
|
|
550 |
mDyn1.add(point0); |
|
551 |
mDyn1.add(point1); |
|
552 |
mDyn1.add(point2); |
|
553 |
mDyn1.add(point3); |
|
554 |
mDyn1.add(point0); |
|
555 |
|
|
556 |
mDyn2.add(point2); |
|
557 |
mDyn2.add(point3); |
|
558 |
mDyn2.add(point0); |
|
559 |
mDyn2.add(point1); |
|
560 |
mDyn2.add(point2); |
|
561 |
|
|
562 |
mDyn1.setConvexity(1.0f); |
|
563 |
mDyn2.setConvexity(1.0f); |
|
564 |
|
|
565 |
mDyn1.setSpeedMode(Dynamic.SPEED_MODE_SEGMENT_CONSTANT); |
|
566 |
mDyn2.setSpeedMode(Dynamic.SPEED_MODE_SEGMENT_CONSTANT); |
|
567 |
|
|
568 |
mPosition1.set(point0); |
|
569 |
mPosition2.set(point2); |
|
570 |
|
|
571 |
mDynMoveHand1.add(mPosition1); |
|
572 |
mDynMoveShad1.add(mPosition1); |
|
573 |
mDynMoveHand2.add(mPosition2); |
|
574 |
mDynMoveShad2.add(mPosition2); |
|
575 |
} |
|
576 |
|
|
577 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
578 |
// both fingers move away from each other |
|
579 |
|
|
580 |
private void setEffectsStage11() |
|
581 |
{ |
|
582 |
resetDynamics1(11); |
|
583 |
resetDynamics2(11); |
|
584 |
resetDynamics3(11); |
|
585 |
|
|
586 |
Static3D point1s= new Static3D(-X2+D,-Y1+D, 0); |
|
587 |
Static3D point2s= new Static3D( X2+D, Y1+D, 0); |
|
588 |
Static3D point1f= new Static3D(-Y1*F,-Y1*F, 0); |
|
589 |
Static3D point2f= new Static3D( Y1*F, Y1*F, 0); |
|
590 |
Static3D scale1F= new Static3D( s014,s014,s014); |
|
591 |
Static3D point1H= new Static3D( s033,s033,s033); |
|
592 |
Static3D scale2F= new Static3D(-s014,s014,s014); |
|
593 |
Static3D point2H= new Static3D(-s033,s033,s033); |
|
594 |
|
|
595 |
mDynScaleHand1.add(point1H); |
|
596 |
mDynScaleShad1.add(scale1F); |
|
597 |
mDynScaleHand2.add(point2H); |
|
598 |
mDynScaleShad2.add(scale2F); |
|
599 |
|
|
600 |
mDyn1.add(point1f); |
|
601 |
mDyn1.add(point1s); |
|
602 |
mDyn2.add(point2f); |
|
603 |
mDyn2.add(point2s); |
|
604 |
|
|
605 |
mDyn1.setConvexity(0.0f); |
|
606 |
mDyn2.setConvexity(0.0f); |
|
607 |
|
|
608 |
mDyn1.setSpeedMode(Dynamic.SPEED_MODE_SMOOTH); |
|
609 |
mDyn2.setSpeedMode(Dynamic.SPEED_MODE_SMOOTH); |
|
610 |
|
|
611 |
mPosition1.set(point1f); |
|
612 |
mPosition2.set(point2f); |
|
613 |
|
|
614 |
mDynMoveHand1.add(mPosition1); |
|
615 |
mDynMoveShad1.add(mPosition1); |
|
616 |
mDynMoveHand2.add(mPosition2); |
|
617 |
mDynMoveShad2.add(mPosition2); |
|
618 |
} |
|
619 |
|
|
620 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
621 |
// both fingers un-touch the screen (part1) |
|
622 |
|
|
623 |
private void setEffectsStage12() |
|
624 |
{ |
|
625 |
resetDynamics1(12); |
|
626 |
resetDynamics2(12); |
|
627 |
resetDynamics3(12); |
|
628 |
|
|
629 |
Static3D point1h = new Static3D(-X2+D,-Y1+D, 0); |
|
630 |
Static3D point2h = new Static3D( X2+D, Y1+D, 0); |
|
631 |
Static3D scale1S = new Static3D( s014,s014,s014); |
|
632 |
Static3D scale1F = new Static3D( s001,s001,s001); |
|
633 |
Static3D point1H = new Static3D( s033,s033,s033); |
|
634 |
Static3D scale2S = new Static3D(-s014,s014,s014); |
|
635 |
Static3D scale2F = new Static3D(-s001,s001,s001); |
|
636 |
Static3D point2H = new Static3D(-s033,s033,s033); |
|
637 |
|
|
638 |
mPosition1.set(scale1S); |
|
639 |
mPosition2.set(scale2S); |
|
640 |
|
|
641 |
mDyn1.add(scale1S); |
|
642 |
mDyn1.add(scale1F); |
|
643 |
mDyn2.add(scale2S); |
|
644 |
mDyn2.add(scale2F); |
|
645 |
|
|
646 |
mDynMoveHand1.add(point1h); |
|
647 |
mDynMoveShad1.add(point1h); |
|
648 |
mDynScaleHand1.add(point1H); |
|
649 |
mDynScaleShad1.add(mPosition1); |
|
650 |
|
|
651 |
mDynMoveHand2.add(point2h); |
|
652 |
mDynMoveShad2.add(point2h); |
|
653 |
mDynScaleHand2.add(point2H); |
|
654 |
mDynScaleShad2.add(mPosition2); |
|
655 |
} |
|
656 |
|
|
657 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
658 |
// both fingers un-touch the screen (part2) |
|
659 |
|
|
660 |
private void setEffectsStage13() |
|
661 |
{ |
|
662 |
resetDynamics1(13); |
|
663 |
resetDynamics2(13); |
|
664 |
resetDynamics3(13); |
|
665 |
resetDynamics4(13); |
|
666 |
|
|
667 |
Static3D point1_0 = new Static3D(-X2 +D,-Y1 +D, 0); |
|
668 |
Static3D point11H = new Static3D(-X2 ,-Y1 , 0); |
|
669 |
Static3D point12H = new Static3D(-X1 ,-Y1 , 0); |
|
670 |
Static3D point13H = new Static3D(-X0 ,-Y1 , 0); |
|
671 |
Static3D point11S = new Static3D(-X2+2*D,-Y1+2*D, 0); |
|
672 |
Static3D point12S = new Static3D(-X1+2*D,-Y1+2*D, 0); |
|
673 |
Static3D point13S = new Static3D(-X0+2*D,-Y1+2*D, 0); |
|
674 |
Static3D point1Sc = new Static3D( s033,s033,s033); |
|
675 |
|
|
676 |
mPosition1.set(point1_0); |
|
677 |
mDynMoveHand1.add(mPosition1); |
|
678 |
mPosition2.set(point1_0); |
|
679 |
mDynMoveShad1.add(mPosition2); |
|
680 |
|
|
681 |
mDynScaleHand1.add(point1Sc); |
|
682 |
mDynScaleShad1.add(point1Sc); |
|
683 |
|
|
684 |
mDyn1.add(point1_0); |
|
685 |
mDyn1.add(point11H); |
|
686 |
mDyn1.add(point11H); |
|
687 |
mDyn1.add(point12H); |
|
688 |
mDyn1.add(point13H); |
|
689 |
|
|
690 |
mDyn2.add(point1_0); |
|
691 |
mDyn2.add(point11S); |
|
692 |
mDyn2.add(point11S); |
|
693 |
mDyn2.add(point12S); |
|
694 |
mDyn2.add(point13S); |
|
695 |
|
|
696 |
Static3D point2_0 = new Static3D( X2 +D, Y1 +D, 0); |
|
697 |
Static3D point21H = new Static3D( X2 , Y1 , 0); |
|
698 |
Static3D point22H = new Static3D( X1 , Y1 , 0); |
|
699 |
Static3D point23H = new Static3D( X0 , Y1 , 0); |
|
700 |
Static3D point21S = new Static3D( X2+2*D, Y1+2*D, 0); |
|
701 |
Static3D point22S = new Static3D( X1+2*D, Y1+2*D, 0); |
|
702 |
Static3D point23S = new Static3D( X0+2*D, Y1+2*D, 0); |
|
703 |
Static3D point2Sc= new Static3D(-s033,s033,s033); |
|
704 |
|
|
705 |
mPosition3.set(point2_0); |
|
706 |
mDynMoveHand2.add(mPosition3); |
|
707 |
mPosition4.set(point2_0); |
|
708 |
mDynMoveShad2.add(mPosition4); |
|
709 |
|
|
710 |
mDynScaleHand2.add(point2Sc); |
|
711 |
mDynScaleShad2.add(point2Sc); |
|
712 |
|
|
713 |
mDyn3.add(point2_0); |
|
714 |
mDyn3.add(point21H); |
|
715 |
mDyn3.add(point21H); |
|
716 |
mDyn3.add(point22H); |
|
717 |
mDyn3.add(point23H); |
|
718 |
|
|
719 |
mDyn4.add(point2_0); |
|
720 |
mDyn4.add(point21S); |
|
721 |
mDyn4.add(point21S); |
|
722 |
mDyn4.add(point22S); |
|
723 |
mDyn4.add(point23S); |
|
724 |
|
|
725 |
mNodes[0].changeInputSurface(mTextureShad); |
|
726 |
mNodes[1].changeInputSurface(mTextureShad); |
|
727 |
} |
|
728 |
|
|
729 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
730 |
|
|
731 |
private void createEffects() |
|
732 |
{ |
|
733 |
mEffects = new DistortedEffects[NUM_EFFE]; |
|
734 |
for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects(); |
|
735 |
|
|
736 |
int time = DUR[0]; |
|
737 |
|
|
738 |
mDyn1 = new Dynamic3D(time,0.5f); |
|
739 |
mDyn1.setMode(Dynamic.MODE_PATH); |
|
740 |
mDyn1.setConvexity(0.0f); |
|
741 |
mDyn2 = new Dynamic3D(time,0.5f); |
|
742 |
mDyn2.setMode(Dynamic.MODE_PATH); |
|
743 |
mDyn2.setConvexity(0.0f); |
|
744 |
mDyn3 = new Dynamic3D(time,0.5f); |
|
745 |
mDyn3.setMode(Dynamic.MODE_PATH); |
|
746 |
mDyn3.setConvexity(0.0f); |
|
747 |
mDyn4 = new Dynamic3D(time,0.5f); |
|
748 |
mDyn4.setMode(Dynamic.MODE_PATH); |
|
749 |
mDyn4.setConvexity(0.0f); |
|
750 |
|
|
751 |
mPosition1 = new Static3D(0,0,0); |
|
752 |
mPosition2 = new Static3D(0,0,0); |
|
753 |
mPosition3 = new Static3D(0,0,0); |
|
754 |
mPosition4 = new Static3D(0,0,0); |
|
755 |
|
|
756 |
tmpBuffer = new float[12]; |
|
757 |
|
|
758 |
mDynMoveHand1 = new Dynamic3D(time,0.5f); |
|
759 |
mDynMoveHand1.setMode(Dynamic.MODE_PATH); |
|
760 |
mDynMoveHand1.setConvexity(0.0f); |
|
761 |
mDynMoveShad1 = new Dynamic3D(time,0.5f); |
|
762 |
mDynMoveShad1.setMode(Dynamic.MODE_PATH); |
|
763 |
mDynMoveShad1.setConvexity(0.0f); |
|
764 |
mDynScaleHand1 = new Dynamic3D(time,0.5f); |
|
765 |
mDynScaleHand1.setMode(Dynamic.MODE_PATH); |
|
766 |
mDynScaleHand1.setConvexity(0.0f); |
|
767 |
mDynScaleShad1 = new Dynamic3D(time,0.5f); |
|
768 |
mDynScaleShad1.setMode(Dynamic.MODE_PATH); |
|
769 |
mDynScaleShad1.setConvexity(0.0f); |
|
770 |
|
|
771 |
MatrixEffectMove moveHand1 = new MatrixEffectMove(mDynMoveHand1); |
|
772 |
MatrixEffectMove moveShad1 = new MatrixEffectMove(mDynMoveShad1); |
|
773 |
MatrixEffectScale scaleHand1= new MatrixEffectScale(mDynScaleHand1); |
|
774 |
MatrixEffectScale scaleShad1= new MatrixEffectScale(mDynScaleShad1); |
|
775 |
|
|
776 |
mEffects[0].apply(scaleShad1); |
|
777 |
mEffects[0].apply(moveShad1); |
|
778 |
mEffects[2].apply(scaleHand1); |
|
779 |
mEffects[2].apply(moveHand1); |
|
780 |
|
|
781 |
mDynMoveHand2 = new Dynamic3D(time,0.5f); |
|
782 |
mDynMoveHand2.setMode(Dynamic.MODE_PATH); |
|
783 |
mDynMoveHand2.setConvexity(0.0f); |
|
784 |
mDynMoveShad2 = new Dynamic3D(time,0.5f); |
|
785 |
mDynMoveShad2.setMode(Dynamic.MODE_PATH); |
|
786 |
mDynMoveShad2.setConvexity(0.0f); |
|
787 |
mDynScaleHand2 = new Dynamic3D(time,0.5f); |
|
788 |
mDynScaleHand2.setMode(Dynamic.MODE_PATH); |
|
789 |
mDynScaleHand2.setConvexity(0.0f); |
|
790 |
mDynScaleShad2 = new Dynamic3D(time,0.5f); |
|
791 |
mDynScaleShad2.setMode(Dynamic.MODE_PATH); |
|
792 |
mDynScaleShad2.setConvexity(0.0f); |
|
793 |
|
|
794 |
MatrixEffectMove moveHand2 = new MatrixEffectMove(mDynMoveHand2); |
|
795 |
MatrixEffectMove moveShad2 = new MatrixEffectMove(mDynMoveShad2); |
|
796 |
MatrixEffectScale scaleHand2= new MatrixEffectScale(mDynScaleHand2); |
|
797 |
MatrixEffectScale scaleShad2= new MatrixEffectScale(mDynScaleShad2); |
|
798 |
|
|
799 |
mEffects[1].apply(scaleShad2); |
|
800 |
mEffects[1].apply(moveShad2); |
|
801 |
mEffects[3].apply(scaleHand2); |
|
802 |
mEffects[3].apply(moveHand2); |
|
803 |
|
|
804 |
DistortedScreen screen = mControl.getScreen(); |
|
805 |
mWidth = screen.getWidth(); |
|
806 |
mHeight= screen.getHeight(); |
|
807 |
|
|
808 |
X0 = mWidth*0.65f; |
|
809 |
X1 = mWidth*0.50f; |
|
810 |
X2 = mWidth*0.35f; |
|
811 |
Y1 = mHeight*0.28f; |
|
812 |
D = mWidth*0.01f; |
|
813 |
s001 = mWidth*0.0001f; |
|
814 |
s014 = mWidth*0.14f; |
|
815 |
s033 = mWidth*0.33f; |
|
816 |
F = 0.50f; |
|
817 |
} |
|
818 |
|
|
819 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
820 |
|
|
821 |
private void createNodes() |
|
822 |
{ |
|
823 |
if( mNodes==null ) |
|
824 |
{ |
|
825 |
mNodes = new DistortedNode[NUM_NODE]; |
|
826 |
mQuad = new MeshQuad(); |
|
827 |
} |
|
828 |
|
|
829 |
RubikActivity act = mControl.getActivity(); |
|
830 |
|
|
831 |
if( act!=null ) |
|
832 |
{ |
|
833 |
Bitmap bmpCirc = openBitmap(act, R.drawable.ui_fading_circle); |
|
834 |
Bitmap bmpShad = openBitmap(act, R.drawable.ui_hand_shadow); |
|
835 |
Bitmap bmpHand = openBitmap(act, R.drawable.ui_hand_pointer); |
|
836 |
|
|
837 |
mTextureCirc = new DistortedTexture(); |
|
838 |
mTextureShad = new DistortedTexture(); |
|
839 |
DistortedTexture textureHand = new DistortedTexture(); |
|
840 |
|
|
841 |
if( bmpCirc!=null ) mTextureCirc.setTexture(bmpCirc); |
|
842 |
if( bmpShad!=null ) mTextureShad.setTexture(bmpShad); |
|
843 |
if( bmpHand!=null ) textureHand.setTexture(bmpHand); |
|
844 |
|
|
845 |
mNodes[0]= new DistortedNode(mTextureShad,mEffects[0],mQuad); |
|
846 |
mNodes[1]= new DistortedNode(mTextureShad,mEffects[1],mQuad); |
|
847 |
mNodes[2]= new DistortedNode( textureHand,mEffects[2],mQuad); |
|
848 |
mNodes[3]= new DistortedNode( textureHand,mEffects[3],mQuad); |
|
849 |
} |
|
850 |
else |
|
851 |
{ |
|
852 |
android.util.Log.e("D", "Activity NULL!!"); |
|
853 |
} |
|
854 |
} |
|
855 |
|
|
856 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
857 |
|
|
858 |
long getEffectID() |
|
859 |
{ |
|
860 |
return mEffectID; |
|
861 |
} |
|
862 |
|
|
863 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
864 |
|
|
865 |
DistortedNode[] getNodes() |
|
866 |
{ |
|
867 |
if( mEffects==null ) createEffects(); |
|
868 |
createNodes(); |
|
869 |
setEffectsStage1(); |
Also available in: Unified diff
Move RubikControl to objectlib (as 'ObjectAutomator')
Hide ObjectPreRender inside objectlib and move its APi to ObjectControl.