Revision a9716c0f
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/examples/wind/WindEffectsManager.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 23 |
|
24 |
import org.distorted.library.effect.MatrixEffectScale; |
|
25 |
import org.distorted.library.effect.MatrixEffectShear; |
|
26 |
import org.distorted.library.effect.VertexEffectDeform; |
|
27 |
import org.distorted.library.effect.VertexEffectWave; |
|
24 | 28 |
import org.distorted.library.main.DistortedEffects; |
25 | 29 |
import org.distorted.library.main.DistortedTexture; |
26 | 30 |
import org.distorted.library.type.Dynamic; |
27 |
import org.distorted.library.type.Dynamic3D; |
|
28 | 31 |
import org.distorted.library.type.Dynamic5D; |
29 | 32 |
import org.distorted.library.type.Static3D; |
30 | 33 |
import org.distorted.library.type.Static4D; |
... | ... | |
35 | 38 |
private int mHeight, mWidth; |
36 | 39 |
|
37 | 40 |
private Static3D shearFactor; |
38 |
private Dynamic3D shearDynamic; |
|
39 | 41 |
private Static3D scaleFactor; |
40 |
private Dynamic3D scaleDynamic; |
|
41 | 42 |
private Static3D deformForce; |
42 | 43 |
private Static5D windFactor11, windFactor12; |
43 | 44 |
private Dynamic5D windDynamic1; |
... | ... | |
54 | 55 |
mWidth = texture.getWidth(); |
55 | 56 |
|
56 | 57 |
shearFactor = new Static3D(0,0,0); |
57 |
shearDynamic= new Dynamic3D(); |
|
58 |
shearDynamic.add(shearFactor); |
|
59 |
|
|
60 | 58 |
scaleFactor = new Static3D(1,1,1); |
61 |
scaleDynamic= new Dynamic3D(); |
|
62 |
scaleDynamic.add(scaleFactor); |
|
63 |
|
|
64 | 59 |
deformForce = new Static3D(mWidth/3,0,0); |
65 | 60 |
|
66 | 61 |
windFactor11 = new Static5D(mHeight/10,mHeight/5, 180, 0, 90); |
... | ... | |
90 | 85 |
|
91 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
92 | 87 |
|
93 |
synchronized void apply(DistortedEffects effects, int wind)
|
|
88 |
void apply(DistortedEffects effects, int wind) |
|
94 | 89 |
{ |
95 | 90 |
Static3D midLeft = new Static3D(0,mHeight/2,0); |
96 | 91 |
Static3D midRight = new Static3D(mWidth,mHeight/2,0); |
... | ... | |
98 | 93 |
|
99 | 94 |
setWind(wind); |
100 | 95 |
|
101 |
effects.shear(shearDynamic,midLeft);
|
|
102 |
effects.scale(scaleDynamic);
|
|
103 |
effects.deform(deformForce,midRight);
|
|
104 |
effects.wave(windDynamic1, midRight, windRegion);
|
|
105 |
effects.wave(windDynamic2, midRight, windRegion);
|
|
106 |
effects.wave(windDynamic3, midRight, windRegion);
|
|
96 |
effects.apply( new MatrixEffectShear(shearFactor,midLeft) );
|
|
97 |
effects.apply( new MatrixEffectScale(scaleFactor) );
|
|
98 |
effects.apply( new VertexEffectDeform(deformForce,midRight) );
|
|
99 |
effects.apply( new VertexEffectWave(windDynamic1, midRight, windRegion) );
|
|
100 |
effects.apply( new VertexEffectWave(windDynamic2, midRight, windRegion) );
|
|
101 |
effects.apply( new VertexEffectWave(windDynamic3, midRight, windRegion) );
|
|
107 | 102 |
} |
108 | 103 |
|
109 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Further progress with Apps: 27 (out of 31) compile now.