def __init__(self,bakery,tileSize,minRenderSize,maxRenderSize,maxPreGenSize,startX,startY):
        
        assert minRenderSize<=maxRenderSize<=maxPreGenSize
        
        self.tileSize=tileSize
        
        self.bakery=bakery
        self.asyncBaking=False # only async bake one tile at a time
        tileX=startX/tileSize
        tileY=startY/tileSize
        
        def replaceTileCacheEntry(x,y,old):
            if old:
                self.destroy(old)
            return None
            
        self.tileCache=ToroidalCache(maxPreGenSize,replaceTileCacheEntry,tileX,tileY)
        
        def replaceMidCacheEntry(x,y,old):
            if old:
                self.unrender(old)
            new=self.tileCache.get(x,y)
            if new:
                self.render(new)
            return new
            
        self.midCache=ToroidalCache(maxRenderSize,replaceMidCacheEntry,tileX,tileY)
        
        def replaceRenderTile(x,y,old):
            new=self.tileCache.get(x,y)
            if not new:
                new=self._makeTile(x,y)
                self.midCache.store(x,y,new)
                self.tileCache.store(x,y,new)
                self.render(new)
            return new
            
        self.renderCache=ToroidalCache(minRenderSize,replaceRenderTile,tileX,tileY)
        # TODO : perhaps add some some of addational cache to save things when outside pregen
        #           LRU, weighted by generation time perhaps?
bakery should be a bakery.bakery.FixedBakery
dataset/ETHPy150Open Craig-Macomber/Panda3D-Terrain-System/tileUtil.py/BakeryManager.__init__