#ifndef VBO_MANAGER_H
#define VBO_MANAGER_H

#include <map>
#include <string>
#include <vector>
using namespace std;

#include "./../../lib/GLee/GLee.h"	//GL header file, including extensions
#include "./openGlSupport/OpenGLwrapper.h"


typedef GLuint GL_ID;


///Contains informations required for Vertex Buffer Object rendering (ie buffer ids ...)
struct VBOids
{
	GL_ID vcoord_id;
	GL_ID ncoord_id;
	vector<GL_ID> tcoord_id;
	GL_ID fcoord_id;
	unsigned int from_index;
	unsigned int to_index;

	VBOids(void):vcoord_id(0),  ncoord_id(0), fcoord_id(0), from_index(0), to_index(0)
	{
		tcoord_id.clear();
	}
};


///Vertex Buffer Object manager
class VBOmanager
{
private:
	map<string,VBOids> vbo_data;

	VBOmanager(const VBOmanager&);	//tato trida nelze kopirovat

public:
	static void renderVBO(const VBOids& vbo_data, const vector<GL_ID> &textures);
	VBOmanager(void);
	bool getVBOdata(const string &name, VBOids &dstVBO );	/**< vraci VBO strukturu, ktera byla do databaze ulozena pod danym jmenem */
	void createNewVBO(const string &name, const vector<float>& vcoords, const vector<float>& ncoords, const vector<vector<float>>& tcoords, const vector<int>& fcoords); /**<  vytvori nove VBO objekty a ulozi je do databaze pod danym jmenem */
	void removeVBO(const string &name);	/**<  idstrani VBO objekty z GPU a z databaze */
};




#endif