package speiger.src.coreengine.rendering.texturesOld.base;

import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;

import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.reloader.IReloadableResource;
import speiger.src.coreengine.rendering.texturesOld.normal.DirectTexture;
import speiger.src.coreengine.rendering.texturesOld.normal.SimpleTexture;
import speiger.src.coreengine.rendering.texturesOld.stb.STBDirectTexture;
import speiger.src.coreengine.rendering.texturesOld.stb.STBTexture;

public interface ITexture extends IReloadableResource
{
	public int getTextureId();
	
	public void bindTexture();
	public void deleteTexture();
	
	public int getWidth();
	public int getHeight();
	
	public float getUMin();
	public float getVMin();
	public float getUMax();
	public float getVMax();
	
	public ITexture makeReloadable();
	
	public default float getInterpolatedU(float u){return getUMin() + ((getUMax() - getUMin()) * u);}
	public default float getInterpolatedV(float v){return getUMin() + ((getUMax() - getUMin()) * v);}
	
	public static ITexture simple(AssetLocation location) {
		return new STBTexture(location);
	}
	
	public static ITexture direct(ByteBuffer stbImageData, int width, int height) {
		return new STBDirectTexture(stbImageData, width, height);
	}
	
	public static ITexture direct(long stbImageData, int width, int height) {
		return new STBDirectTexture(stbImageData, width, height);
	}
	
	public static ITexture direct(BufferedImage imageData) {
		return new STBDirectTexture(imageData);
	}
	
	public static ITexture awtSimple(AssetLocation location) {
		return new SimpleTexture(location);
	}
	
	public static ITexture awtDirect(BufferedImage imageData) {
		return new DirectTexture(imageData);
	}
}
