Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Source/Managers/FrameMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,11 @@ void FrameMan::Draw() {
backgroundShader.End();
if (screenCount > 1) {
m_BackBuffer->Begin(false);
// Copy without blending, otherwise anything drawn translucent comes out darker.
rlDisableColorBlend();
DrawTextureRec(m_PlayerScreen->GetColorTexture(), {0, 0, static_cast<float>(m_PlayerScreen8->w), -static_cast<float>(m_PlayerScreen8->h)}, {screenOffset.m_X, screenOffset.m_Y}, {255, 255, 255, 255});
m_BackBuffer->End();
rlEnableColorBlend();
}
g_PostProcessMan.AdjustEffectsPosToPlayerScreen(playerScreen, drawScreen, screenOffset, screenRelativeEffects, screenRelativeGlowBoxes);
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Managers/PostProcessMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ void PostProcessMan::PostProcess() {
rlDisableDepthTest();
DrawTextureRec(g_FrameMan.GetBackBuffer()->GetColorTexture(), {0, 0, g_FrameMan.GetBackBuffer()->GetSize().w, -g_FrameMan.GetBackBuffer()->GetSize().h}, {0.0f, 0.0f}, {255, 255, 255, 255});
//m_Blit8->End();
// Draw the copy while blending is still off, otherwise anything drawn translucent comes out darker.
rlDrawRenderBatchActive();

// Set the screen blender mode for glows
set_screen_blender(128, 128, 128, 128);
Expand Down
10 changes: 9 additions & 1 deletion Source/Managers/PrimitiveMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,15 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
rlEnableShader(rlGetShaderCurrent());
g_FrameMan.SetBlendMode(blendMode);
GLint colorUniform = glGetUniformLocation(rlGetShaderCurrent(), "rteColor");
glUniform4f(colorUniform, blendAmounts[0] / static_cast<float>(MaxBlend), blendAmounts[1] / static_cast<float>(MaxBlend), blendAmounts[2] / static_cast<float>(MaxBlend), blendAmounts[3] / static_cast<float>(MaxBlend));
// Blend amounts go from 0 for the full effect to 100 for invisible. Transparency uses the RGB amounts, averaged since alpha blending can't do each channel separately, and the other modes only use the alpha amount.
int blendAmount = (blendMode == BlendTransparency) ? (blendAmounts[0] + blendAmounts[1] + blendAmounts[2]) / 3 : blendAmounts[3];
float strength = 1.0f - RoundToNearestMultiple(blendAmount, c_BlendAmountStep) / static_cast<float>(MaxBlend);
if (blendMode == BlendTransparency || blendMode == BlendInvert || blendMode == BlendDissolve) {
glUniform4f(colorUniform, 1.0f, 1.0f, 1.0f, strength);
} else {
// The other blend equations take the color premultiplied by its alpha.
glUniform4f(colorUniform, strength, strength, strength, strength);
}
lastBlendMode = blendMode;
lastBlendAmounts = blendAmounts;
}
Expand Down
Loading