#ifndef HELPER_GL_H
#define HELPER_GL_H

#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
#include <QOpenGLTexture>

struct Vert {
	QVector3D vert;
	Vert(QVector3D vert) : vert(vert) {;}
	int getVertOffset() const {return 0;}
	bool operator == (const Vert& o) const {return (vert == o.vert);}
};

struct VertColor {
	QVector3D vert;
	QVector3D color;
	VertColor(QVector3D vert, QVector3D color) : vert(vert), color(color) {;}
	int getVertOffset() const {return 0;}
	int getColorOffset() const {return sizeof(QVector3D);}
	int getTanOffset() const {throw "error";}
	int getNormOffset() const {throw "error";}
	int getTexOffset() const {throw "error";}
	bool operator == (const VertColor& o) const {return (vert == o.vert) && (color == o.color);}
	static bool hasTangent() {return false;}
	static bool hasColor() {return true;}
	static bool hasNormal() {return false;}
	static bool hasTexCoord() {return false;}
};

struct VertNorm {
	QVector3D vert;
	QVector3D norm;
	VertNorm(QVector3D vert, QVector3D norm) : vert(vert), norm(norm) {;}
	int getVertOffset() const {return 0;}
	int getNormOffset() const {return sizeof(QVector3D);}
	int getTanOffset() const {throw "error";}
	int getColorOffset() const {throw "error";}
	bool operator == (const VertNorm& o) const {return (vert == o.vert) && (norm == o.norm);}
	static bool hasTangent() {return false;}
	static bool hasNormal() {return true;}
	static bool hasTexCoord() {return false;}
	static bool hasColor() {return false;}
};

struct VertNormTex {
	QVector3D vert;
	QVector3D norm;
	QVector2D tex;
	VertNormTex(QVector3D vert, QVector3D norm, QVector3D tex) : vert(vert), norm(norm), tex(tex) {;}
	int getVertOffset() const {return 0;}
	int getNormOffset() const {return sizeof(QVector3D);}
	int getTexOffset() const {return sizeof(QVector3D)*2;}
	int getTanOffset() const {throw "error";}
	int getColorOffset() const {throw "error";}
	bool operator == (const VertNormTex& o) const {return (vert == o.vert) && (norm == o.norm) && (tex == o.tex);}
	static bool hasTangent() {return false;}
	static bool hasNormal() {return true;}
	static bool hasTexCoord() {return true;}
	static bool hasColor() {return false;}
};

struct VertNormTexTan {
	QVector3D vert;
	QVector3D norm;
	QVector2D tex;
	QVector3D tan;
	VertNormTexTan(QVector3D vert, QVector3D norm, QVector3D tex, QVector3D tan) : vert(vert), norm(norm), tex(tex), tan(tan) {;}
	int getVertOffset() const {return 0;}
	int getNormOffset() const {return sizeof(QVector3D);}
	int getTexOffset() const {return sizeof(QVector3D)*2;}
	int getTanOffset() const {return sizeof(QVector3D)*2 + sizeof(QVector2D);}
	int getColorOffset() const {throw "error";}
	bool operator == (const VertNormTexTan& o) const {return (vert == o.vert) && (norm == o.norm) && (tex == o.tex) && (tan == o.tan);}
	static bool hasTangent() {return true;}
	static bool hasNormal() {return true;}
	static bool hasTexCoord() {return true;}
	static bool hasColor() {return false;}
};

#endif // HELPER_GL_H
