Skip to content

Commit 9b481d8

Browse files
committed
Automatic merge of T1.5.1-1695-gade019506 and 17 pull requests
- Pull request #570 at f11a428: glTF 2.0 support with PBR lighting - Pull request #900 at 4629736: DMI in 3D cab + two more dials - Pull request #1030 at d3ae4a2: Refactor settings, in prep for settings exporter - Pull request #1045 at cc4d53c: Bugfix: Empty Start Time for Explore, and other issues loading from Menu Selection and Content Routes - Pull request #1052 at 5bbc476: Content Manager: Add axle count, and lowest derail force - Pull request #1062 at de91cc4: Train Forces popup Window. - Pull request #1064 at 9b3415e: Add Train Info tab to Help window (F1) - Pull request #1066 at 62c89c1: Log derailment, using TraceInformation. - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #1000 at d8d9709: Locomotive operation from control car - Pull request #1029 at 92c74ef: Superelevation Follow Up Fixes - Pull request #1057 at 50c3789: Switchable brake system - Pull request #1069 at 3f153f0: Mouse wheel control only with Alt – Followup for #1051 - Pull request #1070 at f818e40: Fix a NullReferenceException in TCS scripts - Pull request #1055 at 5c78967: Route Based TTrack Sounds - Pull request #896 at f1681df: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #1049 at 4dd8c4f: Re-organise document storage and access
19 parents b1de692 + ade0195 + f11a428 + 4629736 + d3ae4a2 + cc4d53c + 5bbc476 + de91cc4 + 9b3415e + 62c89c1 + 1f5ba4c + d8d9709 + 92c74ef + 50c3789 + 3f153f0 + f818e40 + 5c78967 + f1681df + 4dd8c4f commit 9b481d8

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Diff for: Source/RunActivity/Content/SceneryShader.fx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int MorphConfig[9]; // 0-5: position of POSITION, NORMAL, TANGENT, TEXCOORD
8585
float MorphWeights[MAX_MORPH_TARGETS]; // the actual morphing animation state
8686

8787
int NumLights; // The number of the lights used
88-
float LightTypes[MAX_LIGHTS]; // 0: directional, 1: point, 2: spot
88+
float LightTypes[MAX_LIGHTS]; // 0: directional, 1: point, 2: spot, 3: headlight
8989
float3 LightPositions[MAX_LIGHTS];
9090
float3 LightDirections[MAX_LIGHTS];
9191
float3 LightColors[MAX_LIGHTS];

Diff for: Source/RunActivity/Viewer3D/Lights.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,12 @@ public void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
272272
LightConeDirection = Vector3.Transform(Vector3.Lerp(ActiveLightCone.Direction1, ActiveLightCone.Direction2, ActiveLightCone.Fade.Y), ShapeXNATranslations[coneIndex]);
273273
LightConeDirection -= ShapeXNATranslations[coneIndex].Translation;
274274
LightConeDirection.Normalize();
275-
// The original shaders followed the phylisophy of wanting 50% brightness at half the range. (LightConeDistance is only the half.) Now we need the full range.
276-
LightConeDistance = 2 * MathHelper.Lerp(ActiveLightCone.Distance1, ActiveLightCone.Distance2, ActiveLightCone.Fade.Y);
275+
LightConeDistance = 4 * MathHelper.Lerp(ActiveLightCone.Distance1, ActiveLightCone.Distance2, ActiveLightCone.Fade.Y);
277276
LightConeOuterAngle = MathHelper.Lerp(ActiveLightCone.Angle1, ActiveLightCone.Angle2, ActiveLightCone.Fade.Y);
278277
var lightConeColor = Vector4.Lerp(ActiveLightCone.Color1, ActiveLightCone.Color2, ActiveLightCone.Fade.Y);
279-
LightConeColor = new Vector3(lightConeColor.X, lightConeColor.Y, lightConeColor.Z);
278+
LightConeColor = new Vector3(lightConeColor.X, lightConeColor.Y, lightConeColor.Z) * lightConeColor.W;
280279

281-
frame.AddLight(LightMode.Spot, LightConePosition, LightConeDirection, LightConeColor, RenderFrame.HeadLightIntensity * lightConeColor.W, LightConeDistance, 0, LightConeOuterAngle, ActiveLightCone.Fade.X, false);
280+
frame.AddLight(LightMode.Headlight, LightConePosition, LightConeDirection, LightConeColor, RenderFrame.HeadLightIntensity, LightConeDistance, 0, LightConeOuterAngle, ActiveLightCone.Fade.X, false);
282281
}
283282
else
284283
{

Diff for: Source/RunActivity/Viewer3D/RenderFrame.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public enum LightMode
7373
{
7474
Directional = 0,
7575
Point = 1,
76-
Spot = 2
76+
Spot = 2,
77+
Headlight = 3
7778
}
7879

7980
public abstract class RenderPrimitive
@@ -392,7 +393,8 @@ public class RenderFrame
392393
static readonly Vector3 MoonGlow = new Vector3(245f / 255f, 243f / 255f, 206f / 255f);
393394
const float SunIntensity = 1;
394395
const float MoonIntensity = SunIntensity / 380000;
395-
public const float HeadLightIntensity = 250000; // See some sample values: https://docs.unity3d.com/Packages/[email protected]/manual/LightUnits.html
396+
//public const float HeadLightIntensity = 250000; // See some sample values: https://docs.unity3d.com/Packages/[email protected]/manual/LightUnits.html
397+
public const float HeadLightIntensity = 4; // Using the old linear attenuation model
396398

397399
const float LIGHT_INTENSITY_ADJUSTMENT_SPOT = 1f;
398400
const float LIGHT_INTENSITY_ADJUSTMENT_POINT = 0.08f; // By visual inspection of PlaysetLightTest at nighttime. Probably should be 1 / 4π = 0.08

0 commit comments

Comments
 (0)