Revision fe59d375
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 | 29 |
import org.distorted.library.DistortedEffects; |
30 |
import org.distorted.library.DistortedFramebuffer; |
|
31 | 30 |
import org.distorted.library.DistortedScreen; |
32 | 31 |
import org.distorted.library.MeshFlat; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
... | ... | |
46 | 45 |
{ |
47 | 46 |
private GLSurfaceView mView; |
48 | 47 |
private DistortedEffects mEffects; |
49 |
private DistortedTexture mTexture; |
|
50 |
private MeshFlat mMesh; |
|
51 | 48 |
private DistortedScreen mScreen; |
52 | 49 |
private AroundTheWorldEffectsManager mManager; |
53 | 50 |
private int mObjWidth, mObjHeight; |
... | ... | |
78 | 75 |
public void onDrawFrame(GL10 glUnused) |
79 | 76 |
{ |
80 | 77 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
81 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
78 |
mScreen.render( System.currentTimeMillis() );
|
|
82 | 79 |
} |
83 | 80 |
|
84 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
130 | 127 |
mObjWidth = bitmap.getWidth(); |
131 | 128 |
mObjHeight= bitmap.getHeight(); |
132 | 129 |
|
133 |
mTexture = new DistortedTexture(mObjWidth,mObjHeight);
|
|
134 |
mTexture.setTexture(bitmap);
|
|
130 |
DistortedTexture texture = new DistortedTexture(mObjWidth,mObjHeight);
|
|
131 |
texture.setTexture(bitmap);
|
|
135 | 132 |
|
136 |
mMesh = new MeshFlat(30,30*mObjHeight/mObjWidth); |
|
133 |
MeshFlat mesh = new MeshFlat(30,30*mObjHeight/mObjWidth); |
|
134 |
|
|
135 |
mScreen.detachAll(); |
|
136 |
mScreen.attach(texture, mEffects, mesh ); |
|
137 | 137 |
|
138 | 138 |
try |
139 | 139 |
{ |
src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 | 30 |
import org.distorted.library.DistortedEffects; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.EffectTypes; |
34 | 33 |
import org.distorted.library.Distorted; |
... | ... | |
48 | 47 |
class BeanRenderer implements GLSurfaceView.Renderer |
49 | 48 |
{ |
50 | 49 |
private GLSurfaceView mView; |
51 |
private DistortedTexture mTexture; |
|
52 | 50 |
private DistortedEffects mEffects; |
53 | 51 |
private DistortedScreen mScreen; |
54 |
private MeshFlat mMesh; |
|
55 | 52 |
private int bmpHeight, bmpWidth; |
56 | 53 |
|
57 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
98 | 95 |
public void onDrawFrame(GL10 glUnused) |
99 | 96 |
{ |
100 | 97 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
101 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
98 |
mScreen.render( System.currentTimeMillis() );
|
|
102 | 99 |
} |
103 | 100 |
|
104 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
152 | 149 |
bmpHeight = bitmap.getHeight(); |
153 | 150 |
bmpWidth = bitmap.getWidth(); |
154 | 151 |
|
155 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
156 |
mTexture.setTexture(bitmap); |
|
157 |
mMesh = new MeshFlat(25,25*bmpHeight/bmpWidth); |
|
152 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
153 |
texture.setTexture(bitmap); |
|
154 |
MeshFlat mesh = new MeshFlat(25,25*bmpHeight/bmpWidth); |
|
155 |
|
|
156 |
mScreen.detachAll(); |
|
157 |
mScreen.attach(texture,mEffects,mesh); |
|
158 | 158 |
|
159 | 159 |
try |
160 | 160 |
{ |
src/main/java/org/distorted/examples/blur/BlurRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 | 29 |
import org.distorted.library.DistortedEffects; |
30 |
import org.distorted.library.DistortedFramebuffer; |
|
31 | 30 |
import org.distorted.library.DistortedScreen; |
32 | 31 |
import org.distorted.library.DistortedTexture; |
33 | 32 |
import org.distorted.library.EffectTypes; |
... | ... | |
47 | 46 |
class BlurRenderer implements GLSurfaceView.Renderer |
48 | 47 |
{ |
49 | 48 |
private GLSurfaceView mView; |
50 |
private DistortedTexture mTexture; |
|
51 | 49 |
private DistortedEffects mEffects; |
52 | 50 |
private DistortedScreen mScreen; |
53 | 51 |
private MeshFlat mMesh; |
... | ... | |
84 | 82 |
public void onDrawFrame(GL10 glUnused) |
85 | 83 |
{ |
86 | 84 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
87 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
85 |
mScreen.render( System.currentTimeMillis() );
|
|
88 | 86 |
} |
89 | 87 |
|
90 | 88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
138 | 136 |
bmpHeight = bitmap.getHeight(); |
139 | 137 |
bmpWidth = bitmap.getWidth(); |
140 | 138 |
|
141 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
142 |
mTexture.setTexture(bitmap); |
|
139 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
140 |
texture.setTexture(bitmap); |
|
141 |
|
|
142 |
mScreen.detachAll(); |
|
143 |
mScreen.attach(texture,mEffects,mMesh); |
|
143 | 144 |
|
144 | 145 |
try |
145 | 146 |
{ |
... | ... | |
147 | 148 |
} |
148 | 149 |
catch(Exception ex) |
149 | 150 |
{ |
150 |
android.util.Log.e("Renderer", ex.getMessage() );
|
|
151 |
android.util.Log.e("Blur", ex.getMessage() );
|
|
151 | 152 |
} |
152 | 153 |
} |
153 | 154 |
} |
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
import org.distorted.library.Distorted; |
30 | 30 |
import org.distorted.library.DistortedEffects; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
34 | 33 |
import org.distorted.library.MeshFlat; |
... | ... | |
50 | 49 |
{ |
51 | 50 |
private GLSurfaceView mView; |
52 | 51 |
private DistortedEffects mEffects; |
53 |
private DistortedTexture mTexture; |
|
54 | 52 |
private MeshFlat mMesh; |
55 | 53 |
private DistortedScreen mScreen; |
56 | 54 |
private int bmpHeight, bmpWidth; |
... | ... | |
87 | 85 |
public void onDrawFrame(GL10 glUnused) |
88 | 86 |
{ |
89 | 87 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
90 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
88 |
mScreen.render( System.currentTimeMillis() );
|
|
91 | 89 |
} |
92 | 90 |
|
93 | 91 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
115 | 113 |
bmpHeight = bitmap.getHeight(); |
116 | 114 |
bmpWidth = bitmap.getWidth(); |
117 | 115 |
|
118 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
119 |
mTexture.setTexture(bitmap); |
|
116 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
117 |
texture.setTexture(bitmap); |
|
118 |
|
|
119 |
mScreen.detachAll(); |
|
120 |
mScreen.attach(texture,mEffects,mMesh); |
|
120 | 121 |
|
121 | 122 |
try |
122 | 123 |
{ |
src/main/java/org/distorted/examples/check/CheckRenderer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.distorted.library.Distorted; |
31 | 31 |
import org.distorted.library.DistortedEffects; |
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.DistortedTexture; |
35 | 34 |
import org.distorted.library.MeshFlat; |
... | ... | |
57 | 56 |
private static String compilationTitle; |
58 | 57 |
|
59 | 58 |
private GLSurfaceView mView; |
60 |
private DistortedTexture mTexture; |
|
61 | 59 |
private DistortedEffects mEffects; |
62 |
private MeshFlat mMesh; |
|
63 | 60 |
private DistortedScreen mScreen; |
64 | 61 |
private int bmpHeight, bmpWidth; |
65 | 62 |
|
... | ... | |
83 | 80 |
public void onDrawFrame(GL10 glUnused) |
84 | 81 |
{ |
85 | 82 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
86 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
83 |
mScreen.render( System.currentTimeMillis() );
|
|
87 | 84 |
} |
88 | 85 |
|
89 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
137 | 134 |
bmpHeight = bitmap.getHeight(); |
138 | 135 |
bmpWidth = bitmap.getWidth(); |
139 | 136 |
|
140 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
141 |
mTexture.setTexture(bitmap); |
|
142 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
137 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
138 |
texture.setTexture(bitmap); |
|
139 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
140 |
|
|
141 |
mScreen.detachAll(); |
|
142 |
mScreen.attach(texture,mEffects,mesh); |
|
143 | 143 |
|
144 | 144 |
// Try adding 2 Vertex Effects to the Bitmap. |
145 | 145 |
// This will fail if we have set maxVertexEffects to something < 2. |
src/main/java/org/distorted/examples/cubes/CubesRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 | 30 |
import org.distorted.library.DistortedEffects; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
34 | 33 |
import org.distorted.library.MeshObject; |
... | ... | |
90 | 89 |
public void onDrawFrame(GL10 glUnused) |
91 | 90 |
{ |
92 | 91 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
93 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
92 |
mScreen.render( System.currentTimeMillis() );
|
|
94 | 93 |
} |
95 | 94 |
|
96 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
144 | 143 |
} |
145 | 144 |
|
146 | 145 |
mTexture.setTexture(bitmap); |
147 |
|
|
146 |
|
|
147 |
mScreen.detachAll(); |
|
148 |
mScreen.attach(mTexture,mEffects,mMesh); |
|
149 |
|
|
148 | 150 |
try |
149 | 151 |
{ |
150 | 152 |
Distorted.onCreate(mView.getContext()); |
src/main/java/org/distorted/examples/deform/DeformRenderer.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import org.distorted.library.Distorted; |
26 | 26 |
import org.distorted.library.DistortedEffects; |
27 |
import org.distorted.library.DistortedFramebuffer; |
|
28 | 27 |
import org.distorted.library.DistortedScreen; |
29 | 28 |
import org.distorted.library.DistortedTexture; |
30 | 29 |
import org.distorted.library.MeshObject; |
... | ... | |
182 | 181 |
public void onDrawFrame(GL10 glUnused) |
183 | 182 |
{ |
184 | 183 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
185 |
|
|
186 |
long time = System.currentTimeMillis(); |
|
187 |
|
|
188 |
mScreen.renderTo(stretchTexture, stretchMesh,stretchEffects,time); |
|
189 |
|
|
184 |
|
|
190 | 185 |
mPaint.setColor(0xffffffff); |
191 | 186 |
fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint); |
192 | 187 |
mPaint.setColor(0xff000000); |
193 | 188 |
fpsCanvas.drawText(fpsString, fpsW/2, 5*fpsH/6, mPaint); |
194 |
|
|
195 | 189 |
fpsTexture.setTexture(fpsBitmap); |
196 |
mScreen.renderTo(fpsTexture, fpsMesh,fpsEffects,time); |
|
197 |
|
|
190 |
|
|
191 |
long time = System.currentTimeMillis(); |
|
192 |
|
|
193 |
mScreen.render(time); |
|
198 | 194 |
computeFPS(time); |
199 | 195 |
} |
200 | 196 |
|
... | ... | |
215 | 211 |
stretchEffects.move( new Static3D(scrWidth/4,scrHeight/4,0) ); |
216 | 212 |
fpsEffects.move( new Static3D(5,5,0) ); |
217 | 213 |
bitmapCreated=true; |
214 |
|
|
215 |
mScreen.detachAll(); |
|
216 |
mScreen.attach(stretchTexture,stretchEffects,stretchMesh); |
|
217 |
mScreen.attach(fpsTexture,fpsEffects,fpsMesh); |
|
218 | 218 |
} |
219 | 219 |
else |
220 | 220 |
{ |
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 | 30 |
import org.distorted.library.Distorted; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
34 | 33 |
import org.distorted.library.DistortedEffects; |
... | ... | |
51 | 50 |
private static final int NUM = 3; |
52 | 51 |
|
53 | 52 |
private GLSurfaceView mView; |
54 |
private DistortedTexture[] mTexture; |
|
55 | 53 |
private DistortedEffects[] mEffects; |
56 |
private MeshFlat mMesh; |
|
57 | 54 |
private DistortedScreen mScreen; |
58 | 55 |
private int bmpHeight, bmpWidth; |
59 | 56 |
|
... | ... | |
109 | 106 |
public void onDrawFrame(GL10 glUnused) |
110 | 107 |
{ |
111 | 108 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
112 |
|
|
113 |
long time = System.currentTimeMillis(); |
|
114 |
|
|
115 |
for(int i=NUM-1; i>=0; i--) mScreen.renderTo(mTexture[i], mMesh, mEffects[i], time); |
|
109 |
mScreen.render( System.currentTimeMillis() ); |
|
116 | 110 |
} |
117 | 111 |
|
118 | 112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
164 | 158 |
bmpHeight = bitmap0.getHeight(); |
165 | 159 |
bmpWidth = bitmap0.getWidth(); |
166 | 160 |
|
167 |
mTexture = new DistortedTexture[NUM];
|
|
161 |
DistortedTexture[] texture = new DistortedTexture[NUM];
|
|
168 | 162 |
for(int i=0; i<NUM; i++) |
169 |
mTexture[i] = new DistortedTexture(bmpWidth,bmpHeight);
|
|
163 |
texture[i] = new DistortedTexture(bmpWidth,bmpHeight);
|
|
170 | 164 |
|
171 |
mTexture[0].setTexture(bitmap0); |
|
172 |
mTexture[1].setTexture(bitmap1); |
|
173 |
mTexture[2].setTexture(bitmap2); |
|
165 |
texture[0].setTexture(bitmap0); |
|
166 |
texture[1].setTexture(bitmap1); |
|
167 |
texture[2].setTexture(bitmap2); |
|
168 |
|
|
169 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
174 | 170 |
|
175 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
171 |
mScreen.detachAll(); |
|
172 |
for(int i=NUM-1; i>=0; i--) mScreen.attach(texture[i], mEffects[i], mesh); |
|
176 | 173 |
|
177 | 174 |
try |
178 | 175 |
{ |
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.distorted.library.Distorted; |
31 | 31 |
import org.distorted.library.DistortedEffects; |
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.MeshFlat; |
35 | 34 |
import org.distorted.library.DistortedTexture; |
... | ... | |
53 | 52 |
|
54 | 53 |
private GLSurfaceView mView; |
55 | 54 |
private DistortedEffects[] mEffects; |
56 |
private DistortedTexture mTexture; |
|
57 |
private MeshFlat mMesh; |
|
58 | 55 |
private DistortedScreen mScreen; |
59 | 56 |
private int bmpHeight, bmpWidth; |
60 | 57 |
|
... | ... | |
103 | 100 |
public void onDrawFrame(GL10 glUnused) |
104 | 101 |
{ |
105 | 102 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
106 |
|
|
107 |
long time = System.currentTimeMillis(); |
|
108 |
|
|
109 |
for(int i=NUM-1; i>=0; i--) mScreen.renderTo(mTexture, mMesh, mEffects[i], time); |
|
103 |
mScreen.render( System.currentTimeMillis() ); |
|
110 | 104 |
} |
111 | 105 |
|
112 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
170 | 164 |
bmpHeight = bitmap.getHeight(); |
171 | 165 |
bmpWidth = bitmap.getWidth(); |
172 | 166 |
|
173 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
174 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
167 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
168 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
169 |
texture.setTexture(bitmap); |
|
175 | 170 |
|
176 |
mTexture.setTexture(bitmap); |
|
171 |
mScreen.detachAll(); |
|
172 |
for(int i=NUM-1; i>=0; i--) mScreen.attach(texture, mEffects[i], mesh); |
|
177 | 173 |
|
178 | 174 |
try |
179 | 175 |
{ |
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java | ||
---|---|---|
30 | 30 |
import android.opengl.GLSurfaceView; |
31 | 31 |
|
32 | 32 |
import org.distorted.library.DistortedEffects; |
33 |
import org.distorted.library.DistortedFramebuffer; |
|
34 | 33 |
import org.distorted.library.DistortedScreen; |
35 | 34 |
import org.distorted.library.MeshFlat; |
36 | 35 |
import org.distorted.library.DistortedTexture; |
... | ... | |
61 | 60 |
mPaint.setColor(0xff447da7); |
62 | 61 |
mPaint.setStyle(Style.FILL); |
63 | 62 |
|
64 |
mView = v; |
|
65 |
mMesh = new MeshFlat(1,1); |
|
63 |
mView = v;
|
|
64 |
mMesh = new MeshFlat(1,1);
|
|
66 | 65 |
mEffects = new DistortedEffects(); |
67 |
mScreen = new DistortedScreen(); |
|
66 |
mScreen = new DistortedScreen();
|
|
68 | 67 |
} |
69 | 68 |
|
70 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
92 | 91 |
mBitmap = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888); |
93 | 92 |
mCanvas = new Canvas(mBitmap); |
94 | 93 |
|
94 |
mScreen.detachAll(); |
|
95 |
mScreen.attach(mTexture,mEffects,mMesh); |
|
95 | 96 |
mScreen.resize(texW,texH); |
96 | 97 |
mView.onSurfaceChanged(texW,texH); |
97 | 98 |
} |
... | ... | |
107 | 108 |
mCanvas.drawRect(0, 0, texW, texH, mPaint); |
108 | 109 |
mView.drawCurve(mCanvas,time); |
109 | 110 |
mTexture.setTexture(mBitmap); |
110 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
111 |
mScreen.render( System.currentTimeMillis() );
|
|
111 | 112 |
} |
112 | 113 |
|
113 | 114 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java | ||
---|---|---|
30 | 30 |
import android.opengl.GLSurfaceView; |
31 | 31 |
|
32 | 32 |
import org.distorted.library.DistortedEffects; |
33 |
import org.distorted.library.DistortedFramebuffer; |
|
34 | 33 |
import org.distorted.library.DistortedScreen; |
35 | 34 |
import org.distorted.library.MeshFlat; |
36 | 35 |
import org.distorted.library.DistortedTexture; |
... | ... | |
106 | 105 |
} |
107 | 106 |
mTexture.setTexture(bitmap); |
108 | 107 |
|
108 |
mScreen.detachAll(); |
|
109 |
mScreen.attach(mTexture,mEffects,mMesh); |
|
110 |
|
|
109 | 111 |
try |
110 | 112 |
{ |
111 | 113 |
Distorted.onCreate(mView.getContext()); |
... | ... | |
131 | 133 |
public void onDrawFrame(GL10 glUnused) |
132 | 134 |
{ |
133 | 135 |
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT); |
134 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
136 |
mScreen.render( System.currentTimeMillis() );
|
|
135 | 137 |
} |
136 | 138 |
|
137 | 139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
---|---|---|
249 | 249 |
mSupportsRegion = supports; |
250 | 250 |
} |
251 | 251 |
|
252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
253 |
|
|
254 |
public static boolean supportsRegion() |
|
255 |
{ |
|
256 |
return mSupportsRegion; |
|
257 |
} |
|
258 |
|
|
259 | 252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
260 | 253 |
|
261 | 254 |
public static void setSupportsCenter(boolean supports) |
... | ... | |
263 | 256 |
mSupportsCenter = supports; |
264 | 257 |
} |
265 | 258 |
|
266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
267 |
|
|
268 |
public static boolean supportsCenter() |
|
269 |
{ |
|
270 |
return mSupportsCenter; |
|
271 |
} |
|
272 |
|
|
273 | 259 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
274 | 260 |
|
275 | 261 |
public Bitmap getBitmap() |
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 | 29 |
import org.distorted.library.DistortedEffects; |
30 |
import org.distorted.library.DistortedFramebuffer;
|
|
30 |
import org.distorted.library.DistortedNode;
|
|
31 | 31 |
import org.distorted.library.DistortedScreen; |
32 | 32 |
import org.distorted.library.DistortedTexture; |
33 | 33 |
import org.distorted.library.MeshFlat; |
... | ... | |
52 | 52 |
private DistortedTexture mObjectTexture, mBackgroundTexture, mCenterTexture, mRegionTexture; |
53 | 53 |
private DistortedEffects mObjectEffects, mBackgroundEffects, mCenterEffects, mRegionEffects; |
54 | 54 |
private DistortedScreen mScreen; |
55 |
private DistortedNode mCenterNode, mRegionNode; |
|
55 | 56 |
private MeshFlat mQuad; |
56 | 57 |
private MeshObject mObjectMesh; |
57 | 58 |
private int mObjWidth, mObjHeight, mObjDepth; |
... | ... | |
111 | 112 |
mRegionScalePoint = new Static3D(0,0,0); |
112 | 113 |
mRegionScaleInter.add(mRegionScalePoint); |
113 | 114 |
|
115 |
mCenterNode = new DistortedNode(mCenterTexture, mCenterEffects, mQuad); |
|
116 |
mRegionNode = new DistortedNode(mRegionTexture, mRegionEffects, mQuad); |
|
117 |
|
|
114 | 118 |
mScreen = new DistortedScreen(); |
119 |
mScreen.attach(mBackgroundTexture, mBackgroundEffects, mQuad ); |
|
120 |
mScreen.attach(mObjectTexture , mObjectEffects , mObjectMesh); |
|
121 |
|
|
122 |
//if( Effects3DActivity.supportsCenter() ) |
|
123 |
mScreen.attach(mCenterNode); |
|
124 |
//if( Effects3DActivity.supportsRegion() ) |
|
125 |
mScreen.attach(mRegionNode); |
|
115 | 126 |
} |
116 | 127 |
|
117 | 128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
135 | 146 |
public void onDrawFrame(GL10 glUnused) |
136 | 147 |
{ |
137 | 148 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
138 |
|
|
139 |
long time = System.currentTimeMillis(); |
|
140 |
|
|
141 |
mScreen.renderTo(mBackgroundTexture,mQuad ,mBackgroundEffects,time); |
|
142 |
mScreen.renderTo(mObjectTexture , mObjectMesh,mObjectEffects ,time); |
|
143 |
|
|
144 |
if( Effects3DActivity.supportsCenter() ) |
|
145 |
{ |
|
146 |
mScreen.renderTo(mCenterTexture,mQuad,mCenterEffects, time); |
|
147 |
if( Effects3DActivity.supportsRegion() ) mScreen.renderTo(mRegionTexture,mQuad,mRegionEffects,time); |
|
148 |
} |
|
149 |
mScreen.render(System.currentTimeMillis()); |
|
149 | 150 |
} |
150 | 151 |
|
151 | 152 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/fbo/FBORenderer.java | ||
---|---|---|
81 | 81 |
public void onDrawFrame(GL10 glUnused) |
82 | 82 |
{ |
83 | 83 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
84 |
mScreen.renderTo(mRoot,System.currentTimeMillis());
|
|
84 |
mScreen.render(System.currentTimeMillis());
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
152 | 152 |
mRoot = new DistortedNode(lisa, mEffects,new MeshFlat(1,1)); |
153 | 153 |
mRoot.attach(grid,gridEffects,new MeshCubes(10,10,false)); |
154 | 154 |
|
155 |
mScreen.detachAll(); |
|
156 |
mScreen.attach(mRoot); |
|
157 |
|
|
155 | 158 |
float factor = lisaWidth/(2.0f*gridWidth); |
156 | 159 |
|
157 | 160 |
gridEffects.move( new Static3D( (lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2,0) ); |
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 | 29 |
import org.distorted.library.DistortedEffects; |
30 |
import org.distorted.library.DistortedFramebuffer; |
|
31 | 30 |
import org.distorted.library.DistortedScreen; |
32 | 31 |
import org.distorted.library.MeshCubes; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
... | ... | |
53 | 52 |
private DistortedEffects mEffects; |
54 | 53 |
private DistortedTexture mTexture; |
55 | 54 |
private DistortedScreen mScreen; |
56 |
private MeshCubes mMesh; |
|
57 | 55 |
private DynamicQuat mQuatInt1, mQuatInt2; |
58 | 56 |
private Dynamic5D mWaveDyn; |
59 | 57 |
private Static5D mWaveSta1, mWaveSta2; |
... | ... | |
69 | 67 |
mView = v; |
70 | 68 |
|
71 | 69 |
mEffects = new DistortedEffects(); |
72 |
mMesh = new MeshCubes(50,30,false); |
|
73 | 70 |
mTexture = new DistortedTexture(500,300); |
74 | 71 |
|
75 | 72 |
mObjWidth = mTexture.getWidth(); |
... | ... | |
98 | 95 |
mEffects.wave(mWaveDyn, waveCenter, waveRegion); |
99 | 96 |
|
100 | 97 |
mScreen = new DistortedScreen(); |
98 |
mScreen.attach(mTexture,mEffects, new MeshCubes(50,30,false) ); |
|
101 | 99 |
} |
102 | 100 |
|
103 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
144 | 142 |
public void onDrawFrame(GL10 glUnused) |
145 | 143 |
{ |
146 | 144 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
147 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
145 |
mScreen.render( System.currentTimeMillis() );
|
|
148 | 146 |
} |
149 | 147 |
|
150 | 148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
|
30 | 30 |
import org.distorted.library.Distorted; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.MeshFlat; |
34 | 33 |
import org.distorted.library.DistortedTexture; |
... | ... | |
50 | 49 |
class GirlRenderer implements GLSurfaceView.Renderer |
51 | 50 |
{ |
52 | 51 |
private GLSurfaceView mView; |
53 |
private DistortedTexture mTexture; |
|
54 | 52 |
private DistortedEffects mEffects; |
55 | 53 |
private DistortedScreen mScreen; |
56 |
private MeshFlat mMesh; |
|
57 | 54 |
private Static3D v0,v1,v2,v3; |
58 | 55 |
private Static1D dBegin, dMiddle, dEnd, s0; |
59 | 56 |
private int bmpHeight, bmpWidth; |
... | ... | |
155 | 152 |
public void onDrawFrame(GL10 glUnused) |
156 | 153 |
{ |
157 | 154 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
158 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
155 |
mScreen.render( System.currentTimeMillis() );
|
|
159 | 156 |
} |
160 | 157 |
|
161 | 158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
209 | 206 |
bmpHeight = bitmap.getHeight(); |
210 | 207 |
bmpWidth = bitmap.getWidth(); |
211 | 208 |
|
212 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
213 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
214 |
mTexture.setTexture(bitmap); |
|
209 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
210 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
211 |
texture.setTexture(bitmap); |
|
212 |
|
|
213 |
mScreen.detachAll(); |
|
214 |
mScreen.attach(texture,mEffects,mesh); |
|
215 | 215 |
|
216 | 216 |
try |
217 | 217 |
{ |
src/main/java/org/distorted/examples/listener/ListenerRenderer.java | ||
---|---|---|
29 | 29 |
import org.distorted.examples.R; |
30 | 30 |
|
31 | 31 |
import org.distorted.library.Distorted; |
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.MeshFlat; |
35 | 34 |
import org.distorted.library.DistortedTexture; |
... | ... | |
54 | 53 |
private final int NUM_BUBBLES = 12; |
55 | 54 |
|
56 | 55 |
private GLSurfaceView mView; |
57 |
private DistortedTexture mTexture; |
|
58 | 56 |
private DistortedEffects mEffects; |
59 | 57 |
private DistortedScreen mScreen; |
60 |
private MeshFlat mMesh; |
|
61 | 58 |
private int bmpHeight, bmpWidth; |
62 | 59 |
private Random mRnd; |
63 | 60 |
|
... | ... | |
107 | 104 |
public void onDrawFrame(GL10 glUnused) |
108 | 105 |
{ |
109 | 106 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
110 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
107 |
mScreen.render( System.currentTimeMillis() );
|
|
111 | 108 |
} |
112 | 109 |
|
113 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
161 | 158 |
bmpHeight = bitmap.getHeight(); |
162 | 159 |
bmpWidth = bitmap.getWidth(); |
163 | 160 |
|
164 |
mMesh = new MeshFlat(50,50*bmpHeight/bmpWidth); |
|
165 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
166 |
mTexture.setTexture(bitmap); |
|
161 |
MeshFlat mesh = new MeshFlat(50,50*bmpHeight/bmpWidth); |
|
162 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
163 |
texture.setTexture(bitmap); |
|
164 |
|
|
165 |
mScreen.detachAll(); |
|
166 |
mScreen.attach(texture,mEffects,mesh); |
|
167 | 167 |
|
168 | 168 |
for(int i=0; i<NUM_BUBBLES; i++) randomizeNewBubble(); |
169 | 169 |
|
src/main/java/org/distorted/examples/matrix3d/Matrix3DRenderer.java | ||
---|---|---|
23 | 23 |
import android.opengl.GLSurfaceView; |
24 | 24 |
|
25 | 25 |
import org.distorted.library.Distorted; |
26 |
import org.distorted.library.DistortedEffects; |
|
27 |
import org.distorted.library.DistortedFramebuffer; |
|
28 | 26 |
import org.distorted.library.DistortedScreen; |
29 |
import org.distorted.library.MeshObject; |
|
30 | 27 |
import org.distorted.library.DistortedTexture; |
31 | 28 |
|
32 | 29 |
import javax.microedition.khronos.egl.EGLConfig; |
... | ... | |
38 | 35 |
{ |
39 | 36 |
private GLSurfaceView mView; |
40 | 37 |
private DistortedTexture mTexture; |
41 |
private DistortedEffects mEffects; |
|
42 | 38 |
private DistortedScreen mScreen; |
43 |
private MeshObject mMesh; |
|
44 | 39 |
|
45 | 40 |
private int mWidth, mHeight; |
46 | 41 |
|
... | ... | |
49 | 44 |
Matrix3DRenderer(GLSurfaceView v) |
50 | 45 |
{ |
51 | 46 |
mView = v; |
52 |
|
|
53 | 47 |
Matrix3DActivity act = (Matrix3DActivity)v.getContext(); |
54 |
|
|
55 |
mEffects= act.getEffects(); |
|
56 | 48 |
mTexture= act.getTexture(); |
57 |
mMesh = act.getMesh(); |
|
58 | 49 |
mScreen = new DistortedScreen(); |
50 |
mScreen.attach(mTexture,act.getEffects(),act.getMesh()); |
|
59 | 51 |
} |
60 | 52 |
|
61 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
63 | 55 |
public void onDrawFrame(GL10 glUnused) |
64 | 56 |
{ |
65 | 57 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
66 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
58 |
mScreen.render( System.currentTimeMillis() );
|
|
67 | 59 |
} |
68 | 60 |
|
69 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java | ||
---|---|---|
114 | 114 |
|
115 | 115 |
long time = System.currentTimeMillis(); |
116 | 116 |
|
117 |
mOffScreen1.renderTo( mTextureMirror, mQuad, mEffectsMirror , time ); |
|
118 |
mOffScreen1.renderTo( mOffScreen2 , mQuad, mEffectsOffscreen2, time ); |
|
119 |
mOffScreen1.renderTo( mTextureHead , mQuad, mEffectsHead , time ); |
|
120 |
mOffScreen2.renderTo( mOffScreen1 , mQuad, mEffectsOffscreen1, time ); |
|
121 |
mScreen.renderTo ( mOffScreen1 , mQuad, mEffectsNull , time ); |
|
117 |
mOffScreen1.render(time); |
|
118 |
mOffScreen2.render(time); |
|
119 |
mScreen.render(time); |
|
122 | 120 |
} |
123 | 121 |
|
124 | 122 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
149 | 147 |
mHeadPosition.set2( mScreenH*(1.0f-MIRROR_MARGIN*mMirrorW/mMirrorH) - headScale* mHeadH); |
150 | 148 |
setPosition(mX); |
151 | 149 |
|
150 |
mOffScreen1.attach( mTextureMirror, mEffectsMirror , mQuad ); |
|
151 |
mOffScreen1.attach( mOffScreen2 , mEffectsOffscreen2, mQuad ); |
|
152 |
mOffScreen1.attach( mTextureHead , mEffectsHead , mQuad ); |
|
153 |
mOffScreen2.attach( mOffScreen1 , mEffectsOffscreen1, mQuad ); |
|
154 |
|
|
155 |
mScreen.detachAll(); |
|
156 |
mScreen.attach ( mOffScreen1 , mEffectsNull , mQuad ); |
|
152 | 157 |
mScreen.resize(mScreenW,mScreenH); |
153 | 158 |
} |
154 | 159 |
} |
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java | ||
---|---|---|
28 | 28 |
import org.distorted.examples.R; |
29 | 29 |
import org.distorted.library.Distorted; |
30 | 30 |
import org.distorted.library.DistortedEffects; |
31 |
import org.distorted.library.DistortedFramebuffer; |
|
32 | 31 |
import org.distorted.library.DistortedScreen; |
33 | 32 |
import org.distorted.library.DistortedTexture; |
34 | 33 |
import org.distorted.library.MeshFlat; |
... | ... | |
47 | 46 |
class MonaLisaRenderer implements GLSurfaceView.Renderer |
48 | 47 |
{ |
49 | 48 |
private GLSurfaceView mView; |
50 |
private DistortedTexture mTexture; |
|
51 | 49 |
private DistortedEffects mEffects; |
52 | 50 |
private DistortedScreen mScreen; |
53 |
private MeshFlat mMesh; |
|
54 | 51 |
private int bmpHeight, bmpWidth; |
55 | 52 |
|
56 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
83 | 80 |
public void onDrawFrame(GL10 glUnused) |
84 | 81 |
{ |
85 | 82 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
86 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
83 |
mScreen.render( System.currentTimeMillis() );
|
|
87 | 84 |
} |
88 | 85 |
|
89 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
135 | 132 |
bmpHeight = bitmap.getHeight(); |
136 | 133 |
bmpWidth = bitmap.getWidth(); |
137 | 134 |
|
138 |
mMesh = new MeshFlat(9,9*bmpHeight/bmpWidth); |
|
139 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
140 |
mTexture.setTexture(bitmap); |
|
135 |
MeshFlat mesh = new MeshFlat(9,9*bmpHeight/bmpWidth); |
|
136 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
137 |
texture.setTexture(bitmap); |
|
138 |
|
|
139 |
mScreen.detachAll(); |
|
140 |
mScreen.attach(texture,mEffects,mesh); |
|
141 | 141 |
|
142 | 142 |
try |
143 | 143 |
{ |
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java | ||
---|---|---|
29 | 29 |
import android.opengl.GLES30; |
30 | 30 |
import android.opengl.GLSurfaceView; |
31 | 31 |
|
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.DistortedTexture; |
35 | 34 |
import org.distorted.library.DistortedEffects; |
... | ... | |
46 | 45 |
private Paint mPaint; |
47 | 46 |
private int texW, texH; |
48 | 47 |
|
49 |
private MeshFlat mMesh; |
|
50 | 48 |
private DistortedEffects mEffects; |
51 | 49 |
private DistortedTexture mTexture; |
52 | 50 |
private DistortedScreen mScreen; |
... | ... | |
127 | 125 |
texW = width; |
128 | 126 |
texH = height; |
129 | 127 |
|
130 |
mMesh = new MeshFlat(80,80*texH/texW); |
|
131 | 128 |
mTexture = new DistortedTexture(texW,texH); |
132 | 129 |
mBitmap = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888); |
133 | 130 |
mCanvas = new Canvas(mBitmap); |
134 | 131 |
|
132 |
mScreen.detachAll(); |
|
133 |
mScreen.attach(mTexture,mEffects,new MeshFlat(80,80*texH/texW)); |
|
135 | 134 |
mScreen.resize(texW, texH); |
136 | 135 |
mView.onSurfaceChanged(texW,texH); |
137 | 136 |
|
... | ... | |
154 | 153 |
mRefresh = false; |
155 | 154 |
} |
156 | 155 |
|
157 |
mScreen.renderTo(mTexture, mMesh, mEffects, time );
|
|
156 |
mScreen.render(time);
|
|
158 | 157 |
} |
159 | 158 |
|
160 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 | 29 |
import org.distorted.library.DistortedEffects; |
30 |
import org.distorted.library.DistortedFramebuffer; |
|
31 | 30 |
import org.distorted.library.DistortedScreen; |
32 | 31 |
import org.distorted.library.DistortedTexture; |
33 | 32 |
import org.distorted.library.EffectTypes; |
34 | 33 |
import org.distorted.library.MeshCubes; |
35 |
import org.distorted.library.MeshObject; |
|
36 | 34 |
import org.distorted.library.type.DynamicQuat; |
37 | 35 |
import org.distorted.library.type.Static1D; |
38 | 36 |
import org.distorted.library.type.Static3D; |
... | ... | |
67 | 65 |
private DistortedTexture mTex1, mTex2; |
68 | 66 |
private DistortedEffects[] mEffects; |
69 | 67 |
private Static3D[] mMoveVector; |
70 |
private MeshObject mMesh; |
|
71 | 68 |
private DistortedScreen mScreen; |
72 | 69 |
private DynamicQuat mQuatInt1, mQuatInt2; |
73 | 70 |
|
... | ... | |
88 | 85 |
|
89 | 86 |
mEffects[0].blur(new Static1D(10)); |
90 | 87 |
|
91 |
mMesh = new MeshCubes(1,1,false);
|
|
88 |
MeshCubes mesh = new MeshCubes(1,1,false);
|
|
92 | 89 |
|
93 | 90 |
mTex1 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE); |
94 | 91 |
mTex2 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE); |
... | ... | |
103 | 100 |
mQuatInt2.add(mQuat2); |
104 | 101 |
|
105 | 102 |
mScreen = new DistortedScreen(); |
103 |
|
|
104 |
for(int i=0; i<NUM_OBJECTS; i++) |
|
105 |
mScreen.attach( i<NUM_OBJECTS/2 ? mTex1:mTex2, mEffects[i], mesh); |
|
106 | 106 |
} |
107 | 107 |
|
108 | 108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
110 | 110 |
public void onDrawFrame(GL10 glUnused) |
111 | 111 |
{ |
112 | 112 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
113 |
|
|
114 |
long time = System.currentTimeMillis(); |
|
115 |
|
|
116 |
for(int i=0; i<NUM_OBJECTS; i++) |
|
117 |
mScreen.renderTo( i<NUM_OBJECTS/2 ? mTex1:mTex2, mMesh, mEffects[i], time ); |
|
113 |
mScreen.render( System.currentTimeMillis() ); |
|
118 | 114 |
} |
119 | 115 |
|
120 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java | ||
---|---|---|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
mScreen = new DistortedScreen(); |
116 |
mScreen.attach(mRoot); |
|
116 | 117 |
} |
117 | 118 |
|
118 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
120 | 121 |
public void onDrawFrame(GL10 glUnused) |
121 | 122 |
{ |
122 | 123 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
123 |
mScreen.renderTo(mRoot,System.currentTimeMillis());
|
|
124 |
mScreen.render(System.currentTimeMillis());
|
|
124 | 125 |
} |
125 | 126 |
|
126 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
import org.distorted.library.Distorted; |
34 | 34 |
import org.distorted.library.DistortedEffects; |
35 |
import org.distorted.library.DistortedFramebuffer; |
|
36 | 35 |
import org.distorted.library.DistortedScreen; |
37 | 36 |
import org.distorted.library.MeshFlat; |
38 | 37 |
import org.distorted.library.DistortedTexture; |
... | ... | |
63 | 62 |
private EglCore eglCore; |
64 | 63 |
private EGLSurface eglSurface; |
65 | 64 |
|
66 |
private DistortedTexture mTexture; |
|
67 | 65 |
private DistortedEffects mEffects; |
68 | 66 |
private DistortedScreen mScreen; |
69 |
private MeshFlat mMesh; |
|
70 | 67 |
private int bmpHeight, bmpWidth; |
71 | 68 |
private SurfaceView mView; |
72 | 69 |
|
... | ... | |
212 | 209 |
bmpHeight = bmp.getHeight(); |
213 | 210 |
bmpWidth = bmp.getWidth(); |
214 | 211 |
|
215 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
216 |
mTexture.setTexture(bmp); |
|
212 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
213 |
texture.setTexture(bmp); |
|
214 |
MeshFlat mesh = new MeshFlat(9,9*bmpHeight/bmpWidth); // more-or-less square Grid with 9 columns. |
|
217 | 215 |
|
218 |
mMesh = new MeshFlat(9,9*bmpHeight/bmpWidth); // more-or-less square Grid with 9 columns. |
|
216 |
mScreen.detachAll(); |
|
217 |
mScreen.attach(texture,mEffects,mesh); |
|
219 | 218 |
|
220 | 219 |
try |
221 | 220 |
{ |
... | ... | |
268 | 267 |
eglCore.makeCurrent(eglSurface); |
269 | 268 |
|
270 | 269 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
271 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
270 |
mScreen.render( System.currentTimeMillis() );
|
|
272 | 271 |
|
273 | 272 |
eglCore.swapBuffers(eglSurface); |
274 | 273 |
} |
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import org.distorted.library.Distorted; |
26 | 26 |
import org.distorted.library.DistortedEffects; |
27 |
import org.distorted.library.DistortedFramebuffer; |
|
28 | 27 |
import org.distorted.library.DistortedScreen; |
29 | 28 |
import org.distorted.library.MeshFlat; |
30 | 29 |
import org.distorted.library.DistortedTexture; |
... | ... | |
43 | 42 |
class ProjectionRenderer implements GLSurfaceView.Renderer |
44 | 43 |
{ |
45 | 44 |
private GLSurfaceView mView; |
46 |
private DistortedTexture mTexture; |
|
47 | 45 |
private DistortedEffects mEffects; |
48 | 46 |
private DistortedScreen mScreen; |
49 |
private MeshFlat mMesh; |
|
50 | 47 |
|
51 | 48 |
private float mF, mX, mY; |
52 | 49 |
private int mWidth, mHeight; |
... | ... | |
92 | 89 |
public void onDrawFrame(GL10 glUnused) |
93 | 90 |
{ |
94 | 91 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
95 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
92 |
mScreen.render( System.currentTimeMillis() );
|
|
96 | 93 |
} |
97 | 94 |
|
98 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
106 | 103 |
mEffects.abortAllEffects(); |
107 | 104 |
|
108 | 105 |
Paint paint = new Paint(); |
109 |
mTexture = new DistortedTexture(width,height);
|
|
110 |
mMesh = new MeshFlat(50,50*height/width);
|
|
106 |
DistortedTexture texture= new DistortedTexture(width,height);
|
|
107 |
MeshFlat mesh = new MeshFlat(50,50*height/width);
|
|
111 | 108 |
Bitmap bmp = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888); |
112 | 109 |
Canvas bmpCanvas = new Canvas(bmp); |
113 | 110 |
|
... | ... | |
124 | 121 |
bmpCanvas.drawRect( 0, height*i/NUMLINES -1, width , height*i/NUMLINES + 1, paint); |
125 | 122 |
} |
126 | 123 |
|
127 |
mTexture.setTexture(bmp);
|
|
124 |
texture.setTexture(bmp);
|
|
128 | 125 |
|
129 | 126 |
int min = width<height ? width:height; |
130 | 127 |
|
... | ... | |
136 | 133 |
mEffects.distort(vector, new Static3D( width/4, 3*height/4, 0), region); |
137 | 134 |
mEffects.distort(vector, new Static3D(3*width/4, 3*height/4, 0), region); |
138 | 135 |
|
136 |
mScreen.detachAll(); |
|
137 |
mScreen.attach(texture,mEffects,mesh); |
|
139 | 138 |
mScreen.resize(width, height); |
140 | 139 |
} |
141 | 140 |
|
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
---|---|---|
29 | 29 |
import org.distorted.examples.R; |
30 | 30 |
|
31 | 31 |
import org.distorted.library.DistortedEffects; |
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.EffectTypes; |
35 | 34 |
import org.distorted.library.type.Dynamic; |
... | ... | |
55 | 54 |
private DistortedTexture mTexture; |
56 | 55 |
private DistortedEffects mEffects; |
57 | 56 |
private DistortedScreen mScreen; |
58 |
private MeshCubes mMesh; |
|
59 | 57 |
private DynamicQuat mRot; |
60 | 58 |
|
61 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
63 | 61 |
QuaternionRenderer(GLSurfaceView v) |
64 | 62 |
{ |
65 | 63 |
mView = v; |
66 |
mMesh = new MeshCubes(1,1,false); |
|
67 | 64 |
mTexture = new DistortedTexture(1,1); |
68 | 65 |
mEffects = new DistortedEffects(); |
69 | 66 |
mRot = new DynamicQuat(); |
... | ... | |
88 | 85 |
mRot.setMode(Dynamic.MODE_LOOP); |
89 | 86 |
|
90 | 87 |
mScreen = new DistortedScreen(); |
88 |
mScreen.attach(mTexture,mEffects,new MeshCubes(1,1,false)); |
|
91 | 89 |
} |
92 | 90 |
|
93 | 91 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
95 | 93 |
public void onDrawFrame(GL10 glUnused) |
96 | 94 |
{ |
97 | 95 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
98 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
96 |
mScreen.render( System.currentTimeMillis() );
|
|
99 | 97 |
} |
100 | 98 |
|
101 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
54 | 54 |
class SaveRenderer implements GLSurfaceView.Renderer |
55 | 55 |
{ |
56 | 56 |
private GLSurfaceView mView; |
57 |
private DistortedTexture mTexture; |
|
58 | 57 |
private DistortedEffects mEffects; |
59 |
private MeshFlat mMesh; |
|
60 | 58 |
private DistortedFramebuffer mOffscreen; |
61 | 59 |
private DistortedScreen mScreen; |
62 | 60 |
private Static1D s0; |
... | ... | |
158 | 156 |
{ |
159 | 157 |
mEffects.abortEffects(EffectTypes.MATRIX); |
160 | 158 |
mEffects.scale(mScaleFactor); |
161 |
mOffscreen.renderTo(mTexture, mMesh, mEffects, time );
|
|
159 |
mOffscreen.render(time);
|
|
162 | 160 |
applyMatrixEffects(scrWidth,scrHeight); |
163 | 161 |
|
164 | 162 |
int fW =(int)(mScale*bmpWidth); |
... | ... | |
182 | 180 |
isSaving = false; |
183 | 181 |
} |
184 | 182 |
|
185 |
mScreen.renderTo(mTexture, mMesh, mEffects, time );
|
|
183 |
mScreen.render(time);
|
|
186 | 184 |
} |
187 | 185 |
|
188 | 186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
246 | 244 |
bmpHeight = bitmap.getHeight(); |
247 | 245 |
bmpWidth = bitmap.getWidth(); |
248 | 246 |
|
249 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
|
|
250 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight);
|
|
251 |
mTexture.setTexture(bitmap);
|
|
247 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
|
|
248 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight);
|
|
249 |
texture.setTexture(bitmap);
|
|
252 | 250 |
|
253 | 251 |
mOffscreen = new DistortedFramebuffer( (int)(mScale*bmpWidth) , (int)(mScale*bmpHeight) ); |
254 | 252 |
|
253 |
mOffscreen.detachAll(); |
|
254 |
mOffscreen.attach(texture,mEffects,mesh); |
|
255 |
mScreen.detachAll(); |
|
256 |
mScreen.attach(texture,mEffects,mesh); |
|
257 |
|
|
255 | 258 |
try |
256 | 259 |
{ |
257 | 260 |
Distorted.onCreate(mView.getContext()); |
src/main/java/org/distorted/examples/sink/SinkRenderer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.distorted.library.Distorted; |
31 | 31 |
import org.distorted.library.DistortedEffects; |
32 |
import org.distorted.library.DistortedFramebuffer; |
|
33 | 32 |
import org.distorted.library.DistortedScreen; |
34 | 33 |
import org.distorted.library.MeshFlat; |
35 | 34 |
import org.distorted.library.DistortedTexture; |
... | ... | |
48 | 47 |
class SinkRenderer implements GLSurfaceView.Renderer |
49 | 48 |
{ |
50 | 49 |
private GLSurfaceView mView; |
51 |
private DistortedTexture mTexture; |
|
52 | 50 |
private DistortedEffects mEffects; |
53 | 51 |
private DistortedScreen mScreen; |
54 |
private MeshFlat mMesh; |
|
55 | 52 |
private int bmpHeight, bmpWidth; |
56 | 53 |
|
57 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
75 | 72 |
public void onDrawFrame(GL10 glUnused) |
76 | 73 |
{ |
77 | 74 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
78 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
75 |
mScreen.render( System.currentTimeMillis() );
|
|
79 | 76 |
} |
80 | 77 |
|
81 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
129 | 126 |
bmpHeight = bitmap.getHeight(); |
130 | 127 |
bmpWidth = bitmap.getWidth(); |
131 | 128 |
|
132 |
mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
133 |
mTexture = new DistortedTexture(bmpWidth,bmpHeight); |
|
134 |
mTexture.setTexture(bitmap); |
|
129 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
|
130 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight); |
|
131 |
texture.setTexture(bitmap); |
|
132 |
|
|
133 |
mScreen.detachAll(); |
|
134 |
mScreen.attach(texture,mEffects,mesh); |
|
135 | 135 |
|
136 | 136 |
try |
137 | 137 |
{ |
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
---|---|---|
150 | 150 |
public void onDrawFrame(GL10 glUnused) |
151 | 151 |
{ |
152 | 152 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
153 |
mScreen.renderTo(mRoot,System.currentTimeMillis());
|
|
153 |
mScreen.render(System.currentTimeMillis());
|
|
154 | 154 |
} |
155 | 155 |
|
156 | 156 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
172 | 172 |
|
173 | 173 |
setupScreen(width,height); |
174 | 174 |
|
175 |
mScreen.detachAll(); |
|
176 |
mScreen.attach(mRoot); |
|
175 | 177 |
mScreen.resize(width, height); |
176 | 178 |
} |
177 | 179 |
} |
src/main/java/org/distorted/examples/wind/WindRenderer.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 |
import org.distorted.library.DistortedFramebuffer; |
|
30 | 29 |
import org.distorted.library.DistortedScreen; |
31 | 30 |
import org.distorted.library.MeshCubes; |
32 | 31 |
import org.distorted.library.DistortedEffects; |
... | ... | |
48 | 47 |
private DistortedEffects mEffects; |
49 | 48 |
private DistortedTexture mTexture; |
50 | 49 |
private DistortedScreen mScreen; |
51 |
private MeshCubes mMesh; |
|
52 | 50 |
private WindEffectsManager mManager; |
53 | 51 |
private int mObjWidth, mObjHeight; |
54 | 52 |
private int mWind; |
... | ... | |
59 | 57 |
{ |
60 | 58 |
mView = view; |
61 | 59 |
|
62 |
mMesh = new MeshCubes(50,30,false); |
|
63 | 60 |
mEffects = new DistortedEffects(); |
64 | 61 |
mTexture = new DistortedTexture(50,30); |
65 | 62 |
mManager = new WindEffectsManager(mTexture); |
66 | 63 |
mScreen = new DistortedScreen(); |
67 | 64 |
|
65 |
mScreen.attach(mTexture,mEffects,new MeshCubes(50,30,false)); |
|
66 |
|
|
68 | 67 |
mObjWidth = mTexture.getWidth(); |
69 | 68 |
mObjHeight= mTexture.getHeight(); |
70 | 69 |
} |
... | ... | |
82 | 81 |
public void onDrawFrame(GL10 glUnused) |
83 | 82 |
{ |
84 | 83 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
85 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
|
|
84 |
mScreen.render( System.currentTimeMillis() );
|
|
86 | 85 |
} |
87 | 86 |
|
88 | 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Change the the render() API!
THis introduces some regressions with the Effects3D app.