diff --git a/game/graphics.cc b/game/graphics.cc index 019f39c..49ecb3e 100644 --- a/game/graphics.cc +++ b/game/graphics.cc @@ -226,6 +226,7 @@ void Graphics::init(Level* level) { #ifdef SAXUM_DEBUG std::cout << "There were " << Material::getAllTextures()->size() << " materials used in this level." << std::endl; + cout << "There are " << level->checkMaxSurroundingLights() << " max surrounding lights." << endl; #endif initShadowRenderQueue(); diff --git a/game/level.cc b/game/level.cc index 3497ce7..a109b2e 100644 --- a/game/level.cc +++ b/game/level.cc @@ -1,7 +1,6 @@ #include "level.hh" #include "loader.hh" #include -#include "graphics.hh" Level::Level(std::string xmlFilePath) { // default value @@ -51,6 +50,22 @@ void Level::load() { this->camera = Camera(glm::vec2(-0.8f, 0.0f), 3.0f); } +int Level::checkMaxSurroundingLights() { + int maxSurroundingLights = 0; + for(unsigned int i = 0; igetPosition(), lights.at(j)->getPosition()) < skydomeSize) { + thisSurroundingLights++; + } + } + if (thisSurroundingLights > maxSurroundingLights) { + maxSurroundingLights = thisSurroundingLights; + } + } + return maxSurroundingLights; +} + void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, glm::vec3 center, int chunkRenderDistance, glm::mat4* viewProjectionMatrix, std::vector* shadowVPs) { diff --git a/game/level.hh b/game/level.hh index 8eab380..42a8c12 100644 --- a/game/level.hh +++ b/game/level.hh @@ -87,6 +87,7 @@ class Level { void enqueueObjects(Graphics* graphics); void sortObjects(int textureCount); std::vector>* getClosestLights(); + int checkMaxSurroundingLights(); private: std::vector getSurroundingChunks(glm::vec3 center, int chunkRenderDistance); lua_State* luaState=nullptr;