Explorar o código

World: don't create all chunk objects on initBounds

trethaller %!s(int64=7) %!d(string=hai) anos
pai
achega
e6eac81ae7
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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));