file = GetString("file", "testground.png", "script png") grassMap = GetString("grass", "", "script png") heightScale = GetInt("scale", 64) tileSize = GetInt("tilesize", 128) hollow = GetInt("hollow", 0) function init() CreateMaterial("rock", 0.455, 0.439, 0.408) -- matRock CreateMaterial("dirt", 0.550, 0.450, 0.330, 1, 0, 0.1) -- matDirt CreateMaterial("unphysical", 0.474, 0.519, 0.31, 1, 0, 0.2) -- matGrass1 CreateMaterial("unphysical", 0.505, 0.566, 0.335, 1, 0, 0.2) -- matGrass2 CreateMaterial("masonry", 0.392, 0.376, 0.353, 1, 0, 0.4) -- matTarmac CreateMaterial("masonry", 0.3, 0.3, 0.3, 1, 0, 0.3) -- matTarmacTrack CreateMaterial("masonry", 0.6, 0.6, 0.6, 1, 0, 0.6) -- matTarmacLine if grassMap == "" then LoadImage(file) else local black = {0.39, 0.44, 0.21} local white = {0.555, 0.509, 0.27} for i=1, 8 do local t = (i-1)/7.0 local r = black[1]*(1-t)+white[1]*t local g = black[2]*(1-t)+white[2]*t local b = black[3]*(1-t)+white[3]*t CreateMaterial("unphysical", r, g, b, 1, 0, 0.2) end LoadImage(file, grassMap) end local w,h = GetImageSize() local maxSize = tileSize local y0 = 0 while y0 < h-1 do local y1 = y0 + maxSize if y1 > h-1 then y1 = h-1 end local x0 = 0 while x0 < w-1 do local x1 = x0 + maxSize if x1 > w-1 then x1 = w-1 end Vox(x0, 0, y0) Heightmap(x0, y0, x1, y1, heightScale) x0 = x1 end y0 = y1 end end