/*
PolyGun

Copyright (c) 2023 kacperks
              2023 mrkubax10 <mrkubax10@onet.pl>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef POLUGUN_RENDERER_MESH_HPP
#define POLUGUN_RENDERER_MESH_HPP

#include <vector>

#include "common/type_enum.hpp"

namespace polygun::renderer {
	class Mesh {
	public:
		Mesh();
		virtual ~Mesh(){}

		void load_from_memory(const std::vector<float>& vertices, const std::vector<unsigned>& indices);
		void load_from_memory(const std::vector<float>& vertices, const std::vector<unsigned>& indices, const std::vector<float>& uvs);
		void load_from_memory(const std::vector<float>& vertices, const std::vector<unsigned>& indices, const std::vector<float>& uvs, const std::vector<float>& normals);

		bool has_texture_uvs() const { return m_has_texture_uvs; }
		bool has_normals() const { return m_has_normals; }

		virtual void add_custom_buffer(const void* data, unsigned size, unsigned char data_length, misc::VarType data_type) = 0;

	private:
		bool m_has_texture_uvs, m_has_normals;

	protected:
		virtual void load_vertices(const std::vector<float>& vertices) = 0;
		virtual void load_indices(const std::vector<unsigned>& indices) = 0;
		virtual void load_uvs(const std::vector<float>& uvs) = 0;
		virtual void load_normals(const std::vector<float>& normals) = 0;
	};
}

#endif // POLUGUN_RENDERER_MESH_HPP
