Project

General

Profile

« Previous | Next » 

Revision a4d59c0b

Added by Leszek Koltunski over 5 years ago

Massive: make the coordinate system agree with that of OpenGL (i.e. invert the Y axis).

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
39 39
import org.distorted.library.type.Dynamic3D;
40 40
import org.distorted.library.type.Static1D;
41 41
import org.distorted.library.type.Static3D;
42
import org.distorted.library.type.Static4D;
43 42
import org.distorted.library.message.EffectListener;
44 43
import org.distorted.library.message.EffectMessage;
45 44
import org.distorted.library.main.Distorted;
......
247 246
    di.add(new Static1D(1.0f));
248 247
    di.add(new Static1D(0.0f));
249 248
    
250
    mGFFAEffects.apply( new MatrixEffectMove(new Static3D(w/5,h/3,0)) );
249
    mGFFAEffects.apply( new MatrixEffectMove(new Static3D(w/5,2*h/3,0)) );
251 250
    mGFFAEffects.apply( new MatrixEffectScale(scale) );
252 251
    mGFFAEffects.apply( new FragmentEffectAlpha(di) );
253 252
      
......
410 409
        int crawlW = mCrawlTexture.getWidth();
411 410
        int crawlH = mCrawlTexture.getHeight();
412 411
        int screenW= mScreen.getWidth();
413
        int screenH= mScreen.getHeight();
414 412
        int backH  = mCrawlBackgroundTexture.getHeight();
415 413
        float scale= (float)screenW/crawlW;
416 414

  
417
        mCrawlBackgroundEffects.apply( new MatrixEffectMove(new Static3D(0,screenH-backH,0)) );
418
        mCrawlBackgroundEffects.apply( new MatrixEffectRotate(new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(screenW/2,backH,0)) );
415
        mCrawlBackgroundEffects.apply( new MatrixEffectRotate(new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(screenW/2,0,0)) );
419 416

  
420 417
        final int transpDist = 5;
421
        Static3D center = new Static3D( screenW/2 , (1-transpDist)*backH , 0 );
418
        Static3D center = new Static3D( screenW/2 , transpDist*backH , 0 );
422 419
        Static3D region = new Static3D( transpDist*backH , transpDist*backH , transpDist*backH );
423 420
        mCrawlBackgroundEffects.apply( new FragmentEffectAlpha(new Static1D(1-transpDist*0.6f), center, region, true) );
424 421

  
425 422
        Dynamic3D di = new Dynamic3D(70000,0.5f);
426
        di.add(new Static3D(screenW/2,+backH       , 0));
427
        di.add(new Static3D(screenW/2,-scale*crawlH, 0));
423
        di.add(new Static3D(screenW/2,-scale*crawlH/2        , 0));
424
        di.add(new Static3D(screenW/2,+scale*crawlH/2 + backH, 0));
428 425

  
429 426
        mCrawlEffects.apply( new MatrixEffectMove(di) );
430 427
        mCrawlEffects.apply( new MatrixEffectScale(new Static3D(scale,scale,scale)) );
431
        mCrawlEffects.apply( new MatrixEffectMove(new Static3D(-crawlW/2,0,0)) );
428
        mCrawlEffects.apply( new MatrixEffectMove(new Static3D(-crawlW/2,-crawlH/2,0)) );
432 429
        
433 430
        mBackground = mScreen.attach(mCrawlBackgroundTexture, mCrawlBackgroundEffects,mQuad);
434 431
        mBackground.attach(mCrawlTexture, mCrawlEffects,mQuad);

Also available in: Unified diff