port: better menu blur

TODO: make it render the blurred texture to the fb once instead of rendering it blurred every frame
This commit is contained in:
fgsfds committed 2023-12-02 19:18:47 +01:00
1 parent aef2463361
commit 2c20a0487e
7 files changed
+50 -17

No files matched your search

+5 -16
View File
@@ -50,6 +50,9 @@
#include "types.h"
#ifndef PLATFORM_N64
#include "video.h"
#define BLUR_OFS 10
#else
#define BLUR_OFS 30
#endif
#if VERSION >= VERSION_PAL_FINAL
@@ -5084,23 +5087,9 @@ Gfx *menuRenderBackgroundLayer1(Gfx *gdl, u8 bg, f32 frac)
// Render the blurred background texture with full alpha
gdl = menugfxRenderBgBlur(gdl, 0xffffff00 | alpha, 0, 0);
#ifdef PLATFORM_N64
// Render it twice more with half alpha and offset
gdl = menugfxRenderBgBlur(gdl, 0xffffff00 | alpha >> 1, -30, -30);
gdl = menugfxRenderBgBlur(gdl, 0xffffff00 | alpha >> 1, 30, 30);
#else
// HACK: we don't actually blur anything on the CPU, so
// render it offset to all cardinal and ordinal directions to achieve crappy box blur
const s32 card[2] = { -30, 30 };
const s32 ord[2] = { -21, 21 }; // 30 / sqrt(2)
const u32 rgba = 0xffffff00 | alpha >> 3;
for (s32 i = 0; i < 2; ++i) {
gdl = menugfxRenderBgBlur(gdl, rgba, 0, card[i]);
gdl = menugfxRenderBgBlur(gdl, rgba, card[i], 0);
gdl = menugfxRenderBgBlur(gdl, rgba, ord[0], ord[i]);
gdl = menugfxRenderBgBlur(gdl, rgba, ord[i], ord[0]);
}
#endif
gdl = menugfxRenderBgBlur(gdl, 0xffffff00 | alpha >> 1, -BLUR_OFS, -BLUR_OFS);
gdl = menugfxRenderBgBlur(gdl, 0xffffff00 | alpha >> 1, BLUR_OFS, BLUR_OFS);
}
break;
case MENUBG_BLACK: