Project

General

Profile

« Previous | Next » 

Revision 630703d1

Added by Leszek Koltunski about 7 years ago

Revert "Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to."

This reverts commit d79a56d3bc6cc7a22b21abeb180353a1818bd6ad.

View differences:

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
      float qx = (float)width /bmpWidth;
163
      float qy = (float)height/bmpHeight;
164

  
165 162
      mEffects.abortEffects(EffectTypes.MATRIX);
166
      mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
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;
176

  
177
        mEffects.move( new Static3D(0,(height-h)/2,0) );
178
        mEffects.scale(factor);
179
        }
167 180
      
168 181
      mScreen.resize(width, height);
169 182
      }

Also available in: Unified diff