瀏覽代碼

Clean useless pbr/LightSystem code and clean duplicated cast to pbr/LightSystem in pbr/Renderer

clementlandrin 1 年之前
父節點
當前提交
9831d0d089
共有 2 個文件被更改,包括 4 次插入10 次删除
  1. 0 3
      h3d/scene/pbr/LightSystem.hx
  2. 4 7
      h3d/scene/pbr/Renderer.hx

+ 0 - 3
h3d/scene/pbr/LightSystem.hx

@@ -44,9 +44,6 @@ class LightSystem extends h3d.scene.LightSystem {
 
 
 	public function drawScreenLights( r : h3d.scene.Renderer, lightPass : h3d.pass.ScreenFx<Dynamic>, shadows : Bool = true ) {
 	public function drawScreenLights( r : h3d.scene.Renderer, lightPass : h3d.pass.ScreenFx<Dynamic>, shadows : Bool = true ) {
 		var plight = @:privateAccess ctx.lights;
 		var plight = @:privateAccess ctx.lights;
-		var currentTarget = ctx.engine.getCurrentTarget();
-		var width = currentTarget == null ? ctx.engine.width : currentTarget.width;
-		var height = currentTarget == null ? ctx.engine.height : currentTarget.height;
 		while( plight != null ) {
 		while( plight != null ) {
 			var light = Std.downcast(plight, h3d.scene.pbr.Light);
 			var light = Std.downcast(plight, h3d.scene.pbr.Light);
 			if( light != null && light.primitive == null ) {
 			if( light != null && light.primitive == null ) {

+ 4 - 7
h3d/scene/pbr/Renderer.hx

@@ -267,17 +267,14 @@ class Renderer extends h3d.scene.Renderer {
 		if( ctx.lightSystem != null ) ctx.lightSystem.drawPasses = ctx.engine.drawCalls - count;
 		if( ctx.lightSystem != null ) ctx.lightSystem.drawPasses = ctx.engine.drawCalls - count;
 		end();
 		end();
 
 
-		var pbrLightSystem : h3d.scene.pbr.LightSystem = cast ctx.lightSystem;
-		if (pbrLightSystem != null) {
-			while (pbrLightSystem.lightingShaders.length != 0) {
-				pbrLightSystem.lightingShaders.pop();
-			}
-			pbrLightSystem.lightBuffer.sync(ctx);
+		if (ls != null) {
+			while (ls.lightingShaders.length != 0)
+				ls.lightingShaders.pop();
+			ls.lightBuffer.sync(ctx);
 		}
 		}
 
 
 		begin(Lighting);
 		begin(Lighting);
 		if ( displayMode == Performance ) {
 		if ( displayMode == Performance ) {
-			var ls = Std.downcast(getLightSystem(), h3d.scene.pbr.LightSystem);
 			var s = new h3d.shader.pbr.Light.Performance();
 			var s = new h3d.shader.pbr.Light.Performance();
 			performance.shader.gradient = getLightingPerformanceGradient();
 			performance.shader.gradient = getLightingPerformanceGradient();
 			s.maxLights = performance.shader.gradient.width - 1;
 			s.maxLights = performance.shader.gradient.width - 1;