diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60328880..9e0b8aa4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | @@ -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 @@ -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}} @@ -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' @@ -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/delete-tag-and-release@v0.2.1 + # 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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f30596a7..d5db65d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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}" diff --git a/D3D11Engine/BaseAntTweakBar.cpp b/D3D11Engine/BaseAntTweakBar.cpp index dd6c5887..c81c4835 100644 --- a/D3D11Engine/BaseAntTweakBar.cpp +++ b/D3D11Engine/BaseAntTweakBar.cpp @@ -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 ); diff --git a/D3D11Engine/D3D11Engine.vcxproj b/D3D11Engine/D3D11Engine.vcxproj index cae28854..e63c6e5c 100644 --- a/D3D11Engine/D3D11Engine.vcxproj +++ b/D3D11Engine/D3D11Engine.vcxproj @@ -253,7 +253,7 @@ - copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\" + 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" xxx @@ -302,7 +302,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb" UseLinkTimeCodeGeneration - copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\" + 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" xxx @@ -353,7 +353,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb" - copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\" + 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" xxx @@ -508,7 +508,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb" - copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\" + 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" xxx @@ -542,7 +542,7 @@ copy "$(OutDir)$(TargetName).pdb" "$(G2_SYSTEM_PATH)\ddraw.pdb" - copy "shaders\*.*" "$(G2_SYSTEM_PATH)\GD3D11\shaders\" + 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" xxx diff --git a/D3D11Engine/D3D11PFX_HeightFog.cpp b/D3D11Engine/D3D11PFX_HeightFog.cpp index 1a3f6a5a..8bca5283 100644 --- a/D3D11Engine/D3D11PFX_HeightFog.cpp +++ b/D3D11Engine/D3D11PFX_HeightFog.cpp @@ -59,6 +59,14 @@ 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! @@ -66,16 +74,20 @@ XRESULT D3D11PFX_HeightFog::Render( RenderToTextureBuffer* fxbuffer ) { // 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; @@ -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 ); diff --git a/D3D11Engine/GothicAPI.cpp b/D3D11Engine/GothicAPI.cpp index 0e9c40a7..19752561 100644 --- a/D3D11Engine/GothicAPI.cpp +++ b/D3D11Engine/GothicAPI.cpp @@ -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(); diff --git a/D3D11Engine/GothicAPI.h b/D3D11Engine/GothicAPI.h index 94954bb2..19208ea8 100644 --- a/D3D11Engine/GothicAPI.h +++ b/D3D11Engine/GothicAPI.h @@ -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(); diff --git a/D3D11Engine/GothicMemoryLocations1_08k.h b/D3D11Engine/GothicMemoryLocations1_08k.h index f67a52e5..0a9662d6 100644 --- a/D3D11Engine/GothicMemoryLocations1_08k.h +++ b/D3D11Engine/GothicMemoryLocations1_08k.h @@ -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; diff --git a/D3D11Engine/GothicMemoryLocations2_6_fix.h b/D3D11Engine/GothicMemoryLocations2_6_fix.h index bb37b124..c05c4bc7 100644 --- a/D3D11Engine/GothicMemoryLocations2_6_fix.h +++ b/D3D11Engine/GothicMemoryLocations2_6_fix.h @@ -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; diff --git a/D3D11Engine/Shaders/PS_Diffuse.hlsl b/D3D11Engine/Shaders/PS_Diffuse.hlsl index 2a049d47..f50f5c9e 100644 --- a/D3D11Engine/Shaders/PS_Diffuse.hlsl +++ b/D3D11Engine/Shaders/PS_Diffuse.hlsl @@ -6,21 +6,13 @@ #include #include -static const float SPECULAR_MULT = 8.0f; -static const float ROUGHNESS_MULT = 128.0f; - -#define USE_MIP_LOD - -static const float HEIGHT_MAP_SCALE = 0.025; -static const int MIN_SAMPLES = 8; -static const int MAX_SAMPLES = 64; - cbuffer MI_MaterialInfo : register( b2 ) { float MI_SpecularIntensity; float MI_SpecularPower; float MI_NormalmapStrength; float MI_ParallaxOcclusionStrength; + float4 MI_Color; } @@ -53,222 +45,45 @@ struct PS_INPUT float4 vPosition : SV_POSITION; }; -float3x3 face_orientation( float3 N, float3 p, float2 uv ) -{ - // get edge vectors of the pixel triangle - float3 dp1 = ddx( p ); - float3 dp2 = ddy( p ); - float2 duv1 = ddx( uv ); - float2 duv2 = ddy( uv ); - - // solve the linear system - float3 dp2perp = cross( dp2, N ); - float3 dp1perp = cross( N, dp1 ); - float3 T = dp2perp * duv1.x + dp1perp * duv2.x; - float3 B = dp2perp * duv1.y + dp1perp * duv2.y; - - // Negate because of left-handedness - //T *= -1; - //B *= -1; - - // construct a scale-invariant frame - float invmax = rsqrt( max( dot(T,T), dot(B,B) ) ); - return float3x3( T * invmax, B * invmax, N ); -} - -float2 calculateParallaxCorrectedTexCoord(PS_INPUT input, float2 parallaxOffsetTS, float3 viewTS) -{ - float2 texSampleBase = input.vTexcoord; - - float fMipLevel; - float fMipLevelInt; // mip level integer portion - float fMipLevelFrac; // mip level fractional amount for blending in between levels - - float fMinTexCoordDelta; - float2 dTexCoords; - - -#ifdef USE_MIP_LOD - // Compute the current gradients: - float2 fTexCoordsPerSize = input.vTexcoord; - - // Compute all 4 derivatives in x and y in a single instruction to optimize: - float2 dxSize, dySize; - float2 dx, dy; - - float4( dxSize, dx ) = ddx( float4( fTexCoordsPerSize, input.vTexcoord ) ); - float4( dySize, dy ) = ddy( float4( fTexCoordsPerSize, input.vTexcoord ) ); - - // Find min of change in u and v across quad: compute du and dv magnitude across quad - dTexCoords = dxSize * dxSize + dySize * dySize; - - // Standard mipmapping uses max here - fMinTexCoordDelta = max( dTexCoords.x, dTexCoords.y ) * 0.5f; - - // Compute the current mip level (* 0.5 is effectively computing a square root before ) - fMipLevel = max( 0.5 * log2( fMinTexCoordDelta ), 0 ); - - // Multiplier for visualizing the level of detail (see notes for 'nLODThreshold' variable - // for how that is done visually) - float4 cLODColoring = float4( 1, 1, 3, 1 ); - - float fOcclusionShadow = 1.0; - #endif - // Calculate directions - float3 N = normalize( input.vNormalVS ); - float3 E = normalize( viewTS ); - - //===============================================// - // Parallax occlusion mapping offset computation // - //===============================================// - - // Utilize dynamic flow control to change the number of samples per ray - // depending on the viewing angle for the surface. Oblique angles require - // smaller step sizes to achieve more accurate precision for computing displacement. - // We express the sampling rate as a linear function of the angle between - // the geometric normal and the view direction ray: - int nNumSteps = (int)lerp( MAX_SAMPLES, MIN_SAMPLES, dot( E, N ) ); - - // Intersect the view ray with the height field profile along the direction of - // the parallax offset ray (computed in the vertex shader. Note that the code is - // designed specifically to take advantage of the dynamic flow control constructs - // in HLSL and is very sensitive to specific syntax. When converting to other examples, - // if still want to use dynamic flow control in the resulting assembly shader, - // care must be applied. - // - // In the below steps we approximate the height field profile as piecewise linear - // curve. We find the pair of endpoints between which the intersection between the - // height field profile and the view ray is found and then compute line segment - // intersection for the view ray and the line segment formed by the two endpoints. - // This intersection is the displacement offset from the original texture coordinate. - // See the above paper for more details about the process and derivation. - - float fCurrHeight = 0.0; - float fStepSize = 1.0 / (float) nNumSteps; - float fPrevHeight = 1.0; - float fNextHeight = 0.0; - - int nStepIndex = 0; - bool bCondition = true; - - float2 vTexOffsetPerStep = fStepSize * parallaxOffsetTS; - float2 vTexCurrentOffset = input.vTexcoord; - float fCurrentBound = 1.0; - float fParallaxAmount = 0.0; - - float2 pt1 = 0; - float2 pt2 = 0; - - float2 texOffset2 = 0; - - while ( nStepIndex < nNumSteps ) - { - vTexCurrentOffset -= vTexOffsetPerStep; - - // Sample height map - fCurrHeight = 1 - TX_Texture2.SampleGrad( SS_Linear, vTexCurrentOffset, dx, dy ).b; - - fCurrentBound -= fStepSize; - - if ( fCurrHeight > fCurrentBound ) - { - pt1 = float2( fCurrentBound, fCurrHeight ); - pt2 = float2( fCurrentBound + fStepSize, fPrevHeight ); - - texOffset2 = vTexCurrentOffset - vTexOffsetPerStep; - - nStepIndex = nNumSteps + 1; - fPrevHeight = fCurrHeight; - } - else - { - nStepIndex++; - fPrevHeight = fCurrHeight; - } - } - - float fDelta2 = pt2.x - pt2.y; - float fDelta1 = pt1.x - pt1.y; - - float fDenominator = fDelta2 - fDelta1; - - // SM 3.0 requires a check for divide by zero, since that operation will generate - // an 'Inf' number instead of 0, as previous models (conveniently) did: - if ( fDenominator == 0.0f ) - { - fParallaxAmount = 0.0f; - } - else - { - fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator; - } - - float2 vParallaxOffset = parallaxOffsetTS * (1 - fParallaxAmount ); - - // The computed texture offset for the displaced point on the pseudo-extruded surface: - texSampleBase = input.vTexcoord - vParallaxOffset; - - return texSampleBase; -} - //-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- DEFERRED_PS_OUTPUT PSMain( PS_INPUT Input ) : SV_TARGET { - float2 Texcoord = Input.vTexcoord; - float3 nrm = normalize(Input.vNormalVS); - float4 fx = 0.0f; - -#if FXMAP == 1 - float heightmap = TX_Texture2.Sample(SS_Linear, Input.vTexcoord).b; - - float3x3 TBN = face_orientation(Input.vNormalVS, -Input.vViewPosition, Input.vTexcoord); - float3 VTS = mul(TBN, Input.vViewPosition); - float3 NTS = mul(TBN, Input.vNormalVS); - - // Compute initial parallax displacement direction: - float2 vParallaxDirection = normalize( VTS.xy ); + float4 color = TX_Texture0.Sample(SS_Linear, Input.vTexcoord); - // The length of this vector determines the furthest amount of displacement: - float fLength = length( VTS ); - float fParallaxLength = sqrt( fLength * fLength - VTS.z * VTS.z ) / VTS.z; - - // Compute the actual reverse parallax displacement vector: - float2 vParallaxOffsetTS = vParallaxDirection * fParallaxLength; - - // Need to scale the amount of displacement to account for different height ranges - // in height maps. This is controlled by an artist-editable parameter: - vParallaxOffsetTS *= HEIGHT_MAP_SCALE; + // Do alphatest if wanted +#if ALPHATEST == 1 + ClipDistanceEffect(length(Input.vViewPosition), DIST_DrawDistance, color.r * 2 - 1, 500.0f); - //Texcoord = Input.vTexcoord - (vParallaxOffsetTS * (1 - heightmap)); - Texcoord = calculateParallaxCorrectedTexCoord(Input, vParallaxOffsetTS, Input.vViewPosition); - fx = TX_Texture2.Sample(SS_Linear, Texcoord); + // WorldMesh can always do the alphatest + DoAlphaTest(color.a); #endif - float4 color = TX_Texture0.Sample(SS_Linear, Texcoord); - // Apply normalmapping if wanted #if NORMALMAPPING == 1 - nrm = perturb_normal(Input.vNormalVS, Input.vViewPosition, TX_Texture1, Texcoord, SS_Linear, MI_NormalmapStrength); + float3 nrm = perturb_normal(Input.vNormalVS, Input.vViewPosition, TX_Texture1, Input.vTexcoord, SS_Linear, MI_NormalmapStrength); +#else + float3 nrm = normalize(Input.vNormalVS); #endif - - // Do alphatest if wanted -#if ALPHATEST == 1 - ClipDistanceEffect(length(Input.vViewPosition), DIST_DrawDistance, color.r * 2 - 1, 500.0f); - - // WorldMesh can always do the alphatest - DoAlphaTest(color.a); + + float4 fx; +#if FXMAP == 1 + fx = TX_Texture2.Sample(SS_Linear, Input.vTexcoord); +#else + fx = 1.0f; #endif - - float specular = SPECULAR_MULT * fx.r; - float roughness = ROUGHNESS_MULT * (ceil(fx.g) - fx.g); DEFERRED_PS_OUTPUT output; output.vDiffuse = float4(color.rgb, Input.vDiffuse.y); + //output.vDiffuse = float4(Input.vTexcoord2, 0, 1); + //output.vDiffuse = float4(Input.vNormalVS, 1); - output.vNrm = float4(nrm.xyz, 1.0f); + output.vNrm.xyz = nrm; + output.vNrm.w = 1.0f; - output.vSI_SP = float2(specular, roughness); + output.vSI_SP.x = MI_SpecularIntensity * fx.r; + output.vSI_SP.y = MI_SpecularPower * fx.g; return output; } + diff --git a/D3D11Engine/zCSkyController_Outdoor.h b/D3D11Engine/zCSkyController_Outdoor.h index 2c4733ea..58b54494 100644 --- a/D3D11Engine/zCSkyController_Outdoor.h +++ b/D3D11Engine/zCSkyController_Outdoor.h @@ -208,13 +208,22 @@ class zCSkyController_Outdoor : public zCSkyController { #ifndef BUILD_GOTHIC_1_08k return *reinterpret_cast(THISPTR_OFFSET( GothicMemoryLocations::zCSkyController_Outdoor::Offset_OverrideColor )); #else - return XMFLOAT3( 0, 0, 0 ); + zColor color = *reinterpret_castTHISPTR_OFFSET( GothicMemoryLocations::zCSkyController_Outdoor::Offset_Color ); + return XMFLOAT3( color.bgra.r / 255.0f, color.bgra.g / 255.0f, color.bgra.b / 255.0f ); #endif } bool GetOverrideFlag() { #ifndef BUILD_GOTHIC_1_08k return *reinterpret_cast(THISPTR_OFFSET( GothicMemoryLocations::zCSkyController_Outdoor::Offset_OverrideFlag )) != 0; +#else + return 1; +#endif + } + + float GetFarZ() { +#if defined(BUILD_GOTHIC_1_08k) || defined(BUILD_GOTHIC_2_6_fix) + return *reinterpret_castTHISPTR_OFFSET( GothicMemoryLocations::zCSkyController_Outdoor::Offset_FarZ ); #else return 0; #endif