Skip to content

Commit

Permalink
Automatic merge of T1.5.1-271-g58e67675d and 35 pull requests
Browse files Browse the repository at this point in the history
- Pull request #570 at c466911: Experimental glTF 2.0 support with PBR lighting
- Pull request #722 at fb9079e: Fix Windows Forms deprecations in ActivityEditor
- Pull request #732 at 83002d7: Improvements for air brakes
- Pull request #751 at f947f29: Web interface to control cab controls with external hardware
- Pull request #753 at ab8fe32: Extends CabControls for user input
- Pull request #767 at 4cb5c77: Refine sunrise and sunset
- Pull request #769 at 1a99f43: Partial turntables https://blueprints.launchpad.net/or/+spec/partial-turntable
- Pull request #771 at c380043: Action on Hold Signal is no longer invalidated if train is not stoppe…
- Pull request #772 at 36c3662: Update tt train
- Pull request #774 at d3f8c2e: Use variable OrgAINumber for all train to train references
- Pull request #775 at d84c8d8: Update turntable pools
- Pull request #776 at 7b6af67: Update Receivers in Viewer.cs
- Pull request #777 at 7724f2b: Save and restore ClearMovingTable action (for timetables)
- Pull request #778 at 779a819: Correction for player locomotive on turntable
- Pull request #779 at 87c34a7: Remove forced processed ClearSection actions
- Pull request #780 at 5b3f246: Process passing time
- Pull request #781 at 4d9c3fb: Correct update of pending speed limits for timetable mode
- Pull request #782 at 23c41b5: Nu full physics update is required for trains in state AIStatic
- Pull request #783 at 083bc6c: Move CreateInPool from AI to Pools
- Pull request #784 at 1c37be3: Incorrect distance along track
- Pull request #785 at fd121be: Incorrect calculation of distance to train ahead
- Pull request #786 at f2c5d2d: Improve syntax check on timetable files
- Pull request #787 at e0ad658: Improve debug output for turntable pools
- Pull request #788 at 94a73d5: Improve Debug Outputs for TTTrain.cs
- Pull request #789 at 81b11f7: Avoid error on inserting train without start time
- Pull request #790 at 36a9921: Correct crash in TrainCar.cs
- Pull request #791 at 5bc890b: Correct update for Switchstand signalscript function
- Pull request #792 at f6c16fb: Correct required actions
- Pull request #793 at 8897021: Correct errors in Turntables.cs
- Pull request #794 at 6d2bf04: Use reverse path in TT Pool
- Pull request #795 at 79979e2: Accept SpeedMPS as dimension for Approach Control Speed definition
- Pull request #796 at a67ee61: fix: Resume from Save fails - filenames do not match
- Pull request #797 at 7ced1fe: To use enum for ControlGearBoxType
- Pull request #798 at 4b6141d: Temporary bug fix for https://bugs.launchpad.net/or/+bug/2004100 Casting error crash
- Pull request #800 at 3a0946d: Changes to migrate from Launchpad Bugs to GitHub Issues
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 56 deletions.
52 changes: 3 additions & 49 deletions Source/RunActivity/Content/SceneryShader.fx
Expand Up @@ -52,19 +52,12 @@ texture ImageTexture; // .s: linear RGBA, glTF (PBR): 8 bit sRGB + linear A
texture OverlayTexture;
float OverlayScale;

// When compiling the shaders at runtime, these defines can be set in the Shaders.cs, commenting these out.
// Currently the shaders are being precombiled, so these must be defined here as well.
// Keep them in sync with the values defined in RenderProcess.cs
// Keep these in sync with the values defined in RenderProcess.cs
// MAX_LIGHTS must not be less than 2
//#define LEVEL_9_3
#ifdef LEVEL_9_3
#define MAX_LIGHTS 2
#define MAX_BONES 1
#else
// MAX_BONES must not be less than 1
#define MAX_LIGHTS 20
#define MAX_BONES 50
#define CLEARCOAT
#endif

float4x4 Bones[MAX_BONES]; // model -> world [max number of bones]
float4 BaseColorFactor; // glTF linear color multiplier
Expand Down Expand Up @@ -104,7 +97,7 @@ static const float MinRoughness = 0.04;
static const int LightType_Directional = 0;
static const int LightType_Point = 1;
static const int LightType_Spot = 2;
static const int LightType_Headlight = 3;
static const int LightType_Headlight = 3; // Pre-PBR linear attenuated headlight. Kept for testing purposes.

static const float FullBrightness = 1.0;
static const float ShadowBrightness = 0.5;
Expand Down Expand Up @@ -1221,13 +1214,8 @@ float4 PSSignalLight(in VERTEX_OUTPUT In) : COLOR0

