mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add MeshData
This commit is contained in:
parent
d41ec3a019
commit
5c6b73ee2b
3 changed files with 45 additions and 4 deletions
|
|
@ -4,6 +4,19 @@
|
|||
int Mesh::meshesCount = 0;
|
||||
int Mesh::drawCalls = 0;
|
||||
|
||||
inline size_t calc_vertex_size(const vattr* attrs) {
|
||||
size_t vertexSize = 0;
|
||||
for (int i = 0; attrs[i].size; i++) {
|
||||
vertexSize += attrs[i].size;
|
||||
}
|
||||
return vertexSize;
|
||||
}
|
||||
|
||||
Mesh::Mesh(const MeshData& data)
|
||||
: Mesh(data.vertices.data(),
|
||||
data.vertices.size() / calc_vertex_size(data.attrs.data()),
|
||||
data.attrs.data()) {}
|
||||
|
||||
Mesh::Mesh(const float* vertexBuffer, size_t vertices, const int* indexBuffer, size_t indices, const vattr* attrs) :
|
||||
ibo(0),
|
||||
vertices(vertices),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue