Fixed issue where objects with bloom disabled would screw up bloom rendering
This commit is contained in:
parent
4ef940b1f3
commit
ae0b6f97df
|
@ -67,20 +67,29 @@ bool CMaterial::SetCurrent(ERenderOptions Options)
|
||||||
if (mShaderStatus == eShaderFailed)
|
if (mShaderStatus == eShaderFailed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set blend equation - force to ZERO/ONE if alpha is disabled
|
// Set RGB blend equation - force to ZERO/ONE if alpha is disabled
|
||||||
if (Options & eNoAlpha)
|
GLenum srcRGB, dstRGB, srcAlpha, dstAlpha;
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
|
||||||
else
|
|
||||||
glBlendFunc(mBlendSrcFac, mBlendDstFac);
|
|
||||||
|
|
||||||
// Set color mask. This is for rendering bloom - bloom maps render to the framebuffer alpha
|
if (Options & eNoAlpha) {
|
||||||
// We can only render bloom on materials that aren't alpha blended.
|
srcRGB = GL_ONE;
|
||||||
|
dstRGB = GL_ZERO;
|
||||||
|
} else {
|
||||||
|
srcRGB = mBlendSrcFac;
|
||||||
|
dstRGB = mBlendDstFac;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set alpha blend equation
|
||||||
bool AlphaBlended = ((mBlendSrcFac == GL_SRC_ALPHA) && (mBlendDstFac == GL_ONE_MINUS_SRC_ALPHA));
|
bool AlphaBlended = ((mBlendSrcFac == GL_SRC_ALPHA) && (mBlendDstFac == GL_ONE_MINUS_SRC_ALPHA));
|
||||||
|
|
||||||
if ((mEnableBloom) && (Options & eEnableBloom) && (!AlphaBlended))
|
if ((mEnableBloom) && (Options & eEnableBloom) && (!AlphaBlended)) {
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
srcAlpha = mBlendSrcFac;
|
||||||
else
|
dstAlpha = mBlendDstFac;
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
} else {
|
||||||
|
srcAlpha = GL_ZERO;
|
||||||
|
dstAlpha = GL_ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||||
|
|
||||||
// Set konst inputs
|
// Set konst inputs
|
||||||
for (u32 iKonst = 0; iKonst < 4; iKonst++)
|
for (u32 iKonst = 0; iKonst < 4; iKonst++)
|
||||||
|
|
|
@ -117,7 +117,7 @@ void CScriptNode::Draw(ERenderOptions Options)
|
||||||
|
|
||||||
if (!mpActiveModel)
|
if (!mpActiveModel)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ZERO);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
|
|
Loading…
Reference in New Issue