2023-06-01 21:23:57 +02:00
|
|
|
#include "chunkmesher.hpp"
|
|
|
|
|
2022-11-10 19:47:39 +01:00
|
|
|
#include <array>
|
2022-11-20 19:14:11 +01:00
|
|
|
#include <memory>
|
2022-11-10 19:47:39 +01:00
|
|
|
|
|
|
|
#include "block.hpp"
|
|
|
|
#include "chunk.hpp"
|
2023-06-01 21:23:57 +02:00
|
|
|
#include "chunkmanager.hpp"
|
2022-11-10 19:47:39 +01:00
|
|
|
#include "globals.hpp"
|
2023-05-20 21:19:44 +02:00
|
|
|
#include "renderer.hpp"
|
2022-11-10 19:47:39 +01:00
|
|
|
#include "spacefilling.hpp"
|
|
|
|
#include "utils.hpp"
|
|
|
|
|
2023-03-03 21:33:11 +01:00
|
|
|
namespace chunkmesher{
|
2023-05-20 21:19:44 +02:00
|
|
|
|
|
|
|
oneapi::tbb::concurrent_queue<MeshData*> MeshDataQueue;
|
|
|
|
|
|
|
|
oneapi::tbb::concurrent_queue<MeshData*>& getMeshDataQueue(){ return MeshDataQueue; }
|
2023-03-03 21:33:11 +01:00
|
|
|
|
2023-02-12 14:36:59 +01:00
|
|
|
void mesh(Chunk::Chunk* chunk)
|
2022-11-10 19:47:39 +01:00
|
|
|
{
|
2023-05-20 21:19:44 +02:00
|
|
|
MeshData* mesh_data;
|
|
|
|
if(!MeshDataQueue.try_pop(mesh_data)) return;
|
2022-11-10 19:47:39 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Taking inspiration from 0fps and the jme3 porting at
|
|
|
|
* https://github.com/roboleary/GreedyMesh/blob/master/src/mygame/Main.java
|
|
|
|
*
|
|
|
|
* By carefully re-reading the code and the blog post, I've come to the
|
|
|
|
* realization that I wrote something very similar yet a lot messier (and
|
|
|
|
* uglier) back in
|
|
|
|
* https://github.com/EmaMaker/voxel-engine-jme3/blob/master/src/voxelengine
|
|
|
|
* /world/Chunk.java
|
|
|
|
*
|
|
|
|
* Reading roboleary's impl. I've learned how to optimize having to loop
|
|
|
|
* across different planes everytime I change dimension without having to
|
|
|
|
* write 3 separate 3-nested-for-loops
|
|
|
|
*/
|
2023-03-23 21:17:06 +01:00
|
|
|
|
|
|
|
// Cleanup previous data
|
2023-05-26 23:05:29 +02:00
|
|
|
mesh_data->numVertices = 0;
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->chunk = chunk;
|
|
|
|
mesh_data->vertices.clear();
|
|
|
|
mesh_data->indices.clear();
|
|
|
|
mesh_data->colors.clear();
|
2022-11-10 19:47:39 +01:00
|
|
|
|
2023-03-23 21:17:06 +01:00
|
|
|
// Abort if chunk is empty
|
2023-04-29 14:54:43 +02:00
|
|
|
if(chunk->getState(Chunk::CHUNK_STATE_EMPTY)){
|
|
|
|
chunk->setState(Chunk::CHUNK_STATE_MESHED, true);
|
2023-05-20 21:19:44 +02:00
|
|
|
renderer::getMeshDataQueue().push(mesh_data);
|
2023-04-29 14:54:43 +02:00
|
|
|
return;
|
|
|
|
}
|
2023-02-12 14:36:59 +01:00
|
|
|
|
2022-11-10 19:47:39 +01:00
|
|
|
// convert tree to array since it is easier to work with it
|
2022-11-20 19:14:11 +01:00
|
|
|
int length{0};
|
2023-03-12 18:31:22 +01:00
|
|
|
std::unique_ptr<Block[]> blocks = chunk->getBlocksArray(&length);
|
|
|
|
if(length == 0) {
|
2023-04-29 14:54:43 +02:00
|
|
|
chunk->setState(Chunk::CHUNK_STATE_MESHED, true);
|
2023-05-20 21:19:44 +02:00
|
|
|
renderer::getMeshDataQueue().push(mesh_data);
|
2023-03-12 18:31:22 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-02-22 21:54:15 +01:00
|
|
|
|
2022-11-10 19:47:39 +01:00
|
|
|
int k, l, u, v, w, h, n, j, i;
|
|
|
|
int x[]{0, 0, 0};
|
|
|
|
int q[]{0, 0, 0};
|
|
|
|
int du[]{0, 0, 0};
|
|
|
|
int dv[]{0, 0, 0};
|
|
|
|
|
|
|
|
std::array<Block, CHUNK_SIZE * CHUNK_SIZE> mask;
|
|
|
|
for (bool backFace = true, b = false; b != backFace; backFace = backFace && b, b = !b)
|
|
|
|
{
|
|
|
|
// iterate over 3 dimensions
|
|
|
|
for (int dim = 0; dim < 3; dim++)
|
|
|
|
{
|
|
|
|
// offsets of other 2 axes
|
|
|
|
u = (dim + 1) % 3;
|
|
|
|
v = (dim + 2) % 3;
|
|
|
|
|
|
|
|
x[0] = 0;
|
|
|
|
x[1] = 0;
|
|
|
|
x[2] = 0;
|
|
|
|
|
|
|
|
q[0] = 0;
|
|
|
|
q[1] = 0;
|
|
|
|
q[2] = 0;
|
|
|
|
q[dim] = 1; // easily mark which dimension we are comparing
|
|
|
|
// voxels
|
|
|
|
// on
|
|
|
|
|
|
|
|
for (x[dim] = -1; x[dim] < CHUNK_SIZE;)
|
|
|
|
{
|
|
|
|
n = 0;
|
|
|
|
|
|
|
|
for (x[v] = 0; x[v] < CHUNK_SIZE; x[v]++)
|
|
|
|
{
|
|
|
|
for (x[u] = 0; x[u] < CHUNK_SIZE; x[u]++)
|
|
|
|
{
|
2023-06-01 21:23:57 +02:00
|
|
|
Block b1, b2;
|
|
|
|
if(x[dim] >= 0) b1 = blocks[HILBERT_XYZ_ENCODE[x[0]][x[1]][x[2]]];
|
|
|
|
else{
|
|
|
|
int cx = chunk->getPosition().x*CHUNK_SIZE;
|
|
|
|
int cy = chunk->getPosition().y*CHUNK_SIZE;
|
|
|
|
int cz = chunk->getPosition().z*CHUNK_SIZE;
|
|
|
|
|
|
|
|
int bx = cx+x[0];
|
|
|
|
int by = cy+x[1];
|
|
|
|
int bz = cz+x[2];
|
|
|
|
|
|
|
|
b1 = chunkmanager::getBlockAtPos(bx, by, bz);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(x[dim] < CHUNK_SIZE - 1) b2 = blocks[HILBERT_XYZ_ENCODE[x[0] + q[0]][x[1]
|
|
|
|
+ q[1]][x[2] + q[2]]];
|
|
|
|
else{
|
|
|
|
int cx = chunk->getPosition().x*CHUNK_SIZE;
|
|
|
|
int cy = chunk->getPosition().y*CHUNK_SIZE;
|
|
|
|
int cz = chunk->getPosition().z*CHUNK_SIZE;
|
|
|
|
|
|
|
|
int bx = cx+x[0] + q[0];
|
|
|
|
int by = cy+x[1] + q[1];
|
|
|
|
int bz = cz+x[2] + q[2];
|
|
|
|
|
|
|
|
b2 = chunkmanager::getBlockAtPos(bx, by, bz);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Compute the mask
|
|
|
|
mask[n++] = b1 != Block::NULLBLK && b2 != Block::NULLBLK && b1 == b2 ? Block::NULLBLK
|
|
|
|
: backFace ? b1 == Block::AIR ? b2 : Block::NULLBLK
|
|
|
|
: b2 == Block::AIR ? b1 : Block::NULLBLK;
|
2022-11-10 19:47:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
x[dim]++;
|
|
|
|
n = 0;
|
2022-11-20 19:14:11 +01:00
|
|
|
// Actually generate the mesh from the mask. This is the same thing I used in my old crappy voxel engine
|
2022-11-10 19:47:39 +01:00
|
|
|
for (j = 0; j < CHUNK_SIZE; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < CHUNK_SIZE;)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (mask[n] != Block::NULLBLK)
|
|
|
|
{
|
|
|
|
// First compute the width
|
|
|
|
for (w = 1; i + w < CHUNK_SIZE && mask[n + w] != Block::NULLBLK && mask[n] == mask[n + w]; w++)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool done = false;
|
|
|
|
for (h = 1; j + h < CHUNK_SIZE; h++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < w; k++)
|
|
|
|
{
|
|
|
|
if (mask[n + k + h * CHUNK_SIZE] == Block::NULLBLK || mask[n + k + h * CHUNK_SIZE] != mask[n])
|
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (done)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mask[n] != Block::AIR)
|
|
|
|
{
|
|
|
|
x[u] = i;
|
|
|
|
x[v] = j;
|
|
|
|
|
|
|
|
du[0] = 0;
|
|
|
|
du[1] = 0;
|
|
|
|
du[2] = 0;
|
|
|
|
du[u] = w;
|
|
|
|
|
|
|
|
dv[0] = 0;
|
|
|
|
dv[1] = 0;
|
|
|
|
dv[2] = 0;
|
|
|
|
dv[v] = h;
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
quad(mesh_data, glm::vec3(x[0], x[1], x[2]),
|
2022-11-10 19:47:39 +01:00
|
|
|
glm::vec3(x[0] + du[0], x[1] + du[1], x[2] + du[2]),
|
|
|
|
glm::vec3(x[0] + du[0] + dv[0], x[1] + du[1] + dv[1],
|
|
|
|
x[2] + du[2] + dv[2]),
|
|
|
|
glm::vec3(x[0] + dv[0], x[1] + dv[1], x[2] + dv[2]),
|
2023-03-26 19:57:39 +02:00
|
|
|
glm::vec3(backFace ? q[0] : -q[0], backFace ? q[1] : -q[1], backFace ? q[2] : -q[2] ),
|
2023-04-10 00:21:49 +02:00
|
|
|
mask[n], dim, backFace);
|
2022-11-10 19:47:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (l = 0; l < h; ++l)
|
|
|
|
{
|
|
|
|
for (k = 0; k < w; ++k)
|
|
|
|
{
|
|
|
|
mask[n + k + l * CHUNK_SIZE] = Block::NULLBLK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* And then finally increment the counters and
|
|
|
|
* continue
|
|
|
|
*/
|
|
|
|
i += w;
|
|
|
|
n += w;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-29 14:54:43 +02:00
|
|
|
|
|
|
|
chunk->setState(Chunk::CHUNK_STATE_MESHED, true);
|
2023-05-20 21:19:44 +02:00
|
|
|
renderer::getMeshDataQueue().push(mesh_data);
|
|
|
|
return;
|
2022-11-10 19:47:39 +01:00
|
|
|
}
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
void sendtogpu(MeshData* mesh_data)
|
2023-03-23 16:19:25 +01:00
|
|
|
{
|
2023-05-26 23:05:29 +02:00
|
|
|
if (mesh_data->numVertices > 0)
|
2023-03-23 16:19:25 +01:00
|
|
|
{
|
2023-05-20 21:19:44 +02:00
|
|
|
if(mesh_data->chunk->VAO == 0) mesh_data->chunk->createBuffers();
|
|
|
|
|
2023-03-23 16:19:25 +01:00
|
|
|
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
|
2023-05-20 21:19:44 +02:00
|
|
|
glBindVertexArray(mesh_data->chunk->VAO);
|
2023-03-23 16:19:25 +01:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_data->chunk->VBO);
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, mesh_data->vertices.size() * sizeof(GLfloat), &(mesh_data->vertices[0]), GL_STATIC_DRAW);
|
2023-03-23 16:19:25 +01:00
|
|
|
|
2023-03-26 19:57:39 +02:00
|
|
|
// position attribute
|
|
|
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void *)0);
|
|
|
|
glEnableVertexAttribArray(0);
|
|
|
|
|
|
|
|
// normal attribute
|
|
|
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void *)(3*
|
|
|
|
sizeof(float)));
|
|
|
|
glEnableVertexAttribArray(1);
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_data->chunk->EBO);
|
|
|
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, mesh_data->indices.size() * sizeof(GLuint), &(mesh_data->indices[0]), GL_STATIC_DRAW);
|
2023-03-23 16:19:25 +01:00
|
|
|
|
2023-04-10 00:21:49 +02:00
|
|
|
// texcoords attribute
|
2023-05-20 21:19:44 +02:00
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_data->chunk->colorBuffer);
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, mesh_data->colors.size() * sizeof(GLfloat), &(mesh_data->colors[0]), GL_STATIC_DRAW);
|
2023-03-23 16:19:25 +01:00
|
|
|
|
2023-03-26 19:57:39 +02:00
|
|
|
glEnableVertexAttribArray(2);
|
|
|
|
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void *)0);
|
2023-03-23 16:19:25 +01:00
|
|
|
|
|
|
|
glBindVertexArray(0);
|
|
|
|
|
2023-03-23 21:17:06 +01:00
|
|
|
// save the number of indices of the mesh, it is needed later for drawing
|
2023-05-26 23:05:29 +02:00
|
|
|
mesh_data->chunk->numTriangles = (GLuint)(mesh_data->indices.size());
|
2023-03-23 16:19:25 +01:00
|
|
|
|
2023-03-23 21:17:06 +01:00
|
|
|
// once data has been sent to the GPU, it can be cleared from system RAM
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->vertices.clear();
|
|
|
|
mesh_data->indices.clear();
|
|
|
|
mesh_data->colors.clear();
|
2023-03-23 16:19:25 +01:00
|
|
|
}
|
2023-03-23 21:17:06 +01:00
|
|
|
|
|
|
|
// mark the chunk mesh has loaded on GPU
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->chunk->setState(Chunk::CHUNK_STATE_MESH_LOADED, true);
|
2023-03-23 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
void quad(MeshData* mesh_data, glm::vec3 bottomLeft, glm::vec3 topLeft, glm::vec3 topRight,
|
2023-04-10 00:21:49 +02:00
|
|
|
glm::vec3 bottomRight, glm::vec3 normal, Block block, int dim, bool backFace)
|
2022-11-10 19:47:39 +01:00
|
|
|
{
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->vertices.push_back(bottomLeft.x);
|
|
|
|
mesh_data->vertices.push_back(bottomLeft.y);
|
|
|
|
mesh_data->vertices.push_back(bottomLeft.z);
|
|
|
|
mesh_data->vertices.push_back(normal.x);
|
|
|
|
mesh_data->vertices.push_back(normal.y);
|
|
|
|
mesh_data->vertices.push_back(normal.z);
|
|
|
|
|
|
|
|
mesh_data->vertices.push_back(bottomRight.x);
|
|
|
|
mesh_data->vertices.push_back(bottomRight.y);
|
|
|
|
mesh_data->vertices.push_back(bottomRight.z);
|
|
|
|
mesh_data->vertices.push_back(normal.x);
|
|
|
|
mesh_data->vertices.push_back(normal.y);
|
|
|
|
mesh_data->vertices.push_back(normal.z);
|
|
|
|
|
|
|
|
mesh_data->vertices.push_back(topLeft.x);
|
|
|
|
mesh_data->vertices.push_back(topLeft.y);
|
|
|
|
mesh_data->vertices.push_back(topLeft.z);
|
|
|
|
mesh_data->vertices.push_back(normal.x);
|
|
|
|
mesh_data->vertices.push_back(normal.y);
|
|
|
|
mesh_data->vertices.push_back(normal.z);
|
|
|
|
|
|
|
|
mesh_data->vertices.push_back(topRight.x);
|
|
|
|
mesh_data->vertices.push_back(topRight.y);
|
|
|
|
mesh_data->vertices.push_back(topRight.z);
|
|
|
|
mesh_data->vertices.push_back(normal.x);
|
|
|
|
mesh_data->vertices.push_back(normal.y);
|
|
|
|
mesh_data->vertices.push_back(normal.z);
|
2023-03-26 19:57:39 +02:00
|
|
|
|
2023-04-10 00:21:49 +02:00
|
|
|
// texcoords
|
|
|
|
if(dim == 0){
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(bottomRight.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(bottomRight.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topLeft.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(topLeft.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topRight.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(topRight.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
}else if(dim == 1){
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(bottomRight.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(bottomRight.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topLeft.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(topLeft.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topRight.z - bottomLeft.z));
|
|
|
|
mesh_data->colors.push_back(abs(topRight.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
}else{
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(0);
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(bottomRight.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(abs(bottomRight.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topLeft.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(abs(topLeft.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
mesh_data->colors.push_back(abs(topRight.x - bottomLeft.x));
|
|
|
|
mesh_data->colors.push_back(abs(topRight.y - bottomLeft.y));
|
|
|
|
mesh_data->colors.push_back(((int)block) - 2);
|
2023-04-10 00:21:49 +02:00
|
|
|
}
|
2022-11-10 19:47:39 +01:00
|
|
|
|
2022-12-01 23:37:57 +01:00
|
|
|
if (backFace)
|
|
|
|
{
|
2023-05-26 23:05:29 +02:00
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 2);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 1);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 1);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 3);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 2);
|
2022-12-01 23:37:57 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-05-26 23:05:29 +02:00
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 2);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 3);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 1);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 1);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices);
|
|
|
|
mesh_data->indices.push_back(mesh_data->numVertices + 2);
|
2022-12-01 23:37:57 +01:00
|
|
|
}
|
2023-05-26 23:05:29 +02:00
|
|
|
mesh_data->numVertices += 4;
|
2023-03-03 21:33:11 +01:00
|
|
|
}
|
|
|
|
};
|