Browse Source

optimizations

testing
Michael Porter 2 years ago
parent
commit
6214a6708a
2 changed files with 6 additions and 3 deletions
  1. 1
    0
      CMakeLists.txt
  2. 5
    3
      src/graphics/chunkmesh.cpp

+ 1
- 0
CMakeLists.txt View File

@@ -3,6 +3,7 @@ project ("voxeltronik")
file (GLOB_RECURSE SOURCES "src/*.cpp" "src/*.c")
include_directories("./include")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
add_executable(vtk ${SOURCES})


+ 5
- 3
src/graphics/chunkmesh.cpp View File

@@ -217,9 +217,11 @@ void ChunkMesh::rebuildChunkLighting() {
}

void ChunkMesh::draw() {
updateGeometry();
glBindVertexArray(mVAO);
glDrawArrays(GL_TRIANGLES, 0, mGeometryFaceCount * 6);
if (mFaceCount > 0) {
updateGeometry();
glBindVertexArray(mVAO);
glDrawArrays(GL_TRIANGLES, 0, mGeometryFaceCount * 6);
}
}

bool ChunkMesh::updateGeometry() {

Loading…
Cancel
Save