Ejemplo n.º 1
0
def loadimage1(caller,imagename,s=16,maxh=20):
	s=int(s)
	(xsize, ysize, heights)=loadheightmap(imagename,int(maxh))
	
	serverNotice("Loading image %s for blocky heightmaps. %sx%sx%s" % (imagename,xsize,ysize,s))
	
	mapsize=base.newmap(caller,math.ceil(max(math.log(xsize*s,2),math.log(ysize*s,2))))
	middleheight=2**(mapsize-1)/s
	
	for y in xrange(ysize):
		for x in xrange(xsize):
			cubes.makecolumn(caller,x,y,middleheight,heights[x][y],s)
	
	serverNotice("Done filling packet queue with heightmap.")
Ejemplo n.º 2
0
def loadimage1(caller,imagename,s=16,maxh=20):
	'''Loads an image and starts the process of converting a heightmap into cube packets for map generation(blocky).'''
	s=int(s)
	(xsize, ysize, heights)=loadheightmap(imagename,int(maxh))
	
	serverNotice("Loading image %s for blocky heightmaps. %sx%sx%s" % (imagename,xsize,ysize,s))
	
	mapsize=base.newmap(caller,math.ceil(max(math.log(xsize*s,2),math.log(ysize*s,2))))
	middleheight=2**(mapsize-1)/s
	
	for y in xrange(ysize):
		for x in xrange(xsize):
			cubes.makecolumn(caller,x,y,middleheight,heights[x][y],s)
	
	serverNotice("Done filling packet queue with heightmap.")
Ejemplo n.º 3
0
def loadimage2(caller,imagename,s=16,maxh=20):
	s=int(s)
	(xsize, ysize, heights)=loadheightmap(imagename,int(maxh)*8)
	
	serverNotice("Loading image %s for smooth heightmaps. %sx%sx%s" % (imagename,xsize,ysize,s))
	
	mapsize=base.newmap(caller,math.ceil(max(math.log(xsize*s,2),math.log(ysize*s,2))))
	middleheight=2**(mapsize-1)/s
	
	for y in xrange(ysize-1):
		for x in xrange(xsize-1):
			neighbourheights=(heights[y][x],heights[y][x+1],heights[y+1][x],heights[y+1][x+1])
			cubeheight=(max(neighbourheights)-1)/8+1
			cubes.makecolumn(caller,x,y,middleheight,cubeheight,s)
			cubes.corners(x,y,middleheight+cubeheight-1,(cubeheight*8-h for h in neighbourheights),s)
	
	serverNotice("Done filling packet queue with heightmap.")