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/sink/SinkRenderer.java
78 78
///////////////////////////////////////////////////////////////////////////////////////////////////
79 79
    
80 80
  public void onSurfaceChanged(GL10 glUnused, int width, int height) 
81
    { 
82
    mEffects.abortEffects(EffectTypes.MATRIX);
83
         
84
    if( (float)bmpHeight/bmpWidth > (float)height/width )
85
      {
86
      int w = (height*bmpWidth)/bmpHeight;
87
      float factor = (float)height/bmpHeight;
81
    {
82
    float qx = (float)width /bmpWidth;
83
    float qy = (float)height/bmpHeight;
88 84

  
89
      mEffects.move( new Static3D((width-w)/2,0,0) );
90
      mEffects.scale( factor );
91
      }
92
    else
93
      {
94
      int h = (width*bmpHeight)/bmpWidth;
95
      float factor = (float)width/bmpWidth;
85
    mEffects.abortEffects(EffectTypes.MATRIX);
86
    mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
96 87

  
97
      mEffects.move( new Static3D(0,(height-h)/2,0) );
98
      mEffects.scale( factor );
99
      }
100
      
101 88
    mScreen.resize(width, height);
102 89
    }
103 90

  

Also available in: Unified diff