Revision 77e66c58
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/examples/TableOfContents.java | ||
---|---|---|
89 | 89 |
|
90 | 90 |
private enum Application |
91 | 91 |
{ |
92 |
MESHFILE (R.drawable.icon_example_meshfile , R.string.example_meshfile , R.string.example_meshfile_subtitle , MeshFileActivity.class), |
|
92 | 93 |
MONALISA (R.drawable.icon_example_monalisa , R.string.example_monalisa , R.string.example_monalisa_subtitle , MonaLisaActivity.class), |
93 | 94 |
SINK (R.drawable.icon_example_sink , R.string.example_sink , R.string.example_sink_subtitle , SinkActivity.class), |
94 | 95 |
BEAN (R.drawable.icon_example_bean , R.string.example_bean , R.string.example_bean_subtitle , BeanActivity.class), |
... | ... | |
129 | 130 |
PREDEFORM (R.drawable.icon_example_predeform , R.string.example_predeform , R.string.example_predeform_subtitle , PredeformActivity.class), |
130 | 131 |
DEFERREDJOB (R.drawable.icon_example_deferredjob , R.string.example_deferredjob , R.string.example_deferredjob_subtitle , DeferredJobActivity.class), |
131 | 132 |
SINGLEMESH (R.drawable.icon_example_singlemesh , R.string.example_singlemesh , R.string.example_singlemesh_subtitle , SingleMeshActivity.class), |
132 |
MESHFILE (R.drawable.icon_example_meshfile , R.string.example_meshfile , R.string.example_meshfile_subtitle , MeshFileActivity.class), |
|
133 | 133 |
FLATBLUR2 (R.drawable.icon_example_flatblur , R.string.example_flatblur , R.string.example_flatblur_subtitle , FlatBlur2Activity.class ), |
134 | 134 |
POLYMESH (R.drawable.icon_example_wip , R.string.example_polymesh , R.string.example_polymesh_subtitle , PolymeshActivity.class ), |
135 | 135 |
; |
src/main/java/org/distorted/examples/blur/BlurActivity.java | ||
---|---|---|
96 | 96 |
|
97 | 97 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
98 | 98 |
{ |
99 |
BlurSurfaceView view = findViewById(R.id.blurSurfaceView); |
|
99 |
BlurSurfaceView v = findViewById(R.id.blurSurfaceView); |
|
100 |
BlurRenderer r = v.getRenderer(); |
|
101 |
int id = bar.getId(); |
|
100 | 102 |
|
101 |
switch( bar.getId() )
|
|
103 |
if( id == R.id.blurSeek )
|
|
102 | 104 |
{ |
103 |
case R.id.blurSeek: int l1 = view.getRenderer().setBlur(progress); |
|
104 |
textBlur.setText(getString(R.string.blur_placeholder,l1)); |
|
105 |
break; |
|
106 |
case R.id.haloSeek: int l2 = view.getRenderer().setHalo(progress); |
|
107 |
textHalo.setText(getString(R.string.halo_placeholder,l2)); |
|
108 |
break; |
|
109 |
case R.id.moveSeek: int l3 = view.getRenderer().setMove(progress); |
|
110 |
textMove.setText(getString(R.string.move_placeholder,l3)); |
|
111 |
break; |
|
105 |
int l = r.setBlur(progress); |
|
106 |
textBlur.setText(getString(R.string.blur_placeholder,l)); |
|
107 |
} |
|
108 |
if( id == R.id.haloSeek ) |
|
109 |
{ |
|
110 |
int l = r.setHalo(progress); |
|
111 |
textHalo.setText(getString(R.string.halo_placeholder,l)); |
|
112 |
} |
|
113 |
if( id == R.id.moveSeek ) |
|
114 |
{ |
|
115 |
int l = r.setMove(progress); |
|
116 |
textMove.setText(getString(R.string.move_placeholder,l)); |
|
112 | 117 |
} |
113 | 118 |
} |
114 | 119 |
|
src/main/java/org/distorted/examples/deferredjob/DeferredJobActivity.java | ||
---|---|---|
76 | 76 |
{ |
77 | 77 |
Button butt = (Button)view; |
78 | 78 |
int id = butt.getId(); |
79 |
DeferredJobSurfaceView sView = findViewById(R.id.deferredjobSurfaceView); |
|
79 |
DeferredJobSurfaceView v = findViewById(R.id.deferredjobSurfaceView); |
|
80 |
DeferredJobRenderer r = v.getRenderer(); |
|
80 | 81 |
|
81 |
switch(id) |
|
82 |
{ |
|
83 |
case R.id.deferredjobButton0 : sView.getRenderer().apply(0); break; |
|
84 |
case R.id.deferredjobButton1 : sView.getRenderer().apply(1); break; |
|
85 |
} |
|
82 |
if( id == R.id.deferredjobButton0 ) r.apply(0); |
|
83 |
if( id == R.id.deferredjobButton1 ) r.apply(1); |
|
86 | 84 |
} |
87 | 85 |
} |
src/main/java/org/distorted/examples/dynamic/DynamicActivity.java | ||
---|---|---|
333 | 333 |
} |
334 | 334 |
else |
335 | 335 |
{ |
336 |
switch(id) |
|
337 |
{ |
|
338 |
case R.id.dynamicSeekNoise0 : mNoise0 = progress; break; |
|
339 |
case R.id.dynamicSeekNoise1 : mNoise1 = progress; break; |
|
340 |
case R.id.dynamicSeekNoise2 : mNoise2 = progress; break; |
|
341 |
case R.id.dynamicSeekNoise3 : mNoise3 = progress; break; |
|
342 |
} |
|
336 |
if( id == R.id.dynamicSeekNoise0 ) mNoise0 = progress; |
|
337 |
else if( id == R.id.dynamicSeekNoise1 ) mNoise1 = progress; |
|
338 |
else if( id == R.id.dynamicSeekNoise2 ) mNoise2 = progress; |
|
339 |
else if( id == R.id.dynamicSeekNoise3 ) mNoise3 = progress; |
|
343 | 340 |
|
344 | 341 |
float n0 = mNoise0/100.f; |
345 | 342 |
float n1 = mNoise1/100.f; |
src/main/java/org/distorted/examples/effectqueue/EffectQueueActivity.java | ||
---|---|---|
62 | 62 |
} |
63 | 63 |
} |
64 | 64 |
|
65 |
private ArrayList<EffectRow> mList = new ArrayList<>(); |
|
65 |
private final ArrayList<EffectRow> mList = new ArrayList<>();
|
|
66 | 66 |
|
67 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
68 | 68 |
|
... | ... | |
158 | 158 |
|
159 | 159 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
160 | 160 |
{ |
161 |
switch(parent.getId()) |
|
161 |
int pid = parent.getId(); |
|
162 |
|
|
163 |
if( pid == R.id.effects2d_spinnerAdd ) |
|
162 | 164 |
{ |
163 |
case R.id.effects2d_spinnerAdd : EffectQueueSurfaceView v = findViewById(R.id.effects2dSurfaceView); |
|
164 |
v.setEffect(pos); break; |
|
165 |
case R.id.effects2d_spinnerID : mPosID = pos; break; |
|
166 |
case R.id.effects2d_spinnerName: mPosName = pos; break; |
|
167 |
case R.id.effects2d_spinnerType: mPosType = pos; break; |
|
165 |
EffectQueueSurfaceView v = findViewById(R.id.effects2dSurfaceView); |
|
166 |
v.setEffect(pos); |
|
168 | 167 |
} |
168 |
if( pid == R.id.effects2d_spinnerID ) mPosID = pos; |
|
169 |
if( pid == R.id.effects2d_spinnerName ) mPosName = pos; |
|
170 |
if( pid == R.id.effects2d_spinnerType ) mPosType = pos; |
|
169 | 171 |
} |
170 | 172 |
|
171 | 173 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/flag/FlagActivity.java | ||
---|---|---|
142 | 142 |
FlagSurfaceView mView = findViewById(R.id.flagSurfaceView); |
143 | 143 |
FlagRenderer renderer = mView.getRenderer(); |
144 | 144 |
|
145 |
switch (bar.getId()) |
|
145 |
int id = bar.getId(); |
|
146 |
|
|
147 |
if( id== R.id.flagSeekAmplitude ) |
|
148 |
{ |
|
149 |
renderer.setAmplitude(progress); |
|
150 |
textAmplitude.setText(getString(R.string.amplitude_placeholder,progress)); |
|
151 |
} |
|
152 |
if( id == R.id.flagSeekNoiseAmplitude ) |
|
153 |
{ |
|
154 |
mNoise.set0((float)progress/100); |
|
155 |
renderer.setNoise(mNoise); |
|
156 |
convert(progress); |
|
157 |
textNoiseAmplitude.setText(getString(R.string.noise_placeholder,mStr)); |
|
158 |
} |
|
159 |
if( id == R.id.flagSeekLength ) |
|
160 |
{ |
|
161 |
progress = progress*2; |
|
162 |
renderer.setLength(progress); |
|
163 |
textLength.setText(getString(R.string.length_placeholder,progress)); |
|
164 |
} |
|
165 |
if( id == R.id.flagSeekNoiseLength ) |
|
166 |
{ |
|
167 |
mNoise.set1((float)progress/100); |
|
168 |
renderer.setNoise(mNoise); |
|
169 |
convert(progress); |
|
170 |
textNoiseLength.setText(getString(R.string.noise_placeholder,mStr)); |
|
171 |
} |
|
172 |
if( id == R.id.flagSeekAngleA ) |
|
173 |
{ |
|
174 |
progress = (360*progress)/100; |
|
175 |
renderer.setAngleA(progress); |
|
176 |
textAngleA.setText(getString(R.string.alpha_placeholder,progress)); |
|
177 |
} |
|
178 |
if( id == R.id.flagSeekNoiseAngleA ) |
|
179 |
{ |
|
180 |
mNoise.set3((float)progress/100); |
|
181 |
renderer.setNoise(mNoise); |
|
182 |
convert(progress); |
|
183 |
textNoiseAngleA.setText(getString(R.string.noise_placeholder,mStr)); |
|
184 |
} |
|
185 |
if( id == R.id.flagSeekAngleB ) |
|
186 |
{ |
|
187 |
progress = ((360*progress)/100); |
|
188 |
renderer.setAngleB(progress); |
|
189 |
textAngleB.setText(getString(R.string.beta_placeholder,progress)); |
|
190 |
} |
|
191 |
if( id == R.id.flagSeekNoiseAngleB ) |
|
146 | 192 |
{ |
147 |
case R.id.flagSeekAmplitude : renderer.setAmplitude(progress); |
|
148 |
textAmplitude.setText(getString(R.string.amplitude_placeholder,progress)); |
|
149 |
break; |
|
150 |
case R.id.flagSeekNoiseAmplitude: mNoise.set0((float)progress/100); |
|
151 |
renderer.setNoise(mNoise); |
|
152 |
convert(progress); |
|
153 |
textNoiseAmplitude.setText(getString(R.string.noise_placeholder,mStr)); |
|
154 |
break; |
|
155 |
case R.id.flagSeekLength : progress = progress*2; |
|
156 |
renderer.setLength(progress); |
|
157 |
textLength.setText(getString(R.string.length_placeholder,progress)); |
|
158 |
break; |
|
159 |
case R.id.flagSeekNoiseLength : mNoise.set1((float)progress/100); |
|
160 |
renderer.setNoise(mNoise); |
|
161 |
convert(progress); |
|
162 |
textNoiseLength.setText(getString(R.string.noise_placeholder,mStr)); |
|
163 |
break; |
|
164 |
case R.id.flagSeekAngleA : progress = (360*progress)/100; |
|
165 |
renderer.setAngleA(progress); |
|
166 |
textAngleA.setText(getString(R.string.alpha_placeholder,progress)); |
|
167 |
break; |
|
168 |
case R.id.flagSeekNoiseAngleA : mNoise.set3((float)progress/100); |
|
169 |
renderer.setNoise(mNoise); |
|
170 |
convert(progress); |
|
171 |
textNoiseAngleA.setText(getString(R.string.noise_placeholder,mStr)); |
|
172 |
break; |
|
173 |
case R.id.flagSeekAngleB : progress = ((360*progress)/100); |
|
174 |
renderer.setAngleB(progress); |
|
175 |
textAngleB.setText(getString(R.string.beta_placeholder,progress)); |
|
176 |
break; |
|
177 |
case R.id.flagSeekNoiseAngleB : mNoise.set4((float)progress/100); |
|
178 |
renderer.setNoise(mNoise); |
|
179 |
convert(progress); |
|
180 |
textNoiseAngleB.setText(getString(R.string.noise_placeholder,mStr)); |
|
181 |
break; |
|
193 |
mNoise.set4((float)progress/100); |
|
194 |
renderer.setNoise(mNoise); |
|
195 |
convert(progress); |
|
196 |
textNoiseAngleB.setText(getString(R.string.noise_placeholder,mStr)); |
|
182 | 197 |
} |
183 | 198 |
} |
184 | 199 |
|
src/main/java/org/distorted/examples/generic/GenericActivity.java | ||
---|---|---|
235 | 235 |
|
236 | 236 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
237 | 237 |
{ |
238 |
switch(parent.getId()) |
|
238 |
int pid = parent.getId(); |
|
239 |
|
|
240 |
if( pid == R.id.objectpicker_spinnerType ) |
|
239 | 241 |
{ |
240 |
case R.id.objectpicker_spinnerType : if( mObjectType!=pos ) |
|
241 |
{ |
|
242 |
mObjectType = pos; |
|
243 |
uncheckAll(); |
|
244 |
|
|
245 |
int dim = GenericMeshList.getDimension(mObjectType); |
|
246 |
|
|
247 |
mRowsPicker.setEnabled(dim>=1); |
|
248 |
mColsPicker.setEnabled(dim>=2); |
|
249 |
mSlicPicker.setEnabled(dim>=3); |
|
250 |
} |
|
251 |
break; |
|
252 |
case R.id.objectpicker_spinnerBitmap: switch(pos) |
|
253 |
{ |
|
254 |
case 0: mBitmapID = -1 ; break; |
|
255 |
case 1: mBitmapID = R.raw.face ; break; |
|
256 |
case 2: mBitmapID = R.raw.dog ; break; |
|
257 |
case 3: mBitmapID = R.raw.cat ; break; |
|
258 |
case 4: mBitmapID = R.raw.grid ; break; |
|
259 |
case 5: mBitmapID = R.raw.bean ; break; |
|
260 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
261 |
case 7: mBitmapID = R.raw.world ; break; |
|
262 |
} |
|
263 |
break; |
|
242 |
if( mObjectType!=pos ) |
|
243 |
{ |
|
244 |
mObjectType = pos; |
|
245 |
uncheckAll(); |
|
246 |
int dim = GenericMeshList.getDimension(mObjectType); |
|
247 |
mRowsPicker.setEnabled(dim>=1); |
|
248 |
mColsPicker.setEnabled(dim>=2); |
|
249 |
mSlicPicker.setEnabled(dim>=3); |
|
250 |
} |
|
251 |
} |
|
252 |
if( pid ==R.id.objectpicker_spinnerBitmap ) |
|
253 |
{ |
|
254 |
switch(pos) |
|
255 |
{ |
|
256 |
case 0: mBitmapID = -1 ; break; |
|
257 |
case 1: mBitmapID = R.raw.face ; break; |
|
258 |
case 2: mBitmapID = R.raw.dog ; break; |
|
259 |
case 3: mBitmapID = R.raw.cat ; break; |
|
260 |
case 4: mBitmapID = R.raw.grid ; break; |
|
261 |
case 5: mBitmapID = R.raw.bean ; break; |
|
262 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
263 |
case 7: mBitmapID = R.raw.world ; break; |
|
264 |
} |
|
264 | 265 |
} |
265 | 266 |
} |
266 | 267 |
|
src/main/java/org/distorted/examples/generic/GenericTab.java | ||
---|---|---|
119 | 119 |
@Override |
120 | 120 |
public void onClick(View v) |
121 | 121 |
{ |
122 |
switch (v.getId()) |
|
123 |
{ |
|
124 |
case R.id.effects3dButtonAdd : newEffect(); break; |
|
125 |
case R.id.effects3dButtonRemove: removeAll(); break; |
|
126 |
case R.id.button0dRemove : |
|
127 |
case R.id.button1dRemove : |
|
128 |
case R.id.button2dRemove : |
|
129 |
case R.id.button3dRemove : |
|
130 |
case R.id.button4dRemove : |
|
131 |
case R.id.button5dRemove : remove(v) ; break; |
|
132 |
} |
|
122 |
int id = v.getId(); |
|
123 |
|
|
124 |
if( id == R.id.effects3dButtonAdd ) newEffect(); |
|
125 |
if( id == R.id.effects3dButtonRemove ) removeAll(); |
|
126 |
if( id == R.id.button0dRemove || |
|
127 |
id == R.id.button1dRemove || |
|
128 |
id == R.id.button2dRemove || |
|
129 |
id == R.id.button3dRemove || |
|
130 |
id == R.id.button4dRemove || |
|
131 |
id == R.id.button5dRemove ) remove(v); |
|
133 | 132 |
} |
134 | 133 |
|
135 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/girl/GirlActivity.java | ||
---|---|---|
99 | 99 |
|
100 | 100 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
101 | 101 |
{ |
102 |
float v; |
|
103 |
int i; |
|
104 | 102 |
GirlSurfaceView view = findViewById(R.id.girlSurfaceView); |
103 |
int id = bar.getId(); |
|
105 | 104 |
|
106 |
switch (bar.getId())
|
|
105 |
if( id == R.id.girlSeekSwing )
|
|
107 | 106 |
{ |
108 |
case R.id.girlSeekSwing: v = progress/(5*400.0f); |
|
109 |
view.getRenderer().setSwing(v); |
|
110 |
textSwing.setText(getString(R.string.swing_placeholder,v)); |
|
111 |
break; |
|
112 |
case R.id.girlSeekSize : if( progress> 50) v = (progress-50)/18.0f + 1.0f; |
|
113 |
else v = 0.015f*progress + 0.25f; |
|
114 |
view.getRenderer().setSize(v); |
|
115 |
textSize.setText(getString(R.string.size_placeholder,v)); |
|
116 |
break; |
|
117 |
case R.id.girlSeekHips : i = progress/6; |
|
118 |
view.getRenderer().setHips(i); |
|
119 |
textHips.setText(getString(R.string.hips_placeholder,i)); |
|
120 |
break; |
|
107 |
float v = progress/(5*400.0f); |
|
108 |
view.getRenderer().setSwing(v); |
|
109 |
textSwing.setText(getString(R.string.swing_placeholder,v)); |
|
110 |
} |
|
111 |
if( id == R.id.girlSeekSize ) |
|
112 |
{ |
|
113 |
float v = progress> 50 ? ((progress-50)/18.0f + 1.0f) : (0.015f*progress + 0.25f); |
|
114 |
view.getRenderer().setSize(v); |
|
115 |
textSize.setText(getString(R.string.size_placeholder,v)); |
|
116 |
} |
|
117 |
if( id == R.id.girlSeekHips ) |
|
118 |
{ |
|
119 |
int i = progress/6; |
|
120 |
view.getRenderer().setHips(i); |
|
121 |
textHips.setText(getString(R.string.hips_placeholder,i)); |
|
121 | 122 |
} |
122 | 123 |
} |
123 | 124 |
|
src/main/java/org/distorted/examples/glow/GlowActivity.java | ||
---|---|---|
122 | 122 |
|
123 | 123 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
124 | 124 |
{ |
125 |
GlowSurfaceView view = findViewById(R.id.glowSurfaceView); |
|
125 |
GlowSurfaceView v = findViewById(R.id.glowSurfaceView); |
|
126 |
GlowRenderer r = v.getRenderer(); |
|
126 | 127 |
|
127 |
switch (bar.getId()) |
|
128 |
int id = bar.getId(); |
|
129 |
|
|
130 |
if( id == R.id.glowSeekRadius ) |
|
131 |
{ |
|
132 |
int radius = r.setGlowRadius(progress); |
|
133 |
textRadius.setText(getString(R.string.glow_radius_placeholder,radius)); |
|
134 |
} |
|
135 |
if( id == R.id.glowSeekAlpha ) |
|
128 | 136 |
{ |
129 |
case R.id.glowSeekRadius: int radius = view.getRenderer().setGlowRadius(progress); |
|
130 |
textRadius.setText(getString(R.string.glow_radius_placeholder,radius)); |
|
131 |
break; |
|
132 |
case R.id.glowSeekAlpha : float alpha = view.getRenderer().setGlowAlpha(progress); |
|
133 |
textAlpha.setText(getString(R.string.glow_alpha_placeholder, alpha)); |
|
134 |
break; |
|
137 |
float alpha = r.setGlowAlpha(progress); |
|
138 |
textAlpha.setText(getString(R.string.glow_alpha_placeholder, alpha)); |
|
135 | 139 |
} |
136 | 140 |
} |
137 | 141 |
|
src/main/java/org/distorted/examples/inflate/InflateActivity.java | ||
---|---|---|
235 | 235 |
|
236 | 236 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
237 | 237 |
{ |
238 |
switch(parent.getId()) |
|
238 |
int pid = parent.getId(); |
|
239 |
|
|
240 |
if( pid == R.id.objectpicker_spinnerType ) |
|
239 | 241 |
{ |
240 |
case R.id.objectpicker_spinnerType : if( mObjectType!=pos ) |
|
241 |
{ |
|
242 |
mObjectType = pos; |
|
243 |
uncheckAll(); |
|
244 |
|
|
245 |
int dim = InflateMeshList.getDimension(mObjectType); |
|
246 |
|
|
247 |
mRowsPicker.setEnabled(dim>=1); |
|
248 |
mColsPicker.setEnabled(dim>=2); |
|
249 |
mSlicPicker.setEnabled(dim>=3); |
|
250 |
} |
|
251 |
break; |
|
252 |
case R.id.objectpicker_spinnerBitmap: switch(pos) |
|
253 |
{ |
|
254 |
case 0: mBitmapID = -1 ; break; |
|
255 |
case 1: mBitmapID = R.raw.face ; break; |
|
256 |
case 2: mBitmapID = R.raw.dog ; break; |
|
257 |
case 3: mBitmapID = R.raw.cat ; break; |
|
258 |
case 4: mBitmapID = R.raw.grid ; break; |
|
259 |
case 5: mBitmapID = R.raw.bean ; break; |
|
260 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
261 |
case 7: mBitmapID = R.raw.world ; break; |
|
262 |
} |
|
263 |
break; |
|
242 |
if( mObjectType!=pos ) |
|
243 |
{ |
|
244 |
mObjectType = pos; |
|
245 |
uncheckAll(); |
|
246 |
|
|
247 |
int dim = InflateMeshList.getDimension(mObjectType); |
|
248 |
|
|
249 |
mRowsPicker.setEnabled(dim>=1); |
|
250 |
mColsPicker.setEnabled(dim>=2); |
|
251 |
mSlicPicker.setEnabled(dim>=3); |
|
252 |
} |
|
253 |
} |
|
254 |
if( pid == R.id.objectpicker_spinnerBitmap ) |
|
255 |
{ |
|
256 |
switch(pos) |
|
257 |
{ |
|
258 |
case 0: mBitmapID = -1 ; break; |
|
259 |
case 1: mBitmapID = R.raw.face ; break; |
|
260 |
case 2: mBitmapID = R.raw.dog ; break; |
|
261 |
case 3: mBitmapID = R.raw.cat ; break; |
|
262 |
case 4: mBitmapID = R.raw.grid ; break; |
|
263 |
case 5: mBitmapID = R.raw.bean ; break; |
|
264 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
265 |
case 7: mBitmapID = R.raw.world ; break; |
|
266 |
} |
|
264 | 267 |
} |
265 | 268 |
} |
266 | 269 |
|
src/main/java/org/distorted/examples/inflate/InflateActivity2.java | ||
---|---|---|
212 | 212 |
|
213 | 213 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
214 | 214 |
{ |
215 |
switch (bar.getId()) |
|
215 |
int id = bar.getId(); |
|
216 |
InflateSurfaceView v = findViewById(R.id.inflateSurfaceView); |
|
217 |
|
|
218 |
if( id == R.id.inflateTransparency ) |
|
219 |
{ |
|
220 |
v.getRenderer().setTransparency(progress); |
|
221 |
} |
|
222 |
if( id == R.id.inflateInflateLevel ) |
|
216 | 223 |
{ |
217 |
case R.id.inflateTransparency: InflateSurfaceView v1 = this.findViewById(R.id.inflateSurfaceView); |
|
218 |
v1.getRenderer().setTransparency(progress); |
|
219 |
break; |
|
220 |
case R.id.inflateInflateLevel: InflateSurfaceView v2 = this.findViewById(R.id.inflateSurfaceView); |
|
221 |
float level = v2.getRenderer().setLevel(progress); |
|
222 |
mTextLevel.setText(getString(R.string.inflate_placeholder, level)); |
|
223 |
break; |
|
224 |
float level = v.getRenderer().setLevel(progress); |
|
225 |
mTextLevel.setText(getString(R.string.inflate_placeholder, level)); |
|
224 | 226 |
} |
225 | 227 |
} |
226 | 228 |
|
src/main/java/org/distorted/examples/meshfile/MeshFileActivity.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
private LinearLayout mLayout; |
48 | 48 |
private int mResource; |
49 |
private String[] mNames = new String[] { "procedural" ,
|
|
50 |
"polygon" ,
|
|
49 |
private String[] mNames = new String[] { "polygon" ,
|
|
50 |
"procedural" ,
|
|
51 | 51 |
"deferredjob", |
52 | 52 |
"meshjoin" , |
53 | 53 |
"predeform" , |
... | ... | |
187 | 187 |
{ |
188 | 188 |
switch(pos) |
189 | 189 |
{ |
190 |
case 0: mResource = PROCEDURAL ; break;
|
|
191 |
case 1: mResource = POLYGON ; break;
|
|
190 |
case 0: mResource = POLYGON ; break;
|
|
191 |
case 1: mResource = PROCEDURAL ; break;
|
|
192 | 192 |
case 2: mResource = R.raw.deferredjob; break; |
193 | 193 |
case 3: mResource = R.raw.meshjoin ; break; |
194 | 194 |
case 4: mResource = R.raw.predeform ; break; |
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
210 | 210 |
float F = 0.5f; |
211 | 211 |
float E = SQ3/2; |
212 | 212 |
|
213 |
switch(resourceID) |
|
214 |
{ |
|
215 |
case R.raw.deferredjob: |
|
216 |
case R.raw.meshjoin : |
|
217 |
case PROCEDURAL : |
|
218 |
case POLYGON : |
|
219 |
case R.raw.predeform : return createWhiteTexture(); |
|
220 |
|
|
221 |
case R.raw.cube2 : |
|
222 |
case R.raw.cube3 : |
|
223 |
case R.raw.cube4 : |
|
224 |
case R.raw.cube5 : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
225 |
vertices = new float[] { -F,-F, +F,-F, +F,+F, -F,+F}; |
|
226 |
return factory.createTexture(vertices,colors,0.10f, 0.10f, true); |
|
227 |
case R.raw.pyra3 : |
|
228 |
case R.raw.pyra4 : |
|
229 |
case R.raw.pyra5 : colors = new int[] { 0xffffff00, 0xff00ff00, 0xff0000ff, 0xffff0000 }; |
|
230 |
vertices = new float[] { -F,-E/3, +F,-E/3, 0.0f,2*E/3}; |
|
231 |
return factory.createTexture(vertices,colors,0.05f, 0.05f, true); |
|
232 |
|
|
233 |
case R.raw.dino : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
234 |
vertices = new float[] { -F,F/3, 0,-2*F/3, +F,F/3 }; |
|
235 |
return factory.createTexture(vertices,colors,0.05f, 0.03f, true); |
|
236 |
|
|
237 |
case R.raw.skewb : colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
238 |
//vertices = new float[] { -G,-G, +G,-G, +G,+G, -G,+G }; |
|
239 |
|
|
240 |
vertices = new float[] { -F+F/4,F/4, F/4,-F+F/4, F/4,F/4}; |
|
241 |
return factory.createTexture(vertices,colors,0.05f, 0.08f, true); |
|
242 |
} |
|
213 |
if( resourceID == R.raw.deferredjob || |
|
214 |
resourceID == R.raw.meshjoin || |
|
215 |
resourceID == PROCEDURAL || |
|
216 |
resourceID == POLYGON || |
|
217 |
resourceID == R.raw.predeform ) return createWhiteTexture(); |
|
218 |
|
|
219 |
if( resourceID == R.raw.cube2 || |
|
220 |
resourceID == R.raw.cube3 || |
|
221 |
resourceID == R.raw.cube4 || |
|
222 |
resourceID == R.raw.cube5 ) |
|
223 |
{ |
|
224 |
colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
225 |
vertices = new float[] { -F,-F, +F,-F, +F,+F, -F,+F}; |
|
226 |
return factory.createTexture(vertices,colors,0.10f, 0.10f, true); |
|
227 |
} |
|
228 |
if( resourceID == R.raw.pyra3 || |
|
229 |
resourceID == R.raw.pyra4 || |
|
230 |
resourceID == R.raw.pyra5 ) |
|
231 |
{ |
|
232 |
colors = new int[] { 0xffffff00, 0xff00ff00, 0xff0000ff, 0xffff0000 }; |
|
233 |
vertices = new float[] { -F,-E/3, +F,-E/3, 0.0f,2*E/3}; |
|
234 |
return factory.createTexture(vertices,colors,0.05f, 0.05f, true); |
|
235 |
} |
|
236 |
if( resourceID == R.raw.dino ) |
|
237 |
{ |
|
238 |
colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
239 |
vertices = new float[] { -F,F/3, 0,-2*F/3, +F,F/3 }; |
|
240 |
return factory.createTexture(vertices,colors,0.05f, 0.03f, true); |
|
241 |
} |
|
242 |
if( resourceID == R.raw.skewb ) |
|
243 |
{ |
|
244 |
colors = new int[] { 0xffffff00, 0xffffffff, 0xff0000ff, 0xff00ff00, 0xffff0000, 0xffb5651d }; |
|
245 |
vertices = new float[] { -F+F/4,F/4, F/4,-F+F/4, F/4,F/4}; |
|
246 |
return factory.createTexture(vertices,colors,0.05f, 0.08f, true); |
|
247 |
} |
|
243 | 248 |
|
244 | 249 |
return null; |
245 | 250 |
} |
src/main/java/org/distorted/examples/meshjoin/MeshJoinActivity.java | ||
---|---|---|
77 | 77 |
CheckBox box = (CheckBox)view; |
78 | 78 |
int id = box.getId(); |
79 | 79 |
boolean checked = box.isChecked(); |
80 |
MeshJoinSurfaceView sView = findViewById(R.id.meshjoinSurfaceView); |
|
80 |
MeshJoinSurfaceView v = findViewById(R.id.meshjoinSurfaceView); |
|
81 |
MeshJoinRenderer r = v.getRenderer(); |
|
81 | 82 |
|
82 |
switch(id) |
|
83 |
{ |
|
84 |
case R.id.meshjoinCheckBox0 : sView.getRenderer().setChecked(0,checked); break; |
|
85 |
case R.id.meshjoinCheckBox1 : sView.getRenderer().setChecked(1,checked); break; |
|
86 |
case R.id.meshjoinCheckBox2 : sView.getRenderer().setChecked(2,checked); break; |
|
87 |
case R.id.meshjoinCheckBox3 : sView.getRenderer().setChecked(3,checked); break; |
|
88 |
} |
|
83 |
if( id == R.id.meshjoinCheckBox0 ) r.setChecked(0,checked); |
|
84 |
if( id == R.id.meshjoinCheckBox1 ) r.setChecked(1,checked); |
|
85 |
if( id == R.id.meshjoinCheckBox2 ) r.setChecked(2,checked); |
|
86 |
if( id == R.id.meshjoinCheckBox3 ) r.setChecked(3,checked); |
|
89 | 87 |
} |
90 | 88 |
} |
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
86 | 86 |
{ |
87 | 87 |
MultiblurSurfaceView v = findViewById(R.id.multiblurSurfaceView); |
88 | 88 |
MultiblurRenderer renderer = v.getRenderer(); |
89 |
int pid = parent.getId(); |
|
89 | 90 |
|
90 |
switch(parent.getId())
|
|
91 |
if( pid == R.id.multiblur_spinnerQuality )
|
|
91 | 92 |
{ |
92 |
case R.id.multiblur_spinnerQuality: EffectQuality quality; |
|
93 |
|
|
94 |
switch(pos) |
|
95 |
{ |
|
96 |
case 0 : quality = EffectQuality.HIGHEST; break; |
|
97 |
case 1 : quality = EffectQuality.HIGH ; break; |
|
98 |
case 2 : quality = EffectQuality.MEDIUM ; break; |
|
99 |
default: quality = EffectQuality.LOW ; |
|
100 |
} |
|
101 |
renderer.setQuality(quality); |
|
102 |
mQuality = quality.ordinal(); |
|
103 |
break; |
|
104 |
case R.id.multiblur_spinnerMode : renderer.setRenderModeToOIT(pos==1); |
|
105 |
break; |
|
93 |
EffectQuality quality; |
|
94 |
|
|
95 |
switch(pos) |
|
96 |
{ |
|
97 |
case 0 : quality = EffectQuality.HIGHEST; break; |
|
98 |
case 1 : quality = EffectQuality.HIGH ; break; |
|
99 |
case 2 : quality = EffectQuality.MEDIUM ; break; |
|
100 |
default: quality = EffectQuality.LOW ; |
|
101 |
} |
|
102 |
renderer.setQuality(quality); |
|
103 |
mQuality = quality.ordinal(); |
|
104 |
} |
|
105 |
if( pid == R.id.multiblur_spinnerMode ) |
|
106 |
{ |
|
107 |
renderer.setRenderModeToOIT(pos==1); |
|
106 | 108 |
} |
107 | 109 |
} |
108 | 110 |
|
... | ... | |
192 | 194 |
|
193 | 195 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
194 | 196 |
{ |
195 |
switch (bar.getId()) |
|
196 |
{ |
|
197 |
case R.id.multiblurDistanceSeek: MultiblurSurfaceView view1 = findViewById(R.id.multiblurSurfaceView); |
|
198 |
view1.getRenderer().setDistance(progress); |
|
199 |
break; |
|
200 |
case R.id.multiblurRangeSeek : MultiblurSurfaceView view2 = findViewById(R.id.multiblurSurfaceView); |
|
201 |
view2.getRenderer().setRange(progress); |
|
202 |
break; |
|
197 |
int id = bar.getId(); |
|
198 |
MultiblurSurfaceView v = findViewById(R.id.multiblurSurfaceView); |
|
199 |
MultiblurRenderer r = v.getRenderer(); |
|
203 | 200 |
|
204 |
} |
|
201 |
if( id == R.id.multiblurDistanceSeek ) r.setDistance(progress); |
|
202 |
if( id == R.id.multiblurRangeSeek ) r.setRange(progress); |
|
205 | 203 |
} |
206 | 204 |
|
207 | 205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
219 | 217 |
CheckBox box = (CheckBox)view; |
220 | 218 |
int id = box.getId(); |
221 | 219 |
boolean checked = box.isChecked(); |
222 |
MultiblurSurfaceView sView = findViewById(R.id.multiblurSurfaceView); |
|
223 |
|
|
224 |
switch(id) |
|
225 |
{ |
|
226 |
case R.id.multiblurCheckBox0 : sView.getRenderer().setChecked(0,checked); break; |
|
227 |
case R.id.multiblurCheckBox1 : sView.getRenderer().setChecked(1,checked); break; |
|
228 |
case R.id.multiblurCheckBox2 : sView.getRenderer().setChecked(2,checked); break; |
|
229 |
case R.id.multiblurCheckBox3 : sView.getRenderer().setChecked(3,checked); break; |
|
230 |
case R.id.multiblurCheckBox4 : sView.getRenderer().setChecked(4,checked); break; |
|
231 |
case R.id.multiblurCheckBox5 : sView.getRenderer().setChecked(5,checked); break; |
|
232 |
case R.id.multiblurCheckBox6 : sView.getRenderer().setChecked(6,checked); break; |
|
233 |
case R.id.multiblurCheckBox7 : sView.getRenderer().setChecked(7,checked); break; |
|
234 |
} |
|
220 |
MultiblurSurfaceView v = findViewById(R.id.multiblurSurfaceView); |
|
221 |
MultiblurRenderer r = v.getRenderer(); |
|
222 |
|
|
223 |
if( id == R.id.multiblurCheckBox0 ) r.setChecked(0,checked); |
|
224 |
if( id == R.id.multiblurCheckBox1 ) r.setChecked(1,checked); |
|
225 |
if( id == R.id.multiblurCheckBox2 ) r.setChecked(2,checked); |
|
226 |
if( id == R.id.multiblurCheckBox3 ) r.setChecked(3,checked); |
|
227 |
if( id == R.id.multiblurCheckBox4 ) r.setChecked(4,checked); |
|
228 |
if( id == R.id.multiblurCheckBox5 ) r.setChecked(5,checked); |
|
229 |
if( id == R.id.multiblurCheckBox6 ) r.setChecked(6,checked); |
|
230 |
if( id == R.id.multiblurCheckBox7 ) r.setChecked(7,checked); |
|
235 | 231 |
} |
236 | 232 |
|
237 | 233 |
} |
src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java | ||
---|---|---|
81 | 81 |
CheckBox box = (CheckBox)view; |
82 | 82 |
int id = box.getId(); |
83 | 83 |
boolean checked = box.isChecked(); |
84 |
OlimpicSurfaceView sView = findViewById(R.id.olimpicSurfaceView); |
|
85 |
|
|
86 |
switch(id) |
|
87 |
{ |
|
88 |
case R.id.olimpicCheckBoxBlue0 : sView.getRenderer().pressed(0,0,checked); mBlue[0] =checked; break; |
|
89 |
case R.id.olimpicCheckBoxBlue1 : sView.getRenderer().pressed(0,1,checked); mBlue[1] =checked; break; |
|
90 |
case R.id.olimpicCheckBoxBlue2 : sView.getRenderer().pressed(0,2,checked); mBlue[2] =checked; break; |
|
91 |
case R.id.olimpicCheckBoxBlue3 : sView.getRenderer().pressed(0,3,checked); mBlue[3] =checked; break; |
|
92 |
case R.id.olimpicCheckBoxBlue4 : sView.getRenderer().pressed(0,4,checked); mBlue[4] =checked; break; |
|
93 |
case R.id.olimpicCheckBoxBlue5 : sView.getRenderer().pressed(0,5,checked); mBlue[5] =checked; break; |
|
94 |
case R.id.olimpicCheckBoxBlue6 : sView.getRenderer().pressed(0,6,checked); mBlue[6] =checked; break; |
|
95 |
case R.id.olimpicCheckBoxBlue7 : sView.getRenderer().pressed(0,7,checked); mBlue[7] =checked; break; |
|
96 |
case R.id.olimpicCheckBoxBlue8 : sView.getRenderer().pressed(0,8,checked); mBlue[8] =checked; break; |
|
97 |
|
|
98 |
case R.id.olimpicCheckBoxBlack0 : sView.getRenderer().pressed(1,0,checked); mBlack[0] =checked; break; |
|
99 |
case R.id.olimpicCheckBoxBlack1 : sView.getRenderer().pressed(1,1,checked); mBlack[1] =checked; break; |
|
100 |
case R.id.olimpicCheckBoxBlack2 : sView.getRenderer().pressed(1,2,checked); mBlack[2] =checked; break; |
|
101 |
case R.id.olimpicCheckBoxBlack3 : sView.getRenderer().pressed(1,3,checked); mBlack[3] =checked; break; |
|
102 |
case R.id.olimpicCheckBoxBlack4 : sView.getRenderer().pressed(1,4,checked); mBlack[4] =checked; break; |
|
103 |
case R.id.olimpicCheckBoxBlack5 : sView.getRenderer().pressed(1,5,checked); mBlack[5] =checked; break; |
|
104 |
case R.id.olimpicCheckBoxBlack6 : sView.getRenderer().pressed(1,6,checked); mBlack[6] =checked; break; |
|
105 |
case R.id.olimpicCheckBoxBlack7 : sView.getRenderer().pressed(1,7,checked); mBlack[7] =checked; break; |
|
106 |
case R.id.olimpicCheckBoxBlack8 : sView.getRenderer().pressed(1,8,checked); mBlack[8] =checked; break; |
|
107 |
|
|
108 |
case R.id.olimpicCheckBoxRed0 : sView.getRenderer().pressed(2,0,checked); mRed[0] =checked; break; |
|
109 |
case R.id.olimpicCheckBoxRed1 : sView.getRenderer().pressed(2,1,checked); mRed[1] =checked; break; |
|
110 |
case R.id.olimpicCheckBoxRed2 : sView.getRenderer().pressed(2,2,checked); mRed[2] =checked; break; |
|
111 |
case R.id.olimpicCheckBoxRed3 : sView.getRenderer().pressed(2,3,checked); mRed[3] =checked; break; |
|
112 |
case R.id.olimpicCheckBoxRed4 : sView.getRenderer().pressed(2,4,checked); mRed[4] =checked; break; |
|
113 |
case R.id.olimpicCheckBoxRed5 : sView.getRenderer().pressed(2,5,checked); mRed[5] =checked; break; |
|
114 |
case R.id.olimpicCheckBoxRed6 : sView.getRenderer().pressed(2,6,checked); mRed[6] =checked; break; |
|
115 |
case R.id.olimpicCheckBoxRed7 : sView.getRenderer().pressed(2,7,checked); mRed[7] =checked; break; |
|
116 |
case R.id.olimpicCheckBoxRed8 : sView.getRenderer().pressed(2,8,checked); mRed[8] =checked; break; |
|
117 |
|
|
118 |
case R.id.olimpicCheckBoxYellow0: sView.getRenderer().pressed(3,0,checked); mYellow[0]=checked; break; |
|
119 |
case R.id.olimpicCheckBoxYellow1: sView.getRenderer().pressed(3,1,checked); mYellow[1]=checked; break; |
|
120 |
case R.id.olimpicCheckBoxYellow2: sView.getRenderer().pressed(3,2,checked); mYellow[2]=checked; break; |
|
121 |
case R.id.olimpicCheckBoxYellow3: sView.getRenderer().pressed(3,3,checked); mYellow[3]=checked; break; |
|
122 |
case R.id.olimpicCheckBoxYellow4: sView.getRenderer().pressed(3,4,checked); mYellow[4]=checked; break; |
|
123 |
case R.id.olimpicCheckBoxYellow5: sView.getRenderer().pressed(3,5,checked); mYellow[5]=checked; break; |
|
124 |
case R.id.olimpicCheckBoxYellow6: sView.getRenderer().pressed(3,6,checked); mYellow[6]=checked; break; |
|
125 |
case R.id.olimpicCheckBoxYellow7: sView.getRenderer().pressed(3,7,checked); mYellow[7]=checked; break; |
|
126 |
case R.id.olimpicCheckBoxYellow8: sView.getRenderer().pressed(3,8,checked); mYellow[8]=checked; break; |
|
127 |
|
|
128 |
case R.id.olimpicCheckBoxGreen0 : sView.getRenderer().pressed(4,0,checked); mGreen[0] =checked; break; |
|
129 |
case R.id.olimpicCheckBoxGreen1 : sView.getRenderer().pressed(4,1,checked); mGreen[1] =checked; break; |
|
130 |
case R.id.olimpicCheckBoxGreen2 : sView.getRenderer().pressed(4,2,checked); mGreen[2] =checked; break; |
|
131 |
case R.id.olimpicCheckBoxGreen3 : sView.getRenderer().pressed(4,3,checked); mGreen[3] =checked; break; |
|
132 |
case R.id.olimpicCheckBoxGreen4 : sView.getRenderer().pressed(4,4,checked); mGreen[4] =checked; break; |
|
133 |
case R.id.olimpicCheckBoxGreen5 : sView.getRenderer().pressed(4,5,checked); mGreen[5] =checked; break; |
|
134 |
case R.id.olimpicCheckBoxGreen6 : sView.getRenderer().pressed(4,6,checked); mGreen[6] =checked; break; |
|
135 |
case R.id.olimpicCheckBoxGreen7 : sView.getRenderer().pressed(4,7,checked); mGreen[7] =checked; break; |
|
136 |
case R.id.olimpicCheckBoxGreen8 : sView.getRenderer().pressed(4,8,checked); mGreen[8] =checked; break; |
|
137 |
} |
|
84 |
OlimpicSurfaceView v = findViewById(R.id.olimpicSurfaceView); |
|
85 |
OlimpicRenderer r = v.getRenderer(); |
|
86 |
|
|
87 |
if( id == R.id.olimpicCheckBoxBlue0 ) r.pressed(0,0,checked); mBlue[0] =checked; |
|
88 |
if( id == R.id.olimpicCheckBoxBlue1 ) r.pressed(0,1,checked); mBlue[1] =checked; |
|
89 |
if( id == R.id.olimpicCheckBoxBlue2 ) r.pressed(0,2,checked); mBlue[2] =checked; |
|
90 |
if( id == R.id.olimpicCheckBoxBlue3 ) r.pressed(0,3,checked); mBlue[3] =checked; |
|
91 |
if( id == R.id.olimpicCheckBoxBlue4 ) r.pressed(0,4,checked); mBlue[4] =checked; |
|
92 |
if( id == R.id.olimpicCheckBoxBlue5 ) r.pressed(0,5,checked); mBlue[5] =checked; |
|
93 |
if( id == R.id.olimpicCheckBoxBlue6 ) r.pressed(0,6,checked); mBlue[6] =checked; |
|
94 |
if( id == R.id.olimpicCheckBoxBlue7 ) r.pressed(0,7,checked); mBlue[7] =checked; |
|
95 |
if( id == R.id.olimpicCheckBoxBlue8 ) r.pressed(0,8,checked); mBlue[8] =checked; |
|
96 |
|
|
97 |
if( id == R.id.olimpicCheckBoxBlack0 ) r.pressed(1,0,checked); mBlack[0] =checked; |
|
98 |
if( id == R.id.olimpicCheckBoxBlack1 ) r.pressed(1,1,checked); mBlack[1] =checked; |
|
99 |
if( id == R.id.olimpicCheckBoxBlack2 ) r.pressed(1,2,checked); mBlack[2] =checked; |
|
100 |
if( id == R.id.olimpicCheckBoxBlack3 ) r.pressed(1,3,checked); mBlack[3] =checked; |
|
101 |
if( id == R.id.olimpicCheckBoxBlack4 ) r.pressed(1,4,checked); mBlack[4] =checked; |
|
102 |
if( id == R.id.olimpicCheckBoxBlack5 ) r.pressed(1,5,checked); mBlack[5] =checked; |
|
103 |
if( id == R.id.olimpicCheckBoxBlack6 ) r.pressed(1,6,checked); mBlack[6] =checked; |
|
104 |
if( id == R.id.olimpicCheckBoxBlack7 ) r.pressed(1,7,checked); mBlack[7] =checked; |
|
105 |
if( id == R.id.olimpicCheckBoxBlack8 ) r.pressed(1,8,checked); mBlack[8] =checked; |
|
106 |
|
|
107 |
if( id == R.id.olimpicCheckBoxRed0 ) r.pressed(2,0,checked); mRed[0] =checked; |
|
108 |
if( id == R.id.olimpicCheckBoxRed1 ) r.pressed(2,1,checked); mRed[1] =checked; |
|
109 |
if( id == R.id.olimpicCheckBoxRed2 ) r.pressed(2,2,checked); mRed[2] =checked; |
|
110 |
if( id == R.id.olimpicCheckBoxRed3 ) r.pressed(2,3,checked); mRed[3] =checked; |
|
111 |
if( id == R.id.olimpicCheckBoxRed4 ) r.pressed(2,4,checked); mRed[4] =checked; |
|
112 |
if( id == R.id.olimpicCheckBoxRed5 ) r.pressed(2,5,checked); mRed[5] =checked; |
|
113 |
if( id == R.id.olimpicCheckBoxRed6 ) r.pressed(2,6,checked); mRed[6] =checked; |
|
114 |
if( id == R.id.olimpicCheckBoxRed7 ) r.pressed(2,7,checked); mRed[7] =checked; |
|
115 |
if( id == R.id.olimpicCheckBoxRed8 ) r.pressed(2,8,checked); mRed[8] =checked; |
|
116 |
|
|
117 |
if( id == R.id.olimpicCheckBoxYellow0) r.pressed(3,0,checked); mYellow[0]=checked; |
|
118 |
if( id == R.id.olimpicCheckBoxYellow1) r.pressed(3,1,checked); mYellow[1]=checked; |
|
119 |
if( id == R.id.olimpicCheckBoxYellow2) r.pressed(3,2,checked); mYellow[2]=checked; |
|
120 |
if( id == R.id.olimpicCheckBoxYellow3) r.pressed(3,3,checked); mYellow[3]=checked; |
|
121 |
if( id == R.id.olimpicCheckBoxYellow4) r.pressed(3,4,checked); mYellow[4]=checked; |
|
122 |
if( id == R.id.olimpicCheckBoxYellow5) r.pressed(3,5,checked); mYellow[5]=checked; |
|
123 |
if( id == R.id.olimpicCheckBoxYellow6) r.pressed(3,6,checked); mYellow[6]=checked; |
|
124 |
if( id == R.id.olimpicCheckBoxYellow7) r.pressed(3,7,checked); mYellow[7]=checked; |
|
125 |
if( id == R.id.olimpicCheckBoxYellow8) r.pressed(3,8,checked); mYellow[8]=checked; |
|
126 |
|
|
127 |
if( id == R.id.olimpicCheckBoxGreen0 ) r.pressed(4,0,checked); mGreen[0] =checked; |
|
128 |
if( id == R.id.olimpicCheckBoxGreen1 ) r.pressed(4,1,checked); mGreen[1] =checked; |
|
129 |
if( id == R.id.olimpicCheckBoxGreen2 ) r.pressed(4,2,checked); mGreen[2] =checked; |
|
130 |
if( id == R.id.olimpicCheckBoxGreen3 ) r.pressed(4,3,checked); mGreen[3] =checked; |
|
131 |
if( id == R.id.olimpicCheckBoxGreen4 ) r.pressed(4,4,checked); mGreen[4] =checked; |
|
132 |
if( id == R.id.olimpicCheckBoxGreen5 ) r.pressed(4,5,checked); mGreen[5] =checked; |
|
133 |
if( id == R.id.olimpicCheckBoxGreen6 ) r.pressed(4,6,checked); mGreen[6] =checked; |
|
134 |
if( id == R.id.olimpicCheckBoxGreen7 ) r.pressed(4,7,checked); mGreen[7] =checked; |
|
135 |
if( id == R.id.olimpicCheckBoxGreen8 ) r.pressed(4,8,checked); mGreen[8] =checked; |
|
138 | 136 |
} |
139 | 137 |
|
140 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/predeform/PredeformActivity.java | ||
---|---|---|
335 | 335 |
@Override |
336 | 336 |
public void onClick(View v) |
337 | 337 |
{ |
338 |
switch (v.getId()) |
|
339 |
{ |
|
340 |
case R.id.predeformAddEffect : newEffect(); break; |
|
341 |
case R.id.predeformRemoveEffect: removeAll(); break; |
|
342 |
case R.id.predeformCreate : create(); break; |
|
343 |
case R.id.button1dRemove : |
|
344 |
case R.id.button2dRemove : |
|
345 |
case R.id.button3dRemove : |
|
346 |
case R.id.button4dRemove : |
|
347 |
case R.id.button5dRemove : remove(v) ; break; |
|
348 |
} |
|
338 |
int id = v.getId(); |
|
339 |
|
|
340 |
if( id == R.id.predeformAddEffect ) newEffect(); |
|
341 |
if( id == R.id.predeformRemoveEffect) removeAll(); |
|
342 |
if( id == R.id.predeformCreate ) create(); |
|
343 |
if( id == R.id.button1dRemove || |
|
344 |
id == R.id.button2dRemove || |
|
345 |
id == R.id.button3dRemove || |
|
346 |
id == R.id.button4dRemove || |
|
347 |
id == R.id.button5dRemove ) remove(v); |
|
349 | 348 |
} |
350 | 349 |
|
351 | 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
365 | 364 |
@Override |
366 | 365 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
367 | 366 |
{ |
368 |
switch(parent.getId()) |
|
367 |
int pid = parent.getId(); |
|
368 |
|
|
369 |
if( pid == R.id.predeformSpinnerType ) |
|
370 |
{ |
|
371 |
if( mObjectType!=pos ) |
|
372 |
{ |
|
373 |
mObjectType = pos; |
|
374 |
int dim = PredeformMeshList.getDimension(mObjectType); |
|
375 |
mRowsPicker.setEnabled(dim>=1); |
|
376 |
mColsPicker.setEnabled(dim>=2); |
|
377 |
mSlicPicker.setEnabled(dim>=3); |
|
378 |
} |
|
379 |
} |
|
380 |
if( pid == R.id.predeformSpinnerBitmap ) |
|
381 |
{ |
|
382 |
switch(pos) |
|
383 |
{ |
|
384 |
case 0: mBitmapID = -1 ; break; |
|
385 |
case 1: mBitmapID = R.raw.face ; break; |
|
386 |
case 2: mBitmapID = R.raw.dog ; break; |
|
387 |
case 3: mBitmapID = R.raw.cat ; break; |
|
388 |
case 4: mBitmapID = R.raw.grid ; break; |
|
389 |
case 5: mBitmapID = R.raw.bean ; break; |
|
390 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
391 |
case 7: mBitmapID = R.raw.world ; break; |
|
392 |
} |
|
393 |
} |
|
394 |
if( pid == R.id.predeformSpinnerEffect ) |
|
369 | 395 |
{ |
370 |
case R.id.predeformSpinnerType : if( mObjectType!=pos ) |
|
371 |
{ |
|
372 |
mObjectType = pos; |
|
373 |
|
|
374 |
int dim = PredeformMeshList.getDimension(mObjectType); |
|
375 |
|
|
376 |
mRowsPicker.setEnabled(dim>=1); |
|
377 |
mColsPicker.setEnabled(dim>=2); |
|
378 |
mSlicPicker.setEnabled(dim>=3); |
|
379 |
} |
|
380 |
break; |
|
381 |
case R.id.predeformSpinnerBitmap: switch(pos) |
|
382 |
{ |
|
383 |
case 0: mBitmapID = -1 ; break; |
|
384 |
case 1: mBitmapID = R.raw.face ; break; |
|
385 |
case 2: mBitmapID = R.raw.dog ; break; |
|
386 |
case 3: mBitmapID = R.raw.cat ; break; |
|
387 |
case 4: mBitmapID = R.raw.grid ; break; |
|
388 |
case 5: mBitmapID = R.raw.bean ; break; |
|
389 |
case 6: mBitmapID = R.raw.monalisa; break; |
|
390 |
case 7: mBitmapID = R.raw.world ; break; |
|
391 |
} |
|
392 |
break; |
|
393 |
case R.id.predeformSpinnerEffect: mEffectAdd = pos; |
|
394 |
break; |
|
396 |
mEffectAdd = pos; |
|
395 | 397 |
} |
396 | 398 |
} |
397 | 399 |
|
src/main/java/org/distorted/examples/projection/ProjectionActivity.java | ||
---|---|---|
99 | 99 |
|
100 | 100 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
101 | 101 |
{ |
102 |
float ret;
|
|
103 |
ProjectionSurfaceView view = findViewById(R.id.surfaceViewProjection);
|
|
104 |
ProjectionRenderer renderer = view.getRenderer();
|
|
102 |
ProjectionSurfaceView v = findViewById(R.id.surfaceViewProjection);
|
|
103 |
ProjectionRenderer r = v.getRenderer();
|
|
104 |
int id = bar.getId();
|
|
105 | 105 |
|
106 |
switch (bar.getId())
|
|
106 |
if( id == R.id.projectionSeekFOV )
|
|
107 | 107 |
{ |
108 |
case R.id.projectionSeekFOV : ret = renderer.setFOV(progress); |
|
109 |
textF.setText(getString(R.string.fov_placeholder,(int)ret)); |
|
110 |
break; |
|
111 |
case R.id.projectionSeekNear: ret = renderer.setNear(progress); |
|
112 |
textN.setText(getString(R.string.near_placeholder,ret)); |
|
113 |
break; |
|
108 |
float ret = r.setFOV(progress); |
|
109 |
textF.setText(getString(R.string.fov_placeholder,(int)ret)); |
|
110 |
} |
|
111 |
if( id == R.id.projectionSeekNear) |
|
112 |
{ |
|
113 |
float ret = r.setNear(progress); |
|
114 |
textN.setText(getString(R.string.near_placeholder,ret)); |
|
114 | 115 |
} |
115 | 116 |
} |
116 | 117 |
|
src/main/java/org/distorted/examples/save/SaveActivity.java | ||
---|---|---|
120 | 120 |
|
121 | 121 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
122 | 122 |
{ |
123 |
SaveSurfaceView view = findViewById(R.id.saveSurfaceView); |
|
123 |
SaveSurfaceView v = findViewById(R.id.saveSurfaceView); |
|
124 |
SaveRenderer r = v.getRenderer(); |
|
125 |
int id = bar.getId(); |
|
124 | 126 |
|
125 |
switch (bar.getId()) |
|
126 |
{ |
|
127 |
case R.id.saveSeekBarSize : view.getRenderer().setSize(progress>50 ? ((progress-50)/16.0f + 1.0f):(0.015f*progress + 0.25f)); |
|
128 |
break; |
|
129 |
case R.id.saveSeekBarScale: view.getRenderer().setScale(0.009f*progress+0.1f); |
|
130 |
break; |
|
131 |
} |
|
127 |
if( id == R.id.saveSeekBarSize ) r.setSize(progress>50 ? ((progress-50)/16.0f + 1.0f):(0.015f*progress + 0.25f)); |
|
128 |
if( id == R.id.saveSeekBarScale) r.setScale(0.009f*progress+0.1f); |
|
132 | 129 |
} |
133 | 130 |
|
134 | 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java | ||
---|---|---|
76 | 76 |
{ |
77 | 77 |
Button butt = (Button)view; |
78 | 78 |
int id = butt.getId(); |
79 |
SingleMeshSurfaceView sView = findViewById(R.id.singlemeshSurfaceView); |
|
79 |
SingleMeshSurfaceView v = findViewById(R.id.singlemeshSurfaceView); |
|
80 |
SingleMeshRenderer r = v.getRenderer(); |
|
80 | 81 |
|
81 |
switch(id) |
|
82 |
{ |
|
83 |
case R.id.singlemeshButtonLX : sView.getRenderer().apply( (1<<4) + (0<<2) + 0, 0 ); break; |
|
84 |
case R.id.singlemeshButtonRX : sView.getRenderer().apply( (2<<4) + (0<<2) + 0, 0 ); break; |
|
85 |
case R.id.singlemeshButtonLY : sView.getRenderer().apply( (0<<4) + (1<<2) + 0, 1 ); break; |
|
86 |
case R.id.singlemeshButtonRY : sView.getRenderer().apply( (0<<4) + (2<<2) + 0, 1 ); break; |
|
87 |
case R.id.singlemeshButtonLZ : sView.getRenderer().apply( (0<<4) + (0<<2) + 1, 2 ); break; |
|
88 |
case R.id.singlemeshButtonRZ : sView.getRenderer().apply( (0<<4) + (0<<2) + 2, 2 ); break; |
|
89 |
} |
|
82 |
if( id == R.id.singlemeshButtonLX ) r.apply( (1<<4) + (0<<2) + 0, 0 ); |
|
83 |
if( id == R.id.singlemeshButtonRX ) r.apply( (2<<4) + (0<<2) + 0, 0 ); |
|
84 |
if( id == R.id.singlemeshButtonLY ) r.apply( (0<<4) + (1<<2) + 0, 1 ); |
|
85 |
if( id == R.id.singlemeshButtonRY ) r.apply( (0<<4) + (2<<2) + 0, 1 ); |
|
86 |
if( id == R.id.singlemeshButtonLZ ) r.apply( (0<<4) + (0<<2) + 1, 2 ); |
|
87 |
if( id == R.id.singlemeshButtonRZ ) r.apply( (0<<4) + (0<<2) + 2, 2 ); |
|
90 | 88 |
} |
91 | 89 |
} |
src/main/java/org/distorted/examples/transparency/TransparencyActivity.java | ||
---|---|---|
83 | 83 |
|
84 | 84 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
85 | 85 |
{ |
86 |
switch(parent.getId()) |
|
87 |
{ |
|
88 |
case R.id.transparency_spinnerFirst : privateRenderFirst(pos); |
|
89 |
break; |
|
90 |
case R.id.transparency_spinnerMode : setRenderModeToOIT(pos==1); |
|
91 |
break; |
|
92 |
} |
|
86 |
int pid = parent.getId(); |
|
87 |
|
|
88 |
if( pid == R.id.transparency_spinnerFirst ) privateRenderFirst(pos); |
|
89 |
if( pid == R.id.transparency_spinnerMode ) setRenderModeToOIT(pos==1); |
|
93 | 90 |
} |
94 | 91 |
|
95 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
152 | 149 |
|
153 | 150 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
154 | 151 |
{ |
155 |
switch (bar.getId()) |
|
156 |
{ |
|
157 |
case R.id.transparencySeekRed: TransparencySurfaceView view0 = findViewById(R.id.transparencySurfaceView); |
|
158 |
view0.getRenderer().setTransparency(0, (float)progress/100 ); |
|
159 |
break; |
|
160 |
case R.id.transparencySeekYellow: TransparencySurfaceView view1 = findViewById(R.id.transparencySurfaceView); |
|
161 |
view1.getRenderer().setTransparency(1, (float)progress/100 ); |
|
162 |
break; |
|
163 |
} |
|
152 |
int id = bar.getId(); |
|
153 |
TransparencySurfaceView v = findViewById(R.id.transparencySurfaceView); |
|
154 |
TransparencyRenderer r = v.getRenderer(); |
|
155 |
|
|
156 |
if( id == R.id.transparencySeekRed ) r.setTransparency(0, (float)progress/100 ); |
|
157 |
if( id == R.id.transparencySeekYellow ) r.setTransparency(1, (float)progress/100 ); |
|
164 | 158 |
} |
165 | 159 |
|
166 | 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
199 | 193 |
{ |
200 | 194 |
CheckBox box = (CheckBox)view; |
201 | 195 |
boolean checked = box.isChecked(); |
202 |
TransparencySurfaceView sView = findViewById(R.id.transparencySurfaceView); |
|
196 |
TransparencySurfaceView v = findViewById(R.id.transparencySurfaceView); |
|
197 |
TransparencyRenderer r = v.getRenderer(); |
|
198 |
int id = box.getId(); |
|
203 | 199 |
|
204 |
switch(box.getId()) |
|
205 |
{ |
|
206 |
case R.id.transparencyCheckBox0 : sView.getRenderer().setPostprocess(0,checked); break; |
|
207 |
case R.id.transparencyCheckBox1 : sView.getRenderer().setPostprocess(1,checked); break; |
|
208 |
} |
|
200 |
if( id == R.id.transparencyCheckBox0 ) r.setPostprocess(0,checked); |
|
201 |
if( id == R.id.transparencyCheckBox1 ) r.setPostprocess(1,checked); |
|
209 | 202 |
} |
210 | 203 |
} |
src/main/java/org/distorted/examples/triblur/TriblurActivity.java | ||
---|---|---|
93 | 93 |
|
94 | 94 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
95 | 95 |
{ |
96 |
switch(parent.getId()) |
|
96 |
int pid = parent.getId(); |
|
97 |
|
|
98 |
if( pid == R.id.triblur_spinnerQuality ) |
|
99 |
{ |
|
100 |
privateQuality(pos); |
|
101 |
} |
|
102 |
if( pid == R.id.triblur_spinnerMode ) |
|
103 |
{ |
|
104 |
TriblurSurfaceView v = findViewById(R.id.triblurSurfaceView); |
|
105 |
TriblurRenderer renderer = v.getRenderer(); |
|
106 |
renderer.setRenderModeToOIT(pos==1); |
|
107 |
} |
|
108 |
if( pid == R.id.triblur_effect0 ) |
|
109 |
{ |
|
110 |
privateEffect(0,pos); |
|
111 |
} |
|
112 |
if( pid == R.id.triblur_effect1 ) |
|
97 | 113 |
{ |
98 |
case R.id.triblur_spinnerQuality: privateQuality(pos); |
|
99 |
break; |
|
100 |
case R.id.triblur_spinnerMode : TriblurSurfaceView v = findViewById(R.id.triblurSurfaceView); |
|
101 |
TriblurRenderer renderer = v.getRenderer(); |
|
102 |
renderer.setRenderModeToOIT(pos==1); |
|
103 |
break; |
|
104 |
case R.id.triblur_effect0 : privateEffect(0,pos); |
|
105 |
break; |
|
106 |
case R.id.triblur_effect1 : privateEffect(1,pos); |
|
107 |
break; |
|
108 |
case R.id.triblur_effect2 : privateEffect(2,pos); |
|
109 |
break; |
|
114 |
privateEffect(1,pos); |
|
115 |
} |
|
116 |
if( pid == R.id.triblur_effect2 ) |
|
117 |
{ |
|
118 |
privateEffect(2,pos); |
|
110 | 119 |
} |
111 | 120 |
} |
112 | 121 |
|
... | ... | |
192 | 201 |
|
193 | 202 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
194 | 203 |
{ |
195 |
switch (bar.getId()) |
|
196 |
{ |
|
197 |
case R.id.triblurSeek0: TriblurSurfaceView view0 = findViewById(R.id.triblurSurfaceView); |
|
198 |
view0.getRenderer().setRange(0,progress); |
|
199 |
break; |
|
200 |
case R.id.triblurSeek1: TriblurSurfaceView view1 = findViewById(R.id.triblurSurfaceView); |
|
201 |
view1.getRenderer().setRange(1,progress); |
|
202 |
break; |
|
203 |
case R.id.triblurSeek2: TriblurSurfaceView view2 = findViewById(R.id.triblurSurfaceView); |
|
204 |
view2.getRenderer().setRange(2,progress); |
|
205 |
break; |
|
206 |
} |
|
204 |
int id = bar.getId(); |
|
205 |
TriblurSurfaceView v = findViewById(R.id.triblurSurfaceView); |
|
206 |
TriblurRenderer r = v.getRenderer(); |
|
207 |
|
|
208 |
if( id == R.id.triblurSeek0 ) r.setRange(0,progress); |
|
209 |
if( id == R.id.triblurSeek1 ) r.setRange(1,progress); |
|
210 |
if( id == R.id.triblurSeek2 ) r.setRange(2,progress); |
|
207 | 211 |
} |
208 | 212 |
|
209 | 213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
228 | 232 |
|
229 | 233 |
public void backgroundColor(View v) |
230 | 234 |
{ |
231 |
switch(v.getId()) |
|
232 |
{ |
|
233 |
case R.id.triblurRadioBackground0: privateBackgroundColor(0); break; |
|
234 |
case R.id.triblurRadioBackground1: privateBackgroundColor(1); break; |
|
235 |
case R.id.triblurRadioBackground2: privateBackgroundColor(2); break; |
|
236 |
} |
|
235 |
int id = v.getId(); |
|
236 |
|
|
237 |
if( id == R.id.triblurRadioBackground0 ) privateBackgroundColor(0); |
|
238 |
if( id == R.id.triblurRadioBackground1 ) privateBackgroundColor(1); |
|
239 |
if( id == R.id.triblurRadioBackground2 ) privateBackgroundColor(2); |
|
237 | 240 |
} |
238 | 241 |
|
239 | 242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
in API 34 R.id. things are no loger constants and cannot be used in switches.