Project

General

Profile

« Previous | Next » 

Revision 678c391d

Added by Leszek Koltunski about 4 years ago

Change the Postprocessing effects: separate the radius and the halo.
Reason: we needed a way to specify the size of the halo around a postprocessed object; before it was automatically (and not very correctly) computed from the radius - before we knew the size of the object's bounding box, so this automatic computation was possible. Now we're removing the MashBase.getBounding(0 API, so the size of the halo has to be explicitly given by the user. This way is more correct anyway and gives the user more control (as the Multiblur app proves!)

Warning: here for the first time I can see that the 2 Examples (PostprocessingTree and MovingGlow) sometimes would not appear (black screen). Maybe this commit introduces such a bug - investigate.

View differences:

src/main/java/org/distorted/examples/generic/GenericEffect.java
141 141
      case CONTRAST         : effect = new FragmentEffectContrast  (mDyn1,        mCenterDyn, mRegion3Dyn, false); break;
142 142
      case SMOOTH_CONTRAST  : effect = new FragmentEffectContrast  (mDyn1,        mCenterDyn, mRegion3Dyn, true ); break;
143 143

  
144
      case BLUR             : effect = new PostprocessEffectBlur   (mDyn1       ); break;
145
      case GLOW             : effect = new PostprocessEffectGlow   (mDyn1, mDyn4); break;
144
      case BLUR             : effect = new PostprocessEffectBlur   (mDyn2      ); break;
145
      case GLOW             : effect = new PostprocessEffectGlow   (mDyn2,mDyn4); break;
146 146
      }
147 147

  
148 148
    if( effect!=null )
......
264 264
      // POSTPROCESS
265 265
      ///////////////////////////////////////////////////////////////////////////////////////
266 266

  
267
      case BLUR             : mSta1.set(mInter[0]/2.0f);
267
      case BLUR             : mSta2.set(mInter[0]/2.0f,
268
                                        mInter[1]/2.0f);
268 269
                              break;
269
      case GLOW             : mSta1.set(mInter[0]/2.0f);
270
                              mSta4.set(mInter[1]/100.0f,
271
                                        mInter[2]/100.0f,
270
      case GLOW             : mSta2.set(mInter[0]/2.0f,
271
                                        mInter[1]/2.0f);
272
                              mSta4.set(mInter[2]/100.0f,
272 273
                                        mInter[3]/100.0f,
273
                                        mInter[4]/100.0f );
274
                                        mInter[4]/100.0f,
275
                                        mInter[5]/100.0f );
274 276
                              break;
275 277
      }
276 278
    }
......
281 283
    {
282 284
    switch(mDimension)
283 285
      {
286
      case 6: mInter[5] = 50;
284 287
      case 5: mInter[4] = 50;
285 288
      case 4: mInter[3] = 50;
286 289
      case 3: mInter[2] = 50;
......
531 534
                 mDyn1.add(mSta1);
532 535
                 }
533 536
               break;
537
      case 6 : mDyn2 = new Dynamic2D();
538
               mSta2 = new Static2D(0,0);
539
               mDyn2.add(mSta2);
540
               mDyn4 = new Dynamic4D();
541
               mSta4 = new Static4D(0,0,0,0);
542
               mDyn4.add(mSta4);
543
               break;
534 544
      default: throw new RuntimeException("unsupported effect");
535 545
      }
536 546

  
......
618 628
               mSeekID[4] = seek[4].getId();
619 629
               mButton    = mEffect.findViewById(R.id.button5dRemove);
620 630
               break;
631
      case 6 : mEffect    = act.getLayoutInflater().inflate(R.layout.effect6d, null);
632
               mText      = mEffect.findViewById(R.id.effect6dText);
633
               seek[0]    = mEffect.findViewById(R.id.effect6dbar1);
634
               seek[1]    = mEffect.findViewById(R.id.effect6dbar2);
635
               seek[2]    = mEffect.findViewById(R.id.effect6dbar3);
636
               seek[3]    = mEffect.findViewById(R.id.effect6dbar4);
637
               seek[4]    = mEffect.findViewById(R.id.effect6dbar5);
638
               seek[5]    = mEffect.findViewById(R.id.effect6dbar6);
639
               mSeekID[0] = seek[0].getId();
640
               mSeekID[1] = seek[1].getId();
641
               mSeekID[2] = seek[2].getId();
642
               mSeekID[3] = seek[3].getId();
643
               mSeekID[4] = seek[4].getId();
644
               mSeekID[5] = seek[5].getId();
645
               mButton    = mEffect.findViewById(R.id.button6dRemove);
646
               break;
621 647
      default: android.util.Log.e("GenericEffect", "dimension "+mDimension+" not supported!");
622 648
               return null;
623 649
      }
......
743 769
    boolean regionChanged=false;
744 770
    boolean centerChanged=false;
745 771

  
746
    for(int dim=0; dim<5; dim++)
772
    for(int dim=0; dim<6; dim++)
747 773
      {
748 774
      if ( mDimension>dim && bar.getId()==mSeekID[dim] )
749 775
        {

Also available in: Unified diff