only wait for buffers once. fix chunk mesh edges

This commit is contained in:
Tyler Murphy 2022-09-28 11:26:00 -04:00
parent 50bd5c1a7e
commit 1f4dc3aa84
2 changed files with 3 additions and 1 deletions

View file

@ -52,8 +52,8 @@ void Model::deleteModel(Model* model) {
} }
void Model::submitDeleteQueue(bool purge) { void Model::submitDeleteQueue(bool purge) {
vkDeviceWaitIdle(Engine::getInstance()->xeDevice.device());
for(Model* model: DELETION_QUEUE) { for(Model* model: DELETION_QUEUE) {
vkDeviceWaitIdle(model->xeDevice.device());
try { delete model; } catch(int err) {}; try { delete model; } catch(int err) {};
} }
DELETION_QUEUE.clear(); DELETION_QUEUE.clear();

View file

@ -79,8 +79,10 @@ void FirstApp::reloadLoadedChunks(xe::GameObject& viewer) {
if(chunk == nullptr) { if(chunk == nullptr) {
chunk = Chunk::newChunk(newGridX, newGridZ, 12345); chunk = Chunk::newChunk(newGridX, newGridZ, 12345);
Chunk::createMeshAsync(chunk); Chunk::createMeshAsync(chunk);
Chunk::createMeshAsync(Chunk::getChunk(newGridX+1, newGridZ));
Chunk::createMeshAsync(Chunk::getChunk(newGridX-1, newGridZ)); Chunk::createMeshAsync(Chunk::getChunk(newGridX-1, newGridZ));
Chunk::createMeshAsync(Chunk::getChunk(newGridX, newGridZ+1)); Chunk::createMeshAsync(Chunk::getChunk(newGridX, newGridZ+1));
Chunk::createMeshAsync(Chunk::getChunk(newGridX, newGridZ-1));
} }
gameObject.model = chunk->getMesh(); gameObject.model = chunk->getMesh();
gameObject.transform.translation = glm::vec3(newGridX * 16.f, 0, newGridZ * 16.f); gameObject.transform.translation = glm::vec3(newGridX * 16.f, 0, newGridZ * 16.f);