Project

General

Profile

« Previous | Next » 

Revision 629120e4

Added by Leszek Koltunski over 7 years ago

Minor.

View differences:

src/main/java/org/distorted/examples/deform/DeformRenderer.java
30 30
import org.distorted.library.MeshFlat;
31 31

  
32 32
import org.distorted.library.EffectNames;
33
import org.distorted.library.EffectTypes;
34 33
import org.distorted.library.type.Dynamic3D;
35 34
import org.distorted.library.type.Static3D;
36 35
import org.distorted.library.type.Static4D;
......
87 86
      { 
88 87
      mView = view;
89 88

  
89
      fpsW = 120;
90
      fpsH =  70;
91

  
92
      fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
93
      fpsMesh = new MeshFlat(1,1);
94
      fpsTexture = new DistortedTexture(fpsW,fpsH);
95
      fpsTexture.setTexture(fpsBitmap);
96
      fpsCanvas = new Canvas(fpsBitmap);
97
      fpsEffects = new DistortedEffects();
98
      fpsEffects.move( new Static3D(5,5,0) );
99

  
90 100
      mPaint = new Paint();
91 101
      mPaint.setAntiAlias(true);
92 102
      mPaint.setTextAlign(Paint.Align.CENTER);
103
      mPaint.setTextSize(0.7f*fpsH);
93 104

  
94
      fpsEffects = new DistortedEffects();
95 105
      stretchEffects = new DistortedEffects();
96 106

  
97 107
      mRegion = new Static4D(0,0,0,0);
......
174 184
     mPaint.setColor(0xffffffff);
175 185
     fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint);
176 186
     mPaint.setColor(0xff000000);
177
     fpsCanvas.drawText(fpsString, fpsW/2, 5*fpsH/6, mPaint);
187
     fpsCanvas.drawText(fpsString, fpsW/2, 0.75f*fpsH, mPaint);
178 188
     fpsTexture.setTexture(fpsBitmap);
179 189

  
180 190
     long time = System.currentTimeMillis();
......
200 210
     Bitmap stretchBitmap = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
201 211
     stretchCanvas = new Canvas(stretchBitmap);
202 212

  
203
     fpsW = scrWidth/5;
204
     fpsH = fpsW/2;
205

  
206
     mPaint.setTextSize(2*fpsH/3);
207 213
     mPaint.setColor(0xff008800);
208 214
     mPaint.setStyle(Style.FILL);
209 215
     stretchCanvas.drawRect(0, 0, w, h, mPaint);
......
216 222
       }
217 223

  
218 224
     touchPoint= new Static3D(0,0,0);
219
     fpsMesh = new MeshFlat(1,1);
220

  
221
     fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
222
     fpsCanvas = new Canvas(fpsBitmap);
223 225

  
224 226
     if( stretchTexture==null ) stretchTexture = new DistortedTexture(w,h);
225 227
     stretchTexture.setTexture(stretchBitmap);
226 228

  
227
     if( fpsTexture==null ) fpsTexture = new DistortedTexture(fpsW,fpsH);
228
     fpsTexture.setTexture(fpsBitmap);
229

  
230 229
     stretchEffects.abortAllEffects();
231
     fpsEffects.abortAllEffects();
232 230
     stretchEffects.move( new Static3D(scrWidth/4,scrHeight/4,0) );
233
     fpsEffects.move( new Static3D(5,5,0) );
234 231

  
235 232
     mScreen.detachAll();
236 233
     mScreen.attach(stretchTexture,stretchEffects,stretchMesh);
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
90 90
    // FPS
91 91
    private DistortedTexture fpsTexture;
92 92
    private DistortedEffects fpsEffects;
93
    private MeshFlat fpsMesh;
94 93
    private Canvas fpsCanvas;
95 94
    private Bitmap fpsBitmap;
96 95
    private Paint mPaint;
......
107 106
      mView = v;
108 107
      mDistance = -1;
109 108

  
110
      mPaint = new Paint();
111
      mPaint.setAntiAlias(true);
112
      mPaint.setTextAlign(Paint.Align.CENTER);
109
      fpsW = 120;
110
      fpsH =  70;
113 111

  
114
      fpsTexture = new DistortedTexture(100,100);
112
      fpsTexture = new DistortedTexture(fpsW,fpsH);
113
      fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
114
      fpsTexture.setTexture(fpsBitmap);
115
      fpsCanvas = new Canvas(fpsBitmap);
115 116
      fpsEffects = new DistortedEffects();
116 117
      fpsEffects.move( new Static3D(5,5,0) );
117
      fpsMesh = new MeshFlat(1,1);
118 118
      durations = new long[NUM_FRAMES+1];
119 119
      currDuration = 0;
120 120

  
121
      mPaint = new Paint();
122
      mPaint.setAntiAlias(true);
123
      mPaint.setTextAlign(Paint.Align.CENTER);
124
      mPaint.setTextSize(0.7f*fpsH);
125

  
121 126
      for(int i=0; i<NUM_FRAMES+1; i++) durations[i]=0;
122 127

  
123 128
      mBlurStatus = new boolean[NUM_OBJECTS];
......
164 169
        mScreen.attach(mNode[i]);
165 170
        }
166 171

  
167
      mScreen.attach(fpsTexture,fpsEffects,fpsMesh);
172
      mScreen.attach(fpsTexture,fpsEffects,new MeshFlat(1,1));
168 173

  
169 174
      mBlurStatus[0] = true;
170 175
      mNode[0].setPostprocessEffects(mPostEffects);
......
177 182
      mPaint.setColor(0xffffffff);
178 183
      fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint);
179 184
      mPaint.setColor(0xff000000);
180
      fpsCanvas.drawText(fpsString, fpsW/2, 5*fpsH/6, mPaint);
185
      fpsCanvas.drawText(fpsString, fpsW/2, 0.75f*fpsH, mPaint);
181 186
      fpsTexture.setTexture(fpsBitmap);
182 187

  
183 188
      long time = System.currentTimeMillis();
......
208 213
        }
209 214

  
210 215
      computeMoveVectors();
211

  
212
      fpsW = width/5;
213
      fpsH = fpsW/2;
214
      mPaint.setTextSize(2*fpsH/3);
215
      fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
216
      fpsCanvas = new Canvas(fpsBitmap);
217
      fpsTexture.setTexture(fpsBitmap);
218

  
219 216
      mScreen.resize(width, height);
220 217
      }
221 218

  

Also available in: Unified diff