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/movingglow/MovingGlowRenderer.java
37 37
import org.distorted.library.mesh.MeshQuad;
38 38
import org.distorted.library.message.EffectListener;
39 39
import org.distorted.library.type.Dynamic1D;
40
import org.distorted.library.type.Dynamic2D;
40 41
import org.distorted.library.type.Dynamic4D;
41 42
import org.distorted.library.type.Static1D;
43
import org.distorted.library.type.Static2D;
42 44
import org.distorted.library.type.Static3D;
43 45
import org.distorted.library.type.Static4D;
44 46

  
......
106 108
        root.attach(node);
107 109
        }
108 110

  
109
      Dynamic1D radiusDyn = new Dynamic1D(FLASH_TIME,1.0f);
110
      radiusDyn.add(new Static1D( 0));
111
      radiusDyn.add(new Static1D(70));
111
      Dynamic2D haloAndRadiusDyn = new Dynamic2D(FLASH_TIME,1.0f);
112
      haloAndRadiusDyn.add(new Static2D( 0, 0));
113
      haloAndRadiusDyn.add(new Static2D(70,50));
112 114

  
113 115
      for(int leaf=0; leaf<NUM_LEAVES; leaf++)
114 116
        {
......
118 120
        color.add(P1);
119 121
        color.add(P2);
120 122

  
121
        mGlow[leaf] = new PostprocessEffectGlow(radiusDyn,color);
123
        mGlow[leaf] = new PostprocessEffectGlow(haloAndRadiusDyn,color);
122 124
        }
123 125

  
124 126
      makeGlow(0);
......
161 163
     {
162 164
     float qw = (float)width ;
163 165
     float qh = (float)height;
164
     float factor = 0.9f* (qw<qh ? qw:qh);
166
     float factor = 0.9f* (Math.min(qw, qh));
165 167

  
166 168
     mScale.set( factor,factor,factor );
167 169
     mScreen.resize(width, height);

Also available in: Unified diff