Project

General

Profile

« Previous | Next » 

Revision e11b37f4

Added by Leszek Koltunski almost 8 years ago

Beginnings of the 'Multiblur' app.

View differences:

src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
59 59
        };
60 60

  
61 61
    private static final int NUM_OBJECTS = MOVE_VEC.length/3;
62
    private static final int OBJ_SIZE    = 100;
62 63

  
63 64
    private GLSurfaceView mView;
64 65
    private DistortedTexture mTex1, mTex2;
......
67 68
    private MeshObject mMesh;
68 69
    private DistortedFramebuffer mScreen;
69 70
    private DynamicQuat mQuatInt1, mQuatInt2;
70
    private int mObjWidth, mObjHeight;
71 71

  
72 72
    Static4D mQuat1, mQuat2;
73 73
    int mScreenMin;
......
86 86

  
87 87
      mMesh = new MeshCubes(1,1,false);
88 88

  
89
      mTex1 = new DistortedTexture(100,100);
90
      mTex2 = new DistortedTexture(100,100);
91

  
92
      mObjWidth = mTex1.getWidth();
93
      mObjHeight= mTex2.getHeight();
89
      mTex1 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
90
      mTex2 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
94 91

  
95 92
      mQuat1 = new Static4D(0,0,0,1);  // unity
96 93
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
......
122 119
      {
123 120
      mScreenMin = width<height ? width:height;
124 121
    	
125
      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
126
      float factor = Math.min((0.15f*height)/mObjHeight,(0.15f*width )/mObjWidth);
127
      float xMove  =(width -factor*mObjWidth )/2;
128
      float yMove  =(height-factor*mObjHeight)/2;
129
      float size   = 1.3f*mObjWidth;
122
      Static3D center = new Static3D( (float)OBJ_SIZE/2, (float)OBJ_SIZE/2, 0.0f );
123
      float factor = 0.15f*mScreenMin/OBJ_SIZE;
124
      float xMove  =(width -factor*OBJ_SIZE)/2;
125
      float yMove  =(height-factor*OBJ_SIZE)/2;
126
      float size   = 1.3f*OBJ_SIZE;
130 127

  
131 128
      for(int i=0; i<NUM_OBJECTS; i++)
132 129
        {

Also available in: Unified diff