Revision 2890c5df
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 |
import org.distorted.library.effect.EffectName; |
|
31 |
import org.distorted.library.effect.MatrixEffectMove; |
|
32 |
import org.distorted.library.effect.MatrixEffectScale; |
|
33 |
import org.distorted.library.effect.VertexEffectDistort; |
|
34 |
import org.distorted.library.effect.VertexEffectSink; |
|
35 |
import org.distorted.library.effect.VertexEffectSwirl; |
|
30 | 36 |
import org.distorted.library.main.Distorted; |
31 | 37 |
import org.distorted.library.main.DistortedScreen; |
32 |
import org.distorted.library.EffectNames; |
|
33 | 38 |
import org.distorted.library.main.MeshFlat; |
34 | 39 |
import org.distorted.library.main.DistortedTexture; |
35 | 40 |
import org.distorted.library.main.DistortedEffects; |
36 |
import org.distorted.library.EffectTypes; |
|
37 | 41 |
import org.distorted.library.type.Dynamic1D; |
38 | 42 |
import org.distorted.library.type.Dynamic3D; |
39 | 43 |
import org.distorted.library.type.Static1D; |
... | ... | |
56 | 60 |
private Static3D v0,v1,v2,v3; |
57 | 61 |
private Static1D dBegin, dMiddle, dEnd, s0; |
58 | 62 |
private int bmpHeight, bmpWidth; |
63 |
private Static3D mMove, mScale; |
|
59 | 64 |
|
60 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 66 |
|
... | ... | |
113 | 118 |
|
114 | 119 |
mEffects = new DistortedEffects(); |
115 | 120 |
|
116 |
mEffects.sink( diSink, pLeft, sinkRegion ); |
|
117 |
mEffects.sink( diSink, pRight,sinkRegion ); |
|
121 |
mEffects.apply( new VertexEffectSink(diSink, pLeft, sinkRegion) ); |
|
122 |
mEffects.apply( new VertexEffectSink(diSink, pRight,sinkRegion) ); |
|
123 |
mEffects.apply( new VertexEffectDistort(diL, pLeft , Region) ); |
|
124 |
mEffects.apply( new VertexEffectDistort(diR, pRight, Region) ); |
|
125 |
mEffects.apply( new VertexEffectSwirl(diHips, pHips, HipsRegion) ); |
|
118 | 126 |
|
119 |
mEffects.distort(diL, pLeft , Region);
|
|
120 |
mEffects.distort(diR, pRight, Region);
|
|
121 |
|
|
122 |
mEffects.swirl(diHips, pHips, HipsRegion );
|
|
127 |
mMove = new Static3D(0,0,0);
|
|
128 |
mScale= new Static3D(1,1,1);
|
|
129 |
mEffects.apply(new MatrixEffectMove(mMove)); |
|
130 |
mEffects.apply(new MatrixEffectScale(mScale));
|
|
123 | 131 |
|
124 | 132 |
mScreen = new DistortedScreen(mView); |
125 | 133 |
} |
... | ... | |
160 | 168 |
|
161 | 169 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
162 | 170 |
{ |
163 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
164 |
|
|
165 | 171 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
166 | 172 |
{ |
167 | 173 |
int w = (height*bmpWidth)/bmpHeight; |
168 | 174 |
float factor = (float)height/bmpHeight; |
169 | 175 |
|
170 |
mEffects.move( new Static3D((width-w)/2,0,0) );
|
|
171 |
mEffects.scale(factor);
|
|
176 |
mMove.set((width-w)/2,0,0);
|
|
177 |
mScale.set(factor,factor,factor);
|
|
172 | 178 |
} |
173 | 179 |
else |
174 | 180 |
{ |
175 | 181 |
int h = (width*bmpHeight)/bmpWidth; |
176 | 182 |
float factor = (float)width/bmpWidth; |
177 | 183 |
|
178 |
mEffects.move( new Static3D(0,(height-h)/2,0) );
|
|
179 |
mEffects.scale(factor);
|
|
184 |
mMove.set(0,(height-h)/2,0);
|
|
185 |
mScale.set(factor,factor,factor);
|
|
180 | 186 |
} |
181 | 187 |
|
182 | 188 |
mScreen.resize(width, height); |
... | ... | |
213 | 219 |
mScreen.detachAll(); |
214 | 220 |
mScreen.attach(mTexture,mEffects,mMesh); |
215 | 221 |
|
216 |
DistortedEffects.enableEffect(EffectNames.DISTORT);
|
|
217 |
DistortedEffects.enableEffect(EffectNames.SINK);
|
|
218 |
DistortedEffects.enableEffect(EffectNames.SWIRL);
|
|
222 |
DistortedEffects.enableEffect(EffectName.DISTORT); |
|
223 |
DistortedEffects.enableEffect(EffectName.SINK); |
|
224 |
DistortedEffects.enableEffect(EffectName.SWIRL); |
|
219 | 225 |
|
220 | 226 |
try |
221 | 227 |
{ |
Also available in: Unified diff
Further progress with Apps.