Skip to content

Commit a1ecce2

Browse files
author
Chris Jakeman
committed
Restores option 02g removed in PR#589
1 parent c204d0a commit a1ecce2

File tree

5 files changed

+65
-20
lines changed

5 files changed

+65
-20
lines changed

Source/Documentation/Manual/options.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,17 @@ The default setting is checked.
274274
Viewing distance
275275
----------------
276276

277-
This option defines the maximum distance at which terrain is displayed.
277+
This option defines the maximum distance at which terrain and objects are displayed.
278278
Where the content provides "Distant Mountains", these are displayed independently (see below).
279279

280-
Note: Some routes are optimized for the standard MSTS maximum viewing distance (2km).
281-
282280
Note: When the option to tune settings automatically is applied, then this
283281
value will be overridden and dynamically changed to maintain a target frame rate.
284282

283+
Note: Some routes are optimized for a viewing distance of 2km as this is the maximum provided by MSTS.
284+
285285
The default distance is 2km.
286286

287+
287288
Distant mountains
288289
-----------------
289290

@@ -293,10 +294,33 @@ Note: "Distant Mountains" are present in the route if it has a folder called LO_
293294

294295
The default setting is checked.
295296

296-
The default distance is 40km
297+
The default distance is 40km.
297298

298299
.. image:: images/options-mountains.png
299300

301+
302+
Extend object maximum viewing distance to horizon
303+
-------------------------------------------------
304+
305+
With this option selected, all objects viewable up to the viewing distance
306+
(as defined above) are displayed, even if they have a level of detail (LOD) that is less distant.
307+
308+
Without this option, ORTS only displays objects up to their peak distance set by their level of detail (LOD)
309+
or the viewing distance, whichever is less.
310+
311+
Selecting this option shows all the objects that should be in view but it may reduce the frame rate.
312+
MSTS limits the viewing distance to just 2km and the peak LOD distances are usually 2km, so this option
313+
is especially useful for viewing routes created for MSTS at distances above 2km.
314+
315+
However, for routes that make good use of LOD settings, showing the objects that should be in view can be
316+
achieved at higher frame rates by unchecking this option.
317+
For example, if the viewing distance is 10km and the content has been created with some large objects having
318+
peak distance LODs set at 5km and smaller objects having LODs which are much shorter, then this strategy
319+
will show all the objects that should be in view without reducing the frame rate.
320+
321+
The default setting is checked.
322+
323+
300324
Viewing vertical FOV
301325
--------------------
302326

Source/Menu/Options.Designer.cs

Lines changed: 18 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/Options.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public OptionsForm(UserSettings settings, UpdateManager updateManager, bool init
169169
labelDistantMountainsViewingDistance.Enabled = checkDistantMountains.Checked;
170170
numericDistantMountainsViewingDistance.Enabled = checkDistantMountains.Checked;
171171
numericDistantMountainsViewingDistance.Value = Settings.DistantMountainsViewingDistance / 1000;
172+
checkLODViewingExtension.Checked = Settings.LODViewingExtension;
172173
numericViewingFOV.Value = Settings.ViewingFOV;
173174
numericWorldObjectDensity.Value = Settings.WorldObjectDensity;
174175
comboWindowSize.Text = Settings.WindowSize;
@@ -447,6 +448,7 @@ void buttonOK_Click(object sender, EventArgs e)
447448
Settings.ViewingDistance = (int)numericViewingDistance.Value;
448449
Settings.DistantMountains = checkDistantMountains.Checked;
449450
Settings.DistantMountainsViewingDistance = (int)numericDistantMountainsViewingDistance.Value * 1000;
451+
Settings.LODViewingExtension = checkLODViewingExtension.Checked;
450452
Settings.ViewingFOV = (int)numericViewingFOV.Value;
451453
Settings.WorldObjectDensity = (int)numericWorldObjectDensity.Value;
452454
Settings.WindowSize = GetValidWindowSize(comboWindowSize.Text);

Source/ORTS.Settings/UserSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ public enum DirectXFeature
206206
public bool DistantMountains { get; set; }
207207
[Default(40000)]
208208
public int DistantMountainsViewingDistance { get; set; }
209+
[Default(true)]
210+
public bool LODViewingExtension { get; set; }
209211
[Default(45)] // MSTS uses 60 FOV horizontally, on 4:3 displays this is 45 FOV vertically (what OR uses).
210212
public int ViewingFOV { get; set; }
211213
[Default(49)]

Source/RunActivity/Viewer3D/Shapes.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,15 @@ public SharedStaticShapeInstance(Viewer viewer, string path, List<StaticShape> s
184184
// Object radius should extend from central location to the furthest instance location PLUS the actual object radius.
185185
ObjectRadius = shapes.Max(s => (Location.Location - s.Location.Location).Length()) + dlHighest.ViewSphereRadius;
186186

187-
// Set to MaxValue so that an object never disappears.
188-
// Many MSTS objects had a LOD of 2km which is the maximum distance that MSTS can handle.
189-
// Open Rails can handle greater distances, so we override the lowest-detail LOD to make sure OR shows shapes further away than 2km.
190-
// See http://www.elvastower.com/forums/index.php?/topic/35301-menu-options/page__view__findpost__p__275531
191-
ObjectViewingDistance = float.MaxValue;
187+
// Object viewing distance is easy because it's based on the outside of the object radius.
188+
if (viewer.Settings.LODViewingExtension)
189+
// Set to MaxValue so that an object never disappears.
190+
// Many MSTS objects had a LOD of 2km which is the maximum distance that MSTS can handle.
191+
// Open Rails can handle greater distances, so we override the lowest-detail LOD to make sure OR shows shapes further away than 2km.
192+
// See http://www.elvastower.com/forums/index.php?/topic/35301-menu-options/page__view__findpost__p__275531
193+
ObjectViewingDistance = float.MaxValue;
194+
else
195+
ObjectViewingDistance = dlLowest.ViewingDistance;
192196
}
193197

194198
// Create all the primitives for the shared shape.
@@ -2522,12 +2526,12 @@ public void PrepareFrame(RenderFrame frame, WorldPosition location, Matrix[] ani
25222526
? lodControl.DistanceLevels[lodControl.DistanceLevels.Length - 1]
25232527
: displayDetail;
25242528

2525-
// Extend the lowest LOD to the maximum viewing distance.
2526-
// Set to MaxValue so that an object never disappears.
2527-
// Many MSTS objects had a LOD of 2km which is the maximum distance that MSTS can handle.
2528-
// Open Rails can handle greater distances, so we override the lowest-detail LOD to make sure OR shows shapes further away than 2km.
2529-
// See http://www.elvastower.com/forums/index.php?/topic/35301-menu-options/page__view__findpost__p__275531
2530-
if (displayDetailLevel == lodControl.DistanceLevels.Length - 1)
2529+
// If set, extend the lowest LOD to the maximum viewing distance.
2530+
if (Viewer.Settings.LODViewingExtension && displayDetailLevel == lodControl.DistanceLevels.Length - 1)
2531+
// Set to MaxValue so that an object never disappears.
2532+
// Many MSTS objects had a LOD of 2km which is the maximum distance that MSTS can handle.
2533+
// Open Rails can handle greater distances, so we override the lowest-detail LOD to make sure OR shows shapes further away than 2km.
2534+
// See http://www.elvastower.com/forums/index.php?/topic/35301-menu-options/page__view__findpost__p__275531
25312535
distanceDetail.ViewingDistance = float.MaxValue;
25322536

25332537
for (var i = 0; i < displayDetail.SubObjects.Length; i++)

0 commit comments

Comments
 (0)