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