#ifndef MTL_READER_H
#define MTL_READER_H

#include <string>
#include <fstream>
#include <cassert> 
using namespace std;

//#include "Material.h"
#include "./exception/Exception.h"

const string MTL_NEWMATERIAL_TAG="newmtl";

const string MTL_KA_TAG="Ka";
const string MTL_KD_TAG="Kd";
const string MTL_KS_TAG="Ks";
const string MTL_TF_TAG="Tf";	//transmision factor

const string MTL_NS_TAG="Ns";	//specular exponent
const string MTL_NI_TAG="Ni";	//optical density
const string MTL_ILLUM_TAG="illum";		//illumination model
const string MTL_SHAPRNESS_TAG="sharpness";

const string MTL_DISOLVE_TAG="d";

const string MTL_MAPKD_TAG="map_Kd";	/**<diffuse texture*/
const string MTL_MAPKS_TAG="map_Ks";	/**<specular texture*/
const string MTL_MAPKA_TAG="map_Ka";	/**<ambient texture*/


///Structure for MTL Phong material 
struct MTLmaterial
{
	string name;

	float disolve;
	float ambient[3];
	float diffuse[3];
	float specular[3];
	float specular_exp;

	string map_Ka; /**<ambient texture map name*/
	string map_Kd;	/**<diffuse texture map name*/
	string map_Ks;	/**<specular texture map name*/

	MTLmaterial(void);
	~MTLmaterial(void);
	MTLmaterial(const MTLmaterial& material);

	void clear(void);
};


///Reads and parse MTL files
class MTLreader
{
private:
	fstream file;
	string file_buffer;

public:
	MTLreader(const string &fileName);
	~MTLreader();
	bool readNextMaterial(MTLmaterial& dst_storage);	/**<  Precte ze souboru a formou parametru vrati dalsi material. Pokud parser nenarazil na konec soubor tak vraci True, jinak False */
};




#endif