Implemented a function to check how high the maxShadowSampleCount should be.
This commit is contained in:
parent
b8114ebd91
commit
1ef8047f42
@ -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();
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "level.hh"
|
||||
#include "loader.hh"
|
||||
#include <string>
|
||||
#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; i<lights.size(); i++) {
|
||||
int thisSurroundingLights = 0;
|
||||
for(unsigned int j = 0; j<lights.size(); j++) {
|
||||
if (glm::distance(lights.at(i)->getPosition(), 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<glm::mat4>* shadowVPs) {
|
||||
|
@ -87,6 +87,7 @@ class Level {
|
||||
void enqueueObjects(Graphics* graphics);
|
||||
void sortObjects(int textureCount);
|
||||
std::vector<shared_ptr<Light>>* getClosestLights();
|
||||
int checkMaxSurroundingLights();
|
||||
private:
|
||||
std::vector<Chunk*> getSurroundingChunks(glm::vec3 center, int chunkRenderDistance);
|
||||
lua_State* luaState=nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user