Fixed NVidia shiny water shader bug and re-enabled in settings

missed a commented line
This commit is contained in:
jiminycrick 2020-08-21 11:17:34 -07:00 committed by Forest Anderson
parent 7e9194eb73
commit 6b8e458027
2 changed files with 13 additions and 7 deletions

View File

@ -132,7 +132,14 @@ void main() {
float wave10 = wave_height(wave_pos + vec3(0.1, 0, 0));
float wave01 = wave_height(wave_pos + vec3(0, 0.1, 0));
float slope = abs(wave00 - wave10) * abs(wave00 - wave01);
float slope;
// Prevent slope from being zero so no div by zero
if ((abs(wave00 - wave10) > 0.0001) && (abs(wave00 - wave01) > 0.0001)) {
slope = abs(wave00 - wave10) * abs(wave00 - wave01);
} else {
slope = 0.0001;
}
vec3 nmap = vec3(
-(wave10 - wave00) / 0.1,
-(wave01 - wave00) / 0.1,
@ -151,7 +158,7 @@ void main() {
float f_alt = f_pos.z;
#endif
float fluid_alt = max(ceil(f_pos.z), floor(f_alt));// f_alt;//max(f_alt - f_pos.z, 0.0);
float fluid_alt = f_norm.z == 0 ? f_alt : f_pos.z;
const float alpha = 0.255/*/ / 4.0*//* / 4.0 / sqrt(2.0)*/;
const float n2 = 1.3325;
const float R_s2s0 = pow((1.0 - n2) / (1.0 + n2), 2);

View File

@ -2064,18 +2064,17 @@ impl<'a> Widget for SettingsWindow<'a> {
.color(TEXT_COLOR)
.set(state.ids.fluid_mode_text, ui);
// FIXME: Add shiny water back to the UI once we fix the bug on nVidia cards.
let mode_list = [
FluidMode::Cheap,
// FluidMode::Shiny
FluidMode::Shiny
];
let mode_label_list = [
&self
.localized_strings
.get("hud.settings.fluid_rendering_mode.cheap"),
/* &self
.localized_strings
.get("hud.settings.fluid_rendering_mode.shiny"), */
&self
.localized_strings
.get("hud.settings.fluid_rendering_mode.shiny"),
];
// Get which fluid rendering mode is currently active