Project

General

Profile

« Previous | Next » 

Revision a4d59c0b

Added by Leszek Koltunski over 5 years ago

Massive: make the coordinate system agree with that of OpenGL (i.e. invert the Y axis).

View differences:

src/main/java/org/distorted/examples/check/CheckRenderer.java
143 143
///////////////////////////////////////////////////////////////////////////////////////////////////
144 144
    
145 145
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
146
      { 
147
      if( (float)mObjHeight/mObjWidth > (float)height/width )
148
        {
149
        int w = (height*mObjWidth)/mObjHeight;
150
        float factor = (float)height/mObjHeight;
151
        mMove.set((width-w)/2,0,0);
152
        mScale.set(factor,factor,factor);
153
        }
154
      else
155
        {
156
        int h = (width*mObjHeight)/mObjWidth;
157
        float factor = (float)width/mObjWidth;
158
        mMove.set(0,(height-h)/2,0);
159
        mScale.set(factor,factor,factor);
160
        }
146
      {
147
      final float SCALE = 0.9f;
148

  
149
      float xW = (float)width /mObjWidth;
150
      float xH = (float)height/mObjHeight;
151

  
152
      float factor = xW>xH ? SCALE*xH : SCALE*xW;
153

  
154
      mMove.set( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0);
155
      mScale.set(factor,factor,factor);
161 156

  
162 157
      mScreen.resize(width,height);
163 158
      }
......
196 191
      mSwirl1.set (          0, mObjHeight/2, 0);
197 192
      mSwirl2.set (mObjWidth  , mObjHeight/2, 0);
198 193
      mDeform1.set(          0,         0   , 0);
199
      mDeform2.set(          0,-mObjHeight  , 0);
194
      mDeform2.set(          0, mObjHeight  , 0);
200 195
      mCenter.set (mObjWidth/2,         0   , 0);
201 196

  
202 197
      try

Also available in: Unified diff