Project

General

Profile

« Previous | Next » 

Revision f6d884d5

Added by Leszek Koltunski over 7 years ago

Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)

View differences:

src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
29 29
import android.opengl.GLES20;
30 30
import android.opengl.GLSurfaceView;
31 31

  
32
import org.distorted.library.DistortedObject;
32
import org.distorted.library.DistortedTexture;
33
import org.distorted.library.DistortedEffectQueues;
33 34
import org.distorted.library.GridFlat;
34 35
import org.distorted.library.Distorted;
35 36

  
......
44 45
   private int texW, texH;
45 46

  
46 47
   private GridFlat mGrid;
47

  
48
   static DistortedObject mBackground;
48
   private DistortedEffectQueues mQueues;
49
   private DistortedTexture mTexture;
49 50

  
50 51
///////////////////////////////////////////////////////////////////////////////////////////////////
51 52

  
......
57 58
     mPaint.setStyle(Style.FILL);
58 59
      
59 60
     mView = v;
61

  
62
     mQueues = new DistortedEffectQueues();
60 63
     }
61 64

  
62 65
///////////////////////////////////////////////////////////////////////////////////////////////////
......
85 88
     }
86 89
   
87 90
///////////////////////////////////////////////////////////////////////////////////////////////////
88
   
91

  
92
   DistortedEffectQueues getQueues()
93
     {
94
     return mQueues;
95
     }
96

  
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98

  
89 99
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
90 100
     {
91 101
     try
......
105 115
     texW = width;
106 116
     texH = height;
107 117

  
108
     mGrid = new GridFlat(80,80*height/width);
109
     mBackground = new DistortedObject(texW,texH,1);
110
     mBitmap = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888);
111
     mCanvas = new Canvas(mBitmap);
118
     mGrid    = new GridFlat(80,80*texH/texW);
119
     mTexture = new DistortedTexture(texW,texH,0);
120
     mBitmap  = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888);
121
     mCanvas  = new Canvas(mBitmap);
112 122

  
113 123
     Distorted.onSurfaceChanged(texW, texH);
114 124
     mView.onSurfaceChanged(texW,texH);
......
126 136
       {
127 137
       drawBackground();   
128 138
       mView.drawCurve(mCanvas,time);
129
       mBackground.setTexture(mBitmap);
139
       mTexture.setTexture(mBitmap);
130 140
       }
131 141
      
132
     mBackground.draw(time,mGrid);
142
     mQueues.draw(time,mTexture,mGrid);
133 143
     }
134 144

  
135 145
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff