Test: time_relight using a human-built structure and using natural terrain.

This commit is contained in:
David Vierra 2012-11-07 02:42:09 -10:00
parent 4569227304
commit 0d22baea91
3 changed files with 29 additions and 3 deletions

View File

@ -1,13 +1,36 @@
from infiniteworld import MCInfdevOldLevel
import mclevel
from timeit import timeit
from test import templevel
#import logging
#logging.basicConfig(level=logging.INFO)
path = "testfiles\\AnvilWorld"
world = mclevel.fromFile(path)
def natural_relight():
world = mclevel.fromFile("testfiles/AnvilWorld")
t = timeit(lambda: world.generateLights(world.allChunks), number=1)
print "Relight natural terrain: %d chunks in %.02f seconds (%.02fms per chunk)" % (world.chunkCount, t, t / world.chunkCount * 1000)
print "Relight: %d chunks in %.02f seconds" % (world.chunkCount, timeit(lambda: world.generateLights(world.allChunks), number=1))
def manmade_relight():
t = templevel.TempLevel("TimeRelight", createFunc=lambda f:MCInfdevOldLevel(f, create=True))
world = t.level
station = mclevel.fromFile("testfiles/station.schematic")
times = 2
for x in range(times):
for z in range(times):
world.copyBlocksFrom(station, station.bounds, (x * station.Width, 63, z * station.Length), create=True)
t = timeit(lambda: world.generateLights(world.allChunks), number=1)
print "Relight manmade building: %d chunks in %.02f seconds (%.02fms per chunk)" % (world.chunkCount, t, t / world.chunkCount * 1000)
if __name__ == '__main__':
natural_relight()
manmade_relight()

BIN
testfiles/Station.schematic Normal file

Binary file not shown.

3
testfiles/station.txt Normal file
View File

@ -0,0 +1,3 @@
station.schematic downloaded from http://www.mcschematics.com/index.php?topic=14331.msg91903
Credit goes to the author, bas_de_paljas.