summaryrefslogtreecommitdiff
path: root/src/first_app.cpp
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2022-09-27 13:35:49 -0400
committerTyler Murphy <tylermurphy534@gmail.com>2022-09-27 13:35:49 -0400
commit965ff9cc09401ae61c15aca0232d59fac17bfce3 (patch)
tree9fb7619560e528cbf83edfed57b6b7695e8b9a94 /src/first_app.cpp
parentchange shader lighting (diff)
downloadminecraftvulkan-965ff9cc09401ae61c15aca0232d59fac17bfce3.tar.gz
minecraftvulkan-965ff9cc09401ae61c15aca0232d59fac17bfce3.tar.bz2
minecraftvulkan-965ff9cc09401ae61c15aca0232d59fac17bfce3.zip
async chunk meshing
Diffstat (limited to 'src/first_app.cpp')
-rwxr-xr-xsrc/first_app.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/first_app.cpp b/src/first_app.cpp
index 968f7f8..08f6f0c 100755
--- a/src/first_app.cpp
+++ b/src/first_app.cpp
@@ -11,7 +11,15 @@ void FirstApp::run() {
Chunk::load();
- loadGameObjects();
+ for(int32_t x = 0; x < 10; x++) {
+ for(int32_t z = 0; z < 10; z++) {
+ Chunk* chunk = Chunk::newChunk(x, z, 53463);
+ Chunk::createMeshAsync(chunk);
+ auto chunkObject = xe::GameObject::createGameObject();
+ chunkObject.transform.translation = {16.f*x, 0.f, 16.f*z};
+ gameObjects.push_back(std::move(chunkObject));
+ }
+ }
SimpleRenderer renderer{xeEngine, Chunk::getTextures()};
@@ -44,26 +52,4 @@ void FirstApp::run() {
}
-void FirstApp::loadGameObjects() {
-
- for(int32_t x = 0; x < 10; x++) {
- for(int32_t z = 0; z < 10; z++) {
- Chunk* chunk = Chunk::newChunk(x, z, 53463);
- }
- }
-
- for(int32_t x = 0; x < 10; x++) {
- for(int32_t z = 0; z < 10; z++) {
- Chunk* chunk = Chunk::getChunk(x,z);
- chunk->createMesh();
-
- auto chunkObject = xe::GameObject::createGameObject();
- chunkObject.model = chunk->getMesh();
- chunkObject.transform.translation = {16.f*x, 0.f, 16.f*z};
- gameObjects.push_back(std::move(chunkObject));
- }
- }
-
-}
-
} \ No newline at end of file