mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-09-23 05:46:27 +00:00
Workaround for broken cameraViewToClip
This commit is contained in:
@@ -79,6 +79,8 @@ void IFGFeature::SetCameraValues(float nearValue, float farValue, float vFov, fl
|
||||
_cameraVFov = vFov;
|
||||
_cameraAspectRatio = aspectRatio;
|
||||
_meterFactor = meterFactor;
|
||||
|
||||
LOG_TRACE("farValue: {}, nearValue: {}, vFov: {}, aspectRatio: {}", farValue, nearValue, vFov, aspectRatio);
|
||||
}
|
||||
|
||||
void IFGFeature::SetCameraData(float cameraPosition[3], float cameraUp[3], float cameraRight[3], float cameraForward[3])
|
||||
|
||||
@@ -447,13 +447,19 @@ bool Sl_Inputs_Dx12::dispatchFG()
|
||||
return true;
|
||||
};
|
||||
|
||||
LOG_TRACE("Pre camera recalc near: {}, far: {}", slConstsRef.cameraNear, slConstsRef.cameraFar);
|
||||
static bool dontRecalc = false;
|
||||
|
||||
LOG_TRACE("Camera from SL pre recalc near: {}, far: {}", slConstsRef.cameraNear, slConstsRef.cameraFar);
|
||||
|
||||
// UE seems to not be passing the correct cameraViewToClip
|
||||
// and we can't use it to calculate cameraNear and cameraFar.
|
||||
if (engineType != sl::EngineType::eUnreal)
|
||||
if (engineType != sl::EngineType::eUnreal && !dontRecalc)
|
||||
loadCameraMatrix();
|
||||
|
||||
// Workaround for more games with broken cameraViewToClip
|
||||
if (!dontRecalc && (slConstsRef.cameraNear < 0.0f || slConstsRef.cameraFar < 0.0f))
|
||||
dontRecalc = true;
|
||||
|
||||
infiniteDepth = false;
|
||||
if (slConstsRef.cameraNear != 0.0f && slConstsRef.cameraFar == 0.0f)
|
||||
{
|
||||
@@ -465,8 +471,6 @@ bool Sl_Inputs_Dx12::dispatchFG()
|
||||
slConstsRef.cameraFar = slConstsRef.cameraNear + 1.0f;
|
||||
}
|
||||
|
||||
LOG_TRACE("Post camera recalc near: {}, far: {}", slConstsRef.cameraNear, slConstsRef.cameraFar);
|
||||
|
||||
fgOutput->SetCameraValues(slConstsRef.cameraNear, slConstsRef.cameraFar, slConstsRef.cameraFOV,
|
||||
slConstsRef.cameraAspectRatio, 0.0f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user