Project

General

Profile

« Previous | Next » 

Revision 2f7afccf

Added by Leszek Koltunski over 7 years ago

Fix Crawl transparency in StarWars.

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
101 101
  private final int GFFA_HEIGHT= (FONT_HEIGHT+VERTICAL_SPACING)*(mGFFAString.length+1);
102 102
   
103 103
  private final float CRAWL_ANGLE = -30.0f;
104
   
104
  private final float FOV_ANGLE   =  60.0f;
105

  
105 106
  private GLSurfaceView mView;
106 107
  private DistortedTexture mGFFATexture, mLogoTexture, mCrawlTexture, mCrawlBackgroundTexture, mStarTexture;
107 108
  private DistortedEffects mGFFAEffects, mLogoEffects, mCrawlEffects, mCrawlBackgroundEffects;
......
137 138
      }
138 139

  
139 140
    mScreen = new DistortedScreen();
140
    mScreen.setProjection(60.0f, 0.02f);
141
    mScreen.setProjection(FOV_ANGLE, 0.02f);
141 142
    }
142 143

  
143 144
///////////////////////////////////////////////////////////////////////////////////////////////////
......
200 201

  
201 202
  private void setupScreen(int w, int h)
202 203
    {
203
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(h/Math.cos(CRAWL_ANGLE)));
204
    double angleA = (90.0f - FOV_ANGLE/2)*Math.PI/180;
205
    double angleB = (90.0f - FOV_ANGLE/2 +CRAWL_ANGLE)*Math.PI/180;
206

  
207
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(h*Math.sin(angleA)/Math.sin(angleB)));
204 208
       
205 209
    int randomA, randomX, randomY, randomTime;
206 210
    float randomS, randomAlpha1, randomAlpha2;
......
412 416

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

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

  

Also available in: Unified diff