浏览代码

Adding highprecision to CascadeShadowMap.

clementlandrin 1 年之前
父节点
当前提交
ebca1d5c9e
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      h3d/pass/CascadeShadowMap.hx

+ 2 - 1
h3d/pass/CascadeShadowMap.hx

@@ -17,6 +17,7 @@ class CascadeShadowMap extends DirShadowMap {
 	public var firstCascadeSize : Float = 10.0;
 	public var firstCascadeSize : Float = 10.0;
 	public var castingMaxDist : Float = 0.0;
 	public var castingMaxDist : Float = 0.0;
 	public var cascade(default, set) = 1;
 	public var cascade(default, set) = 1;
+	public var highPrecision : Bool = false;
 	public function set_cascade(v) {
 	public function set_cascade(v) {
 		cascade = v;
 		cascade = v;
 		lightCameras = [];
 		lightCameras = [];
@@ -188,7 +189,7 @@ class CascadeShadowMap extends DirShadowMap {
 			}
 			}
 			texture.depthBuffer = depth;
 			texture.depthBuffer = depth;
 			#else
 			#else
-			var texture = ctx.textures.allocTarget("cascadeShadowMap_"+i, size, size, false, Depth16);
+			var texture = ctx.textures.allocTarget("cascadeShadowMap_"+i, size, size, false, highPrecision ? Depth32 : Depth16);
 			#end
 			#end
 			// Bilinear depth only make sense if we use sample compare to get weighted shadow occlusion which we doesn't support yet.
 			// Bilinear depth only make sense if we use sample compare to get weighted shadow occlusion which we doesn't support yet.
 			texture.filter = Nearest;
 			texture.filter = Nearest;