11
11
#include < array>
12
12
#include " Draw.h"
13
13
#include " glad/gl.h"
14
+ #include " Shader.h"
15
+ #include " PresetMan.h"
14
16
15
17
using namespace RTE ;
16
18
@@ -239,17 +241,20 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
239
241
glBlendBarrierKHR ();
240
242
rlEnableAdvancedColorBlend ();
241
243
}
244
+ const Shader* background = dynamic_cast <const Shader*>(g_PresetMan.GetEntityPreset (" Shader" , " Background" ));
242
245
rlEnableColorBlend ();
243
246
for (const std::unique_ptr<GraphicalPrimitive>& primitive: m_ScheduledPrimitives) {
244
247
if (int playerToDrawFor = primitive->m_Player ; playerToDrawFor == player || playerToDrawFor == -1 ) {
245
248
rlDrawRenderBatchActive ();
246
249
if (DrawBlendMode blendMode = primitive->m_BlendMode ; blendMode > DrawBlendMode::NoBlend) {
247
250
if (const std::array<int , 4 >& blendAmounts = primitive->m_ColorChannelBlendAmounts ; blendMode != lastBlendMode || blendAmounts != lastBlendAmounts) {
251
+ if (lastBlendMode == BlendDissolve) {
252
+ background->Begin ();
253
+ }
248
254
rlEnableShader (rlGetShaderCurrent ());
249
255
g_FrameMan.SetBlendMode (blendMode);
250
256
GLint colorUniform = glGetUniformLocation (rlGetShaderCurrent (), " rteColor" );
251
257
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);
253
258
lastBlendMode = blendMode;
254
259
lastBlendAmounts = blendAmounts;
255
260
}
@@ -272,7 +277,7 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
272
277
rlDisableAdvancedColorBlend ();
273
278
}
274
279
rlSetBlendMode (RL_BLEND_ALPHA);
275
- rlEnableShader (currentShader );
280
+ background-> Begin ( );
276
281
GLint colorUniform = glGetUniformLocation (rlGetShaderCurrent (), " rteColor" );
277
282
glUniform4f (colorUniform, 1 .0f , 1 .0f , 1 .0f , 1 .0f );
278
283
rlZDepth (c_DefaultDrawDepth);
0 commit comments