mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:17:14 +02:00
This should fix the erroneous persistence on startup.
This commit is contained in:
parent
85f7995700
commit
c36e04c435
2 changed files with 8 additions and 3 deletions
|
@ -19,6 +19,7 @@ GlowEffect::GlowEffect()
|
||||||
: _initialized(false),
|
: _initialized(false),
|
||||||
_renderMode(DIFFUSE_ADD_MODE),
|
_renderMode(DIFFUSE_ADD_MODE),
|
||||||
_isOddFrame(false),
|
_isOddFrame(false),
|
||||||
|
_isFirstFrame(true),
|
||||||
_intensity(0.0f) {
|
_intensity(0.0f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
||||||
newDiffusedFBO->bind();
|
newDiffusedFBO->bind();
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, oldDiffusedFBO->texture());
|
glBindTexture(GL_TEXTURE_2D, _isFirstFrame ? 0 : oldDiffusedFBO->texture());
|
||||||
|
|
||||||
_diffuseProgram->bind();
|
_diffuseProgram->bind();
|
||||||
QSize size = Application::getInstance()->getGLWidget()->size();
|
QSize size = Application::getInstance()->getGLWidget()->size();
|
||||||
|
@ -221,7 +222,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
||||||
maybeRelease(destFBO);
|
maybeRelease(destFBO);
|
||||||
|
|
||||||
} else { // _renderMode == BLUR_PERSIST_ADD_MODE
|
} else { // _renderMode == BLUR_PERSIST_ADD_MODE
|
||||||
// render the secondary to the tertiary with horizontal blur and persistence
|
// render the secondary to the tertiary with vertical blur and persistence
|
||||||
QOpenGLFramebufferObject* tertiaryFBO =
|
QOpenGLFramebufferObject* tertiaryFBO =
|
||||||
Application::getInstance()->getTextureCache()->getTertiaryFramebufferObject();
|
Application::getInstance()->getTextureCache()->getTertiaryFramebufferObject();
|
||||||
tertiaryFBO->bind();
|
tertiaryFBO->bind();
|
||||||
|
@ -229,7 +230,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE_MINUS_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);
|
glBlendFunc(GL_ONE_MINUS_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);
|
||||||
const float PERSISTENCE_SMOOTHING = 0.9f;
|
const float PERSISTENCE_SMOOTHING = 0.9f;
|
||||||
glBlendColor(0.0f, 0.0f, 0.0f, PERSISTENCE_SMOOTHING);
|
glBlendColor(0.0f, 0.0f, 0.0f, _isFirstFrame ? 0.0f : PERSISTENCE_SMOOTHING);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, secondaryFBO->texture());
|
glBindTexture(GL_TEXTURE_2D, secondaryFBO->texture());
|
||||||
|
|
||||||
|
@ -270,6 +271,8 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
_isFirstFrame = false;
|
||||||
|
|
||||||
return destFBO;
|
return destFBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,6 +295,7 @@ void GlowEffect::cycleRenderMode() {
|
||||||
qDebug() << "Glow mode: Diffuse/add\n";
|
qDebug() << "Glow mode: Diffuse/add\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
_isFirstFrame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glower::Glower(float amount) {
|
Glower::Glower(float amount) {
|
||||||
|
|
|
@ -66,6 +66,7 @@ private:
|
||||||
|
|
||||||
bool _isEmpty; ///< set when nothing in the scene is currently glowing
|
bool _isEmpty; ///< set when nothing in the scene is currently glowing
|
||||||
bool _isOddFrame; ///< controls the alternation between texture targets in diffuse add mode
|
bool _isOddFrame; ///< controls the alternation between texture targets in diffuse add mode
|
||||||
|
bool _isFirstFrame; ///< for persistent modes, notes whether this is the first frame rendered
|
||||||
|
|
||||||
float _intensity;
|
float _intensity;
|
||||||
QStack<float> _intensityStack;
|
QStack<float> _intensityStack;
|
||||||
|
|
Loading…
Reference in a new issue