| 88 |
88 |
private static boolean mShowCenter = true;
|
| 89 |
89 |
private static boolean mShowRegion = true;
|
| 90 |
90 |
private static boolean mShowNormal = true;
|
|
91 |
private static boolean mUseOIT = false;
|
| 91 |
92 |
|
| 92 |
93 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 93 |
94 |
|
| ... | ... | |
| 102 |
103 |
|
| 103 |
104 |
setContentView(R.layout.objectpickerlayout);
|
| 104 |
105 |
|
| 105 |
|
mLay = (LinearLayout)findViewById(R.id.objectpicker_buttongrid);
|
|
106 |
mLay = findViewById(R.id.objectpicker_buttongrid);
|
| 106 |
107 |
|
| 107 |
|
mColsPicker = (NumberPicker)findViewById(R.id.objectpicker_cols);
|
| 108 |
|
mRowsPicker = (NumberPicker)findViewById(R.id.objectpicker_rows);
|
| 109 |
|
mSlicPicker = (NumberPicker)findViewById(R.id.objectpicker_slices);
|
|
108 |
mColsPicker = findViewById(R.id.objectpicker_cols);
|
|
109 |
mRowsPicker = findViewById(R.id.objectpicker_rows);
|
|
110 |
mSlicPicker = findViewById(R.id.objectpicker_slices);
|
| 110 |
111 |
|
| 111 |
112 |
mColsPicker.setMaxValue(40);
|
| 112 |
113 |
mColsPicker.setMinValue( 0);
|
| ... | ... | |
| 145 |
146 |
mObjectType = 0;
|
| 146 |
147 |
mGridInitialized = false;
|
| 147 |
148 |
|
| 148 |
|
Spinner typeSpinner = (Spinner)findViewById(R.id.objectpicker_spinnerType);
|
|
149 |
Spinner typeSpinner = findViewById(R.id.objectpicker_spinnerType);
|
| 149 |
150 |
typeSpinner.setOnItemSelectedListener(this);
|
| 150 |
151 |
|
| 151 |
152 |
String[] objectType = new String[] {"Mesh: Cubes", "Mesh: Flat"};
|
| ... | ... | |
| 154 |
155 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
| 155 |
156 |
typeSpinner.setAdapter(adapterType);
|
| 156 |
157 |
|
| 157 |
|
Spinner bitmapSpinner = (Spinner)findViewById(R.id.objectpicker_spinnerBitmap);
|
|
158 |
Spinner bitmapSpinner = findViewById(R.id.objectpicker_spinnerBitmap);
|
| 158 |
159 |
bitmapSpinner.setOnItemSelectedListener(this);
|
| 159 |
160 |
|
| 160 |
161 |
String[] objectBitmap = new String[] { "Texture: Grid", "Texture: Girl", "Texture: Dog", "Texture: Cat",
|
| ... | ... | |
| 362 |
363 |
mRegionY =-y;
|
| 363 |
364 |
mRegionR = r;
|
| 364 |
365 |
|
| 365 |
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
366 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
|
| 366 |
367 |
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionR);
|
| 367 |
368 |
}
|
| 368 |
369 |
|
| ... | ... | |
| 374 |
375 |
mCenterY = y;
|
| 375 |
376 |
mCenterZ = z;
|
| 376 |
377 |
|
| 377 |
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
378 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
|
| 378 |
379 |
view.getRenderer().setCenter( mCenterX, mCenterY, mCenterZ );
|
| 379 |
380 |
}
|
| 380 |
381 |
|
| ... | ... | |
| 454 |
455 |
|
| 455 |
456 |
for(int i=0; i<mEffectNames.length; i++) effects[i] = mEffectNames[i].name();
|
| 456 |
457 |
|
| 457 |
|
Spinner effectSpinner = (Spinner)findViewById(R.id.effects3dspinner );
|
|
458 |
Spinner effectSpinner = findViewById(R.id.effects3dspinner );
|
| 458 |
459 |
effectSpinner.setOnItemSelectedListener(this);
|
| 459 |
460 |
|
| 460 |
461 |
ArrayAdapter<String> adapterEffect = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, effects);
|
| ... | ... | |
| 541 |
542 |
mSupportsRegion =false;
|
| 542 |
543 |
mSupportsCenter =false;
|
| 543 |
544 |
|
| 544 |
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
545 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
|
| 545 |
546 |
view.getRenderer().showRegionAndCenter(false,false);
|
| 546 |
547 |
}
|
| 547 |
548 |
|
| ... | ... | |
| 553 |
554 |
Effects3DEffect eff = new Effects3DEffect(mEffectNames[mEffectAdd], this);
|
| 554 |
555 |
mList.add(eff);
|
| 555 |
556 |
|
| 556 |
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
|
557 |
LinearLayout layout = findViewById(R.id.effects3dlayout);
|
| 557 |
558 |
View view = eff.createView();
|
| 558 |
559 |
layout.addView(view);
|
| 559 |
560 |
|
| ... | ... | |
| 572 |
573 |
eff.apply(mEffects);
|
| 573 |
574 |
|
| 574 |
575 |
boolean show = (mEffectNames[mEffectAdd].getType()==EffectType.VERTEX);
|
| 575 |
|
Effects3DSurfaceView sv = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
576 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView);
|
| 576 |
577 |
sv.getRenderer().showRegionAndCenter( (show && mShowRegion) , (show && mShowCenter) );
|
| 577 |
578 |
}
|
| 578 |
579 |
|
| ... | ... | |
| 581 |
582 |
public void removeAll(View v)
|
| 582 |
583 |
{
|
| 583 |
584 |
mList.clear();
|
| 584 |
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
|
585 |
LinearLayout layout = findViewById(R.id.effects3dlayout);
|
| 585 |
586 |
layout.removeAllViews();
|
| 586 |
587 |
mEffects.abortByType(EffectType.VERTEX);
|
| 587 |
588 |
mEffects.abortByType(EffectType.FRAGMENT);
|
| 588 |
589 |
|
| 589 |
590 |
resetData();
|
| 590 |
591 |
|
| 591 |
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
592 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
|
| 592 |
593 |
Effects3DRenderer renderer= view.getRenderer();
|
| 593 |
594 |
|
| 594 |
595 |
renderer.setCenter( mCenterX, mCenterY, mCenterZ );
|
| ... | ... | |
| 605 |
606 |
{
|
| 606 |
607 |
if( effect.thisView(v) )
|
| 607 |
608 |
{
|
| 608 |
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
|
609 |
LinearLayout layout = findViewById(R.id.effects3dlayout);
|
| 609 |
610 |
View view;
|
| 610 |
611 |
|
| 611 |
612 |
view = effect.getEffect();
|
| ... | ... | |
| 646 |
647 |
CheckBox box = (CheckBox)view;
|
| 647 |
648 |
mShowCenter = box.isChecked();
|
| 648 |
649 |
|
| 649 |
|
Effects3DSurfaceView sv = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
650 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView);
|
| 650 |
651 |
sv.getRenderer().showRegionAndCenter(mShowRegion,mShowCenter);
|
| 651 |
652 |
}
|
| 652 |
653 |
|
| ... | ... | |
| 657 |
658 |
CheckBox box = (CheckBox)view;
|
| 658 |
659 |
mShowRegion = box.isChecked();
|
| 659 |
660 |
|
| 660 |
|
Effects3DSurfaceView sv = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
661 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView);
|
| 661 |
662 |
sv.getRenderer().showRegionAndCenter(mShowRegion,mShowCenter);
|
| 662 |
663 |
}
|
| 663 |
664 |
|
| ... | ... | |
| 674 |
675 |
}
|
| 675 |
676 |
}
|
| 676 |
677 |
|
|
678 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
679 |
|
|
680 |
public void triggerOIT(View view)
|
|
681 |
{
|
|
682 |
CheckBox box = (CheckBox)view;
|
|
683 |
mUseOIT = box.isChecked();
|
|
684 |
|
|
685 |
Effects3DSurfaceView sv = findViewById(R.id.effects3dSurfaceView);
|
|
686 |
sv.getRenderer().useOIT(mUseOIT);
|
|
687 |
}
|
|
688 |
|
| 677 |
689 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 678 |
690 |
// Overrides
|
| 679 |
691 |
|
| 680 |
692 |
@Override
|
| 681 |
693 |
protected void onPause()
|
| 682 |
694 |
{
|
| 683 |
|
GLSurfaceView mView = (GLSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
695 |
GLSurfaceView mView = findViewById(R.id.effects3dSurfaceView);
|
| 684 |
696 |
if( mView!=null ) mView.onPause();
|
| 685 |
697 |
|
| 686 |
698 |
Distorted.onPause();
|
| ... | ... | |
| 693 |
705 |
protected void onResume()
|
| 694 |
706 |
{
|
| 695 |
707 |
super.onResume();
|
| 696 |
|
GLSurfaceView mView = (GLSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
|
708 |
GLSurfaceView mView = findViewById(R.id.effects3dSurfaceView);
|
| 697 |
709 |
if( mView!=null ) mView.onResume();
|
| 698 |
710 |
}
|
| 699 |
711 |
|
Add OIT to the Effects3D app.