#pragma once #include #include #include #include "../Math/Math.hpp" namespace MC::GFX { class Mesh { public: struct Attribute { template Attribute( std::vector> v ) : data_size(v.size()), attribute_size(S), type_size(sizeof(T)) { data = copy(v.data(), v.size() * S * type_size); }; Attribute( const Attribute& other ) : data(copy(other.data, other.data_size * other.attribute_size * other.type_size)), data_size(other.data_size), attribute_size(other.attribute_size), type_size(other.type_size) {}; static void* copy(void* ptr, uint32_t size) { auto* buffer = new uint8_t[size]; std::copy((uint8_t*)ptr, (uint8_t*)ptr + size, buffer); return buffer; } void* data; long data_size; int attribute_size; int type_size; }; Mesh( std::vector attributes, std::vector indices ) : m_attributes(std::move(attributes)), m_indices(std::move(indices)) {}; Mesh( std::vector attributes ) : m_attributes(std::move(attributes)), m_indices() {}; std::vector indices(); std::vector attributes(); private: std::vector m_attributes; std::vector m_indices; }; }