Revision 7602a827
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 | 22 |
import android.opengl.GLES31; |
23 | 23 |
|
24 |
import org.distorted.library.main.Distorted; |
|
24 |
import org.distorted.library.main.DistortedLibrary;
|
|
25 | 25 |
import org.distorted.library.main.DistortedFramebuffer; |
26 |
import org.distorted.library.main.DistortedRenderState;
|
|
26 |
import org.distorted.library.main.InternalRenderState;
|
|
27 | 27 |
import org.distorted.library.program.DistortedProgram; |
28 | 28 |
import org.distorted.library.type.Data1D; |
29 | 29 |
import org.distorted.library.type.Data4D; |
... | ... | |
172 | 172 |
} |
173 | 173 |
} |
174 | 174 |
|
175 |
DistortedRenderState.useStencilMark();
|
|
175 |
InternalRenderState.useStencilMark();
|
|
176 | 176 |
|
177 | 177 |
buffer.setAsOutput(); |
178 | 178 |
|
... | ... | |
233 | 233 |
GLES31.glVertexAttribPointer(mProgram2.mAttribute[1], TEX_DATA_SIZE, GLES31.GL_FLOAT, false, 0, mQuadTexture); |
234 | 234 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
235 | 235 |
|
236 |
DistortedRenderState.unuseStencilMark();
|
|
236 |
InternalRenderState.unuseStencilMark();
|
|
237 | 237 |
|
238 | 238 |
return 2; |
239 | 239 |
} |
... | ... | |
242 | 242 |
// PUBLIC API |
243 | 243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
244 | 244 |
/** |
245 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
245 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
246 | 246 |
*/ |
247 | 247 |
public static void enable() |
248 | 248 |
{ |
249 | 249 |
final String glowVertex = |
250 | 250 |
|
251 |
Distorted.GLSL_VERSION + |
|
251 |
DistortedLibrary.GLSL_VERSION +
|
|
252 | 252 |
"precision lowp float; \n"+ |
253 | 253 |
"in vec2 a_Position; \n"+ |
254 | 254 |
"in vec2 a_TexCoord; \n"+ |
... | ... | |
264 | 264 |
|
265 | 265 |
final String glowFragment1 = |
266 | 266 |
|
267 |
Distorted.GLSL_VERSION + |
|
267 |
DistortedLibrary.GLSL_VERSION +
|
|
268 | 268 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
269 | 269 |
"precision lowp float; \n"+ |
270 | 270 |
"in vec2 v_TexCoord; \n"+ |
... | ... | |
287 | 287 |
|
288 | 288 |
final String glowFragment2 = |
289 | 289 |
|
290 |
Distorted.GLSL_VERSION + |
|
290 |
DistortedLibrary.GLSL_VERSION +
|
|
291 | 291 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
292 | 292 |
"precision lowp float; \n"+ |
293 | 293 |
"in vec2 v_TexCoord; \n"+ |
Also available in: Unified diff
Rename all the classes that are not exported to application to 'Internal'