Revision 82ee855a
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/EffectQueueVertex.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.distorted.library.message.EffectMessage; |
25 | 25 |
import org.distorted.library.type.Data1D; |
26 |
import org.distorted.library.type.Data2D; |
|
26 | 27 |
import org.distorted.library.type.Data3D; |
27 | 28 |
import org.distorted.library.type.Data4D; |
28 | 29 |
import org.distorted.library.type.Data5D; |
29 | 30 |
import org.distorted.library.type.Dynamic1D; |
31 |
import org.distorted.library.type.Dynamic2D; |
|
30 | 32 |
import org.distorted.library.type.Dynamic3D; |
31 | 33 |
import org.distorted.library.type.Dynamic4D; |
32 | 34 |
import org.distorted.library.type.Dynamic5D; |
33 | 35 |
import org.distorted.library.type.Static1D; |
36 |
import org.distorted.library.type.Static2D; |
|
34 | 37 |
import org.distorted.library.type.Static3D; |
35 | 38 |
import org.distorted.library.type.Static4D; |
36 | 39 |
import org.distorted.library.type.Static5D; |
... | ... | |
161 | 164 |
// Do various post-processing on already computed effects. |
162 | 165 |
// 1) here unlike in the fragment queue, we don't have to multiply the points by ModelView matrix because that gets done in the shader. |
163 | 166 |
// 2) in case of SWIRL, switch the angles from degrees to radians |
164 |
// 3) likewise in case of WAVE |
|
167 |
// 3) likewise in case of WAVE and PINCH
|
|
165 | 168 |
// 4) In case of DISTORT, invert the Y-axis |
166 | 169 |
|
167 | 170 |
private void postprocess(int effect) |
... | ... | |
170 | 173 |
{ |
171 | 174 |
mUniforms[NUM_UNIFORMS*effect ] = (float)(Math.PI*mUniforms[NUM_UNIFORMS*effect ]/180); |
172 | 175 |
} |
176 |
if( mName[effect]==EffectNames.PINCH.ordinal() ) |
|
177 |
{ |
|
178 |
mUniforms[NUM_UNIFORMS*effect+1] = (float)(Math.PI*mUniforms[NUM_UNIFORMS*effect+1]/180); |
|
179 |
} |
|
173 | 180 |
if( mName[effect]==EffectNames.WAVE.ordinal() ) |
174 | 181 |
{ |
175 | 182 |
mUniforms[NUM_UNIFORMS*effect+2] = (float)(Math.PI*mUniforms[NUM_UNIFORMS*effect+2]/180); |
... | ... | |
292 | 299 |
return -1; |
293 | 300 |
} |
294 | 301 |
|
302 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
303 |
// pinch |
|
304 |
|
|
305 |
synchronized long add(EffectNames eln, Data2D data, Data3D center, Data4D region) |
|
306 |
{ |
|
307 |
if( mMax[INDEX]>mNumEffects ) |
|
308 |
{ |
|
309 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
|
310 |
|
|
311 |
if( data instanceof Dynamic2D) |
|
312 |
{ |
|
313 |
mInter[0][mNumEffects] = (Dynamic2D)data; |
|
314 |
} |
|
315 |
else if( data instanceof Static2D) |
|
316 |
{ |
|
317 |
mInter[0][mNumEffects] = null; |
|
318 |
mUniforms[NUM_UNIFORMS*mNumEffects ] = ((Static2D)data).getX(); |
|
319 |
mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static2D)data).getY(); |
|
320 |
} |
|
321 |
|
|
322 |
return addPriv(eln,center,region); |
|
323 |
} |
|
324 |
|
|
325 |
return -1; |
|
326 |
} |
|
327 |
|
|
328 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
329 |
// pinch |
|
330 |
|
|
331 |
synchronized long add(EffectNames eln, Data2D data, Data3D center) |
|
332 |
{ |
|
333 |
if( mMax[INDEX]>mNumEffects ) |
|
334 |
{ |
|
335 |
EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects); |
|
336 |
|
|
337 |
if( data instanceof Dynamic2D) |
|
338 |
{ |
|
339 |
mInter[0][mNumEffects] = (Dynamic2D)data; |
|
340 |
} |
|
341 |
else if( data instanceof Static2D) |
|
342 |
{ |
|
343 |
mInter[0][mNumEffects] = null; |
|
344 |
mUniforms[NUM_UNIFORMS*mNumEffects ] = ((Static2D)data).getX(); |
|
345 |
mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static2D)data).getY(); |
|
346 |
} |
|
347 |
|
|
348 |
return addPriv(eln,center,null); |
|
349 |
} |
|
350 |
|
|
351 |
return -1; |
|
352 |
} |
|
353 |
|
|
295 | 354 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
296 | 355 |
|
297 | 356 |
private long addPriv(EffectNames eln, Data3D center, Data4D region) |
Also available in: Unified diff
New vertex effect 'PINCH'