Revision 98c04ab8
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
---|---|---|
246 | 246 |
|
247 | 247 |
public void setSupportsRegion(boolean supports) |
248 | 248 |
{ |
249 |
if( mSupportsRegion != supports ) |
|
250 |
{ |
|
251 |
mSupportsRegion = supports; |
|
252 |
Effects3DSurfaceView view = (Effects3DSurfaceView) findViewById(R.id.effects3dSurfaceView); |
|
253 |
view.getRenderer().attachRegion(supports); |
|
254 |
} |
|
249 |
mSupportsRegion = supports; |
|
255 | 250 |
} |
256 | 251 |
|
257 | 252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
258 | 253 |
|
259 | 254 |
public void setSupportsCenter(boolean supports) |
260 | 255 |
{ |
261 |
if( mSupportsCenter != supports ) |
|
262 |
{ |
|
263 |
mSupportsCenter = supports; |
|
264 |
Effects3DSurfaceView view = (Effects3DSurfaceView) findViewById(R.id.effects3dSurfaceView); |
|
265 |
view.getRenderer().attachCenter(supports); |
|
266 |
} |
|
256 |
mSupportsCenter = supports; |
|
267 | 257 |
} |
268 | 258 |
|
269 | 259 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
358 | 348 |
mRegionR = r; |
359 | 349 |
|
360 | 350 |
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView); |
361 |
|
|
362 | 351 |
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionR); |
363 | 352 |
} |
364 | 353 |
|
... | ... | |
371 | 360 |
mCenterZ = z; |
372 | 361 |
|
373 | 362 |
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView); |
374 |
|
|
375 | 363 |
view.getRenderer().setCenter( mCenterX, mCenterY, mCenterZ ); |
376 | 364 |
} |
377 | 365 |
|
... | ... | |
441 | 429 |
mEffects= new DistortedEffects(); |
442 | 430 |
mTexture= new DistortedTexture(mNumCols,mNumRows); |
443 | 431 |
|
444 |
resetData(); |
|
445 |
|
|
446 | 432 |
final View view = getLayoutInflater().inflate(R.layout.effects3dlayout, null); |
447 | 433 |
|
448 | 434 |
setContentView(view); |
... | ... | |
458 | 444 |
adapterEffect.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
459 | 445 |
effectSpinner.setAdapter(adapterEffect); |
460 | 446 |
|
447 |
resetData(); |
|
448 |
|
|
461 | 449 |
mEffectAdd = 0; |
462 | 450 |
} |
463 | 451 |
|
... | ... | |
535 | 523 |
|
536 | 524 |
mSupportsRegion =false; |
537 | 525 |
mSupportsCenter =false; |
538 |
/* |
|
539 |
Effects3DSurfaceView view = (Effects3DSurfaceView) findViewById(R.id.effects3dSurfaceView); |
|
540 |
view.getRenderer().attachRegion(false); |
|
541 |
view.getRenderer().attachCenter(false); |
|
542 |
*/ |
|
526 |
|
|
527 |
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView); |
|
528 |
view.getRenderer().showRegionAndCenter(false); |
|
543 | 529 |
} |
544 | 530 |
|
545 | 531 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
567 | 553 |
} |
568 | 554 |
|
569 | 555 |
eff.apply(mEffects); |
556 |
|
|
557 |
Effects3DSurfaceView sv = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView); |
|
558 |
sv.getRenderer().showRegionAndCenter(mEffectNames[mEffectAdd].getType()==EffectTypes.VERTEX); |
|
570 | 559 |
} |
571 | 560 |
|
572 | 561 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java | ||
---|---|---|
637 | 637 |
if( fromUser ) |
638 | 638 |
{ |
639 | 639 |
Effects3DActivity act = mAct.get(); |
640 |
Effects3DSurfaceView view = (Effects3DSurfaceView)act.findViewById(R.id.effects3dSurfaceView); |
|
641 |
view.getRenderer().showRegionAndCenter(mName.getType()==EffectTypes.VERTEX); |
|
640 | 642 |
|
641 | 643 |
act.setSupportsCenter(mName.supportsCenter()); |
642 | 644 |
act.setSupportsRegion(mName.supportsRegion()); |
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
---|---|---|
67 | 67 |
|
68 | 68 |
Static4D mQuat1, mQuat2; |
69 | 69 |
int mScreenMin; |
70 |
boolean mShowing=false; |
|
70 | 71 |
|
71 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 73 |
|
... | ... | |
118 | 119 |
mScreen = new DistortedScreen(); |
119 | 120 |
mScreen.attach(mBackgroundTexture, mBackgroundEffects, mQuad ); |
120 | 121 |
mScreen.attach(mObjectTexture , mObjectEffects , mObjectMesh); |
121 |
|
|
122 |
mScreen.attach(mCenterNode); |
|
123 |
mScreen.attach(mRegionNode); |
|
124 | 122 |
} |
125 | 123 |
|
126 | 124 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
127 | 125 |
|
128 |
void attachRegion(boolean attach)
|
|
126 |
void showRegionAndCenter(boolean show)
|
|
129 | 127 |
{ |
130 |
//if( attach ) mScreen.attach(mRegionNode); |
|
131 |
//else mScreen.detach(mRegionNode); |
|
132 |
} |
|
133 |
|
|
134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
128 |
if( mShowing!=show ) |
|
129 |
{ |
|
130 |
if( show ) |
|
131 |
{ |
|
132 |
mScreen.attach(mCenterNode); |
|
133 |
mScreen.attach(mRegionNode); |
|
134 |
} |
|
135 |
else |
|
136 |
{ |
|
137 |
mScreen.detach(mCenterNode); |
|
138 |
mScreen.detach(mRegionNode); |
|
139 |
} |
|
135 | 140 |
|
136 |
void attachCenter(boolean attach) |
|
137 |
{ |
|
138 |
//if( attach ) mScreen.attach(mCenterNode); |
|
139 |
//else mScreen.detach(mCenterNode); |
|
141 |
mShowing = show; |
|
142 |
} |
|
140 | 143 |
} |
141 | 144 |
|
142 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Fix the Effects3D regression.