Revision 85cbbc5e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/library/DistortedEffects.java | ||
---|---|---|
1080 | 1080 |
* |
1081 | 1081 |
* @param radius The 'strength' if the effect, in pixels. 0 = no blur, 10 = when blurring a given pixel, |
1082 | 1082 |
* take into account 10 pixels in each direction. |
1083 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect. |
|
1084 | 1083 |
* @return ID of the effect added, or -1 if we failed to add one. |
1085 | 1084 |
*/ |
1086 |
public long blur(Data1D radius, Data2D center)
|
|
1085 |
public long blur(Data1D radius) |
|
1087 | 1086 |
{ |
1088 |
return mP.add(EffectNames.BLUR, radius, center);
|
|
1087 |
return mP.add(EffectNames.BLUR, radius); |
|
1089 | 1088 |
} |
1090 | 1089 |
} |
src/main/java/org/distorted/library/EffectNames.java | ||
---|---|---|
241 | 241 |
|
242 | 242 |
///////////////////////////////////////////////////////////////////////////////// |
243 | 243 |
// POSTPROCESSING EFFECTS. |
244 |
// Always 3 Uniforms: 1 per-effect interpolated value + 2 dimensional center.
|
|
244 |
// Always 1 Uniform: 1 per-effect interpolated value.
|
|
245 | 245 |
/** |
246 | 246 |
* Blur the area around the center. |
247 | 247 |
* <p> |
248 |
* Uniforms: (radius,centerX,centerY)
|
|
248 |
* Uniforms: (radius) |
|
249 | 249 |
* <p> |
250 | 250 |
* Unity: radius==0 |
251 | 251 |
*/ |
252 |
BLUR ( EffectTypes.POSTPROCESS,new float[] {0.0f} , 1, false, true );
|
|
252 |
BLUR ( EffectTypes.POSTPROCESS,new float[] {0.0f} , 1, false, false );
|
|
253 | 253 |
|
254 | 254 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
255 | 255 |
|
src/main/java/org/distorted/library/EffectQueuePostprocess.java | ||
---|---|---|
30 | 30 |
import org.distorted.library.program.VertexCompilationException; |
31 | 31 |
import org.distorted.library.program.VertexUniformsException; |
32 | 32 |
import org.distorted.library.type.Data1D; |
33 |
import org.distorted.library.type.Data2D; |
|
34 | 33 |
import org.distorted.library.type.Dynamic1D; |
35 |
import org.distorted.library.type.Dynamic2D; |
|
36 | 34 |
import org.distorted.library.type.Static1D; |
37 |
import org.distorted.library.type.Static2D; |
|
38 | 35 |
|
39 | 36 |
import java.io.InputStream; |
40 | 37 |
import java.nio.ByteBuffer; |
... | ... | |
106 | 103 |
|
107 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
108 | 105 |
|
109 |
static void getUniforms(int mProgramH) |
|
106 |
private static void getUniforms(int mProgramH)
|
|
110 | 107 |
{ |
111 | 108 |
mNumEffectsH= GLES20.glGetUniformLocation( mProgramH, "pNumEffects"); |
112 | 109 |
mTypeH = GLES20.glGetUniformLocation( mProgramH, "pType"); |
... | ... | |
199 | 196 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
200 | 197 |
// blur |
201 | 198 |
|
202 |
synchronized long add(EffectNames eln, Data1D degree, Data2D center)
|
|
199 |
synchronized long add(EffectNames eln, Data1D degree) |
|
203 | 200 |
{ |
204 | 201 |
if( mMax[INDEX]>mNumEffects ) |
205 | 202 |
{ |
... | ... | |
214 | 211 |
} |
215 | 212 |
else return -1; |
216 | 213 |
|
217 |
if( center instanceof Dynamic2D) |
|
218 |
{ |
|
219 |
mInter[1][mNumEffects] = (Dynamic2D)center; |
|
220 |
} |
|
221 |
else if( center instanceof Static2D) |
|
222 |
{ |
|
223 |
mInter[1][mNumEffects] = null; |
|
224 |
mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static2D)center).getX(); |
|
225 |
mUniforms[NUM_UNIFORMS*mNumEffects+2] = ((Static2D)center).getY(); |
|
226 |
} |
|
227 |
else return -1; |
|
214 |
mInter[1][mNumEffects] = null; |
|
215 |
mInter[2][mNumEffects] = null; |
|
228 | 216 |
|
229 | 217 |
return addBase(eln); |
230 | 218 |
} |
Also available in: Unified diff
Postprocessing effects: remove support for Center