Kaynağa Gözat

World: don't create all chunk objects on initBounds

trethaller 7 yıl önce
ebeveyn
işleme
e6eac81ae7
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      h3d/scene/World.hx

+ 3 - 1
h3d/scene/World.hx

@@ -418,7 +418,9 @@ class World extends Object {
 		var n = Std.int(worldSize / chunkSize);
 		for(x in 0...n)
 			for(y in 0...n) {
-				var c = getChunk(x * chunkSize + originX, y * chunkSize + originY, true);
+				var c = getChunk(x * chunkSize + originX, y * chunkSize + originY);
+				if(c == null)
+					continue;
 				c.bounds.addPoint(new h3d.col.Point(c.x, c.y));
 				c.bounds.addPoint(new h3d.col.Point(c.x + chunkSize, c.y));
 				c.bounds.addPoint(new h3d.col.Point(c.x + chunkSize, c.y + chunkSize));