Kaynağa Gözat

Less allocs for dir shadow maps.

clementlandrin 2 yıl önce
ebeveyn
işleme
7cdb887cd2
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      h3d/pass/DirShadowMap.hx

+ 2 - 1
h3d/pass/DirShadowMap.hx

@@ -70,6 +70,7 @@ class DirShadowMap extends Shadows {
 		if( autoShrink ) {
 			// add visible casters in light camera position
 			var mtmp = new h3d.Matrix();
+			var identity = h3d.Matrix.I();
 			var btmp = autoZPlanes ? new h3d.col.Bounds() : null;
 			var obj = boundingObject != null ? boundingObject : ctx.scene;
 			obj.iterVisibleMeshes(function(m) {
@@ -77,7 +78,7 @@ class DirShadowMap extends Shadows {
 				var b = m.primitive.getBounds();
 				if( b.xMin > b.xMax ) return;
 
-				var absPos = Std.isOfType(m.primitive, h3d.prim.Instanced) ? h3d.Matrix.I() : m.getAbsPos();
+				var absPos = Std.isOfType(m.primitive, h3d.prim.Instanced) ? identity : m.getAbsPos();
 				if( autoZPlanes ) {
 					btmp.load(b);
 					btmp.transform(absPos);