package speiger.src.coreengine.platform.graphics.api.target;

import speiger.src.coreengine.assets.api.ID;
import speiger.src.coreengine.platform.graphics.api.texture.Texture;
import speiger.src.coreengine.platform.graphics.api.texture.states.TextureType;

public record TextureTarget(ID id, Texture color, Texture depth) implements RenderTarget {
	public TextureTarget {
		if(color == null && depth == null) throw new IllegalArgumentException("At least either texture has to be nonNull");
		if(color != null && depth != null) {
			if(color.width() != depth.width()) throw new IllegalArgumentException("Width is not matching");
			if(color.height() != depth.height()) throw new IllegalArgumentException("Height is not matching");
		}
		if(color != null && color.settings().type() != TextureType.TEXTURE_2D) throw new IllegalArgumentException("Color Texture has to be 2D");
		if(depth != null && depth.settings().type() != TextureType.TEXTURE_2D) throw new IllegalArgumentException("Depth Texture has to be 2D");
	}
}
