Revision d79a56d3
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
---|---|---|
102 | 102 |
|
103 | 103 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
104 | 104 |
{ |
105 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
106 |
|
|
107 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
108 |
{ |
|
109 |
int w = (height*bmpWidth)/bmpHeight; |
|
110 |
float factor = (float)height/bmpHeight; |
|
105 |
float qx = (float)width /bmpWidth; |
|
106 |
float qy = (float)height/bmpHeight; |
|
111 | 107 |
|
112 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
113 |
mEffects.scale(factor); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
int h = (width*bmpHeight)/bmpWidth; |
|
118 |
float factor = (float)width/bmpWidth; |
|
119 |
|
|
120 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
121 |
mEffects.scale(factor); |
|
122 |
} |
|
108 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
109 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
123 | 110 |
|
124 | 111 |
mScreen.resize(width, height); |
125 | 112 |
} |
Also available in: Unified diff
Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to.
Re-write the first 15 apps to work with this.