Browse Source

optimizations

testing
Michael Porter 5 years ago
parent
commit
6214a6708a
  1. 1
      CMakeLists.txt
  2. 8
      src/graphics/chunkmesh.cpp

1
CMakeLists.txt

@ -3,6 +3,7 @@ project ("voxeltronik") @@ -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})

8
src/graphics/chunkmesh.cpp

@ -217,9 +217,11 @@ void ChunkMesh::rebuildChunkLighting() { @@ -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