technique Image {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSImageNoClamp();
#else
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSImageNoClamp();
#endif
}
}

Expand All @@ -1254,41 +1242,22 @@ technique PbrSkinned {

technique Transfer {
pass Pass_0 {
#ifdef LEVEL_9_3
// I can't make it work. Reports error X5589: Invalid const register num: 32. Max allowed is 31.
// But I brought the number below 31 as far as I can tell, so it must indicate something unrelevant, not making sense to me...
//VertexShader = compile vs_4_0_level_9_3 VSTransfer();
//PixelShader = compile ps_4_0_level_9_3 PSImageClamp();
VertexShader = compile vs_4_0 VSTransfer();
PixelShader = compile ps_4_0 PSImageClamp();
#else
VertexShader = compile vs_4_0 VSTransfer();
PixelShader = compile ps_4_0 PSImageClamp();
#endif
}
}

technique Forest {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0_level_9_3 VSForest();
PixelShader = compile ps_4_0_level_9_3 PSVegetation();
#else
VertexShader = compile vs_4_0 VSForest();
PixelShader = compile ps_4_0 PSVegetation();
#endif
}
}

technique Vegetation {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0_level_9_3 VSGeneral();
PixelShader = compile ps_4_0_level_9_3 PSVegetation();
#else
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSVegetation();
#endif
}
}

Expand All @@ -1301,37 +1270,22 @@ technique Terrain {

technique DarkShade {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0_level_9_3 VSGeneral();
PixelShader = compile ps_4_0_level_9_3 PSDarkShade();
#else
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSDarkShade();
#endif
}
}

technique HalfBright {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0_level_9_3 VSGeneral();
PixelShader = compile ps_4_0_level_9_3 PSHalfBright();
#else
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSHalfBright();
#endif
}
}

technique FullBright {
pass Pass_0 {
#ifdef LEVEL_9_3
VertexShader = compile vs_4_0_level_9_3 VSGeneral();
PixelShader = compile ps_4_0_level_9_3 PSFullBright();
#else
VertexShader = compile vs_4_0 VSGeneral();
PixelShader = compile ps_4_0 PSFullBright();
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/RunActivity/Viewer3D/GltfShape.cs
Expand Up @@ -561,7 +561,7 @@ public GltfDistanceLevel(GltfShape shape, int lodId, Gltf gltfFile, string gltfF

if (ConsistGenerator.GltfVisualTestRun)
{
// Assign the first four animations to Wipers [V], Item1Continuous [Shift+,], Item2Continuous [Shift+.] respectively,
// Assign the first three animations to Wipers [V], Item1Continuous [Shift+,], Item2Continuous [Shift+.] respectively,
// because these are the ones capable of playing a loop.
for (var i = 0; i < shape.GltfAnimations.Count; i++)
shape.MatrixNames[i] = TestControls[i % TestControls.Length];
Expand Down
8 changes: 2 additions & 6 deletions Source/RunActivity/Viewer3D/RenderFrame.cs
Expand Up @@ -608,12 +608,7 @@ public void PrepareFrame(Viewer viewer)
intensity *= HeadLightIntensity;

if (intensity > 0)
{
// The original shader used linear range attenuation with full-lit pixels within the range, that's what the LightManager.LightType.Headlight simulates:
//AddLight((LightMode)3, lightDrawer.LightConePosition, lightDrawer.LightConeDirection, color, intensity, range, 1, lightDrawer.LightConeMinDotProduct);
// The PBR spot light uses invere-sqared attenuation with realisticcaly lit pixels within the range, use LightManager.LightType.Spot for that:
AddLight(LightMode.Spot, lightDrawer.LightConePosition, lightDrawer.LightConeDirection, color, intensity, range, 1, lightDrawer.LightConeMinDotProduct);
}
}
}

Expand Down Expand Up @@ -1078,7 +1073,8 @@ void DrawSequencesDistantMountains(GraphicsDevice graphicsDevice, bool logging)

public void AddLight(ShapeLight light, ref Matrix worldMatrix, float lodBias)
{
if (light != null)
// Do not allow directional light injection. That is reserved to the sun and the moon.
if (light != null && light.Type != LightMode.Directional)
AddLight(light.Type, worldMatrix.Translation, Vector3.TransformNormal(-Vector3.UnitZ, worldMatrix), light.Color, light.Intensity, light.Range, light.InnerConeCos, light.OuterConeCos);
}
public void AddLight(Vector3 direction, Vector3 color, float intensity) => AddLight(LightMode.Directional, Vector3.Zero, direction, color, intensity, -1, 0, 0);
Expand Down

0 comments on commit ebea3b9

Please sign in to comment.