Browse Source

more isSun cleanup + bugfix

ncannasse 7 years ago
parent
commit
01078c7c02

+ 1 - 9
h3d/scene/pbr/DirLight.hx

@@ -10,16 +10,8 @@ class DirLight extends Light {
 		if( dir != null ) setDirection(dir);
 	}
 
-	override function get_isSun() {
-		return pbr.isSun;
-	}
-
-	override function set_isSun(b:Bool) {
-		return pbr.isSun = b;
-	}
-
 	override function getShadowDirection() : h3d.Vector {
-		return absPos.front();	
+		return absPos.front();
 	}
 
 	override function emit(ctx:RenderContext) {

+ 0 - 9
h3d/scene/pbr/Light.hx

@@ -20,15 +20,6 @@ class Light extends h3d.scene.Light {
 		return _color = v;
 	}
 
-	function get_isSun() {
-		return false;
-	}
-
-	function set_isSun(b:Bool) {
-		if( b ) throw "Not supported on this light";
-		return b;
-	}
-
 	override function get_enableSpecular() {
 		return true;
 	}

+ 0 - 8
h3d/scene/pbr/PointLight.hx

@@ -25,14 +25,6 @@ class PointLight extends Light {
 		return cullingDistance = v;
 	}
 
-	override function get_isSun() {
-		return pbr.isSun;
-	}
-
-	override function set_isSun(b:Bool) {
-		return pbr.isSun = b;
-	}
-
 	override function draw(ctx) {
 		primitive.render(ctx.engine);
 	}

+ 0 - 1
h3d/scene/pbr/Renderer.hx

@@ -204,7 +204,6 @@ class Renderer extends h3d.scene.Renderer {
 			pbrSun.lightDir.load(@:privateAccess ls.shadowLight.getShadowDirection());
 			pbrSun.lightDir.scale3(-1);
 			pbrSun.lightDir.normalize();
-			pbrSun.isSun = true;
 		}
 
 		pbrOut.setGlobals(ctx);

+ 0 - 4
h3d/shader/pbr/Light.hx

@@ -11,7 +11,6 @@ class Light extends hxsl.Shader {
 			Tells that we need to keep occlusion / shadow map.
 		**/
 		@param var lightColor = vec3(0.5, 0.5, 0.5);
-		@const var isSun : Bool;
 
 	};
 }
@@ -41,8 +40,6 @@ class PointLight extends Light {
 			falloff *= falloff;
 			falloff *= 1 / (dist + 1);
 			pbrLightColor = lightColor * falloff;
-
-			if( !isSun ) occlusion = 1.;
 		}
 
 	};
@@ -59,7 +56,6 @@ class DirLight extends Light {
 		function fragment() {
 			pbrLightDirection = lightDir;
 			pbrLightColor = lightColor;
-			if( !isSun ) occlusion = 1.;
 		}
 
 	};

+ 0 - 5
h3d/shader/pbr/Lighting.hx

@@ -47,13 +47,8 @@ class Direct extends PropsDefinition {
 
 		var pbrLightDirection : Vec3;
 		var pbrLightColor : Vec3;
-		var shadow : Float;
 		@const var doDiscard : Bool = true;
 
-		function __init__fragment() {
-			shadow = 1.;
-		}
-
 		function fragment() {
 			var NdL = normal.dot(pbrLightDirection).max(0.);
 			if( pbrLightColor.dot(pbrLightColor) > 0.0001 && NdL > 0 ) {

+ 2 - 0
h3d/shader/pbr/PropsDefinition.hx

@@ -17,8 +17,10 @@ class PropsDefinition extends hxsl.Shader {
 
 		@param var cameraPosition : Vec3;
 		var pixelColor : Vec4;
+		var shadow : Float;
 
 		function __init__fragment() {
+			shadow = 1.;
 			pixelColor = vec4(0.,0.,0.,1.);
 			{
 				view = (cameraPosition - transformedPosition).normalize();