Project

General

Profile

« Previous | Next » 

Revision 51554e47

Added by Leszek Koltunski about 7 years ago

Convert a few more APPs to the new resolution-independent Matrix Effects.

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
404 404
        int crawlH = mCrawlTexture.getHeight();
405 405
        int screenW= mScreen.getWidth();
406 406
        int screenH= mScreen.getHeight();
407
        int backW  = mCrawlBackgroundTexture.getWidth();
407 408
        int backH  = mCrawlBackgroundTexture.getHeight();
408
        float scale= (float)screenW/crawlW;
409
        float scale= ((float)backW/backH)*((float)crawlH/crawlW);
409 410

  
410
        //mCrawlBackgroundEffects.move( new Static3D(0,screenH-backH,0) );
411
        mCrawlBackgroundEffects.move( new Static3D(0, -((float)backH/screenH-1.0f)/2 ,0) );
411 412
        mCrawlBackgroundEffects.rotate( new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(0.5f,1.0f,0.0f) );
412 413
        mCrawlBackgroundEffects.scale( new Static3D(1.0f, (float)backH/screenH,1.0f) );
413 414

  
414 415
        final int transpDist = 5;
415 416
        Static4D region = new Static4D(screenW/2,(1-transpDist)*backH,transpDist*backH,transpDist*backH);
416
        //mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist*0.6f), region, true);
417
        mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist*0.6f), region, true);
417 418

  
418 419
        Dynamic3D di = new Dynamic3D(70000,0.5f);
419
        di.add(new Static3D(screenW/2,+backH       , 0));
420
        di.add(new Static3D(screenW/2,-scale*crawlH, 0));
420
        di.add(new Static3D(0,         0,0));
421
        di.add(new Static3D(0,-(1+scale),0));
422

  
423
        mCrawlEffects.move(di);
424
        mCrawlEffects.move ( new Static3D(0, (1+scale)/2,0) );
425
        mCrawlEffects.scale( new Static3D(1,    scale   ,1) );
421 426

  
422
        //mCrawlEffects.move(di);
423
        //mCrawlEffects.scale( new Static3D(scale,scale,scale) );
424
        //mCrawlEffects.move( new Static3D(-crawlW/2,0,0) );
425
        
426 427
        mBackground = mScreen.attach(mCrawlBackgroundTexture, mCrawlBackgroundEffects,mQuad);
427 428
        mBackground.attach(mCrawlTexture, mCrawlEffects,mQuad);
428 429
        mBackground.glDisable(GLES30.GL_DEPTH_TEST);

Also available in: Unified diff