History

Lighten the shadows, remove some debug code.

Andrzej Kapolka committed 12 years ago

Commit f0e58721 parent cb641034 files · +28 −31Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+10−0
@@ -519,6 +519,13 @@ void VoxelSystem::initVoxelMemory() { · 518 unmodified lines
519 _perlinModulateProgram.bind();519 _perlinModulateProgram.bind();
520 _perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);520 _perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
521 _perlinModulateProgram.release();521 _perlinModulateProgram.release();
522
523 _shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/shadow_map.frag");
524 _shadowMapProgram.link();
525
526 _shadowMapProgram.bind();
527 _shadowMapProgram.setUniformValue("shadowMap", 0);
528 _shadowMapProgram.release();
522 }529 }
523 }530 }
524 531
@@ -1080,6 +1087,7 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 555 unmodified lines
1080}1087}
1081 1088
1082ProgramObject VoxelSystem::_perlinModulateProgram;1089ProgramObject VoxelSystem::_perlinModulateProgram;
1090ProgramObject VoxelSystem::_shadowMapProgram;
1083 1091
1084void VoxelSystem::init() {1092void VoxelSystem::init() {
1085 if (_initialized) {1093 if (_initialized) {
@@ -1388,6 +1396,7 @@ void VoxelSystem::render(bool texture) { · 302 unmodified lines
1388void VoxelSystem::applyScaleAndBindProgram(bool texture) {1396void VoxelSystem::applyScaleAndBindProgram(bool texture) {
1389 1397
1390 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {1398 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {
1399 _shadowMapProgram.bind();
1391 glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());1400 glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());
1392 glEnable(GL_TEXTURE_GEN_S);1401 glEnable(GL_TEXTURE_GEN_S);
1393 glEnable(GL_TEXTURE_GEN_T);1402 glEnable(GL_TEXTURE_GEN_T);
@@ -1412,6 +1421,7 @@ void VoxelSystem::removeScaleAndReleaseProgram(bool texture) { · 18 unmodified lines
1412 glPopMatrix();1421 glPopMatrix();
1413 1422
1414 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {1423 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {
1424 _shadowMapProgram.release();
1415 glBindTexture(GL_TEXTURE_2D, 0);1425 glBindTexture(GL_TEXTURE_2D, 0);
1416 glDisable(GL_TEXTURE_GEN_S);1426 glDisable(GL_TEXTURE_GEN_S);
1417 glDisable(GL_TEXTURE_GEN_T);1427 glDisable(GL_TEXTURE_GEN_T);