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
|
#ifdef SAXUM_DEBUG
|
||||||
std::cout << "There were " << Material::getAllTextures()->size()
|
std::cout << "There were " << Material::getAllTextures()->size()
|
||||||
<< " materials used in this level." << std::endl;
|
<< " materials used in this level." << std::endl;
|
||||||
|
cout << "There are " << level->checkMaxSurroundingLights() << " max surrounding lights." << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initShadowRenderQueue();
|
initShadowRenderQueue();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "level.hh"
|
#include "level.hh"
|
||||||
#include "loader.hh"
|
#include "loader.hh"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "graphics.hh"
|
|
||||||
|
|
||||||
Level::Level(std::string xmlFilePath) {
|
Level::Level(std::string xmlFilePath) {
|
||||||
// default value
|
// default value
|
||||||
@ -51,6 +50,22 @@ void Level::load() {
|
|||||||
this->camera = Camera(glm::vec2(-0.8f, 0.0f), 3.0f);
|
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,
|
void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||||
glm::vec3 center, int chunkRenderDistance, glm::mat4* viewProjectionMatrix,
|
glm::vec3 center, int chunkRenderDistance, glm::mat4* viewProjectionMatrix,
|
||||||
std::vector<glm::mat4>* shadowVPs) {
|
std::vector<glm::mat4>* shadowVPs) {
|
||||||
|
@ -87,6 +87,7 @@ class Level {
|
|||||||
void enqueueObjects(Graphics* graphics);
|
void enqueueObjects(Graphics* graphics);
|
||||||
void sortObjects(int textureCount);
|
void sortObjects(int textureCount);
|
||||||
std::vector<shared_ptr<Light>>* getClosestLights();
|
std::vector<shared_ptr<Light>>* getClosestLights();
|
||||||
|
int checkMaxSurroundingLights();
|
||||||
private:
|
private:
|
||||||
std::vector<Chunk*> getSurroundingChunks(glm::vec3 center, int chunkRenderDistance);
|
std::vector<Chunk*> getSurroundingChunks(glm::vec3 center, int chunkRenderDistance);
|
||||||
lua_State* luaState=nullptr;
|
lua_State* luaState=nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user