Minor cleanup before moving on

main
Brett 2023-02-14 21:58:23 -05:00
parent c111d5c1b7
commit 8be1958fb6
2 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ int main() {
chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag); chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag);
world = new fp::world(); world = new fp::world();
world->setBlock({0,0,0}, 1); //world->setBlock({0,0,0}, 1);
for (int i = 1; i < CHUNK_SIZE; i++) for (int i = 1; i < CHUNK_SIZE; i++)
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)

View File

@ -111,8 +111,9 @@ void fp::world::render(fp::shader& shader) {
auto& indices = chunk->mesh->getIndices(); auto& indices = chunk->mesh->getIndices();
// 11436 vert, 137,232 bytes // 11436 vert, 137,232 bytes
// 1908 vert, 11436 indices, 22896 + 45744 = 68,640 bytes
BLT_INFO("Chunk [%d, %d, %d] mesh updated with %d vertices and %d indices taking (%d, %d) bytes!", BLT_DEBUG("Chunk [%d, %d, %d] mesh updated with %d vertices and %d indices taking (%d, %d) bytes!",
chunk->pos.x, chunk->pos.y, chunk->pos.z, chunk->pos.x, chunk->pos.y, chunk->pos.z,
vertices.size(), indices.size(), vertices.size() * sizeof(vertex), indices.size() * sizeof(unsigned int)); vertices.size(), indices.size(), vertices.size() * sizeof(vertex), indices.size() * sizeof(unsigned int));
@ -133,7 +134,6 @@ void fp::world::render(fp::shader& shader) {
shader.setMatrix("translation", translation); shader.setMatrix("translation", translation);
chunk->chunk_vao->bind(); chunk->chunk_vao->bind();
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
//glDrawArrays(GL_TRIANGLES, 0, (int) chunk->render_size);
glDrawElements(GL_TRIANGLES, (int)chunk->render_size, GL_UNSIGNED_INT, nullptr); glDrawElements(GL_TRIANGLES, (int)chunk->render_size, GL_UNSIGNED_INT, nullptr);
glDisableVertexAttribArray(0); glDisableVertexAttribArray(0);
} }