Revision f4e44230
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
private Dynamic1D mDyn1; |
58 | 58 |
private Dynamic3D mDyn3; |
59 |
private Dynamic4D mDyn4; |
|
59 | 60 |
private Static1D mSta1; |
60 | 61 |
private Static3D mSta3; |
62 |
private Static4D mSta4; |
|
61 | 63 |
private Dynamic4D mRegionDyn; |
62 | 64 |
private Static4D mRegionSta; |
63 | 65 |
private Dynamic2D mCenterDyn; |
... | ... | |
71 | 73 |
switch(mName) |
72 | 74 |
{ |
73 | 75 |
case DISTORT : |
74 |
case DEFORM : |
|
75 |
case WAVE : return 3; |
|
76 |
case DEFORM : return 3; |
|
76 | 77 |
|
77 | 78 |
case CHROMA : |
78 |
case SMOOTH_CHROMA: return 4; |
|
79 |
case SMOOTH_CHROMA: |
|
80 |
case WAVE : return 4; |
|
79 | 81 |
|
80 | 82 |
default : return 1; |
81 | 83 |
} |
... | ... | |
92 | 94 |
case DEFORM : object.deform (mDyn3, mCenterDyn ); break; |
93 | 95 |
case SINK : object.sink (mDyn1, mCenterDyn, mRegionDyn); break; |
94 | 96 |
case SWIRL : object.swirl (mDyn1, mCenterDyn, mRegionDyn); break; |
95 |
case WAVE : object.wave (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
97 |
case WAVE : object.wave (mDyn4, mCenterDyn, mRegionDyn); break;
|
|
96 | 98 |
|
97 | 99 |
case ALPHA : object.alpha (mDyn1, mRegionDyn, false); break; |
98 | 100 |
case SMOOTH_ALPHA : object.alpha (mDyn1, mRegionDyn, true ); break; |
... | ... | |
133 | 135 |
float x2 = (mInter[0]-50)*l2; |
134 | 136 |
float y2 = (mInter[1]-50)*180 / 50; |
135 | 137 |
float z2 = (mInter[2]-50)*l2; |
136 |
mSta3.set(x2,y2,z2); |
|
138 |
float w2 = (mInter[3]-50)*180 / 50; |
|
139 |
mSta4.set(x2,y2,z2,w2); |
|
137 | 140 |
break; |
138 | 141 |
case SINK : mSta1.set(mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f); |
139 | 142 |
break; |
... | ... | |
167 | 170 |
switch(mName) |
168 | 171 |
{ |
169 | 172 |
case DISTORT : |
170 |
case DEFORM : |
|
173 |
case DEFORM : mInter[0] = 50; |
|
174 |
mInter[1] = 50; |
|
175 |
mInter[2] = 50; |
|
176 |
break; |
|
171 | 177 |
case WAVE : mInter[0] = 50; |
172 | 178 |
mInter[1] = 50; |
173 | 179 |
mInter[2] = 50; |
180 |
mInter[3] = 50; |
|
174 | 181 |
break; |
175 | 182 |
case SINK : |
176 | 183 |
case SWIRL : mInter[0] = 50; |
... | ... | |
201 | 208 |
{ |
202 | 209 |
String text = mName.name(); |
203 | 210 |
|
204 |
if( mName.getType()== EffectTypes.FRAGMENT )
|
|
211 |
if( mSta1 !=null )
|
|
205 | 212 |
{ |
206 |
text+=(" "+((int)(mSta1.getX()*100))/100.0f); |
|
213 |
int f1 = (int)((mSta1.getX()*100)/100.0f); |
|
214 |
text += " "+f1; |
|
207 | 215 |
} |
208 | 216 |
|
209 |
if( mDimension>=3 )
|
|
217 |
if( mSta3 !=null )
|
|
210 | 218 |
{ |
211 | 219 |
int f1 = (int)mSta3.getX(); |
212 | 220 |
int f2 = (int)mSta3.getY(); |
213 | 221 |
int f3 = (int)mSta3.getZ(); |
214 | 222 |
text += " ("+f1+","+f2+","+f3+")"; |
215 | 223 |
} |
216 |
else if(mName.getType() == EffectTypes.VERTEX) |
|
224 |
|
|
225 |
if( mSta4 !=null ) |
|
217 | 226 |
{ |
218 |
float f1 = ((int)(mSta1.getX()*100))/100.0f; |
|
219 |
text += " ("+f1+")"; |
|
227 |
int f1 = (int)mSta4.getX(); |
|
228 |
int f2 = (int)mSta4.getY(); |
|
229 |
int f3 = (int)mSta4.getZ(); |
|
230 |
int f4 = (int)mSta4.getW(); |
|
231 |
text += " ("+f1+","+f2+","+f3+","+f4+")"; |
|
220 | 232 |
} |
221 | 233 |
|
222 | 234 |
mText.setText(text); |
... | ... | |
299 | 311 |
mAct = new WeakReference<>(act); |
300 | 312 |
mName = name; |
301 | 313 |
|
314 |
mDyn1 = null; |
|
315 |
mDyn3 = null; |
|
316 |
mDyn4 = null; |
|
317 |
mSta1 = null; |
|
318 |
mSta3 = null; |
|
319 |
mSta4 = null; |
|
320 |
|
|
302 | 321 |
mDimension = getDimension(); |
303 | 322 |
|
304 | 323 |
switch(mDimension) |
... | ... | |
306 | 325 |
case 1 : mDyn1 = new Dynamic1D(); |
307 | 326 |
mSta1 = new Static1D(0); |
308 | 327 |
mDyn1.add(mSta1); |
309 |
mDyn3 = null; |
|
310 | 328 |
break; |
311 | 329 |
case 3 : mDyn3 = new Dynamic3D(); |
312 | 330 |
mSta3 = new Static3D(0,0,0); |
313 | 331 |
mDyn3.add(mSta3); |
314 |
mDyn1 = null; |
|
315 | 332 |
break; |
316 |
case 4 : mDyn3 = new Dynamic3D(); |
|
317 |
mSta3 = new Static3D(0,0,0); |
|
318 |
mDyn3.add(mSta3); |
|
319 |
mDyn1 = new Dynamic1D(); |
|
320 |
mSta1 = new Static1D(0); |
|
321 |
mDyn1.add(mSta1); |
|
333 |
case 4 : if( mName == EffectNames.WAVE ) |
|
334 |
{ |
|
335 |
mDyn4 = new Dynamic4D(); |
|
336 |
mSta4 = new Static4D(0,0,0,0); |
|
337 |
mDyn4.add(mSta4); |
|
338 |
} |
|
339 |
else |
|
340 |
{ |
|
341 |
mDyn3 = new Dynamic3D(); |
|
342 |
mSta3 = new Static3D(0,0,0); |
|
343 |
mDyn3.add(mSta3); |
|
344 |
mDyn1 = new Dynamic1D(); |
|
345 |
mSta1 = new Static1D(0); |
|
346 |
mDyn1.add(mSta1); |
|
347 |
} |
|
322 | 348 |
break; |
323 | 349 |
default: throw new RuntimeException("unsupported effect"); |
324 | 350 |
} |
Also available in: Unified diff
Preparation to make the WAVE effect fully 3D