Project

General

Profile

« Previous | Next » 

Revision d79a56d3

Added by Leszek Koltunski about 7 years ago

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.

View differences:

src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
86 86
///////////////////////////////////////////////////////////////////////////////////////////////////
87 87
    
88 88
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
89
      { 
90
      mEffects.abortEffects(EffectTypes.MATRIX);
89
      {
90
      float qx = (float)width /bmpWidth;
91
      float qy = (float)height/bmpHeight;
91 92

  
92
      if( (float)bmpHeight/bmpWidth > (float)height/width )
93
        {
94
        int w = (height*bmpWidth)/bmpHeight;
95
        float factor = (float)height/bmpHeight;
96
        mEffects.move( new Static3D((width-w)/2,0,0) );
97
        mEffects.scale(factor);
98
        }
99
      else
100
        {
101
        int h = (width*bmpHeight)/bmpWidth;
102
        float factor = (float)width/bmpWidth;
103
        mEffects.move( new Static3D(0,(height-h)/2,0) );
104
        mEffects.scale(factor);
105
        }
93
      mEffects.abortEffects(EffectTypes.MATRIX);
94
      mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
106 95

  
107 96
      mScreen.resize(width, height);
108 97
      }

Also available in: Unified diff