33 #include <glm/vec3.hpp>
34 #include <glm/vec2.hpp>
41 VAO(
unsigned int _id);
48 unsigned int get_id()
const;
54 VBO(
unsigned int _id);
61 unsigned int get_id()
const;
67 EBO(
unsigned int _id);
74 unsigned int get_id()
const;
89 void draw(
const Eng3D::OpenGL::VAO& vao,
MeshMode mode,
const void* indices,
size_t n_indices,
const void* buffer,
size_t n_buffer,
int instances);
90 void upload(
const Eng3D::OpenGL::VAO& vao,
const Eng3D::OpenGL::VBO& vbo,
const Eng3D::OpenGL::EBO& ebo,
const void *buffer,
size_t n_buffer,
size_t sz_buffer,
size_t sz_buffer_vert,
size_t sz_buffer_tex,
size_t v_len,
size_t t_len,
size_t c_len,
const void *indices,
size_t n_indices,
size_t sz_indices,
bool has_color);
93 template<
typename V = glm::vec3,
typename T = glm::vec2,
typename C =
void>
122 template<typename V, typename T>
143 template<typename V = glm::vec3, typename T = glm::vec2, typename
C =
void>
157 void draw(
int instances = 0)
const {
158 Eng3D::draw(vao, mode, indices.data(), indices.size(), buffer.data(), buffer.size(), instances);
163 if constexpr(DataType::has_color) c_len += C::length();
164 Eng3D::upload(vao, vbo, ebo, buffer.data(), buffer.size(),
sizeof(buffer[0]),
sizeof(buffer[0].vert),
sizeof(buffer[0].tex), V::length(), T::length(), c_len, indices.data(), indices.size(),
sizeof(indices), DataType::has_color);
170 template<
typename I = glm::vec2>
178 #if defined E3D_BACKEND_OPENGL || defined E3D_BACKEND_GLES
186 # error not implemented
191 template<std::
size_t vtc_size = 0, std::
size_t i_size = 0,
typename V = glm::vec3,
typename T = glm::vec2,
typename C =
void>
205 void draw(
int instances = 0)
const {
206 Eng3D::draw(vao, mode, indices.data(), indices.size(), buffer.data(), buffer.size(), instances);
211 if constexpr(DataType::has_color) c_len += C::length();
212 Eng3D::upload(vao, vbo, ebo, buffer.data(), buffer.size(),
sizeof(buffer[0]),
sizeof(buffer[0].vert),
sizeof(buffer[0].tex), V::length(), T::length(), c_len, indices.data(), indices.size(),
sizeof(indices), DataType::has_color);
218 template<
typename I = glm::vec2>
226 #if defined E3D_BACKEND_OPENGL || defined E3D_BACKEND_GLES
234 # error not implemented
EBO & operator=(EBO &rhs)
unsigned int get_id() const
VAO & operator=(VAO &rhs)
unsigned int get_id() const
VBO & operator=(VBO &rhs)
unsigned int get_id() const
void upload(const Eng3D::OpenGL::VAO &vao, const Eng3D::OpenGL::VBO &vbo, const Eng3D::OpenGL::EBO &ebo, const void *buffer, size_t n_buffer, size_t sz_buffer, size_t sz_buffer_vert, size_t sz_buffer_tex, size_t v_len, size_t t_len, size_t c_len, const void *indices, size_t n_indices, size_t sz_indices, bool has_color)
void draw(const Eng3D::OpenGL::VAO &vao, MeshMode mode, const void *indices, size_t n_indices, const void *buffer, size_t n_buffer, int instances)
void instancing(const Eng3D::OpenGL::VAO &vao, const Eng3D::OpenGL::VBO &i_vbo, const void *buffer, size_t index_size, int instances)
MeshData(MeshData &&) noexcept=default
constexpr MeshData(V _vert, T _tex)
constexpr MeshData()=default
MeshData(const MeshData &)=delete
constexpr MeshData(V _vert, T _tex, C _color)
constexpr MeshData(V _vert, T _tex)
constexpr static bool has_color
MeshData(MeshData &&) noexcept=default
MeshData(const MeshData &)=delete
constexpr MeshData()=default
Packed model - packs both vertices and texcoords into the same buffer.
virtual void upload() const
std::vector< DataType > buffer
void instancing(I &instances_buffer, int instances=0)
Enables instances on this simple mesh.
Mesh(Mesh &&) noexcept=default
Mesh(const Mesh &)=delete
std::vector< unsigned int > indices
Mesh(enum Eng3D::MeshMode _mode)
A static mesh with fixed number of elements.
MeshStatic(enum Eng3D::MeshMode _mode)
void instancing(I &instances_buffer, int instances=0)
Enables instances on this simple mesh.
std::array< unsigned int, i_size > indices
MeshStatic(MeshStatic &&) noexcept=default
virtual void upload() const
MeshStatic(const MeshStatic &)=delete
virtual ~MeshStatic()=default
std::array< DataType, vtc_size > buffer