Revision 629120e4
Added by Leszek Koltunski about 7 years ago
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); |
Also available in: Unified diff
Minor.