소스 검색

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 castingMaxDist : Float = 0.0;
 	public var cascade(default, set) = 1;
+	public var highPrecision : Bool = false;
 	public function set_cascade(v) {
 		cascade = v;
 		lightCameras = [];
@@ -188,7 +189,7 @@ class CascadeShadowMap extends DirShadowMap {
 			}
 			texture.depthBuffer = depth;
 			#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
 			// Bilinear depth only make sense if we use sample compare to get weighted shadow occlusion which we doesn't support yet.
 			texture.filter = Nearest;