Skip to content

Commit 7bee365

Browse files
committed
dissolve support
1 parent 898d173 commit 7bee365

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Source/Managers/FrameMan.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,16 @@ void FrameMan::SetBlendMode(DrawBlendMode blendMode) {
406406
glUniform1i(invertLoc, 1);
407407
break;
408408
}
409+
case BlendDissolve: {
410+
rlSetBlendMode(RL_BLEND_ALPHA);
411+
std::cout << "Dissolve pre " << rlGetShaderCurrent();
412+
const Shader* dissolve = dynamic_cast<const Shader*>(g_PresetMan.GetEntityPreset("Shader", "Dissolve"));
413+
dissolve->Begin();
414+
std::cout << " " << rlGetShaderCurrent() << std::endl;
415+
GLint paletteLoc = dissolve->GetUniformLocation("rtePalette");
416+
rlSetUniformSampler(paletteLoc, g_PostProcessMan.GetPaletteTexture());
417+
break;
418+
}
409419
default: {
410420
rlSetBlendMode(RL_BLEND_ALPHA);
411421
RTEAssert(blendMode < BlendModeCount, "Unkown blend mode selected!");

Source/Managers/PrimitiveMan.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <array>
1212
#include "Draw.h"
1313
#include "glad/gl.h"
14+
#include "Shader.h"
15+
#include "PresetMan.h"
1416

1517
using namespace RTE;
1618

@@ -239,17 +241,20 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
239241
glBlendBarrierKHR();
240242
rlEnableAdvancedColorBlend();
241243
}
244+
const Shader* background = dynamic_cast<const Shader*>(g_PresetMan.GetEntityPreset("Shader", "Background"));
242245
rlEnableColorBlend();
243246
for (const std::unique_ptr<GraphicalPrimitive>& primitive: m_ScheduledPrimitives) {
244247
if (int playerToDrawFor = primitive->m_Player; playerToDrawFor == player || playerToDrawFor == -1) {
245248
rlDrawRenderBatchActive();
246249
if (DrawBlendMode blendMode = primitive->m_BlendMode; blendMode > DrawBlendMode::NoBlend) {
247250
if (const std::array<int, 4>& blendAmounts = primitive->m_ColorChannelBlendAmounts; blendMode != lastBlendMode || blendAmounts != lastBlendAmounts) {
251+
if (lastBlendMode == BlendDissolve) {
252+
background->Begin();
253+
}
248254
rlEnableShader(rlGetShaderCurrent());
249255
g_FrameMan.SetBlendMode(blendMode);
250256
GLint colorUniform = glGetUniformLocation(rlGetShaderCurrent(), "rteColor");
251257
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));
252-
//g_FrameMan.SetColorTable(blendMode, blendAmounts);
253258
lastBlendMode = blendMode;
254259
lastBlendAmounts = blendAmounts;
255260
}
@@ -272,7 +277,7 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
272277
rlDisableAdvancedColorBlend();
273278
}
274279
rlSetBlendMode(RL_BLEND_ALPHA);
275-
rlEnableShader(currentShader);
280+
background->Begin();
276281
GLint colorUniform = glGetUniformLocation(rlGetShaderCurrent(), "rteColor");
277282
glUniform4f(colorUniform, 1.0f, 1.0f, 1.0f, 1.0f);
278283
rlZDepth(c_DefaultDrawDepth);

0 commit comments

Comments
 (0)