Project

General

Profile

« Previous | Next » 

Revision fc448f77

Added by Leszek Koltunski over 7 years ago

Further progress with Apps: 29 (out of 31) compile now.

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
29 29
import org.distorted.examples.R;
30 30

  
31 31
import org.distorted.library.effect.EffectName;
32
import org.distorted.library.effect.FragmentEffectAlpha;
33
import org.distorted.library.effect.MatrixEffectMove;
34
import org.distorted.library.effect.MatrixEffectRotate;
35
import org.distorted.library.effect.MatrixEffectScale;
32 36
import org.distorted.library.main.DistortedNode;
33 37
import org.distorted.library.main.DistortedScreen;
34 38
import org.distorted.library.main.MeshFlat;
......
224 228
      randomAlpha2 = 0.8f + 0.2f*mRnd.nextFloat();
225 229
      randomTime = 500+mRnd.nextInt(2000);
226 230
      
227
      mStarEffects[i].move( new Static3D(randomX,randomY,0) );
228
      mStarEffects[i].scale(randomS);
229
      mStarEffects[i].rotate( new Static1D(randomA), axis, center );
231
      mStarEffects[i].apply( new MatrixEffectMove(new Static3D(randomX,randomY,0)) );
232
      mStarEffects[i].apply( new MatrixEffectScale(randomS) );
233
      mStarEffects[i].apply( new MatrixEffectRotate(new Static1D(randomA), axis, center) );
230 234
      
231 235
      Dynamic1D di = new Dynamic1D(randomTime,0.0f);
232 236
      di.setNoise(alphaNoise);
233 237
      di.add(new Static1D(randomAlpha1));
234 238
      di.add(new Static1D(randomAlpha2));
235 239
      
236
      mStarEffects[i].alpha(di);
240
      mStarEffects[i].apply( new FragmentEffectAlpha(di) );
237 241
      
238 242
      mScreen.attach(mStarTexture, mStarEffects[i], mQuad);
239 243
      }
......
245 249
    di.add(new Static1D(1.0f));
246 250
    di.add(new Static1D(0.0f));
247 251
    
248
    mGFFAEffects.move( new Static3D(w/5,h/3,0) );
249
    mGFFAEffects.scale( new Static3D(scale,scale,scale) );
250
    mGFFAEffects.alpha(di);
252
    mGFFAEffects.apply( new MatrixEffectMove(new Static3D(w/5,h/3,0)) );
253
    mGFFAEffects.apply( new MatrixEffectScale(scale) );
254
    mGFFAEffects.apply( new FragmentEffectAlpha(di) );
251 255
      
252 256
    mScreen.attach(mGFFATexture, mGFFAEffects, mQuad);
253 257
    mGFFAEffects.registerForMessages(this);
......
393 397
        di.add(new Static3D(initSize,initSize,1));
394 398
        di.add(new Static3D(finaSize,finaSize,1));
395 399

  
396
        mLogoEffects.move( new Static3D(screenW/2,screenH/2,0) );
397
        mLogoEffects.scale(di);
398
        mLogoEffects.move( new Static3D(-logoW/2,-logoH/2,0) );
400
        mLogoEffects.apply( new MatrixEffectMove(new Static3D(screenW/2,screenH/2,0)) );
401
        mLogoEffects.apply( new MatrixEffectScale(di) );
402
        mLogoEffects.apply( new MatrixEffectMove(new Static3D(-logoW/2,-logoH/2,0)) );
399 403
      
400 404
        mScreen.attach(mLogoTexture, mLogoEffects,mQuad);
401 405
        mLogoEffects.registerForMessages(this);
......
412 416
        int backH  = mCrawlBackgroundTexture.getHeight();
413 417
        float scale= (float)screenW/crawlW;
414 418

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

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

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

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

Also available in: Unified diff