Revision 39a0d81b
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
150 | 150 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
151 | 151 |
{ |
152 | 152 |
mScreenMin = width<height ? width:height; |
153 |
|
|
154 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
155 |
float factor; |
|
156 |
|
|
157 |
if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object |
|
158 |
{ |
|
159 |
factor = (0.8f*height)/mObjHeight; |
|
160 |
} |
|
161 |
else |
|
162 |
{ |
|
163 |
factor = (0.8f*width)/mObjWidth; |
|
164 |
} |
|
165 | 153 |
|
166 |
mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
|
|
167 |
mEffects.scale(factor);
|
|
168 |
Static3D center = new Static3D(mObjWidth/2,mObjHeight/2, 0);
|
|
154 |
float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
|
|
155 |
float scale = 0.8f;
|
|
156 |
Static3D center = new Static3D(0,0,0);
|
|
169 | 157 |
|
158 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
170 | 159 |
mEffects.quaternion(mQuatInt1, center); |
171 | 160 |
mEffects.quaternion(mQuatInt2, center); |
172 |
|
|
161 |
mEffects.scale( q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) ); |
|
162 |
|
|
173 | 163 |
mScreen.resize(width, height); |
174 | 164 |
} |
175 | 165 |
|
Also available in: Unified diff
Convert next 4 APPs to the new Matrix effects.