#ifndef OBJLOADER_H
#define OBJLOADER_H

#include <string.h>
#include <hash_set>
#include "shape.h"
#include "vertex.h"

namespace CBK
{
	namespace Shapes
	{
		class objLoader : public Mesh
		{
		public:
			//Create a new shape
			objLoader(const std::string& fileName, const MeshParam& params);
			virtual ~objLoader(void);

			virtual item& load(const std::string& fileName, const MeshParam& params);
		protected:

		private:
			void copyData(IN OUT std::vector<std::vector<UINT>*>& tFaces, std::vector<D3DXVECTOR3*>& tPositions, IN OUT std::vector<D3DXVECTOR3*>& tNormals, IN OUT std::vector<D3DXVECTOR2*>& tTexCoords);
			static WORD getRealIndex(IN const UINT PositionIndex, IN const UINT TexCoordIndex, IN const UINT NormalIndex, IN OUT stdext::hash_set<Vertices::falseIndex>& RealIndexes, IN OUT  WORD& nextIndex);

			static UINT stringToUInt(char* const buffer);
			D3DVERTEXELEMENT9 vertexElement[MAX_FVF_DECL_SIZE];
		};
	}
}

#endif //OBJLOADER_H