Revision 3bb0d218
Added by Leszek Koltunski over 4 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.EffectType; |
|
30 | 31 |
import org.distorted.library.effect.MatrixEffectScale; |
31 | 32 |
import org.distorted.library.effect.VertexEffectDistort; |
33 |
import org.distorted.library.effect.VertexEffectScale; |
|
32 | 34 |
import org.distorted.library.effect.VertexEffectSink; |
33 | 35 |
import org.distorted.library.effect.VertexEffectSwirl; |
34 | 36 |
import org.distorted.library.main.DistortedLibrary; |
... | ... | |
57 | 59 |
private MeshRectangles mMesh; |
58 | 60 |
private Static3D v0,v1,v2,v3; |
59 | 61 |
private Static1D dBegin, dMiddle, dEnd, s0; |
60 |
private Static3D mScale; |
|
62 |
private Static3D mScaleMatrix, mScaleVertex;
|
|
61 | 63 |
private float mBmpRatio; |
62 | 64 |
|
63 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
117 | 119 |
|
118 | 120 |
mEffects = new DistortedEffects(); |
119 | 121 |
|
122 |
mScaleMatrix= new Static3D(1,1,1); |
|
123 |
mScaleVertex= new Static3D(1,1,1); |
|
124 |
mEffects.apply(new MatrixEffectScale(mScaleMatrix)); |
|
125 |
mEffects.apply(new VertexEffectScale(mScaleVertex)); |
|
126 |
|
|
120 | 127 |
mEffects.apply( new VertexEffectSink ( diSink, pLeft , sinkRegion) ); |
121 | 128 |
mEffects.apply( new VertexEffectSink ( diSink, pRight, sinkRegion) ); |
122 | 129 |
mEffects.apply( new VertexEffectDistort( diL , pLeft , Region ) ); |
123 | 130 |
mEffects.apply( new VertexEffectDistort( diR , pRight, Region ) ); |
124 | 131 |
mEffects.apply( new VertexEffectSwirl ( diHips, pHips , HipsRegion) ); |
125 | 132 |
|
126 |
mScale= new Static3D(1,1,1); |
|
127 |
mEffects.apply(new MatrixEffectScale(mScale)); |
|
128 |
|
|
129 | 133 |
mTexture = new DistortedTexture(); |
130 | 134 |
mScreen = new DistortedScreen(); |
131 | 135 |
} |
... | ... | |
167 | 171 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
168 | 172 |
{ |
169 | 173 |
float factor = width<height ? width : height/mBmpRatio; |
170 |
mScale.set( factor,factor,factor ); |
|
174 |
mScaleMatrix.set( factor,factor,factor );
|
|
171 | 175 |
mScreen.resize(width, height); |
172 | 176 |
} |
173 | 177 |
|
... | ... | |
194 | 198 |
mBmpRatio = (float)bitmap.getHeight()/bitmap.getWidth(); |
195 | 199 |
mTexture.setTexture(bitmap); |
196 | 200 |
|
197 |
if( mMesh==null ) |
|
198 |
{ |
|
199 |
mMesh = new MeshRectangles(30, (int)(30*mBmpRatio)); |
|
200 |
mMesh.setStretch(1.0f,mBmpRatio,1.0f); |
|
201 |
} |
|
201 |
mScaleVertex.set(1.0f,mBmpRatio,1.0f); |
|
202 |
|
|
203 |
if( mMesh==null ) mMesh = new MeshRectangles(30, (int)(30*mBmpRatio)); |
|
202 | 204 |
|
203 | 205 |
mScreen.detachAll(); |
204 | 206 |
mScreen.attach(mTexture,mEffects,mMesh); |
205 | 207 |
|
208 |
DistortedLibrary.setMax(EffectType.VERTEX ,6); |
|
209 |
|
|
210 |
VertexEffectScale.enable(); |
|
206 | 211 |
VertexEffectDistort.enable(); |
207 | 212 |
VertexEffectSink.enable(); |
208 | 213 |
VertexEffectSwirl.enable(); |
Also available in: Unified diff
Convert Girl to stretchless API