Skip to content

Commit 0d6334e

Browse files
committed
Automatic merge of T1.5.1-722-g01614a154 and 18 pull requests
- Pull request #570 at 7a89d90: 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 #865 at 3b5a2fe: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 481ed9d: Blueprint/train car operations UI window - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at 697a4b6: Scene viewer extension to TrackViewer - Pull request #888 at d7daf62: docs: Document player application model - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #898 at e271395: Extra line with all the arguments for debugging purposes in logfile - Pull request #900 at 42ea7ad: DMI updates
20 parents 82659c0 + 01614a1 + 7a89d90 + d00beb9 + 3b5a2fe + f8dbeab + 43bf33e + f92de76 + 481ed9d + c81447b + 697a4b6 + d7daf62 + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 0a9d939 + e271395 + 42ea7ad commit 0d6334e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Source/RunActivity/Viewer3D/GltfShape.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,13 @@ internal Stream GetBufferView(int? bufferViewNumber, int accessorByteOffset, out
711711
return stream;
712712
}
713713

714-
internal int GetSizeInBytes(Accessor accessor) => GetComponentNumber(accessor.Type) * GetComponentSizeInBytes(accessor.ComponentType);
714+
internal int GetSizeInBytes(Accessor accessor)
715+
{
716+
var componentNumber = GetComponentNumber(accessor.Type);
717+
var size = componentNumber * GetComponentSizeInBytes(accessor.ComponentType);
718+
var padding = componentNumber == 1 ? 0 : size % 4; // do not add padding to the index buffers
719+
return size + padding;
720+
}
715721

716722
int GetComponentNumber(Accessor.TypeEnum type)
717723
{
@@ -773,6 +779,7 @@ VertexElementFormat GetVertexElementFormat(Accessor accessor, bool msfsFlavoured
773779
case Accessor.TypeEnum.VEC4 when accessor.ComponentType == Accessor.ComponentTypeEnum.FLOAT: return VertexElementFormat.Vector4;
774780

775781
// MSFS twisted out, reversed definitions:
782+
// non-normalized, VEC3 FLOAT, VEC4 BYTE, VEC2 SHORT, VEC4 USHORT, SCALAR FLOAT
776783
case Accessor.TypeEnum.VEC2 when accessor.ComponentType == Accessor.ComponentTypeEnum.SHORT && msfsFlavoured: return accessor.Normalized ? VertexElementFormat.Short2 : VertexElementFormat.HalfVector2;
777784
case Accessor.TypeEnum.VEC2 when accessor.ComponentType == Accessor.ComponentTypeEnum.UNSIGNED_SHORT && msfsFlavoured: return accessor.Normalized ? VertexElementFormat.Short2 : VertexElementFormat.HalfVector2;
778785
case Accessor.TypeEnum.VEC4 when accessor.ComponentType == Accessor.ComponentTypeEnum.BYTE && msfsFlavoured: return VertexElementFormat.Color;

Source/RunActivity/Viewer3D/RenderFrame.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public class RenderFrame
390390
static readonly Vector3 MoonGlow = new Vector3(245f / 255f, 243f / 255f, 206f / 255f);
391391
const float SunIntensity = 1;
392392
const float MoonIntensity = SunIntensity / 380000;
393-
float HeadLightIntensity = 50000; // Can be 10 in case of linear calculation method
393+
float HeadLightIntensity = 25000; // See some sample values: https://docs.unity3d.com/Packages/com.unity.cloud.gltfast@5.2/manual/LightUnits.html
394394

395395
// Local shadow map data.
396396
Matrix[] ShadowMapLightView;
@@ -589,6 +589,11 @@ public void PrepareFrame(Viewer viewer)
589589
}
590590
lastLightState = lightState;
591591
}
592+
else
593+
{
594+
fadeStartTimer = 0;
595+
fadeDuration = 0;
596+
}
592597
if (SolarDirection.Y <= -0.05)
593598
{
594599
clampValue = 1; // at nighttime max headlight

0 commit comments

Comments
 (0)