Add fog density and opacity
This commit is contained in:
@@ -28,9 +28,13 @@ static SetBoolFn SetDOFFixEnabled = nullptr;
|
||||
static SetBoolFn SetCAFixEnabled = nullptr;
|
||||
static SetBoolFn SetVignettingFixEnabled = nullptr;
|
||||
static SetBoolFn SetCameraFixEnabled = nullptr;
|
||||
static SetBoolFn SetFogFixEnabled = nullptr;
|
||||
static SetBoolFn SetVolumetricFogFixEnabled = nullptr;
|
||||
static SetBoolFn SetFogDensityFixEnabled = nullptr;
|
||||
static SetBoolFn SetFogMaxOpacityFixEnabled = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static SetFloatFn SetCameraDistance = nullptr;
|
||||
static SetFloatFn SetFogDensity = nullptr;
|
||||
static SetFloatFn SetFogMaxOpacity = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
// Plugin variables for checkboxes and sliders
|
||||
@@ -39,10 +43,14 @@ static bool DOF_fix_enabled = false;
|
||||
static bool CA_fix_enabled = false;
|
||||
static bool Vignetting_fix_enabled = false;
|
||||
static bool camera_fix_enabled = false;
|
||||
static bool Fog_fix_enabled = false;
|
||||
static bool volumetric_fog_fix_enabled = false;
|
||||
static bool Fog_density_fix_enabled = false;
|
||||
static bool Fog_max_opacity_fix_enabled = false;
|
||||
static bool fix_enabled = false;
|
||||
static int worldFOVvalue = 0;
|
||||
static float cameraDistanceValue = 1.f;
|
||||
static float fogDensityValue = 0.4f;
|
||||
static float fogMaxOpacityValue = 0.4f;
|
||||
|
||||
static bool popup_Informations = false;
|
||||
|
||||
@@ -54,11 +62,15 @@ const char* CAMERA_FIX_SETTING = "CameraFIX=";
|
||||
const char* DOF_FIX_SETTING = "DOFFIX=";
|
||||
const char* CA_FIX_SETTING = "CAFIX=";
|
||||
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
|
||||
const char* FOG_FIX_SETTING = "FogFIX=";
|
||||
const char* VOLUMETRIC_FOG_FIX_SETTING = "VolumetricFogFIX=";
|
||||
const char* FOG_DENSITY_FIX_SETTING = "FogDensityFIX=";
|
||||
const char* FOG_MAX_OPACITY_FIX_SETTING = "FogMaxOpacityFIX=";
|
||||
const char* WORLD_FOV_SETTING = "WorldFOV=";
|
||||
const char* CAMERA_DISTANCE_SETTING = "CameraDistance=";
|
||||
const char* FIX_VERSION = "1.0.2";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n\nDisabling Fog will not entirely remove it.";
|
||||
const char* FOG_DENSITY_SETTING = "FogDensity=";
|
||||
const char* FOG_MAX_OPACITY_SETTING = "FogMaxOpacity=";
|
||||
const char* FIX_VERSION = "1.0.3";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Control fog.\n - Re enable console.\n\nDisabling Fog will not entirely remove it.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
// Scaling factor based on screen resolution
|
||||
@@ -83,21 +95,29 @@ static void LoadFixDLL()
|
||||
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
|
||||
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
|
||||
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
|
||||
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
|
||||
SetVolumetricFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVolumetricFogFixEnabled");
|
||||
SetFogDensityFixEnabled = (SetBoolFn)GetProcAddress(fixLib,"SetFogDensityFixEnabled");
|
||||
SetFogMaxOpacityFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogMaxOpacityFixEnabled");
|
||||
SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
|
||||
SetFogDensity = (SetFloatFn)GetProcAddress(fixLib,"SetFogDensity");
|
||||
SetFogMaxOpacity = (SetFloatFn)GetProcAddress(fixLib, "SetFogMaxOpacity");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
|
||||
if (SetFogDensity) SetFogDensity(fogDensityValue);
|
||||
if (SetFogMaxOpacity) SetFogMaxOpacity(fogMaxOpacityValue);
|
||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
|
||||
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, true);
|
||||
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
|
||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
|
||||
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
|
||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
|
||||
if (SetVolumetricFogFixEnabled) SetVolumetricFogFixEnabled(volumetric_fog_fix_enabled, true);
|
||||
if (SetFogDensityFixEnabled) SetFogDensityFixEnabled(Fog_density_fix_enabled, true);
|
||||
if (SetFogMaxOpacityFixEnabled) SetFogMaxOpacityFixEnabled(Fog_max_opacity_fix_enabled, true);
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
}
|
||||
}
|
||||
@@ -114,9 +134,13 @@ static void SaveSettings()
|
||||
file << DOF_FIX_SETTING << (DOF_fix_enabled ? "1" : "0") << "\n";
|
||||
file << CA_FIX_SETTING << (CA_fix_enabled ? "1" : "0") << "\n";
|
||||
file << VIGNETTING_FIX_SETTING << (Vignetting_fix_enabled ? "1" : "0") << "\n";
|
||||
file << FOG_FIX_SETTING << (Fog_fix_enabled ? "1" : "0") << "\n";
|
||||
file << VOLUMETRIC_FOG_FIX_SETTING << (volumetric_fog_fix_enabled ? "1" : "0") << "\n";
|
||||
file << FOG_DENSITY_FIX_SETTING << (Fog_density_fix_enabled ? "1" : "0") << "\n";
|
||||
file << FOG_MAX_OPACITY_FIX_SETTING << (Fog_max_opacity_fix_enabled ? "1" : "0") << "\n";
|
||||
file << WORLD_FOV_SETTING << worldFOVvalue << "\n";
|
||||
file << CAMERA_DISTANCE_SETTING << cameraDistanceValue << "\n";
|
||||
file << FOG_DENSITY_SETTING << fogDensityValue << "\n";
|
||||
file << FOG_MAX_OPACITY_SETTING << fogMaxOpacityValue << "\n";
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
@@ -159,15 +183,29 @@ static void LoadSettings()
|
||||
std::string val = line.substr(strlen(VIGNETTING_FIX_SETTING));
|
||||
Vignetting_fix_enabled = (val == "1" || val == "true");
|
||||
}
|
||||
else if (line.find(FOG_FIX_SETTING) == 0)
|
||||
else if (line.find(VOLUMETRIC_FOG_FIX_SETTING) == 0)
|
||||
{
|
||||
std::string val = line.substr(strlen(FOG_FIX_SETTING));
|
||||
Fog_fix_enabled = (val == "1" || val == "true");
|
||||
std::string val = line.substr(strlen(VOLUMETRIC_FOG_FIX_SETTING));
|
||||
volumetric_fog_fix_enabled = (val == "1" || val == "true");
|
||||
}
|
||||
else if (line.find(FOG_DENSITY_FIX_SETTING) == 0)
|
||||
{
|
||||
std::string val = line.substr(strlen(FOG_DENSITY_FIX_SETTING));
|
||||
Fog_density_fix_enabled = (val == "1" || val == "true");
|
||||
}
|
||||
else if (line.find(FOG_MAX_OPACITY_FIX_SETTING) == 0)
|
||||
{
|
||||
std::string val = line.substr(strlen(FOG_MAX_OPACITY_FIX_SETTING));
|
||||
Fog_max_opacity_fix_enabled = (val == "1" || val == "true");
|
||||
}
|
||||
else if (line.find(WORLD_FOV_SETTING) == 0)
|
||||
worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_SETTING)));
|
||||
else if (line.find(CAMERA_DISTANCE_SETTING) == 0)
|
||||
cameraDistanceValue = std::stof(line.substr(strlen(CAMERA_DISTANCE_SETTING)));
|
||||
else if (line.find(FOG_DENSITY_SETTING) == 0)
|
||||
fogDensityValue = std::stof(line.substr(strlen(FOG_DENSITY_SETTING)));
|
||||
else if (line.find(FOG_MAX_OPACITY_SETTING) == 0)
|
||||
fogMaxOpacityValue = std::stof(line.substr(strlen(FOG_MAX_OPACITY_SETTING)));
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
@@ -197,8 +235,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.3f);
|
||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.7f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Drawing a left column with slider and general fix
|
||||
@@ -209,35 +247,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// Sliders
|
||||
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(150 * scale);
|
||||
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 50)) {
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("This will affect in game FOV only.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(150 * scale);
|
||||
if (ImGui::SliderFloat("##CameraDistanceValue", &cameraDistanceValue, 0, 3)) {
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Value is a multiplier.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
// Individual fixes
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
@@ -257,20 +266,17 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false);
|
||||
if (ImGui::Checkbox("Fog density", &Fog_density_fix_enabled)) {
|
||||
if (SetFogDensityFixEnabled) SetFogDensityFixEnabled(Fog_density_fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Enabling this fix is a one way.");
|
||||
ImGui::Text("Reverting it in real time would end in game crash.");
|
||||
ImGui::Text("So disabling this fix is only possible by doing it here and restart the game.");
|
||||
ImGui::EndTooltip();
|
||||
|
||||
if (ImGui::Checkbox("Fog opacity", &Fog_max_opacity_fix_enabled)) {
|
||||
if (SetFogMaxOpacityFixEnabled) SetFogMaxOpacityFixEnabled(Fog_max_opacity_fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
|
||||
if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
|
||||
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false);
|
||||
SaveSettings();
|
||||
@@ -285,12 +291,81 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Volumetric fog", &volumetric_fog_fix_enabled)) {
|
||||
if (SetVolumetricFogFixEnabled) SetVolumetricFogFixEnabled(volumetric_fog_fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2 * style.ItemSpacing.y);
|
||||
if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableNextRow();
|
||||
// Sliders
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 50)) {
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("This will affect in game FOV only.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderFloat("##CameraDistanceValue", &cameraDistanceValue, 0, 3)) {
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Value is a multiplier.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Fog density (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderFloat("##FogDensityValue", &fogDensityValue, 0, 5)) {
|
||||
if (SetFogDensity) SetFogDensity(fogDensityValue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("This will override engine dynamic value.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Fog opacity (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderFloat("##FogOpacityValue", &fogMaxOpacityValue, 0, 1)) {
|
||||
if (SetFogMaxOpacity) SetFogMaxOpacity(fogMaxOpacityValue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("This will override engine dynamic value.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
// Fix status
|
||||
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
|
||||
@@ -301,6 +376,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
ImGui::Text("Console enabled and bound to key Tilde");
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut);
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "Default fog density: %.3f, opacity: %3.f", infos.defaultFogDensity, infos.fogMaxOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user