Revision 0de83d97
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
24 | 24 |
import android.opengl.GLSurfaceView; |
25 | 25 |
|
26 | 26 |
import org.distorted.examples.R; |
27 |
import org.distorted.library.effect.MatrixEffectMove; |
|
28 | 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
29 | 28 |
import org.distorted.library.effect.MatrixEffectScale; |
30 | 29 |
import org.distorted.library.effect.VertexEffectWave; |
... | ... | |
55 | 54 |
private Dynamic5D mWaveDyn; |
56 | 55 |
private Static5D mWaveSta1, mWaveSta2; |
57 | 56 |
private int mObjWidth, mObjHeight; |
58 |
private Static3D mMove, mScale, mCenter;
|
|
57 |
private Static3D mScale;
|
|
59 | 58 |
|
60 | 59 |
Static4D mQuat1, mQuat2; |
61 | 60 |
int mScreenMin; |
... | ... | |
88 | 87 |
DistortedEffects effects = new DistortedEffects(); |
89 | 88 |
effects.apply( new VertexEffectWave(mWaveDyn, waveCenter, waveRegion) ); |
90 | 89 |
|
91 |
mMove = new Static3D(0,0,0); |
|
92 | 90 |
mScale = new Static3D(1,1,1); |
93 |
mCenter= new Static3D(0,0,0);
|
|
91 |
Static3D center= new Static3D(0,0,0);
|
|
94 | 92 |
|
95 |
effects.apply( new MatrixEffectMove(mMove)); |
|
96 | 93 |
effects.apply( new MatrixEffectScale(mScale)); |
97 |
effects.apply( new MatrixEffectQuaternion(mQuat1, mCenter) );
|
|
98 |
effects.apply( new MatrixEffectQuaternion(mQuat2, mCenter) );
|
|
94 |
effects.apply( new MatrixEffectQuaternion(mQuat1, center) );
|
|
95 |
effects.apply( new MatrixEffectQuaternion(mQuat2, center) );
|
|
99 | 96 |
|
100 | 97 |
final int GRIDX = 50; |
101 | 98 |
final int GRIDY = 30; |
... | ... | |
160 | 157 |
{ |
161 | 158 |
mScreenMin = width<height ? width:height; |
162 | 159 |
float factor = ( width*mObjHeight > height*mObjWidth ) ? (0.8f*height)/mObjHeight : (0.8f*width)/mObjWidth; |
163 |
mMove.set((width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0); |
|
164 | 160 |
mScale.set(factor,factor,factor); |
165 |
mCenter.set(mObjWidth/2,mObjHeight/2, 0); |
|
166 | 161 |
mScreen.resize(width, height); |
167 | 162 |
} |
168 | 163 |
|
Also available in: Unified diff
Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.