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/cubes/CubesRenderer.java
96 96
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
97 97
      {
98 98
      mScreenMin = width<height ? width:height;
99
    	
100
      mEffects.abortEffects(EffectTypes.MATRIX);
101
      float factor;
102

  
103
      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
104
        {
105
        factor = (0.75f*height)/mObjHeight;
106
        }
107
      else
108
        {
109
        factor = (0.75f*width)/mObjWidth;
110
        }
99 111

  
100
    	float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
101
      float scale = 0.7f;
102
      Static3D center = new Static3D(0,0,0);
112
      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
113
      mEffects.scale(factor);
114
      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
103 115

  
104
      mEffects.abortEffects(EffectTypes.MATRIX);
105 116
      mEffects.quaternion(mQuatInt1, center);
106 117
      mEffects.quaternion(mQuatInt2, center);
107
      mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
108

  
118
       
109 119
      mScreen.resize(width, height);
110 120
      }
111 121

  
src/main/java/org/distorted/examples/flag/FlagRenderer.java
150 150
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
151 151
      {
152 152
      mScreenMin = width<height ? width:height;
153
    	
154
      mEffects.abortEffects(EffectTypes.MATRIX);
155
      float factor;
156

  
157
      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
158
        {
159
        factor = (0.8f*height)/mObjHeight;
160
        }
161
      else
162
        {
163
        factor = (0.8f*width)/mObjWidth;
164
        }
153 165

  
154
    	float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
155
      float scale = 0.8f;
156
      Static3D center = new Static3D(0,0,0);
166
      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
167
      mEffects.scale(factor);
168
      Static3D center = new Static3D(mObjWidth/2,mObjHeight/2, 0);
157 169

  
158
      mEffects.abortEffects(EffectTypes.MATRIX);
159 170
      mEffects.quaternion(mQuatInt1, center);
160 171
      mEffects.quaternion(mQuatInt2, center);
161
      mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
162

  
172
       
163 173
      mScreen.resize(width, height);
164 174
      }
165 175

  
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
50 50
      if( savedState==null )
51 51
        {
52 52
        distanceBar.setProgress(50);
53
        rangeBar.setProgress(50);
53
        rangeBar.setProgress(10);
54 54
        }
55 55
      }
56 56

  
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

  
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
98 98
    
99 99
  public void onSurfaceChanged(GL10 glUnused, int width, int height) 
100 100
    {
101
    float q= (float)width/height;
101
    float qx = (float)width ;
102
    float qy = (float)height;
102 103
    float scale = 0.5f;
103 104

  
104 105
    mEffects.abortEffects(EffectTypes.MATRIX);
105 106
    mEffects.quaternion( mRot, new Static3D(0,0,0) );
106
    mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
107
    mEffects.scale(  qx<qy ? (new Static3D(scale,scale*qx/qy,scale)) : (new Static3D(scale*qy/qx,scale,scale)) );
107 108

  
108 109
    mScreen.resize(width, height);
109 110
    }

Also available in: Unified diff