Exemplo n.º 1
0
def init_image_array(map_image_size, default_color=(0,0,0,0)):
    image_array = shmem.create((map_image_size[1], map_image_size[0], Level.color_depth), dtype=numpy.uint8)
    image_array[:] = default_color
    return image_array
Exemplo n.º 2
0
def init_image_array(map_image_size, default_color=(0,0,0,0)):
    image_array = shmem.create((map_image_size[1], map_image_size[0], Level.color_depth), dtype=numpy.uint8)
    image_array[:] = default_color
    return image_array
Exemplo n.º 3
0
    # map size
    chunks_xpos = map(lambda chunk_file: int(os.path.basename(chunk_file).split('.')[1],36), chunk_files)
    chunks_zpos = map(lambda chunk_file: int(os.path.basename(chunk_file).split('.')[2],36), chunk_files)

    map_size = {'x_min': min(chunks_xpos), 'x_max': max(chunks_xpos),
                'z_min': min(chunks_zpos), 'z_max': max(chunks_zpos)}

    map_chunk_offset_X = abs(map_size['x_min'])
    map_chunk_offset_Z = abs(map_size['z_min'])

    map_image_size = ((abs(map_size['x_max']) + map_chunk_offset_X) * Mapper.chunk_size_X + 16, (abs(map_size['z_max']) + map_chunk_offset_Z) * Mapper.chunk_size_Z + 16)

    init_array = time.clock()

    image_array = shmem.create((map_image_size[1], map_image_size[0], 3), dtype=numpy.uint8)
    image_array[:] = (255, 255, 255)

    end_init_array = time.clock()

    pool = multiprocessing.Pool(multiprocessing.cpu_count()*2, init_multiprocess, (image_array,))

    end_setup = time.clock()

    render = time.clock()

    # multi cpu render
    print 'go', len(chunk_files), map_image_size
    def create_data(file):
        return (map_size, file)
Exemplo n.º 4
0
        'z_min': min(chunks_zpos),
        'z_max': max(chunks_zpos)
    }

    map_chunk_offset_X = abs(map_size['x_min'])
    map_chunk_offset_Z = abs(map_size['z_min'])

    map_image_size = (
        (abs(map_size['x_max']) + map_chunk_offset_X) * Mapper.chunk_size_X +
        16,
        (abs(map_size['z_max']) + map_chunk_offset_Z) * Mapper.chunk_size_Z +
        16)

    init_array = time.clock()

    image_array = shmem.create((map_image_size[1], map_image_size[0], 3),
                               dtype=numpy.uint8)
    image_array[:] = (255, 255, 255)

    end_init_array = time.clock()

    pool = multiprocessing.Pool(multiprocessing.cpu_count() * 2,
                                init_multiprocess, (image_array, ))

    end_setup = time.clock()

    render = time.clock()

    # multi cpu render
    print 'go', len(chunk_files), map_image_size

    def create_data(file):