Skip to content

Commit 6e742ab

Browse files
author
Chris Jakeman
committed
Removed option ConditionalLoadOfDayOrNightTextures
1 parent 2f1cdf2 commit 6e742ab

File tree

9 files changed

+47
-65
lines changed

9 files changed

+47
-65
lines changed
-11 KB
Loading

Source/Documentation/Manual/options.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -606,17 +606,6 @@ When this option is selected, when OR is loading the shape (.s) files it
606606
will report errors in syntax and structure (even if these don't cause
607607
runtime errors) in the :ref:`Log file <driving-logfile>` ``OpenRailsLog.txt`` on the desktop.
608608

609-
Load day/night textures only when needed
610-
----------------------------------------
611-
612-
As a default OR loads night textures together with the day textures both at
613-
daytime and nighttime. When this option is selected, to reduce loading time and reduce
614-
memory used, night textures are not loaded in the daytime and are only
615-
loaded at sunset (if the game continues through sunset time); analogously day
616-
textures are not loaded in the nighttime if the related night textures are
617-
available, and are only loaded at sunrise (if the game continues through sunrise
618-
time).
619-
620609
Signal light glow
621610
-----------------
622611

Source/Menu/Options.Designer.cs

Lines changed: 18 additions & 31 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: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ orderby folder.Key
317317
numericPerformanceTunerTarget.Value = Settings.PerformanceTunerTarget;
318318
trackLODBias.Value = Settings.LODBias;
319319
trackLODBias_ValueChanged(null, null);
320-
checkConditionalLoadOfNightTextures.Checked = Settings.ConditionalLoadOfDayOrNightTextures;
321320
checkSignalLightGlow.Checked = Settings.SignalLightGlow;
322321
checkPreferDDSTexture.Checked = Settings.PreferDDSTexture;
323322
checkUseLocationPassingPaths.Checked = Settings.UseLocationPassingPaths;
@@ -511,7 +510,6 @@ void buttonOK_Click(object sender, EventArgs e)
511510
Settings.PerformanceTuner = checkPerformanceTuner.Checked;
512511
Settings.PerformanceTunerTarget = (int)numericPerformanceTunerTarget.Value;
513512
Settings.LODBias = trackLODBias.Value;
514-
Settings.ConditionalLoadOfDayOrNightTextures = checkConditionalLoadOfNightTextures.Checked;
515513
Settings.SignalLightGlow = checkSignalLightGlow.Checked;
516514
Settings.PreferDDSTexture = checkPreferDDSTexture.Checked;
517515
Settings.UseLocationPassingPaths = checkUseLocationPassingPaths.Checked;

Source/Menu/Options.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,4 @@
123123
<metadata name="bindingSourceContent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124124
<value>114, 17</value>
125125
</metadata>
126-
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127-
<value>17, 17</value>
128-
</metadata>
129126
</root>

Source/ORTS.Settings/UserSettings.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ public enum DirectXFeature
323323
public bool AdhesionProportionalToWeather { get; set; }
324324
[Default(false)]
325325
public bool NoForcedRedAtStationStops { get; set; }
326-
[Default(false)]
327-
public bool ConditionalLoadOfDayOrNightTextures { get; set; }
328326
[Default(100)]
329327
public int PrecipitationBoxHeight { get; set; }
330328
[Default(500)]

Source/RunActivity/Viewer3D/Materials.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,21 +720,21 @@ public SceneryMaterial(Viewer viewer, string texturePath, SceneryMaterialOptions
720720
Texture = SharedMaterialManager.MissingTexture;
721721
NightTexture = SharedMaterialManager.MissingTexture;
722722
// <CSComment> if "trainset" is in the path (true for night textures for 3DCabs) deferred load of night textures is disabled
723-
if (!String.IsNullOrEmpty(texturePath) && (Options & SceneryMaterialOptions.NightTexture) != 0 && ((!viewer.DontLoadNightTextures && !viewer.DontLoadDayTextures)
723+
if (!String.IsNullOrEmpty(texturePath) && (Options & SceneryMaterialOptions.NightTexture) != 0 && ((!viewer.IsDaytime && !viewer.IsNighttime)
724724
|| TexturePath.Contains(@"\trainset\")))
725725
{
726726
var nightTexturePath = Helpers.GetNightTextureFile(Viewer.Simulator, texturePath);
727727
if (!String.IsNullOrEmpty(nightTexturePath))
728728
NightTexture = Viewer.TextureManager.Get(nightTexturePath.ToLower());
729729
Texture = Viewer.TextureManager.Get(texturePath, true);
730730
}
731-
else if ((Options & SceneryMaterialOptions.NightTexture) != 0 && viewer.DontLoadNightTextures)
731+
else if ((Options & SceneryMaterialOptions.NightTexture) != 0 && viewer.IsDaytime)
732732
{
733733
viewer.NightTexturesNotLoaded = true;
734734
Texture = Viewer.TextureManager.Get(texturePath, true);
735735
}
736736

737-
else if ((Options & SceneryMaterialOptions.NightTexture) != 0 && viewer.DontLoadDayTextures)
737+
else if ((Options & SceneryMaterialOptions.NightTexture) != 0 && viewer.IsNighttime)
738738
{
739739
var nightTexturePath = Helpers.GetNightTextureFile(Viewer.Simulator, texturePath);
740740
if (!String.IsNullOrEmpty(nightTexturePath))

Source/RunActivity/Viewer3D/Scenery.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ public SceneryDrawer(Viewer viewer)
7777
public void Load()
7878
{
7979
var cancellation = Viewer.LoaderProcess.CancellationToken;
80-
Viewer.DontLoadNightTextures = (Program.Simulator.Settings.ConditionalLoadOfDayOrNightTextures &&
81-
((Viewer.MaterialManager.sunDirection.Y > 0.05f && Program.Simulator.ClockTime % 86400 < 43200) ||
82-
(Viewer.MaterialManager.sunDirection.Y > 0.15f && Program.Simulator.ClockTime % 86400 >= 43200))) ? true : false;
83-
Viewer.DontLoadDayTextures = (Program.Simulator.Settings.ConditionalLoadOfDayOrNightTextures &&
84-
((Viewer.MaterialManager.sunDirection.Y < -0.05f && Program.Simulator.ClockTime % 86400 >= 43200) ||
85-
(Viewer.MaterialManager.sunDirection.Y < -0.15f && Program.Simulator.ClockTime % 86400 < 43200))) ? true : false;
80+
8681
if (TileX != VisibleTileX || TileZ != VisibleTileZ)
8782
{
8883
TileX = VisibleTileX;
@@ -113,7 +108,7 @@ public void Load()
113108
Viewer.tryLoadingNightTextures = true; // when Tiles loaded change you can try
114109
Viewer.tryLoadingDayTextures = true; // when Tiles loaded change you can try
115110
}
116-
else if (Viewer.NightTexturesNotLoaded && Program.Simulator.ClockTime % 86400 >= 43200 && Viewer.tryLoadingNightTextures)
111+
else if (Viewer.NightTexturesNotLoaded && !Viewer.IsBeforeNoon && Viewer.tryLoadingNightTextures)
117112
{
118113
var sunHeight = Viewer.MaterialManager.sunDirection.Y;
119114
if (sunHeight < 0.10f && sunHeight > 0.01)
@@ -133,7 +128,7 @@ public void Load()
133128
else if (sunHeight <= 0.01)
134129
Viewer.NightTexturesNotLoaded = false; // too late to try, we must give up and we don't load the night textures
135130
}
136-
else if (Viewer.DayTexturesNotLoaded && Program.Simulator.ClockTime % 86400 < 43200 && Viewer.tryLoadingDayTextures)
131+
else if (Viewer.DayTexturesNotLoaded && Viewer.IsBeforeNoon && Viewer.tryLoadingDayTextures)
137132
{
138133
var sunHeight = Viewer.MaterialManager.sunDirection.Y;
139134
if (sunHeight > -0.10f && sunHeight < -0.01)

Source/RunActivity/Viewer3D/Viewer.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,30 @@ enum VisibilityState
216216
public float CabTextureInverseRatio = 0.75f; // default of inverse of cab texture ratio
217217

218218
public CommandLog Log { get { return Simulator.Log; } }
219+
public bool IsBeforeNoon
220+
{
221+
get
222+
{
223+
return Program.Simulator.ClockTime % 86400 < 43200;
224+
}
225+
}
219226

220-
public bool DontLoadNightTextures; // Checkbox set and time of day allows not to load textures
221-
public bool DontLoadDayTextures; // Checkbox set and time of day allows not to load textures
227+
public bool IsDaytime // After dawn and before dusk, so definitely daytime
228+
{
229+
get
230+
{
231+
return (MaterialManager.sunDirection.Y > 0.05f && IsBeforeNoon)
232+
|| (MaterialManager.sunDirection.Y > 0.15f && !IsBeforeNoon);
233+
}
234+
}
235+
public bool IsNighttime // Before dawn and after dusk, so definitely nighttime
236+
{
237+
get
238+
{
239+
return (MaterialManager.sunDirection.Y < -0.05f && !IsBeforeNoon)
240+
|| (MaterialManager.sunDirection.Y < -0.15f && IsBeforeNoon);
241+
}
242+
}
222243
public bool NightTexturesNotLoaded; // At least one night texture hasn't been loaded
223244
public bool DayTexturesNotLoaded; // At least one day texture hasn't been loaded
224245
public long LoadMemoryThreshold; // Above this threshold loader doesn't bulk load day or night textures
@@ -507,11 +528,8 @@ internal void Initialize()
507528
// This ensures that a) we have all the required objects loaded when the 3D view first appears and b) that
508529
// all loading is performed on a single thread that we can handle in debugging and tracing.
509530
World.LoadPrep();
510-
if (Simulator.Settings.ConditionalLoadOfDayOrNightTextures) // We need to compute sun height only in this case
511-
{
512531
MaterialManager.LoadPrep();
513532
LoadMemoryThreshold = (long)HUDWindow.GetVirtualAddressLimit() - 512 * 1024 * 1024;
514-
}
515533
Load();
516534

517535
// MUST be after loading is done! (Or we try and load shapes on the main thread.)

0 commit comments

Comments
 (0)