Revision d04a4886
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
---|---|---|
42 | 42 |
import org.distorted.library.GridCubes; |
43 | 43 |
import org.distorted.library.GridObject; |
44 | 44 |
import org.distorted.library.DistortedTexture; |
45 |
import org.distorted.library.DistortedEffectQueues;
|
|
45 |
import org.distorted.library.DistortedEffects; |
|
46 | 46 |
import org.distorted.library.EffectNames; |
47 | 47 |
import org.distorted.library.EffectTypes; |
48 | 48 |
|
... | ... | |
68 | 68 |
private NumberPicker mColsPicker, mRowsPicker; |
69 | 69 |
private boolean[] mShape; |
70 | 70 |
private DistortedTexture mTexture; |
71 |
private DistortedEffectQueues mQueues;
|
|
71 |
private DistortedEffects mEffects;
|
|
72 | 72 |
private GridObject mGrid; |
73 | 73 |
private int mObjectType; |
74 | 74 |
private int mBitmapID; |
75 | 75 |
private Bitmap mBitmap; |
76 | 76 |
|
77 |
private ArrayList<Effects3DEffect> mEffects;
|
|
77 |
private ArrayList<Effects3DEffect> mList;
|
|
78 | 78 |
private int mEffectAdd; |
79 | 79 |
private float mCenterX, mCenterY, mCenterZ; |
80 | 80 |
private float mRegionX, mRegionY, mRegionR; |
... | ... | |
91 | 91 |
{ |
92 | 92 |
super.onCreate(savedState); |
93 | 93 |
|
94 |
mEffects = new ArrayList<>();
|
|
94 |
mList = new ArrayList<>();
|
|
95 | 95 |
|
96 | 96 |
createEffectNames(); |
97 | 97 |
|
... | ... | |
226 | 226 |
|
227 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
228 | 228 |
|
229 |
public DistortedEffectQueues getQueues()
|
|
229 |
public DistortedEffects getEffects()
|
|
230 | 230 |
{ |
231 |
return mQueues;
|
|
231 |
return mEffects;
|
|
232 | 232 |
} |
233 | 233 |
|
234 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
410 | 410 |
int w = mBitmap.getWidth(); |
411 | 411 |
int h = mBitmap.getHeight(); |
412 | 412 |
|
413 |
mQueues = new DistortedEffectQueues();
|
|
413 |
mEffects = new DistortedEffects();
|
|
414 | 414 |
mTexture= new DistortedTexture(w,h); |
415 | 415 |
mGrid = new GridFlat(mNumCols,mNumCols*h/w); |
416 | 416 |
setEffectView(); |
... | ... | |
441 | 441 |
for(int i=0; i<mNumRows*mNumCols; i++) |
442 | 442 |
str += mShape[i] ? "1" : "0"; |
443 | 443 |
|
444 |
mQueues = new DistortedEffectQueues();
|
|
444 |
mEffects = new DistortedEffects();
|
|
445 | 445 |
mTexture= new DistortedTexture(mNumCols,mNumRows); |
446 | 446 |
mGrid = new GridCubes(mNumCols, str, false); |
447 | 447 |
|
... | ... | |
557 | 557 |
public void newEffect(View v) |
558 | 558 |
{ |
559 | 559 |
Effects3DEffect eff = new Effects3DEffect(mEffectNames[mEffectAdd], this); |
560 |
mEffects.add(eff);
|
|
560 |
mList.add(eff);
|
|
561 | 561 |
|
562 | 562 |
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout); |
563 | 563 |
View view = eff.createView(); |
... | ... | |
575 | 575 |
layout.addView(region); |
576 | 576 |
} |
577 | 577 |
|
578 |
eff.apply(mQueues);
|
|
578 |
eff.apply(mEffects);
|
|
579 | 579 |
} |
580 | 580 |
|
581 | 581 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
582 | 582 |
|
583 | 583 |
public void removeAll(View v) |
584 | 584 |
{ |
585 |
mEffects.clear();
|
|
585 |
mList.clear();
|
|
586 | 586 |
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout); |
587 | 587 |
layout.removeAllViews(); |
588 |
mQueues.abortEffects(EffectTypes.VERTEX);
|
|
589 |
mQueues.abortEffects(EffectTypes.FRAGMENT);
|
|
588 |
mEffects.abortEffects(EffectTypes.VERTEX);
|
|
589 |
mEffects.abortEffects(EffectTypes.FRAGMENT);
|
|
590 | 590 |
|
591 | 591 |
resetData(); |
592 | 592 |
|
... | ... | |
603 | 603 |
|
604 | 604 |
public void remove(View v) |
605 | 605 |
{ |
606 |
for(Effects3DEffect effect: mEffects)
|
|
606 |
for(Effects3DEffect effect: mList)
|
|
607 | 607 |
{ |
608 | 608 |
if( effect.thisView(v) ) |
609 | 609 |
{ |
... | ... | |
617 | 617 |
view = effect.getRegion(); |
618 | 618 |
if( view!=null ) layout.removeView(view); |
619 | 619 |
|
620 |
mQueues.abortEffect(effect.getId());
|
|
621 |
mEffects.remove(effect);
|
|
620 |
mEffects.abortEffect(effect.getId());
|
|
621 |
mList.remove(effect);
|
|
622 | 622 |
|
623 | 623 |
resetData(); |
624 | 624 |
|
Also available in: Unified diff
Change of names.