Skip to content

Commit

Permalink
Add new option fog range
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiyansKing committed Jul 3, 2023
1 parent c1aa56f commit 784b9c0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions D3D11Engine/BaseAntTweakBar.cpp
Expand Up @@ -104,6 +104,7 @@ XRESULT BaseAntTweakBar::Init() {
TwAddVarRW( Bar_General, "Draw ParticleEffects", TW_TYPE_BOOLCPP, &Engine::GAPI->GetRendererState().RendererSettings.DrawParticleEffects, nullptr );
//TwAddVarRW(Bar_General, "Draw Sky", TW_TYPE_BOOLCPP, &Engine::GAPI->GetRendererState().RendererSettings.DrawSky, nullptr);
TwAddVarRW( Bar_General, "Draw Fog", TW_TYPE_BOOLCPP, &Engine::GAPI->GetRendererState().RendererSettings.DrawFog, nullptr );
TwAddVarRW( Bar_General, "Fog Range", TwDefineEnumFromString( "FogRangeEnum", "3, 4, 5, 6, 7, 8, 9, 10" ), &Engine::GAPI->GetRendererState().RendererSettings.FogRange, nullptr );
#if ENABLE_TESSELATION > 0
TwAddVarRW( Bar_General, "Tesselation", TW_TYPE_BOOLCPP, &Engine::GAPI->GetRendererState().RendererSettings.EnableTesselation, nullptr );
#endif
Expand Down
3 changes: 2 additions & 1 deletion D3D11Engine/D3D11GraphicsEngine.cpp
Expand Up @@ -1899,8 +1899,9 @@ XRESULT D3D11GraphicsEngine::DrawSkeletalMesh( SkeletalVobInfo* vi,
if ( zCMaterial* mat = itm.first ) {
zCTexture* tex;
if ( ActivePS && (tex = mat->GetAniTexture()) != nullptr ) {
if ( !BindTextureNRFX( tex, (RenderingStage != DES_GHOST) ) )
if ( !BindTextureNRFX( tex, (RenderingStage != DES_GHOST) ) ) {
continue;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion D3D11Engine/D3D11PFX_HeightFog.cpp
Expand Up @@ -48,7 +48,7 @@ XRESULT D3D11PFX_HeightFog::Render( RenderToTextureBuffer* fxbuffer ) {

float fnear = 15000.0f;
float ffar = 60000.0f;
float secScale = Engine::GAPI->GetRendererState().RendererSettings.SectionDrawRadius;
float secScale = std::min<float>( Engine::GAPI->GetRendererState().RendererSettings.SectionDrawRadius, Engine::GAPI->GetRendererState().RendererSettings.FogRange + 3 );

cb.HF_WeightZNear = std::max( 0.0f, WORLD_SECTION_SIZE * ((secScale - 0.5f) * 0.7f) - (ffar - fnear) ); // Keep distance from original fog but scale the near-fog up to section draw distance
cb.HF_WeightZFar = WORLD_SECTION_SIZE * ((secScale - 0.5f) * 0.8f);
Expand Down
2 changes: 2 additions & 0 deletions D3D11Engine/GothicAPI.cpp
Expand Up @@ -3944,6 +3944,7 @@ XRESULT GothicAPI::SaveMenuSettings( const std::string& file ) {
WritePrivateProfileStringA( "General", "ChangeToMode", std::to_string( s.ChangeWindowPreset ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "AtmosphericScattering", std::to_string( s.AtmosphericScattering ? TRUE : FALSE ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "EnableFog", std::to_string( s.DrawFog ? TRUE : FALSE ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "FogRange", std::to_string( s.FogRange ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "EnableHDR", std::to_string( s.EnableHDR ? TRUE : FALSE ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "HDRToneMap", std::to_string( s.HDRToneMap ).c_str(), ini.c_str() );
WritePrivateProfileStringA( "General", "EnableDebugLog", std::to_string( s.EnableDebugLog ? TRUE : FALSE ).c_str(), ini.c_str() );
Expand Down Expand Up @@ -4037,6 +4038,7 @@ XRESULT GothicAPI::LoadMenuSettings( const std::string& file ) {

s.ChangeWindowPreset = GetPrivateProfileIntA( "General", "ChangeToMode", 0, ini.c_str() );
s.DrawFog = GetPrivateProfileBoolA( "General", "EnableFog", true, ini );
s.FogRange = GetPrivateProfileIntA( "General", "FogRange", 0, ini.c_str() );
s.AtmosphericScattering = GetPrivateProfileBoolA( "General", "AtmosphericScattering", true, ini );
s.EnableHDR = GetPrivateProfileBoolA( "General", "EnableHDR", false, ini );
s.HDRToneMap = GothicRendererSettings::E_HDRToneMap( GetPrivateProfileIntA( "General", "HDRToneMap", 4, ini.c_str() ) );
Expand Down
2 changes: 2 additions & 0 deletions D3D11Engine/GothicGraphicsState.h
Expand Up @@ -529,6 +529,7 @@ struct GothicRendererSettings {

DrawSky = true;
DrawFog = true;
FogRange = 0;
EnableHDR = false;
HDRToneMap = E_HDRToneMap::ToneMap_Simple;
ReplaceSunDirection = false;
Expand Down Expand Up @@ -710,6 +711,7 @@ struct GothicRendererSettings {
bool DrawParticleEffects;
bool DrawSky;
bool DrawFog;
int FogRange;
bool DrawG1ForestPortals;
bool EnableHDR;
E_HDRToneMap HDRToneMap;
Expand Down

0 comments on commit 784b9c0

Please sign in to comment.