Fix model screen size calculation in orthographic view projections

#980
This commit is contained in:
Wojtek Figat
2023-05-08 12:44:01 +02:00
parent aeda759086
commit a5afa04f8f
2 changed files with 2 additions and 4 deletions

View File

@@ -395,7 +395,7 @@ uint64 RenderTools::CalculateTextureMemoryUsage(PixelFormat format, int32 width,
float RenderTools::ComputeBoundsScreenRadiusSquared(const Float3& origin, float radius, const Float3& viewOrigin, const Matrix& projectionMatrix)
{
const float screenMultiple = 0.5f * Math::Max(projectionMatrix.Values[0][0], projectionMatrix.Values[1][1]);
const float distSqr = Float3::DistanceSquared(origin, viewOrigin);
const float distSqr = Float3::DistanceSquared(origin, viewOrigin) * projectionMatrix.Values[2][3];
return Math::Square(screenMultiple * radius) / Math::Max(1.0f, distSqr);
}