lens flare fix

This commit is contained in:
Turanszki Janos
2021-06-24 23:55:30 +02:00
parent 5f3c78be3b
commit 54f789f226
+3 -3
View File
@@ -4613,10 +4613,10 @@ void DrawLensFlares(
if (light.GetType() == LightComponent::DIRECTIONAL)
{
// directional light flare will be placed at infinite position along direction vector:
XMVECTOR D = XMVector3Normalize(-XMVector3Transform(XMVectorSet(0, -vis.camera->zFarP, 0, 0), XMMatrixRotationQuaternion(XMLoadFloat4(&light.rotation))));
if (XMVectorGetX(XMVector3Dot(D, XMVectorSet(0, 1, 0, 0))) < 0)
XMVECTOR D = XMVector3Normalize(-XMVector3Transform(XMVectorSet(0, 1, 0, 1), XMMatrixRotationQuaternion(XMLoadFloat4(&light.rotation))));
if (XMVectorGetX(XMVector3Dot(D, XMVectorSet(0, -1, 0, 0))) < 0)
continue; // sun below horizon, skip lensflare
POS = vis.camera->GetEye() + D;
POS = vis.camera->GetEye() + D * -vis.camera->zFarP;
}
else
{