Project

General

Profile

« Previous | Next » 

Revision 06c636a5

Added by Leszek Koltunski almost 6 years ago

More progress with Effects3D app.

View differences:

src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
37 37
import org.distorted.library.effect.MatrixEffectRotate;
38 38
import org.distorted.library.effect.MatrixEffectScale;
39 39
import org.distorted.library.effect.MatrixEffectShear;
40
import org.distorted.library.effect.PostprocessEffectBlur;
41
import org.distorted.library.effect.PostprocessEffectGlow;
40 42
import org.distorted.library.effect.VertexEffectDeform;
41 43
import org.distorted.library.effect.VertexEffectDistort;
42 44
import org.distorted.library.effect.VertexEffectPinch;
......
123 125
      case SMOOTH_SATURATION: effect = new FragmentEffectSaturation(mDyn1,        mRegionDyn, true ); break;
124 126
      case CONTRAST         : effect = new FragmentEffectContrast  (mDyn1,        mRegionDyn, false); break;
125 127
      case SMOOTH_CONTRAST  : effect = new FragmentEffectContrast  (mDyn1,        mRegionDyn, true ); break;
128

  
129
      case BLUR             : effect = new PostprocessEffectBlur   (mDyn1       ); break;
130
      case GLOW             : effect = new PostprocessEffectGlow   (mDyn1, mDyn4); break;
126 131
      }
127 132

  
128 133
    if( effect!=null )
......
139 144
    {
140 145
    switch(mName)
141 146
      {
147
      ///////////////////////////////////////////////////////////////////////////////////////
148
      // MATRIX
149
      ///////////////////////////////////////////////////////////////////////////////////////
150

  
142 151
      case ROTATE           : float an = (mInter[0]-50)*180/50;
143 152
                              float rx = (mInter[1]-50)/ 50.0f;
144 153
                              float ry = (mInter[2]-50)/ 50.0f;
......
173 182
                              mSta3.set(xsh,ysh,zsh);
174 183
                              break;
175 184

  
185
      ///////////////////////////////////////////////////////////////////////////////////////
186
      // VERTEX
187
      ///////////////////////////////////////////////////////////////////////////////////////
188

  
176 189
      case DISTORT          :
177 190
      case DEFORM           : float ld = mAct.get().getWidth()/50.0f;
178 191
                              float xd = (mInter[0]-50)*ld;
......
197 210
                              mSta2.set(dp,ap);
198 211
                              break;
199 212

  
213
      ///////////////////////////////////////////////////////////////////////////////////////
214
      // FRAGMENT
215
      ///////////////////////////////////////////////////////////////////////////////////////
216

  
200 217
      case ALPHA            :
201 218
      case SMOOTH_ALPHA     : mSta1.set(mInter[0]/100.0f);
202 219
                              break;
......
213 230
                                        mInter[2]/100.0f,
214 231
                                        mInter[3]/100.0f);
215 232
                              break;
233

  
234
      ///////////////////////////////////////////////////////////////////////////////////////
235
      // POSTPROCESS
236
      ///////////////////////////////////////////////////////////////////////////////////////
237

  
238
      case BLUR             : mSta1.set(mInter[0]/2.0f);
239
                              break;
240
      case GLOW             : mSta1.set(mInter[0]/2.0f);
241
                              mSta4.set(mInter[1]/100.0f,
242
                                        mInter[2]/100.0f,
243
                                        mInter[3]/100.0f,
244
                                        mInter[4]/100.0f );
245
                              break;
216 246
      }
217 247
    }
218 248

  
......
405 435
                 mDyn1.add(mSta1);
406 436
                 }
407 437
               break;
408
      case 5 : mDyn5 = new Dynamic5D();
409
               mSta5 = new Static5D(0,0,0,0,0);
410
               mDyn5.add(mSta5);
438
      case 5 : if( mName == EffectName.WAVE )
439
                 {
440
                 mDyn5 = new Dynamic5D();
441
                 mSta5 = new Static5D(0, 0, 0, 0, 0);
442
                 mDyn5.add(mSta5);
443
                 }
444
               else
445
                 {
446
                 mDyn4 = new Dynamic4D();
447
                 mSta4 = new Static4D(0,0,0,0);
448
                 mDyn4.add(mSta4);
449
                 mDyn1 = new Dynamic1D();
450
                 mSta1 = new Static1D(0);
451
                 mDyn1.add(mSta1);
452
                 }
411 453
               break;
412 454
      default: throw new RuntimeException("unsupported effect");
413 455
      }

Also available in: Unified diff