Revision 629120e4
Added by Leszek Koltunski about 7 years ago
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
Minor.