package speiger.src.coreengine.rendering.gui.renderer;

import java.util.function.Consumer;

import speiger.src.coreengine.math.misc.Facing;
import speiger.src.coreengine.math.vector.matrix.Matrix4f;
import speiger.src.coreengine.math.vector.quaternion.Quaternion;
import speiger.src.coreengine.rendering.guiOld.helper.box.IGuiBox;
import speiger.src.coreengine.rendering.models.DrawCall;
import speiger.src.coreengine.rendering.tesselation.format.VertexFormat;
import speiger.src.coreengine.rendering.textures.base.ITexture;

public interface IUIRenderer {
	public boolean isInScissors(IGuiBox box);
	public void pushScissors(IGuiBox box);
	public void popScissors();
	
	public TexturedRect getCachedRect();
	
	public void flush();
	
	public void pushTransform();
	public void popTransform();
	
	public void translate(float z);
	public void translate(float x, float y);
	public void translate(float x, float y, float z);
	
	public void scale(float scale);
	public void scale(float x, float y);
	
	public void rotate(Quaternion rotation);
	
	public void drawCustom(Consumer<Matrix4f> matrix);
	public void drawCustom(VertexFormat format, DrawCall drawcall);
	
	
	public void drawLine(float minX, float minY, float maxX, float maxY, float zLevel, int color);
	
	public default void drawFrame(IGuiBox box, int color) { drawFrame(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), 0F, color); }
	public default void drawFrame(IGuiBox box, float zLevel, int color) { drawFrame(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, color); }
	public void drawFrame(float minX, float minY, float maxX, float maxY, float zLevel, int color);
	
	public default void drawRect(IGuiBox box, int color) { drawRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), 0F, color); }
	public default void drawRect(IGuiBox box, float zLevel, int color) { drawRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, color); }
	public void drawRect(float minX, float minY, float maxX, float maxY, float zLevel, int color);
	
	public default void drawRect(IGuiBox box, int startColor, int endColor, Facing facing) { drawGradientRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), 0F, startColor, endColor, facing); }
	public default void drawRect(IGuiBox box, float zLevel, int startColor, int endColor, Facing facing) { drawGradientRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, startColor, endColor, facing); }
	public void drawGradientRect(float minX, float minY, float maxX, float maxY, float zLevel, int startColor, int endColor, Facing facing);
	
	public default void drawTexturedRect(IGuiBox box, ITexture texture, int color) { drawTexturedRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), 0F, texture.id(), texture.minU(), texture.minV(), texture.maxU(), texture.maxV(), color); }
	public default void drawTexturedRect(IGuiBox box, float zLevel, ITexture texture, int color) { drawTexturedRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, texture.id(), texture.minU(), texture.minV(), texture.maxU(), texture.maxV(), color); }
	public default void drawTexturedRect(float minX, float minY, float maxX, float maxY, float zLevel, ITexture texture, int color) { drawTexturedRect(minX, minY, maxX, maxY, zLevel, texture.id(), texture.minU(), texture.minV(), texture.maxU(), texture.maxV(), color); }
	public default void drawTexturedRect(IGuiBox box, float zLevel, ITexture texture, float minU, float minV, float maxU, float maxV, int color) { drawTexturedRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, texture.id(), minU, minV, maxU, maxV, color); }
	public void drawTexturedRect(float minX, float minY, float maxX, float maxY, float zLevel, int texture, float minU, float minV, float maxU, float maxV, int color);
}
