Project

General

Profile

« Previous | Next » 

Revision 678c391d

Added by Leszek Koltunski about 4 years ago

Change the Postprocessing effects: separate the radius and the halo.
Reason: we needed a way to specify the size of the halo around a postprocessed object; before it was automatically (and not very correctly) computed from the radius - before we knew the size of the object's bounding box, so this automatic computation was possible. Now we're removing the MashBase.getBounding(0 API, so the size of the halo has to be explicitly given by the user. This way is more correct anyway and gives the user more control (as the Multiblur app proves!)

Warning: here for the first time I can see that the 2 Examples (PostprocessingTree and MovingGlow) sometimes would not appear (black screen). Maybe this commit introduces such a bug - investigate.

View differences:

src/main/java/org/distorted/examples/blur/BlurRenderer.java
24 24
import android.opengl.GLSurfaceView;
25 25

  
26 26
import org.distorted.examples.R;
27
import org.distorted.library.effect.MatrixEffectMove;
28 27
import org.distorted.library.effect.MatrixEffectScale;
29 28
import org.distorted.library.effect.PostprocessEffectBlur;
30 29
import org.distorted.library.main.DistortedLibrary;
......
34 33
import org.distorted.library.main.DistortedScreen;
35 34
import org.distorted.library.main.DistortedTexture;
36 35
import org.distorted.library.mesh.MeshRectangles;
37
import org.distorted.library.type.Dynamic1D;
38
import org.distorted.library.type.Static1D;
36
import org.distorted.library.type.Dynamic2D;
37
import org.distorted.library.type.Static2D;
39 38
import org.distorted.library.type.Static3D;
40 39

  
41 40
import java.io.IOException;
......
56 55
    private DistortedScreen mScreen;
57 56
    private DistortedFramebuffer mBuffer;
58 57
    private MeshRectangles mMesh, mMeshBuffer;
59
    private Static1D mRadiusSta;
58
    private Static2D mHaloRadiusSta;
60 59
    private int mObjHeight, mObjWidth;
61 60
    private Static3D mScale, mBufferScale;
62 61

  
......
70 69
      mScreen     = new DistortedScreen();
71 70
      mBuffer     = new DistortedFramebuffer(SIZE,SIZE,1, DistortedFramebuffer.NO_DEPTH_NO_STENCIL);
72 71

  
73
      mRadiusSta = new Static1D(5);
74
      Dynamic1D radiusDyn = new Dynamic1D();
75
      radiusDyn.add(mRadiusSta);
72
      mHaloRadiusSta = new Static2D(10,5);
73
      Dynamic2D haloAndRadiusDyn = new Dynamic2D();
74
      haloAndRadiusDyn.add(mHaloRadiusSta);
76 75

  
77 76
      mScale= new Static3D(1,1,1);
78 77
      mBufferScale= new Static3D(1,1,1);
......
81 80
      mBufferEffects.apply(new MatrixEffectScale(mBufferScale));
82 81

  
83 82
      mEffects = new DistortedEffects();
84
      mEffects.apply( new PostprocessEffectBlur(radiusDyn) );
83
      mEffects.apply( new PostprocessEffectBlur(haloAndRadiusDyn) );
85 84
      mEffects.apply(new MatrixEffectScale(mScale));
86 85
      }
87 86

  
......
90 89
   int setBlur(int blur)
91 90
     {
92 91
     int radius = blur/2;
93
     mRadiusSta.set(radius);
92
     mHaloRadiusSta.set1(radius);
94 93
     return radius;
95 94
     }
96 95

  

Also available in: Unified diff