Project

General

Profile

« Previous | Next » 

Revision 051f00eb

Added by Leszek Koltunski over 4 years ago

Convert Glow to stretchless API.

View differences:

src/main/java/org/distorted/examples/glow/GlowRenderer.java
46 46

  
47 47
class GlowRenderer implements GLSurfaceView.Renderer
48 48
{
49
   private static final int LEAF_SIZE = 100;
50 49
   private static final float HALO_TO_RADIUS = 0.2f;
51 50

  
52 51
   private GLSurfaceView mView;
53 52
   private DistortedTexture mLeaf;
54 53
   private DistortedScreen mScreen;
55 54
   private PostprocessEffectGlow mGlow;
56
   private int mRootW, mRootH;
57 55
   private Static3D mScale;
58 56
   private Static2D mHaloRadius;
59 57
   private Static4D mColor;
......
64 62
      {     
65 63
      mView = v;
66 64

  
67
      mRootW     = LEAF_SIZE;
68
      mRootH     = LEAF_SIZE;
69 65
      mLeaf      = new DistortedTexture();
70 66
      mScale     = new Static3D(1,1,1);
71 67
      mHaloRadius= new Static2D(25*HALO_TO_RADIUS,25);
......
78 74
      effects.apply(mGlow);
79 75

  
80 76
      MeshQuad quad = new MeshQuad();
81
      quad.setStretch(mRootW,mRootH,0);
82 77

  
83 78
      mScreen = new DistortedScreen();
84 79
      mScreen.attach(mLeaf, effects, quad );
......
122 117
    
123 118
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
124 119
     {
125
     float qw = (float)width /mRootW;
126
     float qh = (float)height/mRootH;
127
     float factor = 0.8f* (qw<qh ? qw:qh);
128

  
120
     float factor = 0.8f* (Math.min(width, height));
129 121
     mScale.set( factor,factor,factor );
130 122
     mScreen.resize(width, height);
131 123
     }
......
147 139
         {
148 140
         is.close();
149 141
         }
150
       catch(IOException e) { }
142
       catch(IOException ignored) { }
151 143
       }
152 144
      
153 145
     mLeaf.setTexture(leaf);

Also available in: Unified diff