Project

General

Profile

« Previous | Next » 

Revision 8c1caf83

Added by Leszek Koltunski about 7 years ago

Revert "Convert next 4 APPs to the new Matrix effects."

This reverts commit 39a0d81b7482f2925808d661e526aeaa980fb079.

View differences:

src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
68 68
        };
69 69

  
70 70
    private static final int NUM_OBJECTS = MOVE_VEC.length/3;
71
    private static final int OBJ_SIZE    = 100;
71 72

  
72 73
    private GLSurfaceView mView;
73 74
    private DistortedTexture mTex1, mTex2;
......
82 83
    private DynamicQuat mQuatInt1, mQuatInt2;
83 84
    private int mDistance;
84 85
    private boolean[] mBlurStatus;
85
    private int mScreenW, mScreenH;
86 86

  
87 87
    Static4D mQuat1, mQuat2;
88 88
    int mScreenMin;
......
114 114
      fpsTexture.setTexture(fpsBitmap);
115 115
      fpsCanvas = new Canvas(fpsBitmap);
116 116
      fpsEffects = new DistortedEffects();
117
      fpsEffects.move( new Static3D(5,5,0) );
117 118
      durations = new long[NUM_FRAMES+1];
118 119
      currDuration = 0;
119 120

  
......
148 149

  
149 150
      MeshCubes mesh = new MeshCubes(1,1,false);
150 151

  
151
      mTex1 = new DistortedTexture(1,1);
152
      mTex2 = new DistortedTexture(1,1);
152
      mTex1 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
153
      mTex2 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
153 154

  
154 155
      mQuat1 = new Static4D(0,0,0,1);  // unity
155 156
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
......
195 196
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
196 197
      {
197 198
      mScreenMin = width<height ? width:height;
198
      mScreenW = width;
199
      mScreenH = height;
200 199

  
201
      fpsEffects.abortAllEffects();
202
      fpsEffects.move(  new Static3D( -0.5f + (fpsW/2 + 5.0f)/width, -0.5f + (fpsH/2 + 5.0f)/height,0.0f) );
203
      fpsEffects.scale( new Static3D( (float)fpsW/width, (float)fpsH/height, 1.0f) );
204

  
205
      float q= (float)width/height;
206
      float scale = 0.15f;
207
      Static3D center = new Static3D(0,0,0);
208
      Static3D factor = (q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)));
200
    	float factor    = 0.15f*mScreenMin/OBJ_SIZE;
201
      Static3D center = new Static3D( (float)OBJ_SIZE/2, (float)OBJ_SIZE/2, 0.0f );
202
      Static3D moveVec= new Static3D( (width -factor*OBJ_SIZE)/2 ,(height-factor*OBJ_SIZE)/2 ,0);
209 203

  
210 204
      for(int i=0; i<NUM_OBJECTS; i++)
211 205
        {
212 206
        mEffects[i].abortEffects(EffectTypes.MATRIX);
213 207

  
208
        mEffects[i].move(moveVec);
209
        mEffects[i].scale(factor);
214 210
        mEffects[i].quaternion(mQuatInt1, center);
215 211
        mEffects[i].quaternion(mQuatInt2, center);
216 212
        mEffects[i].move(mMoveDynamic[i]);
217
        mEffects[i].scale(factor);
218 213
        }
219 214

  
220 215
      computeMoveVectors();
......
280 275

  
281 276
    private void computeMoveVectors()
282 277
      {
283
      float size = 2.6f*mDistance;
284
      float sizeX= size/mScreenW;
285
      float sizeY= size/mScreenH;
278
      float size= 0.026f*OBJ_SIZE*mDistance;
286 279

  
287 280
      for(int i=0; i<NUM_OBJECTS; i++)
288 281
        {
289
        mMoveVector[i].set(sizeX*MOVE_VEC[3*i], sizeY*MOVE_VEC[3*i+1], sizeX*MOVE_VEC[3*i+2]);
282
        mMoveVector[i].set(size*MOVE_VEC[3*i], size*MOVE_VEC[3*i+1], size*MOVE_VEC[3*i+2]);
290 283
        }
291 284
      }
292 285

  

Also available in: Unified diff