public void Dispose()
        {
            if (instance == this)

            {

                levelIndex.Clear();

                cache.Clear();

                instance = null;

            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        private RenderableManager()
        {
            numRenderables = 0;

            indexes = new IndexBuffer();

            renderables = new ArrayList();
            queue = new RenderableQueue();

            renderablesLoadQueue = new RenderableQueue();
            tilesLoadQueue = new TileQueue();

            // Add the requested initial number
            addBatch(Options.Instance.Num_Renderables);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public IndexBuffer()
        {
            if (instance != null)

            {

                throw new ApplicationException("IndexBuffer.Constructor() called twice!");

            }

            instance = this;

            tileSize = Options.Instance.TileSize + 1;
            numIndexes = Options.Instance.MaxRenderLevel + 1;
            //mLevelIndex.reserve (mNumIndexes);
            cache = new ArrayList();
            levelIndex = new ArrayList((int)numIndexes);
            for ( long i = 0; i < numIndexes; i++ )
            {
                levelIndex.Add( new Map() );
            }
        }
        public void Dispose()
        {
            if (instance == this)

            {

                renderables.Clear();

                indexes = null;

                instance = null;

            }
        }