Add "Enable Water Refraction" toggle & cleanup

This commit is contained in:
Luke Street
2026-04-11 20:13:32 -06:00
parent 3c281cc988
commit 85df64618d
11 changed files with 14 additions and 58 deletions
+10 -3
View File
@@ -4834,8 +4834,8 @@ inline void dComIfGd_drawXluListDark() {
inline void dComIfGd_drawXluListInvisible() {
ZoneScoped;
#ifdef TARGET_PC
// FIXME: Water rendering hack for frame interpolation
if (!dusk::getSettings().game.enableFrameInterpolation) {
if (dusk::getSettings().game.enableWaterRefraction &&
!dusk::getSettings().game.enableFrameInterpolation) {
#endif
g_dComIfG_gameInfo.drawlist.drawXluListInvisible();
#ifdef TARGET_PC
@@ -4845,7 +4845,14 @@ inline void dComIfGd_drawXluListInvisible() {
inline void dComIfGd_drawOpaListInvisible() {
ZoneScoped;
g_dComIfG_gameInfo.drawlist.drawOpaListInvisible();
#ifdef TARGET_PC
if (dusk::getSettings().game.enableWaterRefraction &&
!dusk::getSettings().game.enableFrameInterpolation) {
#endif
g_dComIfG_gameInfo.drawlist.drawOpaListInvisible();
#ifdef TARGET_PC
}
#endif
}
inline void dComIfGd_drawXluListZxlu() {
+1 -1
View File
@@ -52,7 +52,7 @@ struct UserSettings {
// Graphics
ConfigVar<bool> enableBloom;
ConfigVar<bool> useWaterProjectionOffset;
ConfigVar<bool> enableWaterRefraction;
ConfigVar<bool> enableFrameInterpolation;
ConfigVar<int> shadowResolutionMultiplier;
-8
View File
@@ -300,19 +300,11 @@ int daGrdWater_c::Draw() {
J3DTexMtxInfo* mtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (mtxInfo != NULL) {
Mtx afStack_50;
#if TARGET_PC
C_MTXLightPerspective(afStack_50, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect,
1.0f, 1.0f, dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0.0f);
#else
C_MTXLightPerspective(afStack_50, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect,
1.0f, 1.0f, -0.01f, 0.0f);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(afStack_50);
#endif
mtxInfo->setEffectMtx(afStack_50);
modelData2->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx);
}
-7
View File
@@ -371,15 +371,8 @@ int daLv3Water_c::Draw() {
texMtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (texMtxInfo != NULL) {
Mtx lightProjMtx;
#if TARGET_PC
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0.0f);
#else
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0.0f);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
#endif
-7
View File
@@ -197,14 +197,7 @@ int daLv3Water2_c::Draw() {
texMtxInfo = &btkMaterial->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if(texMtxInfo) {
Mtx lightProjMtx;
#if TARGET_PC
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0);
#else
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
#endif
-7
View File
@@ -27,15 +27,8 @@ static int daObj_Lv3waterB_Draw(obj_lv3WaterB_class* i_this) {
J3DTexMtxInfo* tex_mtx_info = &material_p->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (tex_mtx_info != NULL) {
Mtx m;
#if TARGET_PC
C_MTXLightPerspective(m, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f, 1.0f,
dusk::getSettings().game.useWaterProjectionOffset ? -0.015f : 0.0f, 0.0f);
#else
C_MTXLightPerspective(m, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f,
1.0f, -0.015f, 0.0f);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(m);
#endif
-7
View File
@@ -313,15 +313,8 @@ int daObjRotStair_c::Draw() {
J3DTexMtxInfo* texMtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (texMtxInfo != NULL) {
Mtx lightMtx;
#if TARGET_PC
C_MTXLightPerspective(lightMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0);
#else
C_MTXLightPerspective(lightMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightMtx);
#endif
-7
View File
@@ -36,15 +36,8 @@ static int daObj_Tp_Draw(obj_tp_class* i_this) {
&material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (texMtxInfo != NULL) {
Mtx lightProjMtx;
#if TARGET_PC
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0);
#else
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0);
#endif
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
#endif
-4
View File
@@ -11393,11 +11393,7 @@ void dKy_bg_MAxx_proc(void* bg_model_p) {
if (mat_name[6] == '2') {
C_MTXLightPerspective(sp1D8, dComIfGd_getView()->fovy,
camera_p->view.aspect, 1.0f, 1.0f,
#if TARGET_PC
dusk::getSettings().game.useWaterProjectionOffset ? -0.01f : 0.0f, 0.0f);
#else
-0.01f, 0.0f);
#endif
} else {
C_MTXLightPerspective(sp1D8, dComIfGd_getView()->fovy,
camera_p->view.aspect, 0.49f, -0.49f, 0.5f, 0.5f);
+1 -5
View File
@@ -64,11 +64,7 @@ namespace dusk {
config::ImGuiCheckbox("Native Bloom", getSettings().game.enableBloom);
config::ImGuiCheckbox("Water Projection Offset", getSettings().game.useWaterProjectionOffset);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n"
"that causes ~6px ghost artifacts in water reflections.");
}
config::ImGuiCheckbox("Enable Water Refraction", getSettings().game.enableWaterRefraction);
ImGui::EndMenu();
}
+2 -2
View File
@@ -40,7 +40,7 @@ UserSettings g_userSettings = {
// Graphics
.enableBloom {"game.enableBloom", true},
.useWaterProjectionOffset {"game.useWaterProjectionOffset", false},
.enableWaterRefraction {"game.enableWaterRefraction", true},
.enableFrameInterpolation = {"game.enableFrameInterpolation", false},
.shadowResolutionMultiplier {"game.shadowResolutionMultiplier", 1},
@@ -103,7 +103,7 @@ void registerSettings() {
Register(g_userSettings.game.enableMirrorMode);
Register(g_userSettings.game.invertCameraXAxis);
Register(g_userSettings.game.enableBloom);
Register(g_userSettings.game.useWaterProjectionOffset);
Register(g_userSettings.game.enableWaterRefraction);
Register(g_userSettings.game.shadowResolutionMultiplier);
Register(g_userSettings.game.enableFastIronBoots);
Register(g_userSettings.game.canTransformAnywhere);