Revision 13a5c5cd
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
39 | 39 |
import org.distorted.library.type.Static3D; |
40 | 40 |
import org.distorted.library.type.Static4D; |
41 | 41 |
|
42 |
import android.app.Activity; |
|
43 | 42 |
import android.graphics.Bitmap; |
44 | 43 |
import android.graphics.BitmapFactory; |
45 | 44 |
import android.opengl.GLES20; |
... | ... | |
51 | 50 |
class SaveRenderer implements GLSurfaceView.Renderer |
52 | 51 |
{ |
53 | 52 |
private GLSurfaceView mView; |
54 |
private static DistortedBitmap mGirl;
|
|
53 |
private DistortedBitmap mGirl; |
|
55 | 54 |
private Static2D pLeft, pRight; |
56 | 55 |
private Static4D sinkRegion; |
57 |
private static Dynamic1D diSink;
|
|
58 |
private static Static1D s0;
|
|
56 |
private Dynamic1D diSink; |
|
57 |
private Static1D s0; |
|
59 | 58 |
|
60 | 59 |
private int bmpHeight, bmpWidth; |
61 |
private static int scrHeight, scrWidth; |
|
62 |
private static float boobsSink; |
|
63 |
private static boolean isSaving = false; |
|
64 |
private static String mPath; |
|
65 |
|
|
66 |
private static SaveWorkerThread mWorkerThread =null; |
|
60 |
private int scrHeight, scrWidth; |
|
61 |
private float boobsSink; |
|
62 |
private boolean isSaving = false; |
|
63 |
private String mPath; |
|
67 | 64 |
|
68 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
69 | 66 |
|
70 |
public SaveRenderer(GLSurfaceView v)
|
|
67 |
SaveRenderer(GLSurfaceView v) |
|
71 | 68 |
{ |
72 | 69 |
mView = v; |
73 | 70 |
|
... | ... | |
86 | 83 |
|
87 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
88 | 85 |
|
89 |
public static void startThread(Activity act) |
|
90 |
{ |
|
91 |
if( mWorkerThread ==null ) mWorkerThread = new SaveWorkerThread(); |
|
92 |
|
|
93 |
mWorkerThread.startSending(act); |
|
94 |
} |
|
95 |
|
|
96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
97 |
|
|
98 |
public static void stopThread() |
|
99 |
{ |
|
100 |
mWorkerThread.stopSending(); |
|
101 |
mWorkerThread = null; |
|
102 |
} |
|
103 |
|
|
104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
105 |
|
|
106 |
public static void setSize(float s) |
|
86 |
void setSize(float s) |
|
107 | 87 |
{ |
108 | 88 |
boobsSink = s; |
109 | 89 |
s0.set(boobsSink); |
... | ... | |
111 | 91 |
|
112 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
113 | 93 |
|
114 |
public static void Save()
|
|
94 |
void Save() |
|
115 | 95 |
{ |
116 | 96 |
if( isSaving==false ) |
117 | 97 |
{ |
... | ... | |
147 | 127 |
buf.order(ByteOrder.LITTLE_ENDIAN); |
148 | 128 |
GLES20.glReadPixels( 0, 0, scrWidth, scrHeight , GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); |
149 | 129 |
|
150 |
mWorkerThread.newBuffer(buf,scrWidth,scrHeight,mPath);
|
|
130 |
SaveWorkerThread.newBuffer(buf,scrWidth,scrHeight,mPath);
|
|
151 | 131 |
|
152 | 132 |
isSaving = false; |
153 | 133 |
} |
Also available in: Unified diff
Tidy up 'Save'