Project

General

Profile

« Previous | Next » 

Revision 630703d1

Added by Leszek Koltunski about 7 years ago

Revert "Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to."

This reverts commit d79a56d3bc6cc7a22b21abeb180353a1818bd6ad.

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
207 207
    if( mCrawlBackgroundTexture!=null ) mCrawlBackgroundTexture.markForDeletion();
208 208
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(h*Math.sin(angleA)/Math.sin(angleB)));
209 209
       
210
    int randomTime;
211
    float randomX, randomY, randomS, randomAlpha1, randomAlpha2;
212

  
213
    float starScaleX = (float)mStarTexture.getWidth()/w;
214
    float starScaleY = (float)mStarTexture.getHeight()/h;
215

  
210
    int randomA, randomX, randomY, randomTime;
211
    float randomS, randomAlpha1, randomAlpha2;
212
       
213
    Static3D center = new Static3D(0,0,0);
214
    Static3D axis   = new Static3D(0,0,1);
216 215
    Static1D alphaNoise = new Static1D(0.4f);
217 216

  
218 217
    for(int i=0; i<NUM_STARS; i++)
219 218
      {
220
      randomX = mRnd.nextFloat() -0.5f;
221
      randomY = mRnd.nextFloat() -0.5f;
219
      randomX = mRnd.nextInt(w);
220
      randomY = mRnd.nextInt(h);
222 221
      randomS = 0.2f+ 0.8f*mRnd.nextFloat();
222
      randomA = (int)(180*mRnd.nextFloat());
223 223
      randomAlpha1 = 0.2f + 0.8f*mRnd.nextFloat();
224 224
      randomAlpha2 = 0.8f + 0.2f*mRnd.nextFloat();
225 225
      randomTime = 500+mRnd.nextInt(2000);
226 226
      
227 227
      mStarEffects[i].move( new Static3D(randomX,randomY,0) );
228
      mStarEffects[i].scale( new Static3D(randomS*starScaleX, randomS*starScaleY, 1) );
229

  
228
      mStarEffects[i].scale(randomS);
229
      mStarEffects[i].rotate( new Static1D(randomA), axis, center );
230
      
230 231
      Dynamic1D di = new Dynamic1D(randomTime,0.0f);
231 232
      di.setNoise(alphaNoise);
232 233
      di.add(new Static1D(randomAlpha1));
......
236 237
      
237 238
      mScreen.attach(mStarTexture, mStarEffects[i], mQuad);
238 239
      }
239

  
240
    float qx = (float)mGFFATexture.getWidth()/w;
241
    float qy = (float)mGFFATexture.getHeight()/h;
242

  
240
      
241
    float scale = (0.5f*w/mGFFATexture.getWidth());
242
    
243 243
    Dynamic1D di = new Dynamic1D(6000,0.5f);
244 244
    di.add(new Static1D(1.0f));
245 245
    di.add(new Static1D(1.0f));
246 246
    di.add(new Static1D(0.0f));
247 247
    
248
    mGFFAEffects.move( new Static3D(qx/2-0.3f,qy/2-0.16f,0) );
249
    mGFFAEffects.scale( new Static3D(qx,qy,1) );
248
    mGFFAEffects.move( new Static3D(w/5,h/3,0) );
249
    mGFFAEffects.scale( new Static3D(scale,scale,scale) );
250 250
    mGFFAEffects.alpha(di);
251 251
      
252 252
    mScreen.attach(mGFFATexture, mGFFAEffects, mQuad);
......
380 380
        mScreen.detach(mGFFAEffects);
381 381
        mGFFATexture.markForDeletion();
382 382

  
383
        float qx= (float)mScreen.getWidth() /mLogoTexture.getWidth() ;
384
        float qy= (float)mScreen.getHeight()/mLogoTexture.getHeight();
385

  
386
        float initSize= 3.0f;
387
        float finaSize= 0.1f;
383
        int screenW=mScreen.getWidth();
384
        int screenH=mScreen.getHeight();
385
        
386
        int logoW = mLogoTexture.getWidth();
387
        int logoH = mLogoTexture.getHeight();
388
      
389
        int initSize= (int)(3.0f*screenW/logoW);
390
        int finaSize= (int)(0.1f*screenW/logoW);
388 391
      
389 392
        Dynamic3D di = new Dynamic3D(10000,0.5f);
390
        di.add(qx<qy ? (new Static3D(initSize,initSize*qx/qy,1)) : (new Static3D(initSize*qy/qx,initSize,1)));
391
        di.add(qx<qy ? (new Static3D(finaSize,finaSize*qx/qy,1)) : (new Static3D(finaSize*qy/qx,finaSize,1)));
393
        di.add(new Static3D(initSize,initSize,1));
394
        di.add(new Static3D(finaSize,finaSize,1));
392 395

  
396
        mLogoEffects.move( new Static3D(screenW/2,screenH/2,0) );
393 397
        mLogoEffects.scale(di);
394

  
398
        mLogoEffects.move( new Static3D(-logoW/2,-logoH/2,0) );
399
      
395 400
        mScreen.attach(mLogoTexture, mLogoEffects,mQuad);
396 401
        mLogoEffects.registerForMessages(this);
397 402
        }
......
407 412
        int backH  = mCrawlBackgroundTexture.getHeight();
408 413
        float scale= (float)screenW/crawlW;
409 414

  
410
        //mCrawlBackgroundEffects.move( new Static3D(0,screenH-backH,0) );
411
        mCrawlBackgroundEffects.rotate( new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(0.5f,1.0f,0.0f) );
412
        mCrawlBackgroundEffects.scale( new Static3D(1.0f, (float)backH/screenH,1.0f) );
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) );
413 417

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

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

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

Also available in: Unified diff