Revision 96e3b88a
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java | ||
---|---|---|
47 | 47 |
*/ |
48 | 48 |
public class EffectQueuePostprocess extends EffectQueue |
49 | 49 |
{ |
50 |
private static final int NUM_UNIFORMS = PostprocessEffect.NUM_UNIFORMS; |
|
50 |
private static final int NUM_FLOAT_UNIFORMS = PostprocessEffect.NUM_FLOAT_UNIFORMS; |
|
51 |
private static final int NUM_INT_UNIFORMS = PostprocessEffect.NUM_INT_UNIFORMS; |
|
52 |
|
|
51 | 53 |
private static final int INDEX = EffectType.POSTPROCESS.ordinal(); |
52 | 54 |
|
53 | 55 |
private int mHalo; |
... | ... | |
62 | 64 |
|
63 | 65 |
EffectQueuePostprocess() |
64 | 66 |
{ |
65 |
super(NUM_UNIFORMS,INDEX );
|
|
67 |
super(NUM_FLOAT_UNIFORMS, NUM_INT_UNIFORMS, INDEX );
|
|
66 | 68 |
} |
67 | 69 |
|
68 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
89 | 91 |
// first zero out the 'alpha' because BLUR effect will not overwrite this (it is a 1D effect) |
90 | 92 |
// and if previously there was a GLOW effect here then mA would be non-zero and we don't want |
91 | 93 |
// that (see preprocess()) |
92 |
mUniforms[NUM_UNIFORMS*i+5]=0.0f;
|
|
94 |
mFloatUniforms[NUM_FLOAT_UNIFORMS*i+5]=0.0f;
|
|
93 | 95 |
|
94 |
if( mEffects[i].compute(mUniforms, NUM_UNIFORMS*i, currTime, step) )
|
|
96 |
if( mEffects[i].compute(mFloatUniforms, NUM_FLOAT_UNIFORMS*i, currTime, step) )
|
|
95 | 97 |
{ |
96 | 98 |
EffectMessageSender.newMessage(mEffects[i]); |
97 | 99 |
} |
98 | 100 |
|
99 |
halo = (int)mUniforms[NUM_UNIFORMS*i];
|
|
101 |
halo = (int)mFloatUniforms[NUM_FLOAT_UNIFORMS*i];
|
|
100 | 102 |
if( halo>mHalo ) mHalo = halo; |
101 | 103 |
} |
102 | 104 |
|
103 | 105 |
// TODO (now only really works in case of 1 effect!) |
104 | 106 |
if( mNumEffects>0 ) |
105 | 107 |
{ |
106 |
mR = mUniforms[2]; |
|
107 |
mG = mUniforms[3]; |
|
108 |
mB = mUniforms[4]; |
|
109 |
mA = mUniforms[5]; |
|
108 |
mR = mFloatUniforms[2];
|
|
109 |
mG = mFloatUniforms[3];
|
|
110 |
mB = mFloatUniforms[4];
|
|
111 |
mA = mFloatUniforms[5];
|
|
110 | 112 |
} |
111 | 113 |
|
112 | 114 |
mTime = currTime; |
... | ... | |
214 | 216 |
|
215 | 217 |
for(int i=0; i<mNumEffects; i++) |
216 | 218 |
{ |
217 |
numRenders += ((PostprocessEffect)mEffects[i]).apply(mUniforms,NUM_UNIFORMS*i, buffer);
|
|
219 |
numRenders += ((PostprocessEffect)mEffects[i]).apply(mFloatUniforms,NUM_FLOAT_UNIFORMS*i, buffer);
|
|
218 | 220 |
} |
219 | 221 |
|
220 | 222 |
GLES30.glEnable(GLES30.GL_BLEND); |
Also available in: Unified diff
Introducing UBO to Effect Queues: step 1.