Revision ee82510e
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
|---|---|---|
| 200 | 200 |
|
| 201 | 201 |
private void setupScreen(int w, int h) |
| 202 | 202 |
{
|
| 203 |
mCrawlBackgroundTexture = new DistortedTexture(w,(int)(Math.sqrt(3.0)*h));
|
|
| 203 |
mCrawlBackgroundTexture = new DistortedTexture(w,(int)(h/Math.cos(CRAWL_ANGLE)));
|
|
| 204 | 204 |
|
| 205 | 205 |
int randomA, randomX, randomY, randomTime; |
| 206 | 206 |
float randomS, randomAlpha1, randomAlpha2; |
| ... | ... | |
| 406 | 406 |
int screenH= mScreen.getHeight(); |
| 407 | 407 |
int backH = mCrawlBackgroundTexture.getHeight(); |
| 408 | 408 |
float scale= (float)screenW/crawlW; |
| 409 |
|
|
| 410 |
Dynamic3D di = new Dynamic3D(60000,0.5f); |
|
| 411 |
di.add(new Static3D(screenW/2,+backH , 0)); |
|
| 412 |
di.add(new Static3D(screenW/2,-scale*crawlH, 0)); |
|
| 413 |
|
|
| 409 |
|
|
| 414 | 410 |
mCrawlBackgroundEffects.move( new Static3D(0,screenH-backH,0) ); |
| 415 | 411 |
mCrawlBackgroundEffects.rotate( new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(screenW/2,backH,0) ); |
| 416 |
|
|
| 412 |
|
|
| 417 | 413 |
final int transpDist = 5; |
| 418 | 414 |
Static4D region = new Static4D(screenW/2,(1-transpDist)*backH,transpDist*backH,transpDist*backH); |
| 419 |
mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist/2), region, true); |
|
| 420 |
|
|
| 415 |
mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist/2.0f), region, true); |
|
| 416 |
|
|
| 417 |
Dynamic3D di = new Dynamic3D(120000,0.5f); |
|
| 418 |
di.add(new Static3D(screenW/2,+backH , 0)); |
|
| 419 |
di.add(new Static3D(screenW/2,-scale*crawlH, 0)); |
|
| 420 |
|
|
| 421 | 421 |
mCrawlEffects.move(di); |
| 422 | 422 |
mCrawlEffects.scale( new Static3D(scale,scale,scale) ); |
| 423 | 423 |
mCrawlEffects.move( new Static3D(-crawlW/2,0,0) ); |
Also available in: Unified diff
Small improvements for StarWars, but the main issue - non-working transparency of the Crawl - not solved.