@@ -192,11 +192,14 @@ class Renderer extends h3d.scene.Renderer {
192192
193193 function lighting () {
194194
195+ begin (Shadows );
195196 var ls = hxd.impl. Api .downcast (getLightSystem (), LightSystem );
196197 var count = ctx .engine .drawCalls ;
197198 if ( ls != null ) drawShadows (ls );
198199 if ( ctx .lightSystem != null ) ctx .lightSystem .drawPasses = ctx .engine .drawCalls - count ;
200+ end ();
199201
202+ begin (Lighting );
200203 var lpass = screenLightPass ;
201204 if ( lpass == null ) {
202205 lpass = new h3d.pass. ScreenFx (new h3d.shader. ScreenShader ());
@@ -225,6 +228,7 @@ class Renderer extends h3d.scene.Renderer {
225228 copy (textures .hdr , null );
226229 // no warnings
227230 for ( p in passObjects ) if ( p != null ) p .rendered = true ;
231+ end ();
228232 return ;
229233 }
230234
@@ -236,6 +240,7 @@ class Renderer extends h3d.scene.Renderer {
236240 pbrIndirect .drawIndirectSpecular = true ;
237241 pbrOut .render ();
238242 }
243+ end ();
239244 }
240245
241246 function drawShadows ( ls : LightSystem ) {
@@ -245,7 +250,7 @@ class Renderer extends h3d.scene.Renderer {
245250 passes .clear ();
246251 while ( light != null ) {
247252 var plight = hxd.impl. Api .downcast (light , h3d.scene.pbr. Light );
248- if ( plight != null ) ls .drawLight (plight , passes );
253+ if ( plight != null ) ls .drawShadows (plight , passes );
249254 light = light .next ;
250255 }
251256 }
@@ -416,9 +421,7 @@ class Renderer extends h3d.scene.Renderer {
416421
417422 setTarget (textures .hdr );
418423 clear (0 );
419- begin (Lighting );
420424 lighting ();
421- end ();
422425 if ( renderMode == LightProbe ) return ;
423426
424427 begin (BeforeTonemapping );
0 commit comments