Revision 46b26cdc
Added by Leszek Koltunski over 5 years ago
src/main/AndroidManifest.xml | ||
---|---|---|
35 | 35 |
<activity android:name=".inflate.InflateActivity" /> |
36 | 36 |
<activity android:name=".inflate.InflateActivity2" /> |
37 | 37 |
<activity android:name=".quaternion.QuaternionActivity" /> |
38 |
<activity android:name=".generic.Effects3DActivity" />
|
|
39 |
<activity android:name=".generic.Effects3DActivity2"/>
|
|
38 |
<activity android:name=".generic.GenericActivity" />
|
|
39 |
<activity android:name=".generic.GenericActivity2"/>
|
|
40 | 40 |
<activity android:name=".plainmonalisa.PlainMonaLisaActivity" /> |
41 | 41 |
<activity android:name=".save.SaveActivity"/> |
42 | 42 |
<activity android:name=".flag.FlagActivity"/> |
src/main/java/org/distorted/examples/TableOfContents.java | ||
---|---|---|
53 | 53 |
import org.distorted.examples.starwars.StarWarsActivity; |
54 | 54 |
import org.distorted.examples.inflate.InflateActivity; |
55 | 55 |
import org.distorted.examples.quaternion.QuaternionActivity; |
56 |
import org.distorted.examples.generic.Effects3DActivity;
|
|
56 |
import org.distorted.examples.generic.GenericActivity;
|
|
57 | 57 |
import org.distorted.examples.plainmonalisa.PlainMonaLisaActivity; |
58 | 58 |
import org.distorted.examples.save.SaveActivity; |
59 | 59 |
import org.distorted.examples.flag.FlagActivity; |
... | ... | |
269 | 269 |
item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_effects3d)); |
270 | 270 |
item.put(ITEM_SUBTITLE, getText(R.string.example_effects3d_subtitle)); |
271 | 271 |
data.add(item); |
272 |
activityMapping.put(i++, Effects3DActivity.class);
|
|
272 |
activityMapping.put(i++, GenericActivity.class);
|
|
273 | 273 |
} |
274 | 274 |
|
275 | 275 |
{ |
src/main/java/org/distorted/examples/generic/Effects3DActivity.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2016 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted 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 |
// Distorted 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 Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.examples.generic; |
|
21 |
|
|
22 |
import android.app.Activity; |
|
23 |
import android.content.Intent; |
|
24 |
import android.os.Bundle; |
|
25 |
import android.view.Gravity; |
|
26 |
import android.view.View; |
|
27 |
import android.widget.AdapterView; |
|
28 |
import android.widget.ArrayAdapter; |
|
29 |
import android.widget.Button; |
|
30 |
import android.widget.LinearLayout; |
|
31 |
import android.widget.NumberPicker; |
|
32 |
import android.widget.Spinner; |
|
33 |
import android.widget.TableRow; |
|
34 |
|
|
35 |
import org.distorted.examples.R; |
|
36 |
|
|
37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
38 |
|
|
39 |
public class Effects3DActivity extends Activity |
|
40 |
implements View.OnClickListener, AdapterView.OnItemSelectedListener |
|
41 |
{ |
|
42 |
private static final int COLOR_OFF = 0xffffe81f; |
|
43 |
private static final int COLOR_ON = 0xff0000ff; |
|
44 |
private static final int COLOR_INAC= 0xff999999; |
|
45 |
|
|
46 |
private int mNumCols = 1; |
|
47 |
private int mNumRows = 1; |
|
48 |
private int mNumSlic = 1; |
|
49 |
private boolean mGridInitialized; |
|
50 |
private NumberPicker mColsPicker, mRowsPicker, mSlicPicker; |
|
51 |
private boolean[] mShape; |
|
52 |
private int mObjectType; |
|
53 |
private int mBitmapID; |
|
54 |
private LinearLayout mLay; |
|
55 |
|
|
56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
57 |
|
|
58 |
@Override |
|
59 |
protected void onCreate(Bundle savedState) |
|
60 |
{ |
|
61 |
super.onCreate(savedState); |
|
62 |
|
|
63 |
setContentView(R.layout.objectpickerlayout); |
|
64 |
|
|
65 |
mLay = findViewById(R.id.objectpicker_buttongrid); |
|
66 |
|
|
67 |
mColsPicker = findViewById(R.id.objectpicker_cols); |
|
68 |
mRowsPicker = findViewById(R.id.objectpicker_rows); |
|
69 |
mSlicPicker = findViewById(R.id.objectpicker_slices); |
|
70 |
|
|
71 |
mColsPicker.setMaxValue(40); |
|
72 |
mColsPicker.setMinValue( 1); |
|
73 |
mRowsPicker.setMaxValue(40); |
|
74 |
mRowsPicker.setMinValue( 1); |
|
75 |
mSlicPicker.setMaxValue(40); |
|
76 |
mSlicPicker.setMinValue( 0); |
|
77 |
|
|
78 |
mColsPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() |
|
79 |
{ |
|
80 |
@Override |
|
81 |
public void onValueChange(NumberPicker picker, int oldVal, int newVal) |
|
82 |
{ |
|
83 |
setGrid(); |
|
84 |
} |
|
85 |
}); |
|
86 |
|
|
87 |
mRowsPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() |
|
88 |
{ |
|
89 |
@Override |
|
90 |
public void onValueChange(NumberPicker picker, int oldVal, int newVal) |
|
91 |
{ |
|
92 |
setGrid(); |
|
93 |
} |
|
94 |
}); |
|
95 |
|
|
96 |
mSlicPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() |
|
97 |
{ |
|
98 |
@Override |
|
99 |
public void onValueChange(NumberPicker picker, int oldVal, int newVal) |
|
100 |
{ |
|
101 |
mNumSlic = mSlicPicker.getValue(); |
|
102 |
} |
|
103 |
}); |
|
104 |
|
|
105 |
mObjectType = 0; |
|
106 |
mGridInitialized = false; |
|
107 |
|
|
108 |
Spinner typeSpinner = findViewById(R.id.objectpicker_spinnerType); |
|
109 |
typeSpinner.setOnItemSelectedListener(this); |
|
110 |
|
|
111 |
String[] objectType = new String[] {"Mesh: Cubes", "Mesh: Flat", "Mesh: Sphere", "Mesh: Quad"}; |
|
112 |
|
|
113 |
ArrayAdapter<String> adapterType = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType); |
|
114 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
115 |
typeSpinner.setAdapter(adapterType); |
|
116 |
|
|
117 |
Spinner bitmapSpinner = findViewById(R.id.objectpicker_spinnerBitmap); |
|
118 |
bitmapSpinner.setOnItemSelectedListener(this); |
|
119 |
|
|
120 |
String[] objectBitmap = new String[] { "Texture: Grid", "Texture: Girl", "Texture: Dog", "Texture: Cat", |
|
121 |
"Texture: Squares", "Texture: Bean", "Texture: Lisa", "Texture: World" }; |
|
122 |
|
|
123 |
ArrayAdapter<String> adapterBitmap = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectBitmap); |
|
124 |
adapterBitmap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
125 |
bitmapSpinner.setAdapter(adapterBitmap); |
|
126 |
} |
|
127 |
|
|
128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
129 |
|
|
130 |
private void setGrid() |
|
131 |
{ |
|
132 |
mGridInitialized = true; |
|
133 |
|
|
134 |
mNumCols = mColsPicker.getValue(); |
|
135 |
mNumRows = mRowsPicker.getValue(); |
|
136 |
|
|
137 |
int width = mLay.getWidth(); |
|
138 |
int height= mLay.getHeight(); |
|
139 |
int w = mNumCols>0 ? (int)( 0.9f*width / mNumCols) : 0; |
|
140 |
int h = mNumRows>0 ? (int)( 0.9f*height/ mNumRows) : 0; |
|
141 |
int size= w<h ? w:h; |
|
142 |
int pad = size<20 ? 1 : size/20; |
|
143 |
|
|
144 |
mLay.removeAllViews(); |
|
145 |
|
|
146 |
mShape = new boolean[mNumRows*mNumCols]; |
|
147 |
|
|
148 |
TableRow.LayoutParams p = new TableRow.LayoutParams(); |
|
149 |
|
|
150 |
p.rightMargin = pad; |
|
151 |
p.leftMargin = pad; |
|
152 |
p.topMargin = pad; |
|
153 |
p.bottomMargin = pad; |
|
154 |
p.height = size; |
|
155 |
p.width = size; |
|
156 |
|
|
157 |
for (int rows=0; rows<mNumRows; rows++) |
|
158 |
{ |
|
159 |
TableRow tr = new TableRow(this); |
|
160 |
tr.setGravity(Gravity.CENTER); |
|
161 |
|
|
162 |
for(int cols=0; cols<mNumCols; cols++) |
|
163 |
{ |
|
164 |
Button b = new Button(this); |
|
165 |
b.setOnClickListener(this); |
|
166 |
b.setId(rows*mNumCols+cols); |
|
167 |
b.setLayoutParams(p); |
|
168 |
b.setBackgroundColor(mObjectType==0 ? COLOR_ON:COLOR_INAC); |
|
169 |
tr.addView(b, p); |
|
170 |
mShape[rows*mNumCols+cols] = true; |
|
171 |
} |
|
172 |
|
|
173 |
mLay.addView(tr); |
|
174 |
} |
|
175 |
} |
|
176 |
|
|
177 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
178 |
|
|
179 |
public void onClick(View view) |
|
180 |
{ |
|
181 |
if( mObjectType==0 ) // cubes |
|
182 |
{ |
|
183 |
Button tmp = (Button)view; |
|
184 |
int id = tmp.getId(); |
|
185 |
mShape[id] = !mShape[id]; |
|
186 |
tmp.setBackgroundColor(mShape[id] ? COLOR_ON:COLOR_OFF); |
|
187 |
} |
|
188 |
} |
|
189 |
|
|
190 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
191 |
|
|
192 |
private void uncheckAll() |
|
193 |
{ |
|
194 |
TableRow tr; |
|
195 |
Button butt; |
|
196 |
|
|
197 |
for (int row=0; row<mNumRows; row++) |
|
198 |
{ |
|
199 |
tr = (TableRow)mLay.getChildAt(row); |
|
200 |
|
|
201 |
for(int col=0; col<mNumCols; col++) |
|
202 |
{ |
|
203 |
butt = (Button)tr.getVirtualChildAt(col); |
|
204 |
butt.setBackgroundColor(mObjectType==0 ? COLOR_ON : COLOR_INAC); |
|
205 |
mShape[row*mNumCols+col] = true; |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
|
|
210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
211 |
|
|
212 |
public void Create(View v) |
|
213 |
{ |
|
214 |
Intent mainInt = new Intent( getApplicationContext(), Effects3DActivity2.class); |
|
215 |
Bundle b = new Bundle(); |
|
216 |
|
|
217 |
int rows=0, cols=0; |
|
218 |
|
|
219 |
switch(mObjectType) |
|
220 |
{ |
|
221 |
case 0: |
|
222 |
case 1: rows = mNumRows; |
|
223 |
cols = mNumCols; |
|
224 |
break; |
|
225 |
case 2: rows = mNumRows; // always make the sphere equal in X and Y |
|
226 |
cols = mNumRows; // |
|
227 |
break; |
|
228 |
case 3: rows = 1; // a quad is always 1x1 |
|
229 |
cols = 1; |
|
230 |
break; |
|
231 |
} |
|
232 |
|
|
233 |
b.putInt("type", mObjectType); |
|
234 |
b.putInt("cols", cols); |
|
235 |
b.putInt("rows", rows); |
|
236 |
b.putInt("slices", mNumSlic); |
|
237 |
b.putInt("bitmap", mBitmapID); |
|
238 |
|
|
239 |
if( mObjectType==0 ) // cubes |
|
240 |
{ |
|
241 |
String str = ""; |
|
242 |
|
|
243 |
for(int i=0; i<mNumRows*mNumCols; i++) |
|
244 |
str += mShape[i] ? "1" : "0"; |
|
245 |
|
|
246 |
b.putString("string", str); |
|
247 |
} |
|
248 |
else |
|
249 |
{ |
|
250 |
b.putString("string", ""); |
|
251 |
} |
|
252 |
|
|
253 |
mainInt.putExtras(b); |
|
254 |
startActivity(mainInt); |
|
255 |
} |
|
256 |
|
|
257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
258 |
|
|
259 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
|
260 |
{ |
|
261 |
switch(parent.getId()) |
|
262 |
{ |
|
263 |
case R.id.objectpicker_spinnerType : if( mObjectType!=pos ) |
|
264 |
{ |
|
265 |
mObjectType = pos; |
|
266 |
uncheckAll(); |
|
267 |
|
|
268 |
switch(mObjectType) |
|
269 |
{ |
|
270 |
case 0: mColsPicker.setEnabled(true); |
|
271 |
mRowsPicker.setEnabled(true); |
|
272 |
mSlicPicker.setEnabled(true); |
|
273 |
break; |
|
274 |
case 1: mColsPicker.setEnabled(true); |
|
275 |
mRowsPicker.setEnabled(true); |
|
276 |
mSlicPicker.setEnabled(false); |
|
277 |
break; |
|
278 |
case 2: mColsPicker.setEnabled(false); |
|
279 |
mRowsPicker.setEnabled(true); |
|
280 |
mSlicPicker.setEnabled(false); |
|
281 |
break; |
|
282 |
case 3: mColsPicker.setEnabled(false); |
|
283 |
mRowsPicker.setEnabled(false); |
|
284 |
mSlicPicker.setEnabled(false); |
|
285 |
break; |
|
286 |
} |
|
287 |
} |
|
288 |
break; |
|
289 |
case R.id.objectpicker_spinnerBitmap: switch(pos) |
|
290 |
{ |
|
291 |
case 0: mBitmapID = -1 ; break; |
|
292 |
case 1: mBitmapID = R.raw.face ; break; |
|
293 |
case 2: mBitmapID = R.raw.dog ; break; |
|
294 |
case 3: mBitmapID = R.raw.cat ; break; |
|
295 |
case 4: mBitmapID = R.raw.grid ; break; |
|
296 |
case 5: mBitmapID = R.raw.bean ; break; |
|
297 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
298 |
case 7: mBitmapID = R.raw.world ; break; |
|
299 |
} |
|
300 |
break; |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
305 |
|
|
306 |
public void onNothingSelected(AdapterView<?> parent) |
|
307 |
{ |
|
308 |
} |
|
309 |
|
|
310 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
311 |
// Overrides |
|
312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
313 |
|
|
314 |
@Override |
|
315 |
public void onWindowFocusChanged(boolean hasFocus) |
|
316 |
{ |
|
317 |
super.onWindowFocusChanged(hasFocus); |
|
318 |
|
|
319 |
mColsPicker.setValue(mNumCols); |
|
320 |
mRowsPicker.setValue(mNumRows); |
|
321 |
mSlicPicker.setValue(mNumSlic); |
|
322 |
|
|
323 |
if( !mGridInitialized ) setGrid(); |
|
324 |
} |
|
325 |
} |
src/main/java/org/distorted/examples/generic/Effects3DActivity2.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2016 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted 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 |
// Distorted 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 Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.examples.generic; |
|
21 |
|
|
22 |
import android.graphics.Bitmap; |
|
23 |
import android.graphics.BitmapFactory; |
|
24 |
import android.graphics.Canvas; |
|
25 |
import android.graphics.Paint; |
|
26 |
import android.opengl.GLSurfaceView; |
|
27 |
import android.os.Bundle; |
|
28 |
import android.support.design.widget.TabLayout; |
|
29 |
import android.support.v4.view.ViewPager; |
|
30 |
import android.support.v7.app.AppCompatActivity; |
|
31 |
import android.view.View; |
|
32 |
import android.widget.CheckBox; |
|
33 |
|
|
34 |
import org.distorted.examples.R; |
|
35 |
import org.distorted.library.main.Distorted; |
|
36 |
import org.distorted.library.main.DistortedEffects; |
|
37 |
import org.distorted.library.main.DistortedTexture; |
|
38 |
import org.distorted.library.mesh.MeshCubes; |
|
39 |
import org.distorted.library.mesh.MeshFlat; |
|
40 |
import org.distorted.library.mesh.MeshBase; |
|
41 |
import org.distorted.library.mesh.MeshQuad; |
|
42 |
import org.distorted.library.mesh.MeshSphere; |
|
43 |
import org.distorted.library.type.Static4D; |
|
44 |
|
|
45 |
import java.io.IOException; |
|
46 |
import java.io.InputStream; |
|
47 |
|
|
48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
49 |
|
|
50 |
public class Effects3DActivity2 extends AppCompatActivity |
|
51 |
{ |
|
52 |
public static final int NUM_TABS = 4; |
|
53 |
|
|
54 |
private DistortedTexture mTexture; |
|
55 |
private MeshBase mMesh; |
|
56 |
private Bitmap mBitmap; |
|
57 |
|
|
58 |
private float mCenterX, mCenterY, mCenterZ; |
|
59 |
private float mRegionX, mRegionY, mRegionZ, mRegionR; |
|
60 |
private DistortedEffects mEffects; |
|
61 |
private ViewPager mViewPager; |
|
62 |
|
|
63 |
private boolean mShowCenter; |
|
64 |
private boolean mShowRegion; |
|
65 |
private boolean mShowNormal; |
|
66 |
private boolean mUseOIT ; |
|
67 |
|
|
68 |
private Effects3DTab[] mTab; |
|
69 |
|
|
70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
71 |
|
|
72 |
@Override |
|
73 |
protected void onCreate(Bundle savedState) |
|
74 |
{ |
|
75 |
super.onCreate(savedState); |
|
76 |
|
|
77 |
setTheme(R.style.CustomActivityThemeNoActionBar); |
|
78 |
|
|
79 |
mTab = new Effects3DTab[NUM_TABS]; |
|
80 |
|
|
81 |
Bundle b = getIntent().getExtras(); |
|
82 |
|
|
83 |
int objectType = b.getInt("type"); |
|
84 |
int numCols = b.getInt("cols"); |
|
85 |
int numRows = b.getInt("rows"); |
|
86 |
int numSlic = b.getInt("slices"); |
|
87 |
int bitmapID = b.getInt("bitmap"); |
|
88 |
String str = b.getString("string"); |
|
89 |
|
|
90 |
mShowCenter = false; |
|
91 |
mShowRegion = false; |
|
92 |
mShowNormal = false; |
|
93 |
mUseOIT = false; |
|
94 |
|
|
95 |
int maxsize = numCols > numRows ? (numCols>numSlic ? numCols:numSlic) : (numRows>numSlic ? numRows:numSlic) ; |
|
96 |
|
|
97 |
createBitmap(maxsize, bitmapID); |
|
98 |
|
|
99 |
switch(objectType) |
|
100 |
{ |
|
101 |
case 0: if( bitmapID!=-1 ) |
|
102 |
{ |
|
103 |
mMesh = new MeshCubes(numCols, str, numSlic); |
|
104 |
} |
|
105 |
else |
|
106 |
{ |
|
107 |
Static4D mapFB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numRows/maxsize); |
|
108 |
Static4D mapLR = new Static4D(0.0f,0.0f, (float)numSlic/maxsize, (float)numRows/maxsize); |
|
109 |
Static4D mapTB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numSlic/maxsize); |
|
110 |
|
|
111 |
mMesh = new MeshCubes(numCols, str, numSlic, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB); |
|
112 |
} |
|
113 |
break; |
|
114 |
case 1: mMesh = new MeshFlat(numCols,numRows); |
|
115 |
break; |
|
116 |
case 2: mMesh = new MeshSphere(numRows); |
|
117 |
break; |
|
118 |
case 3: mMesh = new MeshQuad(); |
|
119 |
break; |
|
120 |
} |
|
121 |
|
|
122 |
mMesh.setShowNormals(mShowNormal); |
|
123 |
mTexture= new DistortedTexture(numCols,numRows); |
|
124 |
mEffects= new DistortedEffects(); |
|
125 |
|
|
126 |
final View view = getLayoutInflater().inflate(R.layout.effects3dlayout, null); |
|
127 |
|
|
128 |
setContentView(view); |
|
129 |
|
|
130 |
mViewPager = findViewById(R.id.effects3d_viewpager); |
|
131 |
mViewPager.setOffscreenPageLimit( NUM_TABS-1 ); |
|
132 |
Effects3DTabViewPager pager = new Effects3DTabViewPager(this, getSupportFragmentManager() ); |
|
133 |
mViewPager.setAdapter(pager); |
|
134 |
TabLayout tabLayout = findViewById(R.id.effects3d_sliding_tabs); |
|
135 |
tabLayout.setupWithViewPager(mViewPager); |
|
136 |
|
|
137 |
resetData(); |
|
138 |
} |
|
139 |
|
|
140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
141 |
|
|
142 |
private void createBitmap(int size, int bitmapID) |
|
143 |
{ |
|
144 |
if( bitmapID!=-1) |
|
145 |
{ |
|
146 |
InputStream is = getResources().openRawResource(bitmapID); |
|
147 |
|
|
148 |
try |
|
149 |
{ |
|
150 |
mBitmap = BitmapFactory.decodeStream(is); |
|
151 |
} |
|
152 |
finally |
|
153 |
{ |
|
154 |
try |
|
155 |
{ |
|
156 |
is.close(); |
|
157 |
} |
|
158 |
catch(IOException e) { } |
|
159 |
} |
|
160 |
} |
|
161 |
else |
|
162 |
{ |
|
163 |
final int T = 64; |
|
164 |
final int S = T*size; |
|
165 |
|
|
166 |
Paint paint = new Paint(); |
|
167 |
mBitmap = Bitmap.createBitmap(S,S, Bitmap.Config.ARGB_8888); |
|
168 |
Canvas canvas = new Canvas(mBitmap); |
|
169 |
|
|
170 |
paint.setAntiAlias(true); |
|
171 |
paint.setTextAlign(Paint.Align.CENTER); |
|
172 |
paint.setColor(0xff008800); |
|
173 |
paint.setStyle(Paint.Style.FILL); |
|
174 |
canvas.drawRect(0, 0, S, S, paint); |
|
175 |
paint.setColor(0xffffffff); |
|
176 |
|
|
177 |
for(int i=0; i<=size ; i++ ) |
|
178 |
{ |
|
179 |
canvas.drawRect( T*i-1, 0, T*i+1, S, paint); |
|
180 |
canvas.drawRect( 0, T*i-1, S, T*i+1, paint); |
|
181 |
} |
|
182 |
} |
|
183 |
} |
|
184 |
|
|
185 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
186 |
|
|
187 |
public DistortedTexture getTexture() |
|
188 |
{ |
|
189 |
return mTexture; |
|
190 |
} |
|
191 |
|
|
192 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
193 |
|
|
194 |
public MeshBase getMesh() |
|
195 |
{ |
|
196 |
return mMesh; |
|
197 |
} |
|
198 |
|
|
199 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
200 |
|
|
201 |
public Bitmap getBitmap() |
|
202 |
{ |
|
203 |
return mBitmap; |
|
204 |
} |
|
205 |
|
|
206 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
207 |
|
|
208 |
public void setRegion(float x, float y, float z, float r) |
|
209 |
{ |
|
210 |
mRegionX = x; |
|
211 |
mRegionY =-y; |
|
212 |
mRegionZ = z; |
|
213 |
mRegionR = r; |
|
214 |
|
|
215 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
|
216 |
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionZ, mRegionR); |
|
217 |
} |
|
218 |
|
|
219 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
220 |
|
|
221 |
public void setCenter(float x, float y, float z) |
|
222 |
{ |
|
223 |
mCenterX = x; |
|
224 |
mCenterY = y; |
|
225 |
mCenterZ = z; |
|
226 |
|
|
227 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
|
228 |
view.getRenderer().setCenter( mCenterX, mCenterY, mCenterZ ); |
|
229 |
} |
|
230 |
|
|
231 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
232 |
|
|
233 |
public float getCenterX() |
|
234 |
{ |
|
235 |
return mCenterX; |
|
236 |
} |
|
237 |
|
|
238 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
239 |
|
|
240 |
public float getCenterY() |
|
241 |
{ |
|
242 |
return mCenterY; |
|
243 |
} |
|
244 |
|
|
245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
246 |
|
|
247 |
public float getRegionX() |
|
248 |
{ |
|
249 |
return mRegionX; |
|
250 |
} |
|
251 |
|
|
252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
253 |
|
|
254 |
public float getRegionY() |
|
255 |
{ |
|
256 |
return mRegionY; |
|
257 |
} |
|
258 |
|
|
259 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
260 |
|
|
261 |
public float getRegionZ() |
|
262 |
{ |
|
263 |
return mRegionZ; |
|
264 |
} |
|
265 |
|
|
266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
267 |
|
|
268 |
public float getRegionR() |
|
269 |
{ |
|
270 |
return mRegionR; |
|
271 |
} |
|
272 |
|
|
273 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
274 |
|
|
275 |
public int getWidth() |
|
276 |
{ |
|
277 |
return mTexture==null ? 0: mTexture.getWidth(); |
|
278 |
} |
|
279 |
|
|
280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
281 |
|
|
282 |
public int getHeight() |
|
283 |
{ |
|
284 |
return mTexture==null ? 0: mTexture.getHeight(); |
|
285 |
} |
|
286 |
|
|
287 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
288 |
|
|
289 |
public int getDepth() |
|
290 |
{ |
|
291 |
return mTexture==null ? 0: mTexture.getDepth(mMesh); |
|
292 |
} |
|
293 |
|
|
294 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
295 |
|
|
296 |
public int getScreenWidth() |
|
297 |
{ |
|
298 |
Effects3DRenderer r = ((Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView)).getRenderer(); |
|
299 |
return r.getWidth(); |
|
300 |
} |
|
301 |
|
|
302 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
303 |
|
|
304 |
void resetData() |
|
305 |
{ |
|
306 |
mCenterX = 0.5f*getWidth(); |
|
307 |
mCenterY = 0.5f*getHeight(); |
|
308 |
mRegionX = 0; |
|
309 |
mRegionY = 0; |
|
310 |
mRegionZ = 0; |
|
311 |
mRegionR = getWidth()/2; |
|
312 |
|
|
313 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
|
314 |
Effects3DRenderer renderer= view.getRenderer(); |
|
315 |
|
|
316 |
renderer.setCenter( mCenterX, mCenterY, mCenterZ ); |
|
317 |
renderer.setRegion( mRegionX, mRegionY, mRegionZ, mRegionR ); |
|
318 |
} |
|
319 |
|
|
320 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
321 |
|
|
322 |
void resetMatrixEffects() |
|
323 |
{ |
|
324 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
|
325 |
Effects3DRenderer renderer= view.getRenderer(); |
|
326 |
|
|
327 |
renderer.resetMatrixEffects(); |
|
328 |
} |
|
329 |
|
|
330 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
331 |
|
|
332 |
public DistortedEffects getEffects() |
|
333 |
{ |
|
334 |
return mEffects; |
|
335 |
} |
|
336 |
|
|
337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
338 |
|
|
339 |
public void newEffect(View v) |
|
340 |
{ |
|
341 |
int pos = mViewPager.getCurrentItem(); |
|
342 |
|
|
343 |
if( pos>=0 && pos<NUM_TABS ) mTab[pos].newEffect(); |
|
344 |
} |
|
345 |
|
|
346 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
347 |
|
|
348 |
public void removeAll(View v) |
|
349 |
{ |
|
350 |
int pos = mViewPager.getCurrentItem(); |
|
351 |
|
|
352 |
if( pos>=0 && pos<NUM_TABS ) mTab[pos].removeAll(); |
|
353 |
} |
|
354 |
|
|
355 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
356 |
|
|
357 |
public void remove(View v) |
|
358 |
{ |
|
359 |
int pos = mViewPager.getCurrentItem(); |
|
360 |
|
|
361 |
if( pos>=0 && pos<NUM_TABS ) mTab[pos].remove(v); |
|
362 |
} |
|
363 |
|
|
364 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
365 |
|
|
366 |
void setTab(int pos, Effects3DTab tab) |
|
367 |
{ |
|
368 |
if( pos>=0 && pos<NUM_TABS ) mTab[pos] = tab; |
|
369 |
} |
|
370 |
|
|
371 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
372 |
|
|
373 |
boolean getShowCenter() |
|
374 |
{ |
|
375 |
return mShowCenter; |
|
376 |
} |
|
377 |
|
|
378 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
379 |
|
|
380 |
boolean getShowRegion() |
|
381 |
{ |
|
382 |
return mShowRegion; |
|
383 |
} |
|
384 |
|
|
385 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
386 |
|
|
387 |
public void showCenter(View view) |
|
388 |
{ |
|
389 |
CheckBox box = (CheckBox)view; |
|
390 |
mShowCenter = box.isChecked(); |
|
391 |
|
|
392 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView); |
|
393 |
sv.getRenderer().showRegionAndCenter(mShowRegion,mShowCenter); |
|
394 |
} |
|
395 |
|
|
396 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
397 |
|
|
398 |
public void showRegion(View view) |
|
399 |
{ |
|
400 |
CheckBox box = (CheckBox)view; |
|
401 |
mShowRegion = box.isChecked(); |
|
402 |
|
|
403 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView); |
|
404 |
sv.getRenderer().showRegionAndCenter(mShowRegion,mShowCenter); |
|
405 |
} |
|
406 |
|
|
407 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
408 |
|
|
409 |
public void showNormal(View view) |
|
410 |
{ |
|
411 |
CheckBox box = (CheckBox)view; |
|
412 |
mShowNormal = box.isChecked(); |
|
413 |
|
|
414 |
if ( mMesh!=null ) |
|
415 |
{ |
|
416 |
mMesh.setShowNormals(mShowNormal); |
|
417 |
} |
|
418 |
} |
|
419 |
|
|
420 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
421 |
|
|
422 |
public void triggerOIT(View view) |
|
423 |
{ |
|
424 |
CheckBox box = (CheckBox)view; |
|
425 |
mUseOIT = box.isChecked(); |
|
426 |
|
|
427 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView); |
|
428 |
sv.getRenderer().useOIT(mUseOIT); |
|
429 |
} |
|
430 |
|
|
431 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
432 |
// Overrides |
|
433 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
434 |
|
|
435 |
@Override |
|
436 |
protected void onPause() |
|
437 |
{ |
|
438 |
GLSurfaceView mView = findViewById(R.id.effects3dSurfaceView); |
|
439 |
if( mView!=null ) mView.onPause(); |
|
440 |
|
|
441 |
Distorted.onPause(); |
|
442 |
super.onPause(); |
|
443 |
} |
|
444 |
|
|
445 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
446 |
|
|
447 |
@Override |
|
448 |
protected void onResume() |
|
449 |
{ |
|
450 |
super.onResume(); |
|
451 |
GLSurfaceView mView = findViewById(R.id.effects3dSurfaceView); |
|
452 |
if( mView!=null ) mView.onResume(); |
|
453 |
} |
|
454 |
|
|
455 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
456 |
|
|
457 |
@Override |
|
458 |
protected void onDestroy() |
|
459 |
{ |
|
460 |
Distorted.onDestroy(); |
|
461 |
super.onDestroy(); |
|
462 |
} |
|
463 |
|
|
464 |
} |
src/main/java/org/distorted/examples/generic/Effects3DEffect.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2016 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted 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 |
// Distorted 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 Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.examples.generic; |
|
21 |
|
|
22 |
import android.view.View; |
|
23 |
import android.widget.SeekBar; |
|
24 |
import android.widget.TextView; |
|
25 |
|
|
26 |
import org.distorted.examples.R; |
|
27 |
import org.distorted.library.effect.Effect; |
|
28 |
import org.distorted.library.effect.EffectName; |
|
29 |
import org.distorted.library.effect.EffectType; |
|
30 |
import org.distorted.library.effect.FragmentEffectAlpha; |
|
31 |
import org.distorted.library.effect.FragmentEffectBrightness; |
|
32 |
import org.distorted.library.effect.FragmentEffectChroma; |
|
33 |
import org.distorted.library.effect.FragmentEffectContrast; |
|
34 |
import org.distorted.library.effect.FragmentEffectSaturation; |
|
35 |
import org.distorted.library.effect.MatrixEffectMove; |
|
36 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
37 |
import org.distorted.library.effect.MatrixEffectRotate; |
|
38 |
import org.distorted.library.effect.MatrixEffectScale; |
|
39 |
import org.distorted.library.effect.MatrixEffectShear; |
|
40 |
import org.distorted.library.effect.PostprocessEffectBlur; |
|
41 |
import org.distorted.library.effect.PostprocessEffectGlow; |
|
42 |
import org.distorted.library.effect.VertexEffectDeform; |
|
43 |
import org.distorted.library.effect.VertexEffectDistort; |
|
44 |
import org.distorted.library.effect.VertexEffectPinch; |
|
45 |
import org.distorted.library.effect.VertexEffectSink; |
|
46 |
import org.distorted.library.effect.VertexEffectSwirl; |
|
47 |
import org.distorted.library.effect.VertexEffectWave; |
|
48 |
import org.distorted.library.main.DistortedEffects; |
|
49 |
import org.distorted.library.type.Dynamic1D; |
|
50 |
import org.distorted.library.type.Dynamic2D; |
|
51 |
import org.distorted.library.type.Dynamic3D; |
|
52 |
import org.distorted.library.type.Dynamic4D; |
|
53 |
import org.distorted.library.type.Dynamic5D; |
|
54 |
import org.distorted.library.type.Static1D; |
|
55 |
import org.distorted.library.type.Static2D; |
|
56 |
import org.distorted.library.type.Static3D; |
|
57 |
import org.distorted.library.type.Static4D; |
|
58 |
import org.distorted.library.type.Static5D; |
|
59 |
|
|
60 |
import java.lang.ref.WeakReference; |
|
61 |
|
|
62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
63 |
|
|
64 |
class Effects3DEffect implements SeekBar.OnSeekBarChangeListener |
|
65 |
{ |
|
66 |
private static final int BACKGROUND_ODD = 0xff555555; |
|
67 |
private static final int BACKGROUND_EVEN= 0xff333333; |
|
68 |
|
|
69 |
private WeakReference<Effects3DActivity2> mAct; |
|
70 |
|
|
71 |
private EffectName mName; |
|
72 |
private int[] mInter; |
|
73 |
private int[] mInterRegion; |
|
74 |
private int[] mInterCenter; |
|
75 |
private int[] mSeekID; |
|
76 |
private int[] mSeekRegionID; |
|
77 |
private int[] mSeekCenterID; |
|
78 |
private int mDimension, mRegionDimension; |
|
79 |
private TextView mText,mTextRegion,mTextCenter; |
|
80 |
|
|
81 |
private Dynamic1D mDyn1; |
|
82 |
private Dynamic2D mDyn2; |
|
83 |
private Dynamic3D mDyn3; |
|
84 |
private Dynamic4D mDyn4; |
|
85 |
private Dynamic5D mDyn5; |
|
86 |
private Static1D mSta1; |
|
87 |
private Static2D mSta2; |
|
88 |
private Static3D mSta3; |
|
89 |
private Static4D mSta4; |
|
90 |
private Static5D mSta5; |
|
91 |
private Dynamic4D mRegion4Dyn; |
|
92 |
private Static4D mRegion4Sta; |
|
93 |
private Dynamic3D mRegion3Dyn; |
|
94 |
private Static3D mRegion3Sta; |
|
95 |
private Dynamic3D mCenterDyn; |
|
96 |
private Static3D mCenterSta; |
|
97 |
|
|
98 |
private View mButton, mEffect, mCenter, mRegion; |
|
99 |
private long mId; |
|
100 |
|
|
101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
102 |
// requires knowledge about effect nature |
|
103 |
|
|
104 |
void apply(DistortedEffects effects) |
|
105 |
{ |
|
106 |
Effect effect=null; |
|
107 |
|
|
108 |
switch(mName) |
|
109 |
{ |
|
110 |
case ROTATE : effect = new MatrixEffectRotate (mDyn1, mDyn3, mCenterDyn); break; |
|
111 |
case QUATERNION : effect = new MatrixEffectQuaternion (mDyn4, mCenterDyn); break; |
|
112 |
case MOVE : effect = new MatrixEffectMove (mDyn3) ; break; |
|
113 |
case SCALE : effect = new MatrixEffectScale (mDyn3) ; break; |
|
114 |
case SHEAR : effect = new MatrixEffectShear (mDyn3, mCenterDyn); break; |
|
115 |
|
|
116 |
case DISTORT : effect = new VertexEffectDistort (mDyn3, mCenterDyn, mRegion4Dyn); break; |
|
117 |
case DEFORM : effect = new VertexEffectDeform (mDyn3, mCenterDyn, mRegion4Dyn); break; |
|
118 |
case SINK : effect = new VertexEffectSink (mDyn1, mCenterDyn, mRegion4Dyn); break; |
|
119 |
case PINCH : effect = new VertexEffectPinch (mDyn2, mCenterDyn, mRegion4Dyn); break; |
|
120 |
case SWIRL : effect = new VertexEffectSwirl (mDyn1, mCenterDyn, mRegion4Dyn); break; |
|
121 |
case WAVE : effect = new VertexEffectWave (mDyn5, mCenterDyn, mRegion4Dyn); break; |
|
122 |
|
|
123 |
case ALPHA : effect = new FragmentEffectAlpha (mDyn1, mCenterDyn, mRegion3Dyn, false); break; |
|
124 |
case SMOOTH_ALPHA : effect = new FragmentEffectAlpha (mDyn1, mCenterDyn, mRegion3Dyn, true ); break; |
|
125 |
case CHROMA : effect = new FragmentEffectChroma (mDyn1, mDyn3, mCenterDyn, mRegion3Dyn, false); break; |
|
126 |
case SMOOTH_CHROMA : effect = new FragmentEffectChroma (mDyn1, mDyn3, mCenterDyn, mRegion3Dyn, true ); break; |
|
127 |
case BRIGHTNESS : effect = new FragmentEffectBrightness(mDyn1, mCenterDyn, mRegion3Dyn, false); break; |
|
128 |
case SMOOTH_BRIGHTNESS: effect = new FragmentEffectBrightness(mDyn1, mCenterDyn, mRegion3Dyn, true ); break; |
|
129 |
case SATURATION : effect = new FragmentEffectSaturation(mDyn1, mCenterDyn, mRegion3Dyn, false); break; |
|
130 |
case SMOOTH_SATURATION: effect = new FragmentEffectSaturation(mDyn1, mCenterDyn, mRegion3Dyn, true ); break; |
|
131 |
case CONTRAST : effect = new FragmentEffectContrast (mDyn1, mCenterDyn, mRegion3Dyn, false); break; |
|
132 |
case SMOOTH_CONTRAST : effect = new FragmentEffectContrast (mDyn1, mCenterDyn, mRegion3Dyn, true ); break; |
|
133 |
|
|
134 |
case BLUR : effect = new PostprocessEffectBlur (mDyn1 ); break; |
|
135 |
case GLOW : effect = new PostprocessEffectGlow (mDyn1, mDyn4); break; |
|
136 |
} |
|
137 |
|
|
138 |
if( effect!=null ) |
|
139 |
{ |
|
140 |
effects.apply(effect); |
|
141 |
mId = effect.getID(); |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
146 |
// requires knowledge about effect nature |
|
147 |
|
|
148 |
private void fillStatics() |
|
149 |
{ |
|
150 |
switch(mName) |
|
151 |
{ |
|
152 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
153 |
// MATRIX |
|
154 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
155 |
|
|
156 |
case ROTATE : float an = (mInter[0]-50)*180/50; |
|
157 |
float rx = (mInter[1]-50)/ 50.0f; |
|
158 |
float ry = (mInter[2]-50)/ 50.0f; |
|
159 |
float rz = (mInter[3]-50)/ 50.0f; |
|
160 |
mSta1.set(an); |
|
161 |
mSta3.set(rx,ry,rz); |
|
162 |
break; |
|
163 |
case QUATERNION : float qx = (mInter[0]-50)/ 50.0f; |
|
164 |
float qy = (mInter[1]-50)/ 50.0f; |
|
165 |
float qz = (mInter[2]-50)/ 50.0f; |
|
166 |
float qa = (mInter[3]-50)*3.1415f/50; |
|
167 |
float cosA = (float)Math.cos(qa/2); |
|
168 |
float len = (float)Math.sqrt(qx*qx+qy*qy+qz*qz); |
|
169 |
float sinAnorm = (float)Math.sin(qa/2)/len; |
|
170 |
mSta4.set(sinAnorm*qx,sinAnorm*qy,sinAnorm*qz, cosA); |
|
171 |
break; |
|
172 |
case MOVE : float scr= mAct.get().getScreenWidth(); |
|
173 |
float sw = scr/20000.0f; |
|
174 |
float sh = scr/20000.0f; |
|
175 |
float xm = (mInter[0]-50)*sw; |
|
176 |
float ym = (mInter[1]-50)*sh; |
|
177 |
float zm = (mInter[2]-50)*(sw+sh)/2; |
|
178 |
mSta3.set(xm,ym,zm); |
|
179 |
break; |
|
180 |
case SCALE : float xs = (mInter[0]>50 ? 0.18f : 0.018f)*(mInter[0]-50) + 1; |
|
181 |
float ys = (mInter[1]>50 ? 0.18f : 0.018f)*(mInter[1]-50) + 1; |
|
182 |
float zs = (mInter[2]>50 ? 0.18f : 0.018f)*(mInter[2]-50) + 1; |
|
183 |
mSta3.set(xs,ys,zs); |
|
184 |
break; |
|
185 |
case SHEAR : float xsh = (mInter[0]-50)/25.0f; |
|
186 |
float ysh = (mInter[1]-50)/25.0f; |
|
187 |
float zsh = (mInter[2]-50)/25.0f; |
|
188 |
mSta3.set(xsh,ysh,zsh); |
|
189 |
break; |
|
190 |
|
|
191 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
192 |
// VERTEX |
|
193 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
194 |
|
|
195 |
case DISTORT : |
|
196 |
case DEFORM : float ld = mAct.get().getWidth()/50.0f; |
|
197 |
float xd = (mInter[0]-50)*ld; |
|
198 |
float yd = (mInter[1]-50)*ld; |
|
199 |
float zd = (mInter[2]-50)*ld; |
|
200 |
mSta3.set(xd,yd,zd); |
|
201 |
break; |
|
202 |
case WAVE : float l2 = mAct.get().getWidth()/50.0f; |
|
203 |
float x2 = (mInter[0]-50)*l2; |
|
204 |
float y2 = (mInter[1]-50)*l2; |
|
205 |
float z2 = (mInter[2]-50)*180 / 50; |
|
206 |
float w2 = (mInter[3]-50)*180 / 50; |
|
207 |
float v2 = (mInter[4]-50)*180 / 50; |
|
208 |
mSta5.set(x2,y2,z2,w2,v2); |
|
209 |
break; |
|
210 |
case SWIRL : mSta1.set( 3.6f*(mInter[0]-50) ); |
|
211 |
break; |
|
212 |
case SINK : mSta1.set(mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f); |
|
213 |
break; |
|
214 |
case PINCH : float dp = mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f; |
|
215 |
float ap = (mInter[1]-50)*180 / 50; |
|
216 |
mSta2.set(dp,ap); |
|
217 |
break; |
|
218 |
|
|
219 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
220 |
// FRAGMENT |
|
221 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
222 |
|
|
223 |
case ALPHA : |
|
224 |
case SMOOTH_ALPHA : mSta1.set(mInter[0]/100.0f); |
|
225 |
break; |
|
226 |
case SATURATION : |
|
227 |
case SMOOTH_SATURATION: |
|
228 |
case CONTRAST : |
|
229 |
case SMOOTH_CONTRAST : |
|
230 |
case BRIGHTNESS : |
|
231 |
case SMOOTH_BRIGHTNESS: mSta1.set(mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f); |
|
232 |
break; |
|
233 |
case CHROMA : |
|
234 |
case SMOOTH_CHROMA : mSta1.set(mInter[0]/100.0f); |
|
235 |
mSta3.set(mInter[1]/100.0f, |
|
236 |
mInter[2]/100.0f, |
|
237 |
mInter[3]/100.0f); |
|
238 |
break; |
|
239 |
|
|
240 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
241 |
// POSTPROCESS |
|
242 |
/////////////////////////////////////////////////////////////////////////////////////// |
|
243 |
|
|
244 |
case BLUR : mSta1.set(mInter[0]/2.0f); |
|
245 |
break; |
|
246 |
case GLOW : mSta1.set(mInter[0]/2.0f); |
|
247 |
mSta4.set(mInter[1]/100.0f, |
|
248 |
mInter[2]/100.0f, |
|
249 |
mInter[3]/100.0f, |
|
250 |
mInter[4]/100.0f ); |
|
251 |
break; |
|
252 |
} |
|
253 |
} |
|
254 |
|
|
255 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
256 |
|
|
257 |
private void setDefaultInter() |
|
258 |
{ |
|
259 |
switch(mDimension) |
|
260 |
{ |
|
261 |
case 5: mInter[4] = 50; |
|
262 |
case 4: mInter[3] = 50; |
|
263 |
case 3: mInter[2] = 50; |
|
264 |
case 2: mInter[1] = 50; |
|
265 |
case 1: mInter[0] = 50; |
|
266 |
} |
|
267 |
|
|
268 |
if( mName==EffectName.ROTATE || mName==EffectName.QUATERNION ) mInter[1]= 100; |
|
269 |
} |
|
270 |
|
|
271 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
272 |
|
|
273 |
private void setText() |
|
274 |
{ |
|
275 |
String text = mName.name(); |
|
276 |
|
|
277 |
if( mSta1 !=null ) |
|
278 |
{ |
|
279 |
float f1 = ((int)(mSta1.get1()*100))/100.0f; |
|
280 |
text += " "+f1; |
|
281 |
} |
|
282 |
|
|
283 |
if( mSta2 !=null ) |
|
284 |
{ |
|
285 |
float f1 = ((int)(mSta2.get1()*100))/100.0f; |
|
286 |
float f2 = ((int)(mSta2.get2()*100))/100.0f; |
|
287 |
text += " ("+f1+","+f2+")"; |
|
288 |
} |
|
289 |
|
|
290 |
if( mSta3 !=null ) |
|
291 |
{ |
|
292 |
float f1 = ((int)(mSta3.get1()*100))/100.0f; |
|
293 |
float f2 = ((int)(mSta3.get2()*100))/100.0f; |
|
294 |
float f3 = ((int)(mSta3.get3()*100))/100.0f; |
|
295 |
text += " ("+f1+","+f2+","+f3+")"; |
|
296 |
} |
|
297 |
|
|
298 |
if( mSta4 !=null ) |
|
299 |
{ |
|
300 |
float f1 = ((int)(mSta4.get1()*100))/100.0f; |
|
301 |
float f2 = ((int)(mSta4.get2()*100))/100.0f; |
|
302 |
float f3 = ((int)(mSta4.get3()*100))/100.0f; |
|
303 |
float f4 = ((int)(mSta4.get4()*100))/100.0f; |
|
304 |
text += " ("+f1+","+f2+","+f3+","+f4+")"; |
|
305 |
} |
|
306 |
|
|
307 |
if( mSta5 !=null ) |
|
308 |
{ |
|
309 |
float f1 = ((int)(mSta5.get1()*100))/100.0f; |
|
310 |
float f2 = ((int)(mSta5.get2()*100))/100.0f; |
|
311 |
float f3 = ((int)(mSta5.get3()*100))/100.0f; |
|
312 |
float f4 = ((int)(mSta5.get4()*100))/100.0f; |
|
313 |
float f5 = ((int)(mSta5.get5()*100))/100.0f; |
|
314 |
text += " ("+f1+","+f2+","+f3+","+f4+","+f5+")"; |
|
315 |
} |
|
316 |
|
|
317 |
mText.setText(text); |
|
318 |
} |
|
319 |
|
|
320 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
321 |
|
|
322 |
private void fillCenterStatics() |
|
323 |
{ |
|
324 |
Effects3DActivity2 act = mAct.get(); |
|
325 |
|
|
326 |
float x = (mInterCenter[0]*0.012f - 0.1f)*act.getWidth(); |
|
327 |
float y = (mInterCenter[1]*0.012f - 0.1f)*act.getHeight(); |
|
328 |
float z = (mInterCenter[2]*0.012f - 0.1f)*act.getDepth(); |
|
329 |
|
|
330 |
mCenterSta.set(x,y,z); |
|
331 |
} |
|
332 |
|
|
333 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
334 |
|
|
335 |
private void setDefaultCenterInter() |
|
336 |
{ |
|
337 |
mInterCenter[0] = 50; |
|
338 |
mInterCenter[1] = 50; |
|
339 |
mInterCenter[2] = 50; |
|
340 |
} |
|
341 |
|
|
342 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
343 |
|
|
344 |
private void setCenterText() |
|
345 |
{ |
|
346 |
float f0 = ((int)(mCenterSta.get1()*100))/100.0f; |
|
347 |
float f1 = ((int)(mCenterSta.get2()*100))/100.0f; |
|
348 |
float f2 = ((int)(mCenterSta.get3()*100))/100.0f; |
|
349 |
|
|
350 |
mTextCenter.setText("center ("+f0+","+f1+","+f2+")"); |
|
351 |
} |
|
352 |
|
|
353 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
354 |
|
|
355 |
private void fillRegionStatics() |
|
356 |
{ |
|
357 |
Effects3DActivity2 act = mAct.get(); |
|
358 |
|
|
359 |
float factorX = act.getWidth() / 100.0f; |
|
360 |
float factorY = act.getHeight()/ 100.0f; |
|
361 |
// float factorZ = act.getDepth() / 100.0f; |
|
362 |
|
|
363 |
int deduct = (mName.getType() == EffectType.VERTEX ? 50:0); |
|
364 |
|
|
365 |
float x = (mInterRegion[0]-deduct)*factorX; |
|
366 |
float y = (mInterRegion[1]-deduct)*factorY; |
|
367 |
float z = (mInterRegion[2]-deduct)*factorX; // ?? |
|
368 |
float r = mInterRegion[3] *(factorX+factorY)/2; |
|
369 |
|
|
370 |
mRegion4Sta.set(x,y,z,r); |
|
371 |
mRegion3Sta.set(x,y,z); |
|
372 |
} |
|
373 |
|
|
374 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
375 |
|
|
376 |
private void setDefaultRegionInter() |
|
377 |
{ |
|
378 |
mInterRegion[0] = 50; |
|
379 |
mInterRegion[1] = 50; |
|
380 |
mInterRegion[2] = 50; |
|
381 |
mInterRegion[3] = 50; |
|
382 |
} |
|
383 |
|
|
384 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
385 |
|
|
386 |
private void setRegionText() |
|
387 |
{ |
|
388 |
if( mRegionDimension==4 ) |
|
389 |
{ |
|
390 |
float f0 = ((int)(mRegion4Sta.get1()*100))/100.0f; |
|
391 |
float f1 = ((int)(mRegion4Sta.get2()*100))/100.0f; |
|
392 |
float f2 = ((int)(mRegion4Sta.get3()*100))/100.0f; |
|
393 |
float f3 = ((int)(mRegion4Sta.get4()*100))/100.0f; |
|
394 |
|
|
395 |
mTextRegion.setText("region (" + f0 + "," + f1 + "," + f2 + "," + f3 + ")"); |
|
396 |
} |
|
397 |
|
|
398 |
if( mRegionDimension==3 ) |
|
399 |
{ |
|
400 |
float f0 = ((int)(mRegion4Sta.get1()*100))/100.0f; |
|
401 |
float f1 = ((int)(mRegion4Sta.get2()*100))/100.0f; |
|
402 |
float f2 = ((int)(mRegion4Sta.get3()*100))/100.0f; |
|
403 |
|
|
404 |
mTextRegion.setText("region (" + f0 + "," + f1 + "," + f2 + ")"); |
|
405 |
} |
|
406 |
} |
|
407 |
|
|
408 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
409 |
|
|
410 |
void setBackground(int pos) |
|
411 |
{ |
|
412 |
int color = (pos%2==1 ? BACKGROUND_ODD:BACKGROUND_EVEN); |
|
413 |
|
|
414 |
if( mEffect!=null ) mEffect.setBackgroundColor(color); |
|
415 |
if( mCenter!=null ) mCenter.setBackgroundColor(color); |
|
416 |
if( mRegion!=null ) mRegion.setBackgroundColor(color); |
|
417 |
} |
|
418 |
|
|
419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
420 |
|
|
421 |
Effects3DEffect(EffectName name, Effects3DActivity2 act) |
|
422 |
{ |
|
423 |
mAct = new WeakReference<>(act); |
|
424 |
mName = name; |
|
425 |
|
|
426 |
mDyn1 = null; |
|
427 |
mDyn2 = null; |
|
428 |
mDyn3 = null; |
|
429 |
mDyn4 = null; |
|
430 |
mDyn5 = null; |
|
431 |
mSta1 = null; |
|
432 |
mSta2 = null; |
|
433 |
mSta3 = null; |
|
434 |
mSta4 = null; |
|
435 |
mSta5 = null; |
|
436 |
|
|
437 |
mDimension = mName.getEffectDimension(); |
|
438 |
mRegionDimension = mName.getRegionDimension(); |
|
439 |
|
|
440 |
switch(mDimension) |
|
441 |
{ |
|
442 |
case 1 : mDyn1 = new Dynamic1D(); |
|
443 |
mSta1 = new Static1D(0); |
|
444 |
mDyn1.add(mSta1); |
|
445 |
break; |
|
446 |
case 2 : mDyn2 = new Dynamic2D(); |
|
447 |
mSta2 = new Static2D(0,0); |
|
448 |
mDyn2.add(mSta2); |
|
449 |
break; |
|
450 |
case 3 : mDyn3 = new Dynamic3D(); |
|
451 |
mSta3 = new Static3D(0,0,0); |
|
452 |
mDyn3.add(mSta3); |
|
453 |
break; |
|
454 |
case 4 : if( mName == EffectName.QUATERNION ) |
|
455 |
{ |
|
456 |
mDyn4 = new Dynamic4D(); |
|
457 |
mSta4 = new Static4D(0,0,0,0); |
|
458 |
mDyn4.add(mSta4); |
|
459 |
} |
|
460 |
else |
|
461 |
{ |
|
462 |
mDyn3 = new Dynamic3D(); |
|
463 |
mSta3 = new Static3D(0,0,0); |
|
464 |
mDyn3.add(mSta3); |
|
465 |
mDyn1 = new Dynamic1D(); |
|
466 |
mSta1 = new Static1D(0); |
|
467 |
mDyn1.add(mSta1); |
|
468 |
} |
|
469 |
break; |
|
470 |
case 5 : if( mName == EffectName.WAVE ) |
|
471 |
{ |
|
472 |
mDyn5 = new Dynamic5D(); |
|
473 |
mSta5 = new Static5D(0, 0, 0, 0, 0); |
|
474 |
mDyn5.add(mSta5); |
|
475 |
} |
|
476 |
else |
|
477 |
{ |
|
478 |
mDyn4 = new Dynamic4D(); |
|
479 |
mSta4 = new Static4D(0,0,0,0); |
|
480 |
mDyn4.add(mSta4); |
|
481 |
mDyn1 = new Dynamic1D(); |
|
482 |
mSta1 = new Static1D(0); |
|
483 |
mDyn1.add(mSta1); |
|
484 |
} |
|
485 |
break; |
|
486 |
default: throw new RuntimeException("unsupported effect"); |
|
487 |
} |
|
488 |
|
|
489 |
mInter = new int[mDimension]; |
|
490 |
mSeekID= new int[mDimension]; |
|
491 |
|
|
492 |
mInterRegion = new int[4]; |
|
493 |
mSeekRegionID= new int[4]; |
|
494 |
mRegion4Dyn = new Dynamic4D(); |
|
495 |
mRegion4Sta = new Static4D(0,0,0,0); |
|
496 |
mRegion4Dyn.add(mRegion4Sta); |
|
497 |
mRegion3Dyn = new Dynamic3D(); |
|
498 |
mRegion3Sta = new Static3D(0,0,0); |
|
499 |
mRegion3Dyn.add(mRegion3Sta); |
|
500 |
|
|
501 |
mInterCenter = new int[3]; |
|
502 |
mSeekCenterID= new int[3]; |
|
503 |
mCenterDyn = new Dynamic3D(); |
|
504 |
mCenterSta = new Static3D(0,0,0); |
|
505 |
mCenterDyn.add(mCenterSta); |
|
506 |
|
|
507 |
mButton = null; |
|
508 |
mEffect = null; |
|
509 |
mCenter = null; |
|
510 |
mRegion = null; |
|
511 |
} |
|
512 |
|
|
513 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
514 |
|
|
515 |
View createView(int num) |
|
516 |
{ |
|
517 |
SeekBar[] seek = new SeekBar[mDimension]; |
|
518 |
|
|
519 |
Effects3DActivity2 act = mAct.get(); |
|
520 |
|
|
521 |
switch(mDimension) |
|
522 |
{ |
|
523 |
case 1 : mEffect = act.getLayoutInflater().inflate(R.layout.effect1d, null); |
|
524 |
mText = mEffect.findViewById(R.id.effect1dText); |
|
525 |
seek[0] = mEffect.findViewById(R.id.effect1dbar1); |
|
526 |
mSeekID[0] = seek[0].getId(); |
|
527 |
mButton = mEffect.findViewById(R.id.button1dRemove); |
|
528 |
break; |
|
529 |
case 2 : mEffect = act.getLayoutInflater().inflate(R.layout.effect2d, null); |
|
530 |
mText = mEffect.findViewById(R.id.effect2dText); |
|
531 |
seek[0] = mEffect.findViewById(R.id.effect2dbar1); |
|
532 |
seek[1] = mEffect.findViewById(R.id.effect2dbar2); |
|
533 |
mSeekID[0] = seek[0].getId(); |
|
534 |
mSeekID[1] = seek[1].getId(); |
|
535 |
mButton = mEffect.findViewById(R.id.button2dRemove); |
|
536 |
break; |
|
537 |
case 3 : mEffect = act.getLayoutInflater().inflate(R.layout.effect3d, null); |
|
538 |
mText = mEffect.findViewById(R.id.effect3dText); |
|
539 |
seek[0] = mEffect.findViewById(R.id.effect3dbar1); |
|
540 |
seek[1] = mEffect.findViewById(R.id.effect3dbar2); |
|
541 |
seek[2] = mEffect.findViewById(R.id.effect3dbar3); |
|
542 |
mSeekID[0] = seek[0].getId(); |
|
543 |
mSeekID[1] = seek[1].getId(); |
|
544 |
mSeekID[2] = seek[2].getId(); |
|
545 |
mButton = mEffect.findViewById(R.id.button3dRemove); |
|
546 |
break; |
|
547 |
case 4 : mEffect = act.getLayoutInflater().inflate(R.layout.effect4d, null); |
|
548 |
mText = mEffect.findViewById(R.id.effect4dText); |
|
549 |
seek[0] = mEffect.findViewById(R.id.effect4dbar1); |
|
550 |
seek[1] = mEffect.findViewById(R.id.effect4dbar2); |
|
551 |
seek[2] = mEffect.findViewById(R.id.effect4dbar3); |
|
552 |
seek[3] = mEffect.findViewById(R.id.effect4dbar4); |
|
553 |
mSeekID[0] = seek[0].getId(); |
|
554 |
mSeekID[1] = seek[1].getId(); |
|
555 |
mSeekID[2] = seek[2].getId(); |
|
556 |
mSeekID[3] = seek[3].getId(); |
|
557 |
mButton = mEffect.findViewById(R.id.button4dRemove); |
|
558 |
break; |
|
559 |
case 5 : mEffect = act.getLayoutInflater().inflate(R.layout.effect5d, null); |
|
560 |
mText = mEffect.findViewById(R.id.effect5dText); |
|
561 |
seek[0] = mEffect.findViewById(R.id.effect5dbar1); |
|
562 |
seek[1] = mEffect.findViewById(R.id.effect5dbar2); |
|
563 |
seek[2] = mEffect.findViewById(R.id.effect5dbar3); |
|
564 |
seek[3] = mEffect.findViewById(R.id.effect5dbar4); |
|
565 |
seek[4] = mEffect.findViewById(R.id.effect5dbar5); |
|
566 |
mSeekID[0] = seek[0].getId(); |
|
567 |
mSeekID[1] = seek[1].getId(); |
|
568 |
mSeekID[2] = seek[2].getId(); |
|
569 |
mSeekID[3] = seek[3].getId(); |
|
570 |
mSeekID[4] = seek[4].getId(); |
|
571 |
mButton = mEffect.findViewById(R.id.button5dRemove); |
|
572 |
break; |
|
573 |
default: android.util.Log.e("Effects3DEffect", "dimension "+mDimension+" not supported!"); |
|
574 |
return null; |
|
575 |
} |
|
576 |
|
|
577 |
mEffect.setBackgroundColor( num%2==1 ? BACKGROUND_EVEN: BACKGROUND_ODD ); |
|
578 |
|
|
579 |
setDefaultInter(); |
|
580 |
|
|
581 |
for(int i=0; i<mDimension; i++) |
|
582 |
{ |
|
583 |
seek[i].setOnSeekBarChangeListener(this); |
|
584 |
seek[i].setProgress( mInter[i] ); |
|
585 |
} |
|
586 |
|
|
587 |
return mEffect; |
|
588 |
} |
|
589 |
|
|
590 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
591 |
|
|
592 |
View createRegion(int num) |
|
593 |
{ |
|
594 |
Effects3DActivity2 act = mAct.get(); |
|
595 |
|
|
596 |
if( mRegionDimension== 4 ) |
|
597 |
{ |
|
598 |
mRegion = act.getLayoutInflater().inflate(R.layout.effectregion4, null); |
|
599 |
mRegion.setBackgroundColor(num % 2 == 1 ? BACKGROUND_EVEN : BACKGROUND_ODD); |
|
600 |
|
|
601 |
SeekBar[] seek = new SeekBar[4]; |
|
602 |
|
|
603 |
seek[0] = mRegion.findViewById(R.id.effectRegion4BarX); |
|
604 |
seek[1] = mRegion.findViewById(R.id.effectRegion4BarY); |
|
605 |
seek[2] = mRegion.findViewById(R.id.effectRegion4BarZ); |
|
606 |
seek[3] = mRegion.findViewById(R.id.effectRegion4BarR); |
|
607 |
|
|
608 |
mSeekRegionID[0] = seek[0].getId(); |
|
609 |
mSeekRegionID[1] = seek[1].getId(); |
|
610 |
mSeekRegionID[2] = seek[2].getId(); |
|
611 |
mSeekRegionID[3] = seek[3].getId(); |
|
612 |
|
|
613 |
mTextRegion = mRegion.findViewById(R.id.effectRegion4Text); |
|
614 |
|
|
615 |
setDefaultRegionInter(); |
|
616 |
|
|
617 |
for (int i = 0; i < 4; i++) |
|
618 |
{ |
|
619 |
seek[i].setOnSeekBarChangeListener(this); |
|
620 |
seek[i].setProgress(mInterRegion[i]); |
|
621 |
} |
|
622 |
|
|
623 |
act.setRegion(mRegion4Sta.get1(), mRegion4Sta.get2(), mRegion4Sta.get3(), mRegion4Sta.get4()); |
|
624 |
} |
|
625 |
else |
|
626 |
{ |
|
627 |
mRegion = act.getLayoutInflater().inflate(R.layout.effectregion3, null); |
|
628 |
mRegion.setBackgroundColor(num % 2 == 1 ? BACKGROUND_EVEN : BACKGROUND_ODD); |
|
629 |
|
|
630 |
SeekBar[] seek = new SeekBar[3]; |
|
631 |
|
|
632 |
seek[0] = mRegion.findViewById(R.id.effectRegion3BarRX); |
|
633 |
seek[1] = mRegion.findViewById(R.id.effectRegion3BarRY); |
|
634 |
seek[2] = mRegion.findViewById(R.id.effectRegion3BarRZ); |
|
635 |
|
|
636 |
mSeekRegionID[0] = seek[0].getId(); |
|
637 |
mSeekRegionID[1] = seek[1].getId(); |
|
638 |
mSeekRegionID[2] = seek[2].getId(); |
|
639 |
|
|
640 |
mTextRegion = mRegion.findViewById(R.id.effectRegion3Text); |
|
641 |
|
|
642 |
setDefaultRegionInter(); |
|
643 |
|
|
644 |
for (int i = 0; i < 3; i++) |
|
645 |
{ |
|
646 |
seek[i].setOnSeekBarChangeListener(this); |
|
647 |
seek[i].setProgress(mInterRegion[i]); |
|
648 |
} |
|
649 |
|
|
650 |
act.setRegion(mRegion3Sta.get1(), mRegion3Sta.get2(), mRegion3Sta.get3(), 1.0f ); |
|
651 |
} |
Also available in: Unified diff
Rename the 'Effects3D' app files.