#pragma once

#include "render/OpenGlExtensions.h"
#include "utils/Utils.h"

#if defined EMSCRIPTEN || defined __ANDROID__
#define PNG_ENABLED
#endif

namespace ZL
{

	struct TextureDataStruct {
		size_t width;
		size_t height;
		std::vector<char> data;

		enum BitSize {
			BS_24BIT,
			BS_32BIT
		};

		// ����� ������������ ��� ���������� ���-���������
		enum MipmapType {
			NONE,       // ��� ���-����� (GL_LINEAR)
			GENERATE    // �������������� ��������� (GL_LINEAR_MIPMAP_LINEAR)
		};

		BitSize bitSize;
/*#ifdef SIMPLIFIED	
		MipmapType mipmap = NONE; // �� ��������� ��������
#else*/
		MipmapType mipmap = GENERATE; // �� ��������� ��������
//#endif
	};
	class Texture
	{
		size_t width = 0;
		size_t height = 0;
		GLuint texID = 0;

	public:

		Texture(const TextureDataStruct& texData);

		//Cubemap texture:
		Texture(const std::array<TextureDataStruct, 6>& texDataArray);

		~Texture();

		GLuint getTexID();

		size_t getWidth();
		size_t getHeight();


	};

	TextureDataStruct CreateTextureDataFromBmp24(const std::string& fullFileName, const std::string& ZIPFileName="");
	TextureDataStruct CreateTextureDataFromBmp32(const std::string& fullFileName, const std::string& ZIPFileName="");
#ifdef PNG_ENABLED
	TextureDataStruct CreateTextureDataFromPng(const std::string& fullFileName, const std::string& ZIPFileName = "");
#endif


}
