leezer3/OpenBVE

[Bug] ObjectViewer crash on the latest Nightly Build

Closed this issue · 1 comments

Description

On the latest penBVE nightly build, Object Viewer will crash immediately when trying to launch.
1182f38 ?

Logs

Unhandled Exception:
System.ArgumentOutOfRangeException: zFar must be positive
Parameter name: zFar
  at OpenBveApi.Math.Matrix4D.CreatePerspectiveFieldOfView (System.Double fieldOfViewY, System.Double aspectRatio, System.Double zNear, System.Double zFar) [0x0006c] in <0259f80555ec47be94da27053c4a8cca>:0 
  at LibRender2.BaseRenderer.UpdateViewport (System.Int32 Width, System.Int32 Height) [0x00099] in <5a03d4946b344419bd6a1d8b687624ee>:0 
  at LibRender2.BaseRenderer.UpdateViewport () [0x00000] in <5a03d4946b344419bd6a1d8b687624ee>:0 
  at ObjectViewer.ObjectViewer.OnLoad (System.EventArgs e) [0x000b4] in <ff9d3cc6d9844601b190a543d2cbb896>:0 
  at OpenTK.GameWindow.OnLoadInternal (System.EventArgs e) [0x00000] in <13d03852c6254f51840d199e801a688e>:0 
  at OpenTK.GameWindow.Run (System.Double updates_per_second, System.Double frames_per_second) [0x0008f] in <13d03852c6254f51840d199e801a688e>:0 
  at OpenTK.GameWindow.Run () [0x00000] in <13d03852c6254f51840d199e801a688e>:0 
  at ObjectViewer.Program.Main (System.String[] args) [0x00318] in <ff9d3cc6d9844601b190a543d2cbb896>:0

Related information

  • Operating system: Debian Testing (Trixie)
  • Method of control: Keyboard

Now that's typical....
Fix one issue, surface one in something completely unrelated.

TLDR:
The base renderer assumed a viewing distance of 1km unless otherwise set when creating the view matrix.
The main game was doing this correctly, but Route Viewer wasn't.
Change this assumption to use the viewing distance instead, but of course Object Viewer didn't set a viewing distance.