예제 #1
0
hill_shade = {}

SIZE = 7682

pixels = zeros((SIZE, SIZE, 3), dtype=uint8)

for y in range(64, SIZE - 32):
    for x in range(32, SIZE - 32):
# for y in range(1000, 2000):
#     for x in range(4500, 5500):
        cy, py = divmod(y, 30)
        cx, px = divmod(x, 30)
        file_id = 0x80020000 + cy * 0x100 + cx
        if file_id not in height_map:
            print "loading %08X" % file_id
            height_map[file_id] = heights(f.find_file(file_id))
            if height_map[file_id] is not None:
                print "calculating hillshade"
                hill_shade[file_id] = hillshade(height_map[file_id])
            else:
                hill_shade[file_id] = None
        if hill_shade[file_id] is not None:
            hs = hill_shade[file_id]
            hm = height_map[file_id]
            c = 128 - int(hs[py, px]) / 4
            r, g, b = [cc * (c / 255.) for cc in colour_for_height(hm[py, px])]
            pixels[y, SIZE - x] = (r, g, b)
#             height = hm[py][px]
#             pixels[y, SIZE - x] = colour_for_height(height)
print "outputing"
png.output_png("heights.png", SIZE, SIZE, pixels)
예제 #2
0
def show_find_file(filename, file_id):
    """
    find the directory entry for the file with the given id
    """
    f = DatFile(filename)
    print_entry(f.find_file(file_id))
예제 #3
0
파일: clidat.py 프로젝트: smillaedler/lotro
def show_find_file(filename, file_id):
    """
    find the directory entry for the file with the given id
    """
    f = DatFile(filename)
    print_entry(f.find_file(file_id))
예제 #4
0
SIZE = 7682

pixels = zeros((SIZE, SIZE, 3), dtype=uint8)

# for y in range(1000, 2000):
#     for x in range(4500, 5500):

for y in range(64, SIZE - 32):
    for x in range(32, SIZE - 32):
        cy, py = divmod(y, 30)
        cx, px = divmod(x, 30)
        file_id = 0x80020000 + cy * 0x100 + cx
        if file_id not in height_map:
            print "loading %08X" % file_id
            height_map[file_id] = heights(f.find_file(file_id))
            if height_map[file_id] is not None:
                print "calculating hillshade"
                hill_shade[file_id] = hillshade(height_map[file_id])
            else:
                hill_shade[file_id] = None
        if hill_shade[file_id] is not None:
            hs = hill_shade[file_id]
            hm = height_map[file_id]
            c = 128 - int(hs[py, px]) / 4
            r, g, b = [cc * (c / 255.) for cc in colour_for_height(hm[py, px])]
            pixels[y, SIZE - x] = (r, g, b)
#             height = hm[py][px]
#             pixels[y, SIZE - x] = colour_for_height(height)
print "outputing"
png.output_png("heights.png", SIZE, SIZE, pixels)