diff --git a/dependencies/kekengine b/dependencies/kekengine index 2ff8deb..656603f 160000 --- a/dependencies/kekengine +++ b/dependencies/kekengine @@ -1 +1 @@ -Subproject commit 2ff8debe8c607c90a9fa7df29577a24967b00cf9 +Subproject commit 656603f4396872afd07565a02f5d73bb66885ec2 diff --git a/src/kekrooms/cpp/kekrooms.cpp b/src/kekrooms/cpp/kekrooms.cpp index 88ebfa8..f932cb8 100644 --- a/src/kekrooms/cpp/kekrooms.cpp +++ b/src/kekrooms/cpp/kekrooms.cpp @@ -32,6 +32,7 @@ using namespace kek; #define CHUNK_RADIUS 2 #define WALLS_PER_CHUNK 20 #define WALL_HEIGHT 9 +#define LIGHT_SPACING 8 static ButtonElement *buttonPlay; @@ -42,6 +43,7 @@ struct Chunk { GameObject *floor; GameObject *ceiling; std::vector walls; + std::vector lights; }; std::map loadedChunks; @@ -56,10 +58,9 @@ void gameLoop(GLFWwindow *window, void *) { glm::vec3 playerPos = player->getPosition(); Scene *scene = Engine::getActiveScene(); - SpotLight *fl = (SpotLight *) flashlight; glm::vec3 playerRight = glm::cross(camera->direction, glm::vec3(0, 1, 0)); - fl->moveTo(playerPos + glm::normalize(playerRight) * 0.3f); - fl->lookAt(camera->direction); + flashlight->moveTo(playerPos + glm::normalize(playerRight) * 0.3f); + flashlight->lookAt(camera->direction); int chunkX = (int) playerPos.x / CHUNK_SIZE; int chunkZ = (int) playerPos.z / CHUNK_SIZE; @@ -118,7 +119,18 @@ void gameLoop(GLFWwindow *window, void *) { walls.push_back(wall); } - Chunk newChunk{x, z, floor, ceiling, walls}; + std::vector lights; + // for(int lx = 0; lx < CHUNK_SIZE / LIGHT_SPACING; lx++) { + // for(int ly = 0; ly < CHUNK_SIZE / LIGHT_SPACING; ly++) { + // SpotLight *light = new SpotLight(glm::vec3(1), glm::vec3(0, -1, 0), 1, 1, 1, 0.5, 0.6); + PointLight *light = new PointLight(glm::vec3(1), 1, 1, 1); + light->moveTo(glm::vec3(x * CHUNK_SIZE, WALL_HEIGHT - 1, z * CHUNK_SIZE)); + scene->lights->add(light); + lights.push_back(light); + // } + //} + + Chunk newChunk{x, z, floor, ceiling, walls, lights}; loadedChunks.emplace(chunkID, newChunk); } }