ShiroSmith 7 vuotta sitten
vanhempi
commit
c13116d47f
7 muutettua tiedostoa jossa 5 lisäystä ja 90 poistoa
  1. 1 1
      h2d/Graphics.hx
  2. 0 14
      h3d/Camera.hx
  3. 2 2
      h3d/impl/GlDriver.hx
  4. 0 1
      h3d/pass/Default.hx
  5. 0 5
      h3d/shader/Blur.hx
  6. 0 8
      h3d/shader/PointShadow.hx
  7. 2 59
      h3d/shader/pbr/Brush.hx

+ 1 - 1
h2d/Graphics.hx

@@ -443,7 +443,7 @@ class Graphics extends Drawable {
 		}
 		flush();
 	}
-
+	
 	public function drawEllipse( cx : Float, cy : Float, radiusX : Float, radiusY : Float, rotationAngle : Float = 0, nsegments = 0 ) {
 		flush();
 		if( nsegments == 0 )

+ 0 - 14
h3d/Camera.hx

@@ -43,7 +43,6 @@ class Camera {
 
 	var minv : Matrix;
 	var miview : Matrix;
-	var miproj : Matrix;
 	var needInv : Bool;
 
 	public function new( fovY = 25., zoom = 1., screenRatio = 1.333333, zNear = 0.02, zFar = 4000., rightHanded = false ) {
@@ -114,19 +113,6 @@ class Camera {
 		return miview;
 	}
 
-	/**
-		Returns the inverse of the camera matrix proj only. Cache the result until the next update().
-	**/
-	public function getInverseProj() {
-		if( miproj == null ) {
-			miproj = new h3d.Matrix();
-			miproj._44 = 0;
-		}
-		if( miproj._44 == 0 )
-			miproj.initInverse(mproj);
-		return miproj;
-	}
-
 	/**
 		Setup camera for cubemap rendering on the given face.
 	**/

+ 2 - 2
h3d/impl/GlDriver.hx

@@ -1552,7 +1552,7 @@ class GlDriver extends Driver {
 			false;
 		}
 	}
-
+	
 	// Draws video element directly onto Texture. Used for video rendering.
 	private function uploadTextureVideoElement( t : h3d.mat.Texture, v : js.html.VideoElement, mipLevel : Int, side : Int ) {
 		var cubic = t.flags.has(Cube);
@@ -1568,7 +1568,7 @@ class GlDriver extends Driver {
 		}
 		restoreBind();
 	}
-
+	
 	#end
 
 	override function captureRenderBuffer( pixels : hxd.Pixels ) {

+ 0 - 1
h3d/pass/Default.hx

@@ -25,7 +25,6 @@ class Default extends Base {
 	@global("camera.projFlip") var cameraProjFlip : Float = ctx.engine.driver.hasFeature(BottomLeftCoords) && ctx.engine.getCurrentTarget() != null ? -1 : 1;
 	@global("camera.viewProj") var cameraViewProj : h3d.Matrix = ctx.camera.m;
 	@global("camera.inverseViewProj") var cameraInverseViewProj : h3d.Matrix = ctx.camera.getInverseViewProj();
-	@global("camera.inverseProj") var cameraInverseProj : h3d.Matrix = ctx.camera.getInverseProj();
 	@global("global.time") var globalTime : Float = ctx.time;
 	@global("global.pixelSize") var pixelSize : h3d.Vector = new h3d.Vector(2 / ctx.engine.width, 2 / ctx.engine.height);
 	@global("global.modelView") var globalModelView : h3d.Matrix;

+ 0 - 5
h3d/shader/Blur.hx

@@ -59,11 +59,6 @@ class Blur extends ScreenShader {
 					else color += texture.get(input.uv + pixel * offsets[i < 0 ? -i : i] * i) * values[i < 0 ? -i : i];
 				}
 				output.color = color;
-
-				if( isCube ){
-					var ref = cubeTexture.get(vec3(input.uv * 2.0 - 1.0, 1) * cubeDir);
-					output.color = max(color,ref);
-				}
 			}
 			if( hasFixedColor ) {
 				output.color.rgb = fixedColor.rgb;

+ 0 - 8
h3d/shader/PointShadow.hx

@@ -21,16 +21,8 @@ class PointShadow extends hxsl.Shader {
 				var dir = normalize(posToLight.xyz);
 				var depth = shadowMap.get(dir).r * zFar;
 				var zMax = length(posToLight);
-
 				var delta = (depth + shadowBias).min(zMax) - zMax;
 				shadow = exp( shadowPower * delta ).saturate();
-
-				var dist =  1 - (abs(zMax - depth) / shadowPower);
-				var lightDist = (zMax / shadowPower);
-
-				var factor = dist * lightDist;
-
-				shadow = depth + shadowBias < zMax ? clamp( 1 - dist, 0, 1) : 1;
 			}
 		}
 	}

+ 2 - 59
h3d/shader/pbr/Brush.hx

@@ -5,70 +5,13 @@ class Brush extends hxsl.Shader {
 	static var SRC = {
 
 		@:import h3d.shader.Base2d;
-		@const var normalize : Bool;
-		@const var clamp : Bool;
-		@const var generateIndex : Bool;
-
 		@param var strength : Float;
-		@param var weightTextures : Sampler2DArray;
-		@param var weightCount : Int;
-		@param var refIndex : Int;
-		@param var targetIndex : Int;
 		@param var size : Float;
 		@param var pos : Vec3;
-		@param var mask : Array<Vec4, 4>;
 
 		function fragment() {
-			if(clamp){
-				var tileUV = pos.xy + calculatedUV * size;
-				var count = 0;
-				var smallestWeightIndex = -1;
-				var smallestWeight = 1.0;
-				for(i in 0 ... weightCount){
-					var w = weightTextures.get(vec3(tileUV, i)).r;
-					if(w > 0.0){
-						count++;
-						if(i != refIndex && smallestWeight > w){
-							smallestWeight = w;
-							smallestWeightIndex = i;
-						}
-					}
-				}
-				pixelColor = weightTextures.get(vec3(tileUV, targetIndex)).rgba;
-				if(count > 3 && targetIndex == smallestWeightIndex)
-					pixelColor = vec4(0);
-			}
-			else if(normalize){
-				var tileUV = pos.xy + calculatedUV * size ;
-				var refValue = weightTextures.get(vec3(tileUV, refIndex)).r;
-				var sum = 0.0;
-				for(i in 0 ... weightCount)
-					if(i != refIndex) sum += weightTextures.get(vec3(tileUV, i)).r;
-				var targetSum = 1 - refValue;
-				pixelColor = vec4(vec3((weightTextures.get(vec3(tileUV, targetIndex)).rgb / sum) * targetSum), 1.0);
-
-				if(targetIndex == refIndex){
-					pixelColor = mix(vec4(1), vec4(refValue), ceil(min(1,sum)));
-				}
-			}
-			else if(generateIndex){
-				var tileUV = pos.xy + calculatedUV * size;
-				var indexes = vec4(0);
-				var curMask = 0;
-				for(i in 0 ... weightCount){
-					var w = weightTextures.get(vec3(tileUV, i)).r;
-					if( w > 0 && curMask < 3){
-						indexes += mask[curMask] * i / 255.0;
-						curMask++;
-					}
-				}
-				pixelColor = indexes;
-			}
-			else{
-				pixelColor = vec4(textureColor * strength);
-			}
+			var tileUV = pos.xy + calculatedUV * size;
+			pixelColor = vec4((textureColor * strength).rgb, textureColor.r);
 		}
 	}
-
-
 }