Project

General

Profile

« Previous | Next » 

Revision de77a6c5

Added by Leszek Koltunski over 3 years ago

Introduce another Uniform Block Object. Now we can have much more vertex and fragment effects - up their default number to 100.

View differences:

src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java
85 85
    mR = mG = mB = mA = 0.0f;
86 86
    mHalo = 0;
87 87
    int halo;
88
    float[] array = mUBF.getBackingArray();
88 89

  
89 90
    for(int i=0; i<mNumEffects; i++)
90 91
      {
91 92
      // first zero out the 'alpha' because BLUR effect will not overwrite this (it is a 1D effect)
92 93
      // and if previously there was a GLOW effect here then mA would be non-zero and we don't want
93 94
      // that (see preprocess())
94
      mFloatUniforms[NUM_FLOAT_UNIFORMS*i+5]=0.0f;
95
      array[NUM_FLOAT_UNIFORMS*i+5]=0.0f;
95 96

  
96
      if( mEffects[i].compute(mFloatUniforms, NUM_FLOAT_UNIFORMS*i, currTime, step) )
97
      if( mEffects[i].compute(array, NUM_FLOAT_UNIFORMS*i, currTime, step) )
97 98
        {
98 99
        EffectMessageSender.newMessage(mEffects[i]);
99 100
        }
100 101

  
101
      halo = (int)mFloatUniforms[NUM_FLOAT_UNIFORMS*i];
102
      halo = (int)array[NUM_FLOAT_UNIFORMS*i];
102 103
      if( halo>mHalo ) mHalo = halo;
103 104
      }
104 105

  
105 106
    // TODO  (now only really works in case of 1 effect!)
106 107
    if( mNumEffects>0 )
107 108
      {
108
      mR = mFloatUniforms[2];
109
      mG = mFloatUniforms[3];
110
      mB = mFloatUniforms[4];
111
      mA = mFloatUniforms[5];
109
      mR = array[2];
110
      mG = array[3];
111
      mB = array[4];
112
      mA = array[5];
112 113
      }
113 114

  
114 115
    mTime = currTime;
......
211 212
  public int postprocess(DistortedFramebuffer buffer)
212 213
    {
213 214
    int numRenders = 0;
215
    float[] array = mUBF.getBackingArray();
214 216

  
215 217
    GLES30.glDisable(GLES30.GL_BLEND);
216 218

  
217 219
    for(int i=0; i<mNumEffects; i++)
218 220
      {
219
      numRenders += ((PostprocessEffect)mEffects[i]).apply(mFloatUniforms,NUM_FLOAT_UNIFORMS*i, buffer);
221
      numRenders += ((PostprocessEffect)mEffects[i]).apply(array,NUM_FLOAT_UNIFORMS*i, buffer);
220 222
      }
221 223

  
222 224
    GLES30.glEnable(GLES30.GL_BLEND);

Also available in: Unified diff