0

moved most global vars in textures.py into an instantiatable class

This commit is contained in:
Aaron Griffith
2012-01-01 19:52:49 -05:00
parent 319d444997
commit c4a183b9b0
2 changed files with 977 additions and 928 deletions

40
contrib/gallery.py Normal file
View File

@@ -0,0 +1,40 @@
"""
Outputs a huge image with all currently-supported block textures.
"""
from overviewer_core import textures
import sys
import Image
if len(sys.argv) != 2:
print "usage: %s [output.png]" % (sys.argv[0],)
sys.exit(1)
t = textures.Textures()
t.generate()
blocks = {}
for blockid in xrange(t.max_blockid):
for data in xrange(t.max_data):
tex = t.blockmap[blockid * t.max_data + data]
if tex:
if not blockid in blocks:
blocks[blockid] = {}
blocks[blockid][data] = tex
columns = max(map(len, blocks.values()))
rows = len(blocks)
texsize = t.texture_size
gallery = Image.new("RGBA", (columns * texsize, rows * texsize), t.bgcolor)
row = 0
for blockid, textures in blocks.iteritems():
column = 0
for data, tex in textures.iteritems():
gallery.paste(tex[0], (column * texsize, row * texsize))
column += 1
row += 1
gallery.save(sys.argv[1])

File diff suppressed because it is too large Load Diff