Skip to content

Commit d56c11a

Browse files
authored
Merge pull request #663 from cjakeman/menu-option-LOD-to-horizon
Restores option 02g removed in PR#589
2 parents e446122 + a1ecce2 commit d56c11a

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
@@ -206,16 +206,17 @@ The default setting is checked.
206206
Viewing distance
207207
----------------
208208

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

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

215+
Note: Some routes are optimized for a viewing distance of 2km as this is the maximum provided by MSTS.
216+
217217
The default distance is 2km.
218218

219+
219220
Distant mountains
220221
-----------------
221222

@@ -225,10 +226,33 @@ Note: "Distant Mountains" are present in the route if it has a folder called LO_
225226

226227
The default setting is checked.
227228

228-
The default distance is 40km
229+
The default distance is 40km.
229230

230231
.. image:: images/options-mountains.png
231232

233+
234+
Extend object maximum viewing distance to horizon
235+
-------------------------------------------------
236+
237+
With this option selected, all objects viewable up to the viewing distance
238+
(as defined above) are displayed, even if they have a level of detail (LOD) that is less distant.
239+
240+
Without this option, ORTS only displays objects up to their peak distance set by their level of detail (LOD)
241+
or the viewing distance, whichever is less.
242+
243+
Selecting this option shows all the objects that should be in view but it may reduce the frame rate.
244+
MSTS limits the viewing distance to just 2km and the peak LOD distances are usually 2km, so this option
245+
is especially useful for viewing routes created for MSTS at distances above 2km.
246+
247+
However, for routes that make good use of LOD settings, showing the objects that should be in view can be
248+
achieved at higher frame rates by unchecking this option.
249+
For example, if the viewing distance is 10km and the content has been created with some large objects having
250+
peak distance LODs set at 5km and smaller objects having LODs which are much shorter, then this strategy
251+
will show all the objects that should be in view without reducing the frame rate.
252+
253+
The default setting is checked.
254+
255+
232256
Viewing vertical FOV
233257
--------------------
234258

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
@@ -165,6 +165,7 @@ public OptionsForm(UserSettings settings, UpdateManager updateManager, bool init
165165
labelDistantMountainsViewingDistance.Enabled = checkDistantMountains.Checked;
166166
numericDistantMountainsViewingDistance.Enabled = checkDistantMountains.Checked;
167167
numericDistantMountainsViewingDistance.Value = Settings.DistantMountainsViewingDistance / 1000;
168+
checkLODViewingExtension.Checked = Settings.LODViewingExtension;
168169
numericViewingFOV.Value = Settings.ViewingFOV;
169170
numericWorldObjectDensity.Value = Settings.WorldObjectDensity;
170171
trackDayAmbientLight.Value = Settings.DayAmbientLight;
@@ -445,6 +446,7 @@ void buttonOK_Click(object sender, EventArgs e)
445446
Settings.ViewingDistance = (int)numericViewingDistance.Value;
446447
Settings.DistantMountains = checkDistantMountains.Checked;
447448
Settings.DistantMountainsViewingDistance = (int)numericDistantMountainsViewingDistance.Value * 1000;
449+
Settings.LODViewingExtension = checkLODViewingExtension.Checked;
448450
Settings.ViewingFOV = (int)numericViewingFOV.Value;
449451
Settings.WorldObjectDensity = (int)numericWorldObjectDensity.Value;
450452

Source/ORTS.Settings/UserSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ public enum DirectXFeature
195195
public bool DistantMountains { get; set; }
196196
[Default(40000)]
197197
public int DistantMountainsViewingDistance { get; set; }
198+
[Default(true)]
199+
public bool LODViewingExtension { get; set; }
198200
[Default(45)] // MSTS uses 60 FOV horizontally, on 4:3 displays this is 45 FOV vertically (what OR uses).
199201
public int ViewingFOV { get; set; }
200202
[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)