mirror of
https://github.com/overte-org/overte.git
synced 2025-07-16 13:36:48 +02:00
Fix for deferred lighting on voxels.
This commit is contained in:
parent
76728e4fb1
commit
f954e4d7ea
3 changed files with 7 additions and 3 deletions
|
@ -22,5 +22,5 @@ void main(void) {
|
||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
|
|
||||||
// store the color directly
|
// store the color directly
|
||||||
gl_FrontColor = gl_Color;
|
gl_FrontColor = vec4(gl_Color.rgb, 0.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ void DeferredLightingEffect::render() {
|
||||||
const int VIEWPORT_WIDTH_INDEX = 2;
|
const int VIEWPORT_WIDTH_INDEX = 2;
|
||||||
float sMin = viewport[VIEWPORT_X_INDEX] / (float)primaryFBO->width();
|
float sMin = viewport[VIEWPORT_X_INDEX] / (float)primaryFBO->width();
|
||||||
float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)primaryFBO->width();
|
float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)primaryFBO->width();
|
||||||
|
|
||||||
if (Menu::getInstance()->getShadowsEnabled()) {
|
if (Menu::getInstance()->getShadowsEnabled()) {
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPrimaryDepthTextureID());
|
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPrimaryDepthTextureID());
|
||||||
|
|
|
@ -1392,8 +1392,11 @@ void VoxelSystem::render() {
|
||||||
|
|
||||||
applyScaleAndBindProgram(texture);
|
applyScaleAndBindProgram(texture);
|
||||||
|
|
||||||
// for performance, enable backface culling
|
// for performance, enable backface culling and disable blending
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw voxels in 6 passes
|
// draw voxels in 6 passes
|
||||||
|
@ -1435,6 +1438,7 @@ void VoxelSystem::render() {
|
||||||
PerformanceWarning warn(showWarnings, "render().. cleanup after glDrawRangeElementsEXT()...");
|
PerformanceWarning warn(showWarnings, "render().. cleanup after glDrawRangeElementsEXT()...");
|
||||||
|
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
removeScaleAndReleaseProgram(texture);
|
removeScaleAndReleaseProgram(texture);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue