More lights
This commit is contained in:
parent
f6bddc111b
commit
fa41614783
2
dependencies/kekengine
vendored
2
dependencies/kekengine
vendored
@ -1 +1 @@
|
||||
Subproject commit 2ff8debe8c607c90a9fa7df29577a24967b00cf9
|
||||
Subproject commit 656603f4396872afd07565a02f5d73bb66885ec2
|
@ -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<GameObject *> walls;
|
||||
std::vector<PointLight *> lights;
|
||||
};
|
||||
|
||||
std::map<long int, Chunk> 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<PointLight *> 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user