Esempio n. 1
0
		public TextureLoader<Texture> FindTextureLoader(Texture Texture) {
			CatalogEntry<Texture, TextureLoader<Texture>> textureCatalogEntry = _textureCatalog[Texture.Name];
			if(textureCatalogEntry != null) {
				return textureCatalogEntry.Loader;
			} else {
				return null;
			}
		}
Esempio n. 2
0
		public Texture RegisterTexture(ref Texture texture, ref TextureLoader<Texture> textureLoader) {
			if(_textureList.Contains(texture)) {
				throw new Exception(string.Format("Texture {0} already registered.", texture));
			}
			if(_textureCatalog.ContainsKey(texture.Name)) {
				throw new Exception(string.Format("A Texture with the Name {0} already exists in this catalog. Cannot insert {1}.", texture.Name, texture));
			}
			_textureList.Add(texture);
			_textureCatalog.Add(
				texture.Name, 
			    new CatalogEntry<Texture, TextureLoader<Texture>>(texture, textureLoader)
			);
			return texture;
		}
		public override Texture ImportTexture(Catalog Catalog, string Name, string Path) {
			Console.WriteLine(string.Format("ImportTexture({0},\"{1}\",\"{2}\")", Catalog, Name, Path));
			
			if(!File.Exists(Path)) {
				throw new Exception(string.Format("There is no image for \"{0}\" found at the specified path \"{1}\"", Name, Path));
			}
			
			Texture texture = new Texture();
			texture.ID = 1;
			texture.Name = Name;
			texture.TextureSource = new TextureDiskSource(Path);
			TextureLoader<Texture> textureLoader = CreateTextureLoader(texture);
			
			Catalog.RegisterTexture(ref texture, ref textureLoader);
		
			return texture;
		}
Esempio n. 4
0
		public override void Draw(Texture Texture, int XPos, int YPos, int Width, int Height) {
			GL.PushMatrix();
			GL.LoadIdentity();
			
			Matrix4 orthgonalProjection = Matrix4.CreateOrthographicOffCenter(0, this.Width, this.Height, 0, -1, 1);
			GL.MatrixMode(MatrixMode.Projection);
			
			GL.PushMatrix();
			GL.LoadMatrix(ref orthgonalProjection);
			
			GL.Enable(EnableCap.Blend);
			GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.Zero);
			
			EnableTexture(Texture);
			GL.Enable(EnableCap.Texture2D);
			
			GL.Begin(BeginMode.Quads);
				GL.TexCoord2(0, 0); GL.Vertex2(XPos, YPos);
				GL.TexCoord2(1, 0); GL.Vertex2(XPos+Width, YPos);
				GL.TexCoord2(1, 1); GL.Vertex2(XPos+Width, YPos+Height);
				GL.TexCoord2(0, 1); GL.Vertex2(XPos, YPos+Height);
			GL.End();
			GL.PopMatrix();
			
			GL.Disable(EnableCap.Blend);
			GL.Disable(EnableCap.Texture2D);
			
			DisableTexture();
			GL.MatrixMode(MatrixMode.Modelview);
			GL.PopMatrix();
		}
Esempio n. 5
0
		public override void Draw(Texture Texture, int XPos, int YPos) {
			
		}
Esempio n. 6
0
		public override void Draw(Texture Texture) {
			Draw(Texture, 0, 0, Width, Height);
		}
Esempio n. 7
0
		public override void EnableTexture(Texture Texture) {
			if(!Texture.InVideoMemory) {
				LoadTexture(Texture);
			}
			GL.BindTexture(TextureTarget.Texture2D, Texture.Handle);
		}
Esempio n. 8
0
		public override void LoadTexture(Texture Texture) {
			if(!Texture.InSystemMemory) {
				Loader<Texture> textureLoader = Catalog.FindTextureLoader(Texture.Name);
				textureLoader.LoadIntoSystemMemory();
				textureLoader.LoadIntoVideoMemory();
			}
			if(!Texture.InVideoMemory) {
				Loader<Texture> textureLoader = Catalog.FindTextureLoader(Texture.Name);
				textureLoader.LoadIntoVideoMemory();
			}
		}
		public override TextureLoader<Texture> CreateTextureLoader(Texture Texture) {
			return new OpenTKTextureLoader<Texture>(Texture);
		}
Esempio n. 10
0
		// Unload Texture
				
		
		
		// Load Model
		
		// Unload Model
		
		// LoadFont
		
		// UnloadFont
		
		// Load Float Buffer
		
		// Unload Float Buffer
		
		// Load Int Buffer
		
		// Unload Int Buffer
		
		// Load Vertex Shader
		
		// Unload Vertex Shader
		
		// Load Fragment Shader
		
		// Unload Fragment Shader
		
		/**
		 * Enable/Disable Resources
		 **/
		
		// Enable Texture
		public abstract void EnableTexture(Texture Texture);
Esempio n. 11
0
		/// <summary>
		/// Resource Management
		/// </summary>
		/**
		 * Load From Catalog
		 **/
		// Load Texture
		public abstract void LoadTexture(Texture Texture); 
Esempio n. 12
0
		public abstract void Draw(Texture Texture, int XPos, int YPos, int Width, int Height);
Esempio n. 13
0
		public abstract void Draw(Texture Texture, int XPos, int YPos);
Esempio n. 14
0
		/*
		public abstract void ClearBackBuffer(int XPos, int YPos, int Width, int Height);
		
		public abstract void ClearZBuffer(int XPos, int YPos, int Width, int Height);
		
		public abstract void ClearStencilBuffer(int XPos, int YPos, int Width, int Height);
		
		public virtual void ClearBuffers(int XPos, int YPos, int Width, int Height) {
			ClearBackBuffer(XPos, YPos, Width, Height);
			ClearZBuffer(XPos, YPos, Width, Height);
			ClearStencilBuffer(XPos, YPos, Width, Height);
		}
		*/
		/// <summary>
		/// Scene management
		/// </summary>
		
		/*
		public virtual void BeginScene() {}
		
		public virtual void EndScene() {}
		
		public abstract void DrawScene(VisibleSet VisibleSet);
		
		public abstract void Draw(Geometry Geometry);
		
		
		*/
			
		// public abstract void ApplyEffect(ShaderEffect ShaderEffect, bool PrimaryEffect);
		
		
		/// <summary>
		/// Text and 2D
		/// </summary>
		// SelectFont
		public abstract void Draw(Texture Texture);