Project

General

Profile

« Previous | Next » 

Revision 16b22aab

Added by Leszek Koltunski about 5 years ago

Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.

View differences:

src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
58 58
   private DistortedTexture mTexture;
59 59
   private MeshFlat mMesh;
60 60
   private DistortedScreen mScreen;
61
   private int bmpHeight, bmpWidth;
62 61
   private Static3D mScale;
63 62
   private Static3D[] mMove;
64 63

  
......
131 130
    
132 131
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
133 132
     {
134
     if( (float)bmpHeight/(NUM*bmpWidth) > (float)height/width )
135
       {
136
       int w = (height*bmpWidth)/bmpHeight;
137
       float factor = (float)height/bmpHeight;
138
       mScale.set(factor,factor,factor);
139
       for(int i=NUM-1; i>=0; i--) mMove[i].set((width-NUM*w)/2 +i*w , 0, 0);
140
       }
141
     else
142
       {
143
       int w = width/NUM;
144
       int h = (width*bmpHeight)/(bmpWidth*NUM);
145
       float factor = (float)width/(bmpWidth*NUM);
146
       mScale.set(factor,factor,factor);
147
       for(int i=NUM-1; i>=0; i--) mMove[i].set(i*w, (height-h)/2, 0);
148
       }
149
       
133
     float horiRatio = (float)width / (NUM*mTexture.getWidth());
134
     float vertRatio = (float)height/ (    mTexture.getHeight());
135
     float factor    = horiRatio > vertRatio ? vertRatio : horiRatio;
136

  
137
     mScale.set( factor,factor,factor );
138

  
139
     for(int i=NUM-1; i>=0; i--) mMove[i].set((i-(NUM-1)/2.0f)*(width/NUM), 0, 0);
140

  
150 141
     mScreen.resize(width, height);
151 142
     }
152 143

  
......
170 161
       catch(IOException e) { }
171 162
       }
172 163
      
173
     bmpHeight = bitmap.getHeight();
174
     bmpWidth  = bitmap.getWidth();
164
     int bmpHeight = bitmap.getHeight();
165
     int bmpWidth  = bitmap.getWidth();
175 166

  
176 167
     if( mMesh==null ) mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
177 168
     if( mTexture==null ) mTexture  = new DistortedTexture(bmpWidth,bmpHeight);

Also available in: Unified diff