def makeVerticesFromModel(templates, dataMask=0):
    """
    Returns a function that creates vertex arrays.

    This produces vertex arrays based on the passed
    templates. This doesn't cull any faces based on
    if they are exposed.

    :param templates: list of templates to draw
    :param dataMask:  mask to mask the data
    """
    if isinstance(templates, list):
        templates = numpy.array(templates)
    if templates.shape == (6, 4, 6):
        templates = numpy.array([templates])
    if len(templates.shape) == 4:
        templates = templates[numpy.newaxis, ...]
    elements = templates.shape[0]

    def makeVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap):
        mask = self.getMaterialIndices(blockMaterials)
        blockIndices = mask.nonzero()
        yield

        data = blockData[mask]
        data &= dataMask
        self.vertexArrays = []
        append = self.vertexArrays.append
        for i in xrange(elements):
            vertexArray = numpy.zeros((len(blockIndices[0]), 6, 4, 6), dtype='float32')
            for indicies in xrange(3):
                dimension = (0, 2, 1)[indicies]

                vertexArray[..., indicies] = blockIndices[dimension][:, numpy.newaxis,
                                             numpy.newaxis]  # xxx swap z with y using ^
                
            vertexArray[..., 0:5] += templates[i, data][..., 0:5]
            vertexArray[_ST] += texMap(blocks[blockIndices], blockData[blockIndices] & 15)[..., numpy.newaxis, :]

            vertexArray.view('uint8')[_RGB] = templates[i, data][..., 5][..., numpy.newaxis]
            vertexArray.view('uint8')[_A] = 0xFF
            vertexArray.view('uint8')[_RGB] *= areaBlockLights[1:-1, 1:-1, 1:-1][blockIndices][
                ..., numpy.newaxis, numpy.newaxis, numpy.newaxis]
            vertexArray.shape = (vertexArray.shape[0] * 6, 4, 6)
            yield
            append(vertexArray)
    return makeVertices

    Returns a function that creates vertex arrays.

    This produces vertex arrays based on the passed
    templates. This doesn't cull any faces based on
    if they are exposed.

    :param templates: list of templates to draw
    :param dataMask:  mask to mask the data
    
renderer.py