Revision f6d884d5
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
---|---|---|
41 | 41 |
import org.distorted.library.GridFlat; |
42 | 42 |
import org.distorted.library.GridCubes; |
43 | 43 |
import org.distorted.library.GridObject; |
44 |
import org.distorted.library.DistortedObject; |
|
44 |
import org.distorted.library.DistortedTexture; |
|
45 |
import org.distorted.library.DistortedEffectQueues; |
|
45 | 46 |
import org.distorted.library.EffectNames; |
46 | 47 |
import org.distorted.library.EffectTypes; |
47 | 48 |
|
... | ... | |
66 | 67 |
private int mNumRows = 10; |
67 | 68 |
private NumberPicker mColsPicker, mRowsPicker; |
68 | 69 |
private boolean[] mShape; |
69 |
private DistortedObject mObject; |
|
70 |
private DistortedTexture mTexture; |
|
71 |
private DistortedEffectQueues mQueues; |
|
70 | 72 |
private GridObject mGrid; |
71 | 73 |
private int mObjectType; |
72 | 74 |
private int mBitmapID; |
... | ... | |
217 | 219 |
|
218 | 220 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
219 | 221 |
|
220 |
public DistortedObject getObject()
|
|
222 |
public DistortedTexture getTexture()
|
|
221 | 223 |
{ |
222 |
return mObject; |
|
224 |
return mTexture; |
|
225 |
} |
|
226 |
|
|
227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
228 |
|
|
229 |
public DistortedEffectQueues getQueues() |
|
230 |
{ |
|
231 |
return mQueues; |
|
223 | 232 |
} |
224 | 233 |
|
225 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
401 | 410 |
int w = mBitmap.getWidth(); |
402 | 411 |
int h = mBitmap.getHeight(); |
403 | 412 |
|
404 |
mObject = new DistortedObject(w,h,1); |
|
413 |
mQueues = new DistortedEffectQueues(); |
|
414 |
mTexture= new DistortedTexture(w,h,0); |
|
405 | 415 |
mGrid = new GridFlat(mNumCols,mNumCols*h/w); |
406 | 416 |
setEffectView(); |
407 | 417 |
} |
... | ... | |
431 | 441 |
for(int i=0; i<mNumRows*mNumCols; i++) |
432 | 442 |
str += mShape[i] ? "1" : "0"; |
433 | 443 |
|
434 |
mObject = new DistortedObject(mNumCols,mNumRows,1); |
|
444 |
mQueues = new DistortedEffectQueues(); |
|
445 |
mTexture= new DistortedTexture(mNumCols,mNumRows,1); |
|
435 | 446 |
mGrid = new GridCubes(mNumCols, str, false); |
436 | 447 |
|
437 | 448 |
setEffectView(); |
... | ... | |
471 | 482 |
|
472 | 483 |
public int getWidth() |
473 | 484 |
{ |
474 |
return mObject==null ? 0: mObject.getWidth();
|
|
485 |
return mTexture==null ? 0: mTexture.getWidth();
|
|
475 | 486 |
} |
476 | 487 |
|
477 | 488 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
478 | 489 |
|
479 | 490 |
public int getHeight() |
480 | 491 |
{ |
481 |
return mObject==null ? 0: mObject.getHeight();
|
|
492 |
return mTexture==null ? 0: mTexture.getHeight();
|
|
482 | 493 |
} |
483 | 494 |
|
484 | 495 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
485 | 496 |
|
486 | 497 |
public int getDepth() |
487 | 498 |
{ |
488 |
return mObject==null ? 0: mObject.getDepth();
|
|
499 |
return mTexture==null ? 0: mTexture.getDepth();
|
|
489 | 500 |
} |
490 | 501 |
|
491 | 502 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
564 | 575 |
layout.addView(region); |
565 | 576 |
} |
566 | 577 |
|
567 |
eff.apply(mObject);
|
|
578 |
eff.apply(mQueues);
|
|
568 | 579 |
} |
569 | 580 |
|
570 | 581 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
574 | 585 |
mEffects.clear(); |
575 | 586 |
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout); |
576 | 587 |
layout.removeAllViews(); |
577 |
mObject.abortEffects(EffectTypes.VERTEX);
|
|
578 |
mObject.abortEffects(EffectTypes.FRAGMENT);
|
|
588 |
mQueues.abortEffects(EffectTypes.VERTEX);
|
|
589 |
mQueues.abortEffects(EffectTypes.FRAGMENT);
|
|
579 | 590 |
|
580 | 591 |
resetData(); |
581 | 592 |
|
... | ... | |
606 | 617 |
view = effect.getRegion(); |
607 | 618 |
if( view!=null ) layout.removeView(view); |
608 | 619 |
|
609 |
long id = effect.getId(); |
|
610 |
mObject.abortEffect(id); |
|
620 |
mQueues.abortEffect(effect.getId()); |
|
611 | 621 |
mEffects.remove(effect); |
612 | 622 |
|
613 | 623 |
resetData(); |
Also available in: Unified diff
Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)