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
519519 _perlinModulateProgram.bind();
520520 _perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
521521 _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();
522529 }
523530 }
524531
@@ -1080,6 +1087,7 @@ glm::vec3 VoxelSystem::computeVoxelVertex(const glm::vec3& startVertex, float vo · 555 unmodified lines
10801087 }
10811088
10821089 ProgramObject VoxelSystem::_perlinModulateProgram;
1090+ProgramObject VoxelSystem::_shadowMapProgram;
10831091
10841092 void VoxelSystem::init() {
10851093 if (_initialized) {
@@ -1388,6 +1396,7 @@ void VoxelSystem::render(bool texture) { · 302 unmodified lines
13881396 void VoxelSystem::applyScaleAndBindProgram(bool texture) {
13891397
13901398 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {
1399+ _shadowMapProgram.bind();
13911400 glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());
13921401 glEnable(GL_TEXTURE_GEN_S);
13931402 glEnable(GL_TEXTURE_GEN_T);
@@ -1412,6 +1421,7 @@ void VoxelSystem::removeScaleAndReleaseProgram(bool texture) { · 18 unmodified lines
14121421 glPopMatrix();
14131422
14141423 if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows)) {
1424+ _shadowMapProgram.release();
14151425 glBindTexture(GL_TEXTURE_2D, 0);
14161426 glDisable(GL_TEXTURE_GEN_S);
14171427 glDisable(GL_TEXTURE_GEN_T);