Project

General

Profile

« Previous | Next » 

Revision 0ef8fafc

Added by Leszek Koltunski about 7 years ago

1) Bugfix for an issue introduced with previous commit
2) scale up the BLUR effect radius with MIPMAP levels.

View differences:

src/main/java/org/distorted/library/DistortedEffectsPostprocess.java
87 87

  
88 88
  int getQuality()
89 89
    {
90
    return mP.mQuality;
90
    return mP.mQualityLevel;
91 91
    }
92 92

  
93 93
///////////////////////////////////////////////////////////////////////////////////////////////////
......
294 294
 */
295 295
  public void setQuality(EffectQuality quality)
296 296
    {
297
    mP.mQuality = quality.level;
297
    int level = quality.level;
298

  
299
    mP.mQualityLevel = level;
300
    mP.mQualityScale = 1.0f;
301

  
302
    for(int i=0; i<level; i++) mP.mQualityScale*=0.5f;
298 303
    }
299 304

  
300 305
///////////////////////////////////////////////////////////////////////////////////////////////////   
src/main/java/org/distorted/library/EffectQueuePostprocess.java
99 99
  private static float[] mOffsets = new float[MAX_BLUR];
100 100
  // another effect ....
101 101

  
102
  int mQuality;
102
  int mQualityLevel;
103
  float mQualityScale;
103 104

  
104 105
///////////////////////////////////////////////////////////////////////////////////////////////////
105 106

  
......
107 108
    { 
108 109
    super(id,NUM_UNIFORMS,NUM_CACHE,INDEX );
109 110

  
110
    mQuality = 0;
111
    mQualityLevel = 0;
112
    mQualityScale = 1.0f;
111 113
    }
112 114

  
113 115
///////////////////////////////////////////////////////////////////////////////////////////////////
......
263 265
      {
264 266
      compute(time);
265 267

  
266
      DistortedFramebuffer buffer1 = surface.mBuffer1[mQuality];
267
      DistortedFramebuffer buffer2 = surface.mBuffer1[mQuality];
268
      DistortedFramebuffer buffer1 = surface.mBuffer1[mQualityLevel];
269
      DistortedFramebuffer buffer2 = surface.mBuffer2[mQualityLevel];
268 270

  
269 271
      float w1 = buffer1.mWidth;
270 272
      float h1 = buffer1.mHeight;
271 273
      float w2 = surface.mWidth;
272 274
      float h2 = surface.mHeight;
273 275

  
274
      int radius = (int)mUniforms[0];
276
      int radius = (int)(mUniforms[0]*mQualityScale);
275 277
      if( radius>=MAX_BLUR ) radius = MAX_BLUR-1;
276 278
      computeGaussianKernel(radius);
277 279

  

Also available in: Unified diff