Revision d79a56d3
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
159 | 159 |
|
160 | 160 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
161 | 161 |
{ |
162 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
163 |
|
|
164 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
165 |
{ |
|
166 |
int w = (height*bmpWidth)/bmpHeight; |
|
167 |
float factor = (float)height/bmpHeight; |
|
168 |
|
|
169 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
170 |
mEffects.scale(factor); |
|
171 |
} |
|
172 |
else |
|
173 |
{ |
|
174 |
int h = (width*bmpHeight)/bmpWidth; |
|
175 |
float factor = (float)width/bmpWidth; |
|
162 |
float qx = (float)width /bmpWidth; |
|
163 |
float qy = (float)height/bmpHeight; |
|
176 | 164 |
|
177 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
178 |
mEffects.scale(factor); |
|
179 |
} |
|
165 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
166 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
180 | 167 |
|
181 | 168 |
mScreen.resize(width, height); |
182 | 169 |
} |
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.