Class for loading & managing textures.
Texture manager serves as an abstract singleton for all API specific texture managers. When a class inherits from this and is created, a instance of that class (i.e. GLTextureManager) is stored in the global singleton instance of the TextureManager. Note: This will not take place until the RenderSystem is initialized and at least one RenderWindow has been created.
Inheritance: ResourceManager
Esempio n. 1
0
		/// <summary>
		///     Internal constructor.  This class cannot be instantiated externally.
		/// </summary>
		/// <remarks>
		///     Protected internal because this singleton will actually hold the instance of a subclass
		///     created by a render system plugin.
		/// </remarks>
		protected internal TextureManager()
			: base()
		{
			if ( instance == null )
			{
				instance = this;
				ResourceType = "Texture";
				LoadingOrder = 75.0f;
			}
			else
				throw new AxiomException( "Cannot create another instance of {0}. Use Instance property instead", this.GetType().Name );
		}
 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 /// <remarks>
 ///     Protected internal because this singleton will actually hold the instance of a subclass
 ///     created by a render system plugin.
 /// </remarks>
 protected internal TextureManager()
 {
     if (instance == null) {
         instance = this;
     }
 }
        /// <summary>
        ///     Called when the engine is shutting down.    
        /// </summary>
        public override void Dispose()
        {
            base.Dispose();

            if (this == instance) {
                instance = null;
            }
        }
Esempio n. 4
0
		/// <summary>
		///     Called when the engine is shutting down.
		/// </summary>
		protected override void dispose( bool disposeManagedResources )
		{
			if ( !IsDisposed )
			{
				if ( disposeManagedResources )
				{
					if ( this == instance )
					{
						instance = null;
					}

					foreach ( Texture texture in Resources )
					{
						if ( !texture.IsDisposed )
						{
							texture.Dispose();
						}
					}
				}

				// There are no unmanaged resources to release, but
				// if we add them, they need to be released here.
			}

			// If it is available, make the call to the
			// base class's Dispose(Boolean) method
			base.dispose( disposeManagedResources );
		}