Revision 7602a827
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 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.effectqueue; |
... | ... | |
27 | 27 |
import org.distorted.library.effect.EffectType; |
28 | 28 |
import org.distorted.library.effect.PostprocessEffect; |
29 | 29 |
import org.distorted.library.effect.VertexEffect; |
30 |
import org.distorted.library.main.Distorted; |
|
30 |
import org.distorted.library.main.DistortedLibrary;
|
|
31 | 31 |
import org.distorted.library.main.DistortedFramebuffer; |
32 | 32 |
import org.distorted.library.main.DistortedNode; |
33 |
import org.distorted.library.main.DistortedOutputSurface;
|
|
34 |
import org.distorted.library.main.DistortedRenderState;
|
|
35 |
import org.distorted.library.main.DistortedSurface;
|
|
33 |
import org.distorted.library.main.InternalOutputSurface;
|
|
34 |
import org.distorted.library.main.InternalRenderState;
|
|
35 |
import org.distorted.library.main.InternalSurface;
|
|
36 | 36 |
import org.distorted.library.mesh.MeshBase; |
37 | 37 |
import org.distorted.library.message.EffectMessage; |
38 | 38 |
import org.distorted.library.message.EffectMessageSender; |
... | ... | |
117 | 117 |
|
118 | 118 |
int numV = VertexEffect.getNumEnabled(); |
119 | 119 |
|
120 |
String mainVertHeader= Distorted.GLSL_VERSION + ("#define NUM_VERTEX " + ( numV>0 ? Distorted.getMax(EffectType.VERTEX ) : 0 ) + "\n");
|
|
121 |
String mainFragHeader= Distorted.GLSL_VERSION + "\n"; |
|
120 |
String mainVertHeader= DistortedLibrary.GLSL_VERSION + ("#define NUM_VERTEX " + ( numV>0 ? DistortedLibrary.getMax(EffectType.VERTEX ) : 0 ) + "\n");
|
|
121 |
String mainFragHeader= DistortedLibrary.GLSL_VERSION + "\n";
|
|
122 | 122 |
|
123 | 123 |
String enabledEffectV= VertexEffect.getGLSL(); |
124 | 124 |
|
125 | 125 |
try |
126 | 126 |
{ |
127 | 127 |
mPreProgram = new DistortedProgram(mainVertStream, mainFragStream, mainVertHeader, mainFragHeader, |
128 |
enabledEffectV, null, Distorted.GLSL, null); |
|
128 |
enabledEffectV, null, DistortedLibrary.GLSL, null);
|
|
129 | 129 |
} |
130 | 130 |
catch(Exception e) |
131 | 131 |
{ |
... | ... | |
158 | 158 |
|
159 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
160 | 160 |
|
161 |
public int preprocess(DistortedOutputSurface buffer, DistortedNode node, float distance, float mipmap, float[] projection)
|
|
161 |
public int preprocess(InternalOutputSurface buffer, DistortedNode node, float distance, float mipmap, float[] projection)
|
|
162 | 162 |
{ |
163 | 163 |
buffer.setAsOutput(); |
164 |
DistortedSurface input = node.getInternalSurface();
|
|
164 |
InternalSurface input = node.getInternalSurface();
|
|
165 | 165 |
|
166 | 166 |
if( input.setAsInput() ) |
167 | 167 |
{ |
... | ... | |
174 | 174 |
int width = buffer.getWidth(); |
175 | 175 |
int height = buffer.getHeight(); |
176 | 176 |
|
177 |
DistortedRenderState.setUpStencilMark(mA!=0.0f);
|
|
178 |
DistortedRenderState.disableBlending();
|
|
177 |
InternalRenderState.setUpStencilMark(mA!=0.0f);
|
|
178 |
InternalRenderState.disableBlending();
|
|
179 | 179 |
|
180 | 180 |
GLES31.glViewport(0, 0, width, height ); |
181 | 181 |
|
... | ... | |
206 | 206 |
|
207 | 207 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() ); |
208 | 208 |
|
209 |
DistortedRenderState.restoreBlending();
|
|
210 |
DistortedRenderState.unsetUpStencilMark();
|
|
209 |
InternalRenderState.restoreBlending();
|
|
210 |
InternalRenderState.unsetUpStencilMark();
|
|
211 | 211 |
|
212 | 212 |
return 1; |
213 | 213 |
} |
Also available in: Unified diff
Rename all the classes that are not exported to application to 'Internal'