Exemplo n.º 1
0
        int mipbias = 4; // 3 is sufficient, but at 4 it loads

        #endregion Fields

        #region Constructors

        public VirtualTexture( D3D10.Device device, VirtualTextureInfo info, int atlassize, int uploadsperframe, string filename )
        {
            this.device = device;
            this.info   = info;

            this.atlascount = atlassize / info.PageSize;
            this.uploadsperframe = uploadsperframe;

            indexer = new PageIndexer( info );
            toload = new List<PageCount>( indexer.Count );

            Console.Write( "Creating PageAtlas...");
            atlas = new TextureAtlas( device, info, atlascount, uploadsperframe );
            Console.WriteLine("done.");

            Console.Write( "Creating PageLoader..." );
            loader = new PageLoader( filename + ".cache", indexer, info );
            Console.WriteLine("done.");

            cache = new PageCache( info, atlas, loader, indexer, atlascount );

            Console.Write( "Creating PageTable...");
            pagetable = new PageTable( device, cache, info, indexer );
            Console.WriteLine("done.");
        }
Exemplo n.º 2
0
        int current; // This is used for generating the texture atlas indices before the lru is full

        #endregion Fields

        #region Constructors

        public PageCache( VirtualTextureInfo info, TextureAtlas atlas, PageLoader loader, PageIndexer indexer, int count )
        {
            this.info  = info;
            this.atlas = atlas;
            this.loader = loader;
            this.indexer = indexer;
            this.count = count;

            lru = new LruCollection<Page,Point>( count * count );
            lru.Removed += ( page, point ) => Removed( page, point );

            loader.LoadComplete += LoadComplete;

            loading = new HashSet<Page>();
        }