Increase maximum possible point light shadows to 15.

This commit is contained in:
Faerbit 2015-05-31 21:31:31 +02:00
parent 53e8e6d719
commit 4a35c4feba
2 changed files with 29 additions and 9 deletions

View File

@ -27,6 +27,11 @@ uniform samplerCubeShadow shadowMap_cube6;
uniform samplerCubeShadow shadowMap_cube7;
uniform samplerCubeShadow shadowMap_cube8;
uniform samplerCubeShadow shadowMap_cube9;
uniform samplerCubeShadow shadowMap_cube10;
uniform samplerCubeShadow shadowMap_cube11;
uniform samplerCubeShadow shadowMap_cube12;
uniform samplerCubeShadow shadowMap_cube13;
uniform samplerCubeShadow shadowMap_cube14;
uniform vec3 ambientColor;
uniform float ambientFactor;
uniform float diffuseFactor;
@ -314,6 +319,21 @@ void main()
if (i == 9 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube9, lightDirection, intensity);
}
if (i == 10 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube10, lightDirection, intensity);
}
if (i == 11 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube11, lightDirection, intensity);
}
if (i == 12 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube12, lightDirection, intensity);
}
if (i == 13 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube13, lightDirection, intensity);
}
if (i == 14 && i<maxShadowRenderCount) {
pointVisibility = samplePointShadow(shadowMap_cube14, lightDirection, intensity);
}
vec3 lightVector = normalize(lightPos-vec3(fragPosition));
diffuseColor += clamp(dot(normalize(vNormal), lightVector)
*diffuseFactor*intensity*lightColors[i]*pointVisibility, 0.0, 1.0);

View File

@ -144,7 +144,7 @@ void Graphics::init(Level* level) {
// always generate and bind 10 cube maps, because otherwise the shader won't work
depth_cubeMaps = std::vector<ACGL::OpenGL::SharedTextureCubeMap>(10);
depth_cubeMaps = std::vector<ACGL::OpenGL::SharedTextureCubeMap>(15);
for (unsigned int i = 0; i<depth_cubeMaps.size(); i++) {
depth_cubeMaps.at(i) = SharedTextureCubeMap(new TextureCubeMap(glm::vec2(cube_size, cube_size), GL_DEPTH_COMPONENT24));
depth_cubeMaps.at(i)->setMinFilter(GL_NEAREST);
@ -219,8 +219,8 @@ void Graphics::bindTextureUnits(){
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &number_of_texture_units);
printf("Your graphics card supports %d texture units.\n", number_of_texture_units);
// Exit if we need more texture units
if (number_of_texture_units < (int)textureCount + 18) {
printf("You need at least %d texture units to run this application. Exiting\n", textureCount + 18);
if (number_of_texture_units < (int)textureCount + 27) {
printf("You need at least %d texture units to run this application. Exiting\n", textureCount + 27);
exit(-1);
}
for(unsigned int i = 0; i<Material::getAllTextures()->size(); i++) {
@ -237,16 +237,16 @@ void Graphics::bindTextureUnits(){
}
}
flamePostShader->use();
flamePostShader->setTexture("light_fbo", light_fbo_color_texture, textureCount + 17);
flamePostShader->setTexture("light_fbo", light_fbo_color_texture, textureCount + 22);
skydomeShader->use();
skydomeShader->setTexture("dayTexture", level->getSkydome()->getDayTexture(), textureCount + 18);
skydomeShader->setTexture("nightTexture", level->getSkydome()->getNightTexture(), textureCount + 19);
skydomeShader->setTexture("dayTexture", level->getSkydome()->getDayTexture(), textureCount + 23);
skydomeShader->setTexture("nightTexture", level->getSkydome()->getNightTexture(), textureCount + 24);
loadingShader->use();
loadingShader->setTexture("screen", loadingScreen, textureCount + 20);
loadingShader->setTexture("screenContinue", loadingContinueScreen, textureCount + 21);
printf("This application used %d texture units.\n", textureCount + 21);
loadingShader->setTexture("screen", loadingScreen, textureCount + 25);
loadingShader->setTexture("screenContinue", loadingContinueScreen, textureCount + 26);
printf("This application used %d texture units.\n", textureCount + 27);
}
void Graphics::renderLoadingScreen() {