Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert PS_Diffse.hlsl #3

Merged
merged 13 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
configuration: [Release_AVX, Release_G1_AVX, Release, Release_G1, Spacer_NET, Launcher]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v1.1

- name: Set tag and directory name env
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
run: msbuild /p:Configuration=${{matrix.configuration}} .

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.configuration }}
path: ${{ matrix.configuration }}/ddraw.dll
Expand All @@ -51,21 +51,21 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set tag and directory name env
run: |
$tagName = $Env:GITHUB_SHA.Substring(0, 9)
$dirName = "GD3D11-git-$tagName"
$dirName = "GD3D11-git"
echo "Tag: ${tagName}"
echo "Directory: ${dirName}"
echo "RELEASE_VERSION=${tagName}" >> $Env:GITHUB_ENV
echo "RELEASE_DIR=${dirName}" >> $Env:GITHUB_ENV

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4

- name: Display structure of downloaded files
run: ls -R
run: tree

- name: Create distribution
working-directory: ${{env.GITHUB_WORKSPACE}}
Expand All @@ -84,10 +84,12 @@ jobs:
copy "Launcher\ddraw.dll" "${{env.RELEASE_DIR}}\"

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_DIR }}
path: ${{ env.RELEASE_DIR }}
# higher values don't get us much due to DLLs, libs, textures...
compression-level: 1

- name: zip distribution for nightly
if: github.ref_name == 'master'
Expand All @@ -102,22 +104,28 @@ jobs:
run: |
(Get-FileHash "${{env.RELEASE_DIR}}.zip" -Algorithm SHA256).hash | Out-File -FilePath "${{env.RELEASE_DIR}}.zip.sha256"
type "${{env.RELEASE_DIR}}.zip.sha256"

