Revision e8e54972
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
---|---|---|
214 | 214 |
if( mCrawlBackgroundTexture!=null ) mCrawlBackgroundTexture.markForDeletion(); |
215 | 215 |
mCrawlBackgroundTexture = new DistortedTexture(); |
216 | 216 |
|
217 |
mCrawlBackgroundQuad.setStretch(scrW,(int)(scrH*Math.sin(angleA)/Math.sin(angleB)),0); |
|
218 |
|
|
217 | 219 |
int randomA, randomX, randomY, randomTime; |
218 | 220 |
float randomS, randomAlpha1, randomAlpha2; |
219 | 221 |
|
... | ... | |
230 | 232 |
randomAlpha1 = 0.2f + 0.8f*mRnd.nextFloat(); |
231 | 233 |
randomAlpha2 = 0.8f + 0.2f*mRnd.nextFloat(); |
232 | 234 |
randomTime = 500+mRnd.nextInt(2000); |
233 |
|
|
234 |
mStarEffects[i].apply( new MatrixEffectMove(new Static3D(randomX,randomY,0)) ); |
|
235 |
mStarEffects[i].apply( new MatrixEffectScale(randomS) ); |
|
235 |
|
|
236 | 236 |
mStarEffects[i].apply( new MatrixEffectRotate(new Static1D(randomA), axis, center) ); |
237 |
|
|
237 |
mStarEffects[i].apply( new MatrixEffectScale(randomS) ); |
|
238 |
mStarEffects[i].apply( new MatrixEffectMove(new Static3D(randomX,randomY,0)) ); |
|
239 |
|
|
238 | 240 |
Dynamic1D di = new Dynamic1D(randomTime,0.0f); |
239 | 241 |
di.setNoise(alphaNoise); |
240 | 242 |
di.add(new Static1D(randomAlpha1)); |
... | ... | |
245 | 247 |
mScreen.attach(mStarTexture, mStarEffects[i], mStarQuad); |
246 | 248 |
} |
247 | 249 |
|
248 |
float scale = (0.5f*scrW/mGFFATexture.getWidth());
|
|
250 |
float scale = (0.5f*scrW/mGFFAQuad.getStretchX());
|
|
249 | 251 |
|
250 | 252 |
Dynamic1D di = new Dynamic1D(6000,0.5f); |
251 | 253 |
di.add(new Static1D(1.0f)); |
252 | 254 |
di.add(new Static1D(1.0f)); |
253 | 255 |
di.add(new Static1D(0.0f)); |
254 |
|
|
255 |
mGFFAEffects.apply( new MatrixEffectMove(new Static3D(-scrW/3 + mGFFATexture.getWidth()/2 ,scrH/6,0)) ); |
|
256 |
|
|
257 |
FragmentEffectAlpha alpha = new FragmentEffectAlpha(di); |
|
258 |
alpha.notifyWhenFinished(this); |
|
259 |
alphaEffectID = alpha.getID(); |
|
260 |
|
|
256 | 261 |
mGFFAEffects.apply( new MatrixEffectScale(scale) ); |
257 |
mGFFAEffects.apply( new FragmentEffectAlpha(di) ); |
|
262 |
mGFFAEffects.apply( new MatrixEffectMove(new Static3D(-scrW/3 + mGFFAQuad.getStretchX()/2 ,scrH/6,0)) ); |
|
263 |
mGFFAEffects.apply( alpha ); |
|
258 | 264 |
|
259 | 265 |
mScreen.attach(mGFFATexture, mGFFAEffects, mGFFAQuad); |
260 | 266 |
} |
... | ... | |
381 | 387 |
mScreen.detach(mGFFAEffects); |
382 | 388 |
mGFFATexture.markForDeletion(); |
383 | 389 |
|
384 |
int screenW=mScreen.getWidth();
|
|
390 |
int screenW = mScreen.getWidth();
|
|
385 | 391 |
float logoW = mLogoQuad.getStretchX(); |
386 | 392 |
int initSize= (int)(3.0f*screenW/logoW); |
387 | 393 |
int finaSize= (int)(0.1f*screenW/logoW); |
... | ... | |
389 | 395 |
Dynamic3D di = new Dynamic3D(10000,0.5f); |
390 | 396 |
di.add(new Static3D(initSize,initSize,1)); |
391 | 397 |
di.add(new Static3D(finaSize,finaSize,1)); |
392 |
|
|
393 | 398 |
MatrixEffectScale scale = new MatrixEffectScale(di); |
394 | 399 |
scale.notifyWhenFinished(this); |
395 | 400 |
scaleEffectID = scale.getID(); |
... | ... | |
401 | 406 |
mScreen.detach(mLogoEffects); |
402 | 407 |
mLogoTexture.markForDeletion(); |
403 | 408 |
|
404 |
int crawlW = mCrawlTexture.getWidth();
|
|
405 |
int crawlH = mCrawlTexture.getHeight();
|
|
406 |
int screenW= mScreen.getWidth();
|
|
407 |
int screenH= mScreen.getHeight();
|
|
408 |
int backW = mCrawlBackgroundTexture.getWidth();
|
|
409 |
int backH = mCrawlBackgroundTexture.getHeight();
|
|
410 |
float scale= (float)backW/crawlW;
|
|
409 |
float crawlW = mCrawlQuad.getStretchX();
|
|
410 |
float crawlH = mCrawlQuad.getStretchY();
|
|
411 |
float screenW= mScreen.getWidth();
|
|
412 |
float screenH= mScreen.getHeight();
|
|
413 |
float backW = mCrawlBackgroundQuad.getStretchX();
|
|
414 |
float backH = mCrawlBackgroundQuad.getStretchY();
|
|
415 |
float scale = backW/crawlW;
|
|
411 | 416 |
|
412 |
mCrawlBackgroundEffects.apply( new MatrixEffectMove(new Static3D( 0, (backH-screenH)/2, 0)) ); |
|
413 | 417 |
mCrawlBackgroundEffects.apply( new MatrixEffectRotate(new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(0,-backH/2,0)) ); |
418 |
mCrawlBackgroundEffects.apply( new MatrixEffectMove(new Static3D( 0, (backH-screenH)/2, 0)) ); |
|
414 | 419 |
|
415 | 420 |
final int transpDist = 5; |
416 | 421 |
Static3D center = new Static3D( screenW/2 , transpDist*backH , 0 ); |
... | ... | |
427 | 432 |
mCrawlEffects.apply( new MatrixEffectScale(new Static3D(scale,scale,scale)) ); |
428 | 433 |
mCrawlEffects.apply( move ); |
429 | 434 |
|
430 |
mBackground = mScreen.attach(mCrawlBackgroundTexture, mCrawlBackgroundEffects,mCrawlBackgroundQuad); |
|
431 |
mBackground.attach(mCrawlTexture, mCrawlEffects,mCrawlQuad); |
|
435 |
mBackground = mScreen.attach(mCrawlBackgroundTexture, mCrawlBackgroundEffects, mCrawlBackgroundQuad);
|
|
436 |
mBackground.attach(mCrawlTexture, mCrawlEffects, mCrawlQuad);
|
|
432 | 437 |
mBackground.glDisable(GLES31.GL_DEPTH_TEST); |
433 | 438 |
mBackground.glDepthMask(false); |
434 | 439 |
} |
435 |
else if( effectID==moveEffectID )
|
|
440 |
else if( effectID == moveEffectID )
|
|
436 | 441 |
{ |
437 | 442 |
mScreen.detach(mBackground); |
438 | 443 |
mBackground.detach(mCrawlEffects); |
Also available in: Unified diff
Fixes for the merge.