History

Use deferred lighting for voxels as well as metavoxels.

Andrzej Kapolka committed 12 years ago

Commit e6f37541 parent c2b58c916 files · +114 −206Browse files

Showing the changes to interface/src/renderer/DeferredLightingEffect.cpp (1 of 16 files). Show all

Unified · Split

interface/src/renderer/DeferredLightingEffect.cpp+9−0
@@ -26,6 +26,13 @@ void DeferredLightingEffect::init() { · 25 unmodified lines
2626 _directionalLightCascadedShadowMapLocations);
2727 }
2828
29+void DeferredLightingEffect::prepare() {
30+ // clear the normal buffer
31+ Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, true);
32+ glClear(GL_COLOR_BUFFER_BIT);
33+ Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
34+}
35+
2936 void DeferredLightingEffect::render() {
3037 // perform deferred lighting, rendering to free fbo
3138 glPushMatrix();
@@ -38,6 +45,7 @@ void DeferredLightingEffect::render() { · 6 unmodified lines
3845 glDisable(GL_BLEND);
3946 glDisable(GL_LIGHTING);
4047 glDisable(GL_DEPTH_TEST);
48+ glDisable(GL_COLOR_MATERIAL);
4149 glDepthMask(false);
4250
4351 QOpenGLFramebufferObject* primaryFBO = Application::getInstance()->getTextureCache()->getPrimaryFramebufferObject();
@@ -133,6 +141,7 @@ void DeferredLightingEffect::render() { · 89 unmodified lines
133141 glDisable(GL_TEXTURE_2D);
134142
135143 glEnable(GL_LIGHTING);
144+ glEnable(GL_COLOR_MATERIAL);
136145 glEnable(GL_DEPTH_TEST);
137146 glDepthMask(true);
138147