- name: Delete old nightly
if: github.ref_name == 'master'
uses: dev-drprasad/[email protected]
# v1.0.1
uses: dev-drprasad/delete-tag-and-release@8cd619d00037e4aeb781909c9a6b03940507d0da
with:
delete_release: true
tag_name: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create new nightly
uses: ncipollo/release-action@v1
if: github.ref_name == 'master'
# v1.13.0
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
with:
name: Nightly
tag: nightly
generateReleaseNotes: true
allowUpdates: true
prerelease: true
artifacts: "${{env.RELEASE_DIR}}.zip,{{env.RELEASE_DIR}}.zip.sha256"
tag: nightly
draft: false
omitDraftDuringUpdate: false
removeArtifacts: true
artifacts: "${{env.RELEASE_DIR}}.zip,${{env.RELEASE_DIR}}.zip.sha256"
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set tag and directory name env
run: |
$tagName = $Env:GITHUB_REF -replace 'refs/tags/', ''
$dirName = "GD3D11-${tagName}"
$dirName = "GD3D11"
$shortHash = $Env:GITHUB_SHA.Substring(0, 9)
echo "Tag: ${tagName}"
echo "Directory: ${dirName}"
Expand Down
3 changes: 3 additions & 0 deletions D3D11Engine/BaseAntTweakBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ XRESULT BaseAntTweakBar::Init() {
Bar_General = TwNewBar( "General" );
TwDefine( " General position='600 0'" );

static std::string versionString = std::string( VERSION_NUMBER );
TwAddVarRO( Bar_General, "Version", TW_TYPE_STDSTRING, &versionString, VERSION_NUMBER );

TwAddButton( Bar_General, "Save ZEN-Resources", (TwButtonCallback)SaveZENResourcesCallback, this, nullptr );
TwAddButton( Bar_General, "Load ZEN-Resources", (TwButtonCallback)LoadZENResourcesCallback, this, nullptr );
TwAddButton( Bar_General, "Open Settings Dialog", (TwButtonCallback)OpenSettingsCallback, this, nullptr );
Expand Down
10 changes: 5 additions & 5 deletions D3D11Engine/D3D11Engine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
</AssemblyDebug>
</Link>
<CustomBuildStep>
<Command>copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\"
<Command>robocopy "shaders" "$(G2_SYSTEM_PATH)\GD3D11\shaders" /E
copy "$(OutDir)$(TargetName)$(TargetExt)" "$(G2_SYSTEM_PATH)\ddraw.dll"
copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<Outputs>xxx</Outputs>
Expand Down Expand Up @@ -302,7 +302,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Command>copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\"
<Command>robocopy "shaders" "$(G2_SYSTEM_PATH)\GD3D11\shaders" /E
copy "$(OutDir)$(TargetName)$(TargetExt)" "$(G2_SYSTEM_PATH)\ddraw.dll"
copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<Outputs>xxx</Outputs>
Expand Down Expand Up @@ -353,7 +353,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
</AssemblyDebug>
</Link>
<CustomBuildStep>
<Command>copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\"
<Command>robocopy "shaders" "$(G2_SYSTEM_PATH)\GD3D11\shaders" /E
copy "$(OutDir)$(TargetName)$(TargetExt)" "$(G2_SYSTEM_PATH)\ddraw.dll"
copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<Outputs>xxx</Outputs>
Expand Down Expand Up @@ -508,7 +508,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\"
<Command>robocopy "shaders" "$(G2_SYSTEM_PATH)\GD3D11\shaders" /E
copy "$(OutDir)$(TargetName)$(TargetExt)" "$(G2_SYSTEM_PATH)\ddraw.dll"
copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<Outputs>xxx</Outputs>
Expand Down Expand Up @@ -542,7 +542,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
</DelayLoadDLLs>
</Link>
<CustomBuildStep>
<Command>copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\"
<Command>robocopy "shaders" "$(G2_SYSTEM_PATH)\GD3D11\shaders" /E
copy "$(OutDir)$(TargetName)$(TargetExt)" "$(G2_SYSTEM_PATH)\ddraw.dll"
copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb"</Command>
<Outputs>xxx</Outputs>
Expand Down
16 changes: 14 additions & 2 deletions D3D11Engine/D3D11PFX_HeightFog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,35 @@ XRESULT D3D11PFX_HeightFog::Render( RenderToTextureBuffer* fxbuffer ) {
cb.HF_WeightZFar = std::min( cb.HF_WeightZFar, atmoMax );
cb.HF_WeightZNear = std::min( cb.HF_WeightZNear, atmoMin );

#ifndef BUILD_GOTHIC_1_08k
float fogDensityFactor = 2;
float fogDensityFactorRain = (1.0f - Engine::GAPI->GetFogOverride());
#else
float fogDensityFactor = pow( 15000.0f / Engine::GAPI->GetFarZ(), 4.0f );
float fogDensityFactorRain = 1.0f;
#endif

if ( Engine::GAPI->GetFogOverride() > 0.0f ) {
// Make sure the camera is inside the fog when in fog zone
height = Toolbox::lerp( height, Engine::GAPI->GetCameraPosition().y + 10000, Engine::GAPI->GetFogOverride() ); // TODO: Get this from the actual fog-distance in the fogzone!

// Override fog color when in fog zone
color = Engine::GAPI->GetFogColor();

#ifndef BUILD_GOTHIC_1_08k
// Make it z-Fog
cb.HF_HeightFalloff = Toolbox::lerp( cb.HF_HeightFalloff, 0.000001f, Engine::GAPI->GetFogOverride() );
#endif

// Turn up density
cb.HF_GlobalDensity = Toolbox::lerp( cb.HF_GlobalDensity, cb.HF_GlobalDensity * 2, Engine::GAPI->GetFogOverride() );
cb.HF_GlobalDensity = Toolbox::lerp( cb.HF_GlobalDensity, cb.HF_GlobalDensity * fogDensityFactor, Engine::GAPI->GetFogOverride() );

#ifndef BUILD_GOTHIC_1_08k
// Use other fog-values for fog-zones
float distNear = WORLD_SECTION_SIZE * ((ffar - fnear) / ffar);
cb.HF_WeightZNear = Toolbox::lerp( cb.HF_WeightZNear, WORLD_SECTION_SIZE * 0.09f, Engine::GAPI->GetFogOverride() );
cb.HF_WeightZFar = Toolbox::lerp( cb.HF_WeightZFar, WORLD_SECTION_SIZE * 0.8, Engine::GAPI->GetFogOverride() );
#endif
}

//Engine::GAPI->GetRendererState().RendererSettings.FogColorMod;
Expand All @@ -94,7 +106,7 @@ XRESULT D3D11PFX_HeightFog::Render( RenderToTextureBuffer* fxbuffer ) {
XMStoreFloat3( &FogColorMod, XMVectorLerpV( color, XMLoadFloat3( &Engine::GAPI->GetRendererState().RendererSettings.RainFogColor ), XMVectorSet( std::min( 1.0f, rain * 2.0f ), std::min( 1.0f, rain * 2.0f ), std::min( 1.0f, rain * 2.0f ), 0 ) ) ); // Scale color faster here, so it looks better on light rain
cb.HF_FogColorMod = FogColorMod;
// Raining Density, only when not in fogzone
cb.HF_GlobalDensity = Toolbox::lerp( cb.HF_GlobalDensity, Engine::GAPI->GetRendererState().RendererSettings.RainFogDensity, rain * (1.0f - Engine::GAPI->GetFogOverride()) );
cb.HF_GlobalDensity = Toolbox::lerp( cb.HF_GlobalDensity, Engine::GAPI->GetRendererState().RendererSettings.RainFogDensity, rain * fogDensityFactorRain );


hfPS->GetConstantBuffer()[0]->UpdateBuffer( &cb );
Expand Down
6 changes: 6 additions & 0 deletions D3D11Engine/GothicAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,12 @@ GInventory* GothicAPI::GetInventory() {
return Inventory.get();
}

/** Returns the far Z */
float GothicAPI::GetFarZ() {
zCSkyController_Outdoor* sc = oCGame::GetGame()->_zCSession_world->GetSkyControllerOutdoor();
return sc->GetFarZ();
}

/** Returns the fog-color */
FXMVECTOR GothicAPI::GetFogColor() {
zCSkyController_Outdoor* sc = oCGame::GetGame()->_zCSession_world->GetSkyControllerOutdoor();
Expand Down
3 changes: 3 additions & 0 deletions D3D11Engine/GothicAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ class GothicAPI {
/** Returns the GSky-Object */
GSky* GetSky() const;

/** Returns the far Z */
float GetFarZ();

/** Returns the fog-color */
FXMVECTOR GetFogColor();

Expand Down
4 changes: 2 additions & 2 deletions D3D11Engine/GothicMemoryLocations1_08k.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ struct GothicMemoryLocations {
static const unsigned int Init = 0x005E6A00;*/

static const unsigned int GetUnderwaterFX = 0x5baaa0;
static const unsigned int Offset_OverrideColor = 0x558;
static const unsigned int Offset_OverrideFlag = 0x564;
static const unsigned int Offset_FarZ = 0x56C;
static const unsigned int Offset_Color = 0x580;

static const unsigned int SetCameraLocationHint = 0x005BC7D0;

Expand Down
2 changes: 2 additions & 0 deletions D3D11Engine/GothicMemoryLocations2_6_fix.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ struct GothicMemoryLocations {
static const unsigned int Offset_SkyLayerState1 = 0x124;
static const unsigned int Offset_OverrideColor = 0x558;
static const unsigned int Offset_OverrideFlag = 0x564;
static const unsigned int Offset_FarZ = 0x580;
static const unsigned int Offset_Color = 0x594;
static const unsigned int Interpolate = 0x005E8C20;
static const unsigned int Offset_InitDone = 0x7C;
static const unsigned int Init = 0x005E6A00;
Expand Down
Loading
Loading