Project

General

Profile

« Previous | Next » 

Revision f6d884d5

Added by Leszek Koltunski over 7 years ago

Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)

View differences:

src/main/java/org/distorted/examples/matrix3d/Matrix3DActivity.java
32 32

  
33 33
import org.distorted.examples.R;
34 34
import org.distorted.library.Distorted;
35
import org.distorted.library.DistortedEffectQueues;
35 36
import org.distorted.library.GridObject;
36 37
import org.distorted.library.GridCubes;
37
import org.distorted.library.DistortedObject;
38
import org.distorted.library.DistortedTexture;
38 39
import org.distorted.library.EffectNames;
39 40
import org.distorted.library.EffectTypes;
40 41

  
......
46 47

  
47 48
public class Matrix3DActivity extends Activity implements AdapterView.OnItemSelectedListener
48 49
  {
49
  private DistortedObject mObject;
50
  private DistortedTexture mTexture;
50 51
  private GridObject mGrid;
52
  private DistortedEffectQueues mQueues;
51 53

  
52 54
  private ArrayList<Matrix3DEffect> mEffects;
53 55
  private int mEffectAdd;
......
67 69

  
68 70
    createEffectNames();
69 71

  
72
    mQueues = new DistortedEffectQueues();
70 73
    mGrid   = new GridCubes(1,1,false);
71
    mObject = new DistortedObject(100,100,100);
74
    mTexture= new DistortedTexture(100,100,100);
72 75

  
73 76
    setEffectView();
74 77
    }
......
99 102

  
100 103
///////////////////////////////////////////////////////////////////////////////////////////////////
101 104

  
102
  public DistortedObject getObject()
105
  public DistortedEffectQueues getQueues()
103 106
    {
104
    return mObject;
107
    return mQueues;
108
    }
109

  
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111

  
112
  public DistortedTexture getTexture()
113
    {
114
    return mTexture;
105 115
    }
106 116

  
107 117
///////////////////////////////////////////////////////////////////////////////////////////////////
......
181 191

  
182 192
  public int getWidth()
183 193
    {
184
    return mObject==null ? 0: mObject.getWidth();
194
    return mTexture==null ? 0: mTexture.getWidth();
185 195
    }
186 196

  
187 197
///////////////////////////////////////////////////////////////////////////////////////////////////
188 198

  
189 199
  public int getHeight()
190 200
    {
191
    return mObject==null ? 0: mObject.getHeight();
201
    return mTexture==null ? 0: mTexture.getHeight();
192 202
    }
193 203

  
194 204
///////////////////////////////////////////////////////////////////////////////////////////////////
195 205

  
196
  public int getScreenWidth()
206
  public int getDepth()
197 207
    {
198
    Matrix3DRenderer r = ((Matrix3DSurfaceView)findViewById(R.id.matrix3dSurfaceView)).getRenderer();
199
    return r.getWidth();
208
    return mTexture==null ? 0: mTexture.getDepth();
200 209
    }
201 210

  
202 211
///////////////////////////////////////////////////////////////////////////////////////////////////
203 212

  
204
  public int getScreenHeight()
213
  public int getScreenWidth()
205 214
    {
206 215
    Matrix3DRenderer r = ((Matrix3DSurfaceView)findViewById(R.id.matrix3dSurfaceView)).getRenderer();
207
    return r.getHeight();
216
    return r.getWidth();
208 217
    }
209 218

  
210 219
///////////////////////////////////////////////////////////////////////////////////////////////////
211 220

  
212
  public int getDepth()
221
  public int getScreenHeight()
213 222
    {
214
    return mObject==null ? 0: mObject.getDepth();
223
    Matrix3DRenderer r = ((Matrix3DSurfaceView)findViewById(R.id.matrix3dSurfaceView)).getRenderer();
224
    return r.getHeight();
215 225
    }
216 226

  
217 227
///////////////////////////////////////////////////////////////////////////////////////////////////
......
279 289
      layout.addView(center);
280 290
      }
281 291

  
282
    eff.apply(mObject);
292
    eff.apply(mQueues);
283 293
    }
284 294

  
285 295
///////////////////////////////////////////////////////////////////////////////////////////////////
......
289 299
    mEffects.clear();
290 300
    LinearLayout layout = (LinearLayout)findViewById(R.id.matrix3dlayout);
291 301
    layout.removeAllViews();
292
    mObject.abortEffects(EffectTypes.MATRIX);
302
    mQueues.abortEffects(EffectTypes.MATRIX);
293 303

  
294 304
    resetData();
295 305
    }
......
312 322
        view = effect.getRegion();
313 323
        if( view!=null ) layout.removeView(view);
314 324

  
315
        long id = effect.getId();
316
        mObject.abortEffect(id);
325
        mQueues.abortEffect(effect.getId());
317 326
        mEffects.remove(effect);
318 327

  
319 328
        resetData();

Also available in: Unified diff