Skip to content

Commit 7346557

Browse files
committed
Automatic merge of T1.5.1-870-ge0bf062eb and 16 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 9c456aa: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 42f1dd9: feat: Improved system information collection - Pull request #903 at 9bead33: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #912 at d595703: New Triple Valve Features Vol. 2 - Pull request #914 at e06fbf1: Adjustments to Duplex steam - Pull request #915 at 6d911d7: Correct calculation error with curve friction - Pull request #917 at 3bbf66e: Lighting Configuration Enhancements
18 parents b2690f1 + e0bf062 + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 42f1dd9 + 9bead33 + 9b0b04f + 6834af0 + d595703 + e06fbf1 + 6d911d7 + 3bbf66e commit 7346557

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ public static void CalculateLightCone(LightState lightState, out Vector3 positio
270270

271271
bool UpdateState()
272272
{
273+
// No need to update lights if there are none
274+
if (Car.Lights == null)
275+
return false;
276+
273277
Debug.Assert(Viewer.PlayerTrain.LeadLocomotive == Viewer.PlayerLocomotive ||Viewer.PlayerTrain.TrainType == Train.TRAINTYPE.AI_PLAYERHOSTING ||
274278
Viewer.PlayerTrain.TrainType == Train.TRAINTYPE.REMOTE || Viewer.PlayerTrain.TrainType == Train.TRAINTYPE.STATIC, "PlayerTrain.LeadLocomotive must be PlayerLocomotive.");
275279
var leadLocomotiveCar = Car.Train?.LeadLocomotive;

Source/RunActivity/Viewer3D/Trains.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ internal void Mark()
102102
foreach (var car in cars.Values)
103103
{
104104
car.Mark();
105-
if (car.lightDrawer != null)
106-
car.lightDrawer.Mark();
105+
car.lightDrawer?.Mark();
107106
}
108107
CABTextureManager.Mark(Viewer);
109108
}
@@ -151,8 +150,7 @@ public void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
151150
car.PrepareFrame(frame, elapsedTime);
152151
// Do the lights separately for proper alpha sorting
153152
foreach (var car in cars.Values)
154-
if (car.lightDrawer != null)
155-
car.lightDrawer.PrepareFrame(frame, elapsedTime);
153+
car.lightDrawer?.PrepareFrame(frame, elapsedTime);
156154
}
157155

158156
TrainCarViewer LoadCar(TrainCar car)
@@ -165,7 +163,8 @@ TrainCarViewer LoadCar(TrainCar car)
165163
car is MSTSLocomotive ? new MSTSLocomotiveViewer(Viewer, car as MSTSLocomotive) :
166164
car is MSTSWagon ? new MSTSWagonViewer(Viewer, car as MSTSWagon) :
167165
null;
168-
carViewer.lightDrawer = new LightViewer(Viewer, car, carViewer);
166+
if (car.Lights != null) // Don't make a light viewer when there are no lights
167+
carViewer.lightDrawer = new LightViewer(Viewer, car, carViewer);
169168
return carViewer;
170169
}
171170
}

0 commit comments

Comments
 (0)