Project

General

Profile

« Previous | Next » 

Revision 30c47368

Added by Leszek Koltunski over 7 years ago

Fix 'EffectQueue' APP. Now 30 out of 31 APPs work.

View differences:

src/main/java/org/distorted/examples/effectqueue/EffectQueueSurfaceView.java
24 24
import android.view.MotionEvent;
25 25
import android.util.AttributeSet;
26 26

  
27
import org.distorted.library.effect.EffectName;
28
import org.distorted.library.effect.EffectType;
29 27
import org.distorted.library.effect.FragmentEffectAlpha;
30 28
import org.distorted.library.effect.FragmentEffectChroma;
31 29
import org.distorted.library.effect.FragmentEffectSaturation;
......
41 39

  
42 40
public class EffectQueueSurfaceView extends GLSurfaceView
43 41
  {
42
  private static final int RADIUS = 60;
43

  
44 44
  private EffectQueueRenderer mRenderer;
45 45
  private int mCurrentEffect;
46 46
  private int mScrW, mScrH;
47 47
    
48
  private Static4D mRegionV, mRegionF;
49
  private Static3D mPoint;
48
  private Static4D mRegionV;
50 49
  private Dynamic1D mInterA, mInterB, mInterC, mInterS;
51 50
  private Dynamic3D mInterD;
52 51

  
......
90 89
      {
91 90
      setFocusable(true);
92 91
      setFocusableInTouchMode(true);
93

  
94 92
      mRenderer = new EffectQueueRenderer(this);
95 93
      setRenderer(mRenderer);
96

  
97
      mPoint  = new Static3D(0,0,0);
98
      mRegionV= new Static4D(0,0,60,60);
99
      mRegionF= new Static4D(0,0,60,60);
100
        
94
      mRegionV= new Static4D(0,0,RADIUS,RADIUS);
101 95
      setEffect(0);  
102 96
      }
103 97
    }
......
135 129
      {
136 130
      case MotionEvent.ACTION_DOWN: x = (int)event.getX()* mRenderer.BWID/mScrW;
137 131
                                    y = (int)event.getY()* mRenderer.BHEI/mScrH;
138
                                    mPoint.set(x,y,0);
139
                                    mRegionF.set(x,y,60,60);
140 132
                                    EffectQueueActivity act = (EffectQueueActivity)getContext();
141 133

  
142 134
                                    switch(mCurrentEffect)
143 135
                                      {
144
                                      case 0: VertexEffectDistort distort = new VertexEffectDistort(mInterD, mPoint, mRegionV);
136
                                      case 0: VertexEffectDistort distort = new VertexEffectDistort(mInterD, new Static3D(x,y,0), mRegionV);
145 137
                                              success = mRenderer.getEffects().apply(distort);
146 138
                                              act.effectAdded(success,distort);
147 139
                                              break;
148
                                      case 1: VertexEffectSink sink = new VertexEffectSink(mInterS, mPoint, mRegionV);
140
                                      case 1: VertexEffectSink sink = new VertexEffectSink(mInterS, new Static3D(x,y,0), mRegionV);
149 141
                                              success = mRenderer.getEffects().apply(sink);
150 142
                                              act.effectAdded(success,sink);
151 143
                                              break;
152
                                      case 2: FragmentEffectAlpha alpha = new FragmentEffectAlpha(mInterA, mRegionF, true);
144
                                      case 2: FragmentEffectAlpha alpha = new FragmentEffectAlpha(mInterA, new Static4D(x,y,RADIUS,RADIUS), true);
153 145
                                              success = mRenderer.getEffects().apply(alpha);
154 146
                                              act.effectAdded(success,alpha);
155 147
                                              break;
156
                                      case 3: FragmentEffectSaturation saturation = new FragmentEffectSaturation(mInterB, mRegionF, false);
148
                                      case 3: FragmentEffectSaturation saturation = new FragmentEffectSaturation(mInterB, new Static4D(x,y,RADIUS,RADIUS), false);
157 149
                                              success = mRenderer.getEffects().apply(saturation);
158 150
                                              act.effectAdded(success,saturation);
159 151
                                              break;
160
                                      case 4: FragmentEffectChroma chroma = new FragmentEffectChroma(mInterC, mRED, mRegionF, true);
152
                                      case 4: FragmentEffectChroma chroma = new FragmentEffectChroma(mInterC, mRED, new Static4D(x,y,RADIUS,RADIUS), true);
161 153
                                              success = mRenderer.getEffects().apply(chroma);
162 154
                                              act.effectAdded(success,chroma);
163 155
                                              break;

Also available in: Unified diff