2020import com .thomasdiewald .pixelflow .java .geometry .DwMeshUtils ;
2121import com .thomasdiewald .pixelflow .java .imageprocessing .filter .DepthOfField ;
2222import com .thomasdiewald .pixelflow .java .imageprocessing .filter .DwFilter ;
23- import com .thomasdiewald .pixelflow .java .imageprocessing .filter .SummedAreaTable ;
2423import com .thomasdiewald .pixelflow .java .render .skylight .DwSceneDisplay ;
2524import com .thomasdiewald .pixelflow .java .render .skylight .DwScreenSpaceGeometryBuffer ;
2625import com .thomasdiewald .pixelflow .java .utils .DwMagnifier ;
@@ -61,8 +60,6 @@ public class DepthOfField_Demo extends PApplet {
6160 PGraphics3D pg_tmp ;
6261 DwScreenSpaceGeometryBuffer geombuffer ;
6362
64- SummedAreaTable sat ;
65-
6663 DepthOfField dof ;
6764
6865 DwMagnifier magnifier ;
@@ -92,11 +89,6 @@ public void setup() {
9289 // projection
9390 perspective (60 * DEG_TO_RAD , width /(float )height , 2 , 6000 );
9491
95- // processing font
96-
97- // shape = loadShape("examples/data/skylight_demo_scene.obj");
98- // shape.scale(20);
99-
10092 pg_render = (PGraphics3D ) createGraphics (width , height , P3D );
10193 pg_render .smooth (8 );
10294
@@ -106,24 +98,17 @@ public void setup() {
10698 pg_dof .beginDraw ();
10799 pg_dof .endDraw ();
108100
109-
110- pg_tmp = (PGraphics3D ) createGraphics (width , height , P3D );
101+ pg_tmp = (PGraphics3D ) createGraphics (width , height , P3D );
111102 pg_tmp .smooth (0 );
112103
113104 DwGLTextureUtils .changeTextureFormat (pg_tmp , GL2 .GL_RGBA16F , GL2 .GL_RGBA , GL2 .GL_FLOAT );
114105 pg_tmp .beginDraw ();
115- // pg_tmp.hint(PConstants.DISABLE_TEXTURE_MIPMAPS);
116- // pg_tmp.textureSampling(2);
117- // pg_tmp.background(0xFFFFFFFF);
118- // pg_tmp.blendMode(PConstants.REPLACE);
119- // pg_tmp.noStroke();
120106 pg_tmp .endDraw ();
121107
122108 // main library context
123109 context = new DwPixelFlow (this );
124110 context .print ();
125111 context .printGL ();
126-
127112
128113
129114 // callback for scene display (used in GBAA)
@@ -134,14 +119,11 @@ public void display(PGraphics3D canvas) {
134119 }
135120 };
136121
137- sat = new SummedAreaTable (context );
138-
139122
140123 geombuffer = new DwScreenSpaceGeometryBuffer (context , scene_display );
141124
142125 dof = new DepthOfField (context );
143126
144-
145127 int mag_h = (int ) (height /3f );
146128 magnifier = new DwMagnifier (this , 4 , 0 , height -mag_h , mag_h , mag_h );
147129
@@ -164,29 +146,30 @@ public void draw() {
164146
165147 DwFilter .get (context ).gaussblur .apply (geombuffer .pg_geom , geombuffer .pg_geom , pg_tmp , 5 );
166148
167- // sat.create(pg_render);
168-
169149// dof.param.focus = map(mouseX, 0, width, 0, 1);
170150 dof .param .focus_pos = new float []{0.5f , 0.5f };
171151 dof .param .focus_pos [0 ] = map (mouseX +0.5f , 0 , width , 0 , 1 );
172152 dof .param .focus_pos [1 ] = map (mouseY +0.5f , 0 , height , 1 , 0 );
173153 dof .param .mult_blur = mult_blur ;
174- dof .apply (pg_render , pg_dof ,geombuffer );
154+ dof .apply (pg_render , pg_dof , geombuffer );
155+
156+ DwFilter .get (context ).copy .apply (pg_dof , pg_render );
157+ } else {
158+
175159 }
176160
177- magnifier .apply (pg_dof , mouseX , mouseY );
161+ magnifier .apply (pg_render , mouseX , mouseY );
178162 magnifier .displayTool ();
179163
180164 peasycam .beginHUD ();
181165 {
182166 blendMode (REPLACE );
183167 clear ();
184- image (pg_dof , 0 , 0 );
168+ image (pg_render , 0 , 0 );
185169// image(geombuffer.pg_geom, 0, 0);
186170
187171 magnifier .display (this .g );
188172
189-
190173 blendMode (BLEND );
191174
192175 pushMatrix ();
0 commit comments