Skip to content

Commit 6eaaabc

Browse files
Nicolas Cannassencannasse
authored andcommitted
added Shadows Step, rename pbr.LightSystem.drawLight to drawShadows
1 parent 8a4f8f6 commit 6eaaabc

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

h3d/impl/RendererFX.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package h3d.impl;
33
enum Step {
44
MainDraw;
55
Decals;
6+
Shadows;
67
Lighting;
78
BeforeTonemapping;
89
AfterTonemapping;

h3d/scene/pbr/LightSystem.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class LightSystem extends h3d.scene.LightSystem {
1414
}
1515

1616

17-
public function drawLight( light : Light, passes : h3d.pass.PassList ) {
17+
public function drawShadows( light : Light, passes : h3d.pass.PassList ) {
1818
light.shadows.setContext(ctx);
1919
light.shadows.draw(passes);
2020
passes.reset();

h3d/scene/pbr/Renderer.hx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)