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
26 _directionalLightCascadedShadowMapLocations);26 _directionalLightCascadedShadowMapLocations);
27}27}
28 28
29void 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
29void DeferredLightingEffect::render() {36void DeferredLightingEffect::render() {
30 // perform deferred lighting, rendering to free fbo37 // perform deferred lighting, rendering to free fbo
31 glPushMatrix();38 glPushMatrix();
@@ -38,6 +45,7 @@ void DeferredLightingEffect::render() { · 6 unmodified lines
38 glDisable(GL_BLEND);45 glDisable(GL_BLEND);
39 glDisable(GL_LIGHTING);46 glDisable(GL_LIGHTING);
40 glDisable(GL_DEPTH_TEST);47 glDisable(GL_DEPTH_TEST);
48 glDisable(GL_COLOR_MATERIAL);
41 glDepthMask(false);49 glDepthMask(false);
42 50
43 QOpenGLFramebufferObject* primaryFBO = Application::getInstance()->getTextureCache()->getPrimaryFramebufferObject();51 QOpenGLFramebufferObject* primaryFBO = Application::getInstance()->getTextureCache()->getPrimaryFramebufferObject();
@@ -133,6 +141,7 @@ void DeferredLightingEffect::render() { · 89 unmodified lines
133 glDisable(GL_TEXTURE_2D);141 glDisable(GL_TEXTURE_2D);
134 142
135 glEnable(GL_LIGHTING);143 glEnable(GL_LIGHTING);
144 glEnable(GL_COLOR_MATERIAL);
136 glEnable(GL_DEPTH_TEST);145 glEnable(GL_DEPTH_TEST);
137 glDepthMask(true);146 glDepthMask(true);
138 147