Files

48 lines
1.8 KiB
C++
Raw Permalink Normal View History

2024-04-29 18:52:20 -05:00
#include <libultraship/bridge.h>
#include "2s2h/BenGui/UIWidgets.hpp"
extern "C" {
#include "z64.h"
}
const char* motionBlurOptions[] = { "Dynamic (default)", "Always Off", "Always On" };
void MotionBlur_RenderMenuOptions() {
ImGui::SeparatorText("Motion Blur");
2024-05-22 09:52:56 -04:00
UIWidgets::CVarCombobox("Motion Blur Mode", "gEnhancements.Graphics.MotionBlur.Mode", motionBlurOptions,
{
.labelPosition = UIWidgets::LabelPosition::None,
});
UIWidgets::CVarCheckbox(
"Interpolate", "gEnhancements.Graphics.MotionBlur.Interpolate",
2024-05-22 09:52:56 -04:00
{ .tooltip =
"Change motion blur capture to also happen on interpolated frames instead of only on game frames.\n"
"This notably reduces the overall motion blur strength but smooths out the trails." });
2024-04-29 18:52:20 -05:00
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 0) {
UIWidgets::Checkbox("On/Off", (bool*)&R_MOTION_BLUR_ENABLED);
if (R_MOTION_BLUR_ENABLED) {
int32_t motionBlurStrength = R_MOTION_BLUR_ALPHA;
if (UIWidgets::SliderInt("Strength", &motionBlurStrength, 0, 255)) {
R_MOTION_BLUR_ALPHA = motionBlurStrength;
}
}
}
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 2) {
UIWidgets::CVarSliderInt("Strength", "gEnhancements.Graphics.MotionBlur.Strength", 0, 255, 180);
}
}
extern "C" void MotionBlur_Override(u8* status, s32* alpha) {
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 1) {
*status = 0;
*alpha = 0;
} else if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 2) {
2024-05-22 09:52:56 -04:00
if (*status == 0)
*status = 2;
2024-04-29 18:52:20 -05:00
*alpha = CVarGetInteger("gEnhancements.Graphics.MotionBlur.Strength", 180);
}
}