Skip to content

Commit de77b9c

Browse files
authored
Merge branch 'openrails:master' into multi_track_profiles
2 parents 15b9cc9 + ca63633 commit de77b9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2530
-785
lines changed

Source/Contrib/TrackViewer/Drawing/DrawTerrain.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,14 @@ void UpdateCamera(DrawArea drawArea)
486486
float camHeight = width / device.Viewport.AspectRatio / 2;
487487
Vector3 cameraPosition = cameraTarget;
488488
cameraPosition.Y = -camHeight;
489+
float nearPlaneDistance = camHeight / 2;
490+
if (nearPlaneDistance <= 0)
491+
{
492+
// distance is too close for CreatePerspectiveFieldOfView
493+
return;
494+
}
489495
basicEffect.View = Matrix.CreateLookAt(cameraPosition, cameraTarget, new Vector3(0, 0, 1));
490-
basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, device.Viewport.AspectRatio, camHeight / 2, camHeight * 2);
496+
basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, device.Viewport.AspectRatio, nearPlaneDistance, camHeight * 2);
491497

492498
}
493499
#endregion
10.6 KB
Loading
3.79 KB
Loading
3.2 KB
Loading
56.9 KB
Loading
73.2 KB
Loading
49.4 KB
Loading
54.3 KB
Loading
62.3 KB
Loading
45.5 KB
Loading

0 commit comments

Comments
 (0)