Project

General

Profile

« Previous | Next » 

Revision df80818c

Added by Leszek Koltunski about 4 years ago

Further corrections.

View differences:

src/main/java/org/distorted/examples/girl/GirlRenderer.java
61 61
    private float mBmpRatio;
62 62

  
63 63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
// girl bitmap: 400x600
64
// girl bitmap: 400x600 but we setStretch() the Mesh so
65 65

  
66 66
   GirlRenderer(GLSurfaceView v)
67 67
      {
68 68
      mView = v;
69 69

  
70
      Static3D pLeft = new Static3D(-68/400.0f, 36/600.0f, 0);
71
      Static3D pRight= new Static3D( 47/400.0f, 36/600.0f, 0);
70
      Static3D pLeft = new Static3D(-68/400.0f, 36/400.0f, 0);
71
      Static3D pRight= new Static3D( 47/400.0f, 36/400.0f, 0);
72 72

  
73 73
      // Size
74 74
      Static4D sinkRegion = new Static4D(0,0,0,60/400.0f);
......
100 100
      diR.add(v1);
101 101
      
102 102
      // Lower Movement
103
      Static3D pHips      = new Static3D( 16/400.0f,-205/600.0f,0);
103
      Static3D pHips      = new Static3D( 16/400.0f,-205/400.0f,0);
104 104
      Static4D HipsRegion = new Static4D(0,0,0,120/400.0f);
105 105
      Dynamic1D diHips    = new Dynamic1D(1500,0.0f);
106 106
      
......
166 166
    
167 167
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
168 168
     {
169
     if( width<height ) mScale.set( width,   width*mBmpRatio, width  );
170
     else               mScale.set( height/mBmpRatio, height, height );
171

  
169
     float factor = width<height ? width : height/mBmpRatio;
170
     mScale.set( factor,factor,factor );
172 171
     mScreen.resize(width, height);
173 172
     }
174 173

  
......
195 194
     mBmpRatio = (float)bitmap.getHeight()/bitmap.getWidth();
196 195
     mTexture.setTexture(bitmap);
197 196

  
198
     if( mMesh==null ) mMesh = new MeshRectangles(30, (int)(30*mBmpRatio));
197
     if( mMesh==null )
198
       {
199
       mMesh = new MeshRectangles(30, (int)(30*mBmpRatio));
200
       mMesh.setStretch(1.0f,mBmpRatio,1.0f);
201
       }
199 202

  
200 203
     mScreen.detachAll();
201 204
     mScreen.attach(mTexture,mEffects,mMesh);

Also available in: Unified diff