Revision 4aa38649
Added by Leszek Koltunski almost 7 years ago
| src/main/java/org/distorted/library/main/DistortedScreen.java | ||
|---|---|---|
| 38 | 38 |
public class DistortedScreen extends DistortedFramebuffer |
| 39 | 39 |
{
|
| 40 | 40 |
///// DEBUGGING ONLY ///////////////////////// |
| 41 |
private boolean mShowFPS; |
|
| 42 |
|
|
| 43 | 41 |
private static final int NUM_FRAMES = 100; |
| 42 |
private static final int FPS_W = 120; |
|
| 43 |
private static final int FPS_H = 70; |
|
| 44 |
|
|
| 45 |
private boolean mShowFPS; |
|
| 44 | 46 |
|
| 45 | 47 |
private MeshQuad fpsMesh; |
| 46 | 48 |
private DistortedTexture fpsTexture; |
| ... | ... | |
| 48 | 50 |
private Canvas fpsCanvas; |
| 49 | 51 |
private Bitmap fpsBitmap; |
| 50 | 52 |
private Paint mPaint; |
| 51 |
private int fpsH, fpsW; |
|
| 52 | 53 |
private String fpsString; |
| 53 | 54 |
private long lastTime=0; |
| 54 | 55 |
private long[] durations; |
| ... | ... | |
| 100 | 101 |
fpsString = "" + ((int)(10000.0f*NUM_FRAMES/durations[NUM_FRAMES]))/10.0f; |
| 101 | 102 |
|
| 102 | 103 |
mPaint.setColor(0xffffffff); |
| 103 |
fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint);
|
|
| 104 |
fpsCanvas.drawRect(0, 0, FPS_W, FPS_H, mPaint);
|
|
| 104 | 105 |
mPaint.setColor(0xff000000); |
| 105 |
fpsCanvas.drawText(fpsString, fpsW/2, 0.75f*fpsH, mPaint);
|
|
| 106 |
fpsCanvas.drawText(fpsString, FPS_W/2, 0.75f*FPS_H, mPaint);
|
|
| 106 | 107 |
fpsTexture.setTexture(fpsBitmap); |
| 107 | 108 |
|
| 108 | 109 |
lastTime = time; |
| ... | ... | |
| 129 | 130 |
|
| 130 | 131 |
if( mShowFPS && fpsTexture.setAsInput()) |
| 131 | 132 |
{
|
| 132 |
fpsEffects.drawPriv(fpsW / 2.0f, fpsH / 2.0f, fpsMesh, this, time);
|
|
| 133 |
fpsEffects.drawPriv(FPS_W / 2.0f, FPS_H / 2.0f, fpsMesh, this, time);
|
|
| 133 | 134 |
} |
| 134 | 135 |
|
| 135 | 136 |
if( ++mCurRenderedFBO>=Distorted.FBO_QUEUE_SIZE ) |
| ... | ... | |
| 155 | 156 |
if( !mShowFPS ) |
| 156 | 157 |
{
|
| 157 | 158 |
mShowFPS = true; |
| 158 |
|
|
| 159 |
fpsW = 120; |
|
| 160 |
fpsH = 70; |
|
| 161 |
|
|
| 162 | 159 |
fpsString = ""; |
| 163 |
fpsBitmap = Bitmap.createBitmap(fpsW, fpsH, Bitmap.Config.ARGB_8888);
|
|
| 160 |
fpsBitmap = Bitmap.createBitmap(FPS_W, FPS_H, Bitmap.Config.ARGB_8888);
|
|
| 164 | 161 |
fpsMesh = new MeshQuad(); |
| 165 |
fpsTexture = new DistortedTexture(fpsW, fpsH);
|
|
| 162 |
fpsTexture = new DistortedTexture(FPS_W, FPS_H);
|
|
| 166 | 163 |
fpsTexture.setTexture(fpsBitmap); |
| 167 | 164 |
fpsCanvas = new Canvas(fpsBitmap); |
| 168 | 165 |
fpsEffects = new DistortedEffects(); |
| ... | ... | |
| 171 | 168 |
mPaint = new Paint(); |
| 172 | 169 |
mPaint.setAntiAlias(true); |
| 173 | 170 |
mPaint.setTextAlign(Paint.Align.CENTER); |
| 174 |
mPaint.setTextSize(0.7f * fpsH);
|
|
| 171 |
mPaint.setTextSize(0.7f * FPS_H);
|
|
| 175 | 172 |
|
| 176 | 173 |
durations = new long[NUM_FRAMES + 1]; |
| 177 | 174 |
currDuration = 0; |
Also available in: Unified diff
Redefine the Vertex Region from (x,y,r,unused) to (x,y,z,r). This takes into account the 'Z', which makes it possible to warp only one side of a 3D Mesh like Sphere.
Also corresponding changes in applications.