Revision 8c1caf83
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/cubes/CubesRenderer.java | ||
---|---|---|
96 | 96 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
97 | 97 |
{ |
98 | 98 |
mScreenMin = width<height ? width:height; |
99 |
|
|
100 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
101 |
float factor; |
|
102 |
|
|
103 |
if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object |
|
104 |
{ |
|
105 |
factor = (0.75f*height)/mObjHeight; |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
factor = (0.75f*width)/mObjWidth; |
|
110 |
} |
|
99 | 111 |
|
100 |
float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
|
|
101 |
float scale = 0.7f;
|
|
102 |
Static3D center = new Static3D(0,0,0);
|
|
112 |
mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
|
|
113 |
mEffects.scale(factor);
|
|
114 |
Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
|
|
103 | 115 |
|
104 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
105 | 116 |
mEffects.quaternion(mQuatInt1, center); |
106 | 117 |
mEffects.quaternion(mQuatInt2, center); |
107 |
mEffects.scale( q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) ); |
|
108 |
|
|
118 |
|
|
109 | 119 |
mScreen.resize(width, height); |
110 | 120 |
} |
111 | 121 |
|
Also available in: Unified diff
Revert "Convert next 4 APPs to the new Matrix effects."
This reverts commit 39a0d81b7482f2925808d661e526aeaa980fb079.