Project

General

Profile

« Previous | Next » 

Revision 7bf107f7

Added by Leszek Koltunski almost 8 years ago

Some more progress with porting apps to new VERTEX API.

View differences:

src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
38 38
import org.distorted.library.type.Static3D;
39 39
import org.distorted.library.type.Static4D;
40 40

  
41
///////////////////////////////////////////////////////////////////
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42 42

  
43 43
public class MovingEffectsSurfaceView extends GLSurfaceView
44 44
    {
......
57 57
    private static int xDown,yDown;
58 58
    private static int mScrW, mScrH;
59 59

  
60
    private static Dynamic1D macroDyn, alphaDyn;
61 60
    private static Dynamic2D di2D;
62
    private static Dynamic3D di3D;
63 61
    private static Static4D dr;
64

  
65 62
    private static Dynamic4D mRegion;
66 63

  
67 64
    private static Paint mPaint;
......
71 68
    
72 69
    private static int mCurrEffect;
73 70
    
74
///////////////////////////////////////////////////////////////////
71
///////////////////////////////////////////////////////////////////////////////////////////////////
75 72
    
76 73
    public MovingEffectsSurfaceView(Context c, AttributeSet attrs) 
77 74
      {
78 75
      super(c, attrs);
79 76

  
80
      macroDyn = new Dynamic1D();
81
      macroDyn.setDuration(0);
82
      macroDyn.setCount(0.5f);
83
      macroDyn.add(new Static1D(1));
84
      macroDyn.add(new Static1D(3));
85

  
86
      alphaDyn = new Dynamic1D();
87
      alphaDyn.setDuration(0);
88
      alphaDyn.setCount(0.5f);
89
      alphaDyn.add(new Static1D(1.0f));
90
      alphaDyn.add(new Static1D(0.5f));
91

  
92 77
      mCurrEffect=EFFECT_POINTS;
93 78
      mPaint = new Paint();
94 79
      mPaint.setStyle(Style.FILL);
......
97 82
      di2D = new Dynamic2D();
98 83
      di2D.setCount(0.0f);
99 84
      di2D.setDuration(LOOP_TIME);
100
      
101
      di3D = new Dynamic3D();
102
      di3D.add(new Static3D(0,0, 0));
103
      di3D.add(new Static3D(0,0,30));
104
      
85

  
105 86
      dr = new Static4D(0,0,60,60);
106 87

  
107 88
      mRegion = new Dynamic4D();
......
125 106
        }
126 107
      }
127 108

  
128
///////////////////////////////////////////////////////////////////
109
///////////////////////////////////////////////////////////////////////////////////////////////////
129 110

  
130 111
    public static void setScreenSize(int width, int height)
131 112
      {
......
133 114
      mScrH = height;
134 115
      }
135 116

  
136
///////////////////////////////////////////////////////////////////
117
///////////////////////////////////////////////////////////////////////////////////////////////////
137 118

  
138 119
    public static int getCurrentEffect()
139 120
      {
140 121
      return mCurrEffect;
141 122
      }
142 123
    
143
///////////////////////////////////////////////////////////////////
124
///////////////////////////////////////////////////////////////////////////////////////////////////
144 125
    
145 126
    public static void Bubble()
146 127
      {
......
150 131
        {
151 132
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
152 133
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
153
        MovingEffectsRenderer.mBackground.distort(di3D, dr, di2D);
134
        MovingEffectsRenderer.mBackground.distort( new Static3D(0,0,30) , di2D, dr);
154 135
        mCurrEffect = EFFECT_BUBBLE;
155 136
        }
156 137
      }
157 138

  
158
///////////////////////////////////////////////////////////////////
139
///////////////////////////////////////////////////////////////////////////////////////////////////
159 140

  
160 141
    public static void Sink()
161 142
      {
......
165 146
        {
166 147
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
167 148
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
168
        MovingEffectsRenderer.mBackground.sink(10.0f, dr, di2D, 0, 0.5f);
149
        MovingEffectsRenderer.mBackground.sink(new Static1D(10), di2D, dr);
169 150
        mCurrEffect = EFFECT_SINK;
170 151
        }
171 152
      }
172 153

  
173
///////////////////////////////////////////////////////////////////
154
///////////////////////////////////////////////////////////////////////////////////////////////////
174 155

  
175 156
    public static void Macroblock()
176 157
      {
......
180 161
        {
181 162
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
182 163
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
183
        MovingEffectsRenderer.mBackground.macroblock(macroDyn, mRegion);
164
        MovingEffectsRenderer.mBackground.macroblock(new Static1D(3), mRegion);
184 165
        mCurrEffect = EFFECT_MACRO;
185 166
        }
186 167
      }
187 168

  
188
///////////////////////////////////////////////////////////////////
169
///////////////////////////////////////////////////////////////////////////////////////////////////
189 170

  
190 171
    public static void Transparency()
191 172
      {
......
195 176
        {
196 177
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
197 178
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
198
        MovingEffectsRenderer.mBackground.alpha(alphaDyn, mRegion, true);
179
        MovingEffectsRenderer.mBackground.alpha(new Static1D(0.5f), mRegion, true);
199 180
        mCurrEffect = EFFECT_TRANS;
200 181
        }
201 182
      }
202 183

  
203
///////////////////////////////////////////////////////////////////
184
///////////////////////////////////////////////////////////////////////////////////////////////////
204 185

  
205 186
    public static void Swirl()
206 187
      {
......
210 191
        {
211 192
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
212 193
        MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
213
        MovingEffectsRenderer.mBackground.swirl(30, dr, di2D);
194
        MovingEffectsRenderer.mBackground.swirl( new Static1D(30), di2D, dr);
214 195
        mCurrEffect = EFFECT_SWIRL;
215 196
        }
216 197
      }
217 198
    
218
///////////////////////////////////////////////////////////////////
199
///////////////////////////////////////////////////////////////////////////////////////////////////
219 200

  
220 201
    public static void Abort()
221 202
      {
......
229 210
        }
230 211
      }
231 212

  
232
///////////////////////////////////////////////////////////////////
213
///////////////////////////////////////////////////////////////////////////////////////////////////
233 214
 
234 215
    public static void drawCurve(Canvas c, long time)
235 216
      {
......
265 246
        }
266 247
      }
267 248
       
268
///////////////////////////////////////////////////////////////////
249
///////////////////////////////////////////////////////////////////////////////////////////////////
269 250
    
270 251
    @Override public boolean onTouchEvent(MotionEvent event) 
271 252
      {
......
314 295
        }
315 296
      return true;
316 297
      }
317
 
318
///////////////////////////////////////////////////////////////////
319
// end of file
320

  
321 298
  }

Also available in: Unified diff