Parcourir la source

Less allocs for dir shadow maps.

clementlandrin il y a 2 ans
Parent
commit
7cdb887cd2
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      h3d/pass/DirShadowMap.hx

+ 2 - 1
h3d/pass/DirShadowMap.hx

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