Ejemplo n.º 1
0
        /// <summary>
        /// Sets the image cache for the clip map and initializes the clip stack.
        /// </summary>
        /// <param name="imageCache">The image cache to use.</param>
        /// <param name="textureSize">The total size of the virtual texture this clip map will serve data from.</param>
        /// <param name="clipMapSize">The width of the clip stack in texels. This will be the height and width of each clip level.</param>
        public void Initialize(IClipMapImageCache imageCache, int textureSize, int clipMapSize)
        {
            Assert.Fatal(TextureSize >= ClipMapSize, "ClipMap.Initialize - The clipMapSize parameter must bes smaller than the textureSize parameter. Can't make a clip map bigger than the virtual texture it represents!");
            Assert.Fatal(imageCache != null, "ClipMap.Initialize - Error: Image cache is null.");

            // ORDER HERE IS IMPORTANT:
            // -clip stack must be initialized after clip map size and texture scale are set
            // -image cache must be set after clip stack has been initialized
            // -clip stack can then be filled with texture data from the image cache
            TextureSize = textureSize;
            ClipMapSize = clipMapSize;
            _InitClipStack();
            ImageCache = imageCache;
            FillWithTextureData();
            _needsRecenter = true;
        }
Ejemplo n.º 2
0
 public override void Dispose()
 {
     _IsDisposed = true;
     _imageCache = null;
     _clipLevels.Clear();
     _clipLevels = null;
     base.Dispose();
 }