Project

General

Profile

« Previous | Next » 

Revision 7589635e

Added by Leszek Koltunski almost 8 years ago

Major push towards simplifying DistortedObject's public API.
All MATRIX effects are using the new API - the 'DataND' marker interfaces.

View differences:

src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
34 34
import org.distorted.library.Distorted;
35 35
import org.distorted.library.DistortedBitmap;
36 36
import org.distorted.library.EffectTypes;
37
import org.distorted.library.type.Float2D;
38
import org.distorted.library.type.Float3D;
39
import org.distorted.library.type.Float4D;
37
import org.distorted.library.type.Static2D;
38
import org.distorted.library.type.Static3D;
39
import org.distorted.library.type.Static4D;
40 40
import org.distorted.examples.R;
41 41

  
42 42
import java.io.IOException;
......
63 63
  private DistortedBitmap monaLisa;
64 64
  private int bmpHeight, bmpWidth;
65 65

  
66
  private Float2D pLeft, pRight;
67
  private Float4D rLeft, rRight;
68
  private Float3D vLeft, vRight;
66
  private Static2D pLeft, pRight;
67
  private Static4D rLeft, rRight;
68
  private Static3D vLeft, vRight;
69 69

  
70 70
  SurfaceView mView;
71 71

  
......
76 76
    mSurfaceHolder = holder;
77 77
    mView = view;
78 78

  
79
    pLeft = new Float2D( 90, 258);
80
    pRight= new Float2D(176, 255);
79
    pLeft = new Static2D( 90, 258);
80
    pRight= new Static2D(176, 255);
81 81

  
82
    rLeft = new Float4D(-10,-10,25,25);
83
    rRight= new Float4D( 10, -5,25,25);
82
    rLeft = new Static4D(-10,-10,25,25);
83
    rRight= new Static4D( 10, -5,25,25);
84 84

  
85
    vLeft = new Float3D(-20,-20,0);
86
    vRight= new Float3D( 20,-10,0);
85
    vLeft = new Static3D(-20,-20,0);
86
    vRight= new Static3D( 20,-10,0);
87 87
    }
88 88

  
89 89
///////////////////////////////////////////////////////////////////////////////////////////////////
......
208 208
    if( bmpHeight/bmpWidth > height/width )
209 209
      {
210 210
      int w = (height*bmpWidth)/bmpHeight;
211
      monaLisa.move((width-w)/2 ,0, 0);
212
      monaLisa.scale((float)height/bmpHeight);
211
      float factor = (float)height/bmpHeight;
212

  
213
      monaLisa.move( new Static3D((width-w)/2,0,0) );
214
      monaLisa.scale( new Static3D(factor,factor,factor) );
213 215
      }
214 216
    else
215 217
      {
216 218
      int h = (width*bmpHeight)/bmpWidth;
217
      monaLisa.move(0 ,(height-h)/2, 0);
218
      monaLisa.scale((float)width/bmpWidth);
219
      float factor = (float)width/bmpWidth;
220

  
221
      monaLisa.move( new Static3D(0,(height-h)/2,0) );
222
      monaLisa.scale( new Static3D(factor,factor,factor) );
219 223
      }
220 224

  
221 225
    Distorted.onSurfaceChanged(width, height);

Also available in: Unified diff