Project

General

Profile

« Previous | Next » 

Revision dea953f4

Added by Leszek Koltunski over 7 years ago

Improvements for Multiblur.

View differences:

src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
42 42
      setContentView(R.layout.multiblurlayout);
43 43

  
44 44
      SeekBar distanceBar = (SeekBar)findViewById(R.id.multiblurDistanceSeek);
45
      SeekBar rangeBar    = (SeekBar)findViewById(R.id.multiblurRangeSeek);
46

  
45 47
      distanceBar.setOnSeekBarChangeListener(this);
46
      distanceBar.setProgress(50);
47
      SeekBar rangeBar = (SeekBar)findViewById(R.id.multiblurRangeSeek);
48 48
      rangeBar.setOnSeekBarChangeListener(this);
49
      rangeBar.setProgress(10);
49

  
50
      if( savedState==null )
51
        {
52
        distanceBar.setProgress(50);
53
        rangeBar.setProgress(10);
54
        }
50 55
      }
51 56

  
52 57
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
202 202

  
203 203
    private void computeMoveVectors()
204 204
      {
205
      float size= 1.3f*OBJ_SIZE*(mDistance/50.0f);
205
      float size= 0.026f*OBJ_SIZE*mDistance;
206 206

  
207 207
      for(int i=0; i<NUM_OBJECTS; i++)
208 208
        {
......
210 210
        }
211 211
      }
212 212

  
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214

  
215
    int getDistance()
216
      {
217
      return mDistance;
218
      }
219

  
220 213
///////////////////////////////////////////////////////////////////////////////////////////////////
221 214

  
222 215
    void setDistance(int distance)
223 216
      {
224 217
      mDistance = distance;
225 218
      computeMoveVectors();
226
      android.util.Log.e("renderer", "distance: "+distance);
227
      }
228 219

  
229
///////////////////////////////////////////////////////////////////////////////////////////////////
230

  
231
    int getRange()
232
      {
233
      return (int)mBlurVector.getX();
220
      //android.util.Log.d("renderer", "distance: "+distance);
234 221
      }
235 222

  
236 223
///////////////////////////////////////////////////////////////////////////////////////////////////
......
238 225
    void setRange(int range)
239 226
      {
240 227
      mBlurVector.set(range);
241
      android.util.Log.e("renderer", "range: "+range);
228

  
229
      //android.util.Log.d("renderer", "range: "+range);
242 230
      }
243 231

  
244 232
///////////////////////////////////////////////////////////////////////////////////////////////////
......
254 242
     {
255 243
     if( number>=0 && number<=7 && mEffects!=null )
256 244
       {
257
       if( checked )
245
       if( checked && !mBlurStatus[number] )
258 246
         {
259
         if( !mBlurStatus[number] )
260
           {
261
           mBlurStatus[number] = true;
262
           mEffects[number].blur(mBlurDynamic);
263
           }
264
         else
265
           {
266
           android.util.Log.e("renderer", "Error, failed to add BLUR effect, number: "+number );
267
           }
247
         mBlurStatus[number] = true;
248
         mEffects[number].blur(mBlurDynamic);
268 249
         }
269
       else
250
       if( !checked && mBlurStatus[number] )
270 251
         {
271
         if( mBlurStatus[number] )
272
           {
273
           mBlurStatus[number] = false;
274
           mEffects[number].abortEffects(EffectNames.BLUR);
275
           }
276
         else
277
           {
278
           android.util.Log.e("renderer", "Error, failed to remove BLUR effect, number: "+number );
279
           }
252
         mBlurStatus[number] = false;
253
         mEffects[number].abortEffects(EffectNames.BLUR);
280 254
         }
281 255
       }
282 256
     else
283 257
       {
284 258
       android.util.Log.e("renderer", "Error, number: "+number+" checked: "+checked+" mEffects="+ (mEffects==null ? "null":"not null") );
285 259
       }
260

  
261
     //android.util.Log.d("renderer", "setting box "+number+" BLUR state to "+checked);
286 262
     }
287 263
}

Also available in: Unified diff