Skip to content

Commit

Permalink
Automatic merge of T1.5-rc1-55-g01de7b11e and 9 pull requests
Browse files Browse the repository at this point in the history
- Pull request #570 at 824f96f: Experimental glTF 2.0 support with PBR lighting
- Pull request #630 at 704731a: Sky Color Fix (Addresses Trello Roadmap Card #367 for More accurate sunrise and sunset)
- Pull request #652 at 918fdb1: Add button functions to Raildriver
- Pull request #677 at 0855181: Correct double heading bug
- Pull request #688 at e44897d: adds Help Icons to Video tab
- Pull request #692 at 20de7da: Italian translation for OR 1.5
- Pull request #693 at 453ac3d: French locales
- Pull request #699 at 6baf43d: Bug fix for https://bugs.launchpad.net/or/+bug/1987453. Web: HUD/Force Information, some labels not visible.
- Pull request #705 at 80408da: feat: Updated Russian translations
  • Loading branch information
openrails-bot committed Sep 4, 2022
11 parents 73f852e + 01de7b1 + 824f96f + 704731a + 918fdb1 + 0855181 + e44897d + 20de7da + 453ac3d + 6baf43d + 80408da commit 70fe87a
Showing 1 changed file with 64 additions and 64 deletions.
128 changes: 64 additions & 64 deletions Source/RunActivity/Viewer3D/Shapes.cs
Expand Up @@ -1592,37 +1592,37 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
}
else
{
if (Turntable.GoToTarget || Turntable.GoToAutoTarget)
{
nextKey = Turntable.TargetY / (2 * (float)Math.PI) * animation.FrameCount;
}
else
{
float moveFrames;
if (Turntable.Counterclockwise)
moveFrames = animation.FrameRate * elapsedTime.ClockSeconds;
else if (Turntable.Clockwise)
moveFrames = -animation.FrameRate * elapsedTime.ClockSeconds;
if (Turntable.GoToTarget || Turntable.GoToAutoTarget)
{
nextKey = Turntable.TargetY / (2 * (float)Math.PI) * animation.FrameCount;
}
else
moveFrames = 0;
nextKey = AnimationKey + moveFrames;
}
AnimationKey = nextKey % animation.FrameCount;
if (AnimationKey < 0)
AnimationKey += animation.FrameCount;
Turntable.YAngle = MathHelper.WrapAngle(nextKey / animation.FrameCount * 2 * (float)Math.PI);
{
float moveFrames;
if (Turntable.Counterclockwise)
moveFrames = animation.FrameRate * elapsedTime.ClockSeconds;
else if (Turntable.Clockwise)
moveFrames = -animation.FrameRate * elapsedTime.ClockSeconds;
else
moveFrames = 0;
nextKey = AnimationKey + moveFrames;
}
AnimationKey = nextKey % animation.FrameCount;
if (AnimationKey < 0)
AnimationKey += animation.FrameCount;
Turntable.YAngle = MathHelper.WrapAngle(nextKey / animation.FrameCount * 2 * (float)Math.PI);

if ((Turntable.Clockwise || Turntable.Counterclockwise || Turntable.AutoClockwise || Turntable.AutoCounterclockwise) && !Rotating)
{
Rotating = true;
if (Sound != null) Sound.HandleEvent(Turntable.TrainsOnMovingTable.Count == 1 &&
Turntable.TrainsOnMovingTable[0].FrontOnBoard && Turntable.TrainsOnMovingTable[0].BackOnBoard ? Event.MovingTableMovingLoaded : Event.MovingTableMovingEmpty);
}
else if ((!Turntable.Clockwise && !Turntable.Counterclockwise && !Turntable.AutoClockwise && !Turntable.AutoCounterclockwise && Rotating))
{
Rotating = false;
if (Sound != null) Sound.HandleEvent(Event.MovingTableStopped);
}
if ((Turntable.Clockwise || Turntable.Counterclockwise || Turntable.AutoClockwise || Turntable.AutoCounterclockwise) && !Rotating)
{
Rotating = true;
if (Sound != null) Sound.HandleEvent(Turntable.TrainsOnMovingTable.Count == 1 &&
Turntable.TrainsOnMovingTable[0].FrontOnBoard && Turntable.TrainsOnMovingTable[0].BackOnBoard ? Event.MovingTableMovingLoaded : Event.MovingTableMovingEmpty);
}
else if ((!Turntable.Clockwise && !Turntable.Counterclockwise && !Turntable.AutoClockwise && !Turntable.AutoCounterclockwise && Rotating))
{
Rotating = false;
if (Sound != null) Sound.HandleEvent(Event.MovingTableStopped);
}
}
// Update the pose for each matrix
for (var matrix = 0; matrix < SharedShape.Matrices.Length; ++matrix)
Expand Down Expand Up @@ -1701,35 +1701,35 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
}
else
{
if (Transfertable.GoToTarget)
{
AnimationKey = (Transfertable.TargetOffset - Transfertable.CenterOffsetComponent) / Transfertable.Span * SharedShape.Animations[0].FrameCount;
}
if (Transfertable.GoToTarget)
{
AnimationKey = (Transfertable.TargetOffset - Transfertable.CenterOffsetComponent) / Transfertable.Span * SharedShape.Animations[0].FrameCount;
}

else if (Transfertable.Forward)
{
AnimationKey += SharedShape.Animations[0].FrameRate * elapsedTime.ClockSeconds;
}
else if (Transfertable.Reverse)
{
AnimationKey -= SharedShape.Animations[0].FrameRate * elapsedTime.ClockSeconds;
}
if (AnimationKey > SharedShape.Animations[0].FrameCount) AnimationKey = SharedShape.Animations[0].FrameCount;
if (AnimationKey < 0) AnimationKey = 0;
else if (Transfertable.Forward)
{
AnimationKey += SharedShape.Animations[0].FrameRate * elapsedTime.ClockSeconds;
}
else if (Transfertable.Reverse)
{
AnimationKey -= SharedShape.Animations[0].FrameRate * elapsedTime.ClockSeconds;
}
if (AnimationKey > SharedShape.Animations[0].FrameCount) AnimationKey = SharedShape.Animations[0].FrameCount;
if (AnimationKey < 0) AnimationKey = 0;

Transfertable.OffsetPos = AnimationKey / SharedShape.Animations[0].FrameCount * Transfertable.Span + Transfertable.CenterOffsetComponent;
Transfertable.OffsetPos = AnimationKey / SharedShape.Animations[0].FrameCount * Transfertable.Span + Transfertable.CenterOffsetComponent;

if ((Transfertable.Forward || Transfertable.Reverse) && !Translating)
{
Translating = true;
if (Sound != null) Sound.HandleEvent(Transfertable.TrainsOnMovingTable.Count == 1 &&
Transfertable.TrainsOnMovingTable[0].FrontOnBoard && Transfertable.TrainsOnMovingTable[0].BackOnBoard ? Event.MovingTableMovingLoaded : Event.MovingTableMovingEmpty);
}
else if ((!Transfertable.Forward && !Transfertable.Reverse && Translating))
{
Translating = false;
if (Sound != null) Sound.HandleEvent(Event.MovingTableStopped);
}
if ((Transfertable.Forward || Transfertable.Reverse) && !Translating)
{
Translating = true;
if (Sound != null) Sound.HandleEvent(Transfertable.TrainsOnMovingTable.Count == 1 &&
Transfertable.TrainsOnMovingTable[0].FrontOnBoard && Transfertable.TrainsOnMovingTable[0].BackOnBoard ? Event.MovingTableMovingLoaded : Event.MovingTableMovingEmpty);
}
else if ((!Transfertable.Forward && !Transfertable.Reverse && Translating))
{
Translating = false;
if (Sound != null) Sound.HandleEvent(Event.MovingTableStopped);
}
}

// Update the pose for each matrix
Expand Down Expand Up @@ -1788,7 +1788,7 @@ public override void Draw(GraphicsDevice graphicsDevice)
graphicsDevice.SetVertexBuffers(VertexBufferBindings);
if (IndexBuffer != null)
{
graphicsDevice.Indices = IndexBuffer;
graphicsDevice.Indices = IndexBuffer;
graphicsDevice.DrawIndexedPrimitives(PrimitiveType, baseVertex: 0, startIndex: 0, primitiveCount: PrimitiveCount);
}
else
Expand Down Expand Up @@ -2581,8 +2581,8 @@ public void PrepareFrame(RenderFrame frame, WorldPosition location, Matrix[] ani
else
{
// .s lod-ding is based on distance levels
while ((displayDetailLevel > 0) && Viewer.Camera.InRange(mstsLocation, lodControl.DistanceLevels[displayDetailLevel - 1].ViewSphereRadius, lodControl.DistanceLevels[displayDetailLevel - 1].ViewingDistance * lodBias))
displayDetailLevel--;
while ((displayDetailLevel > 0) && Viewer.Camera.InRange(mstsLocation, lodControl.DistanceLevels[displayDetailLevel - 1].ViewSphereRadius, lodControl.DistanceLevels[displayDetailLevel - 1].ViewingDistance * lodBias))
displayDetailLevel--;
}
}

Expand Down Expand Up @@ -2629,12 +2629,12 @@ public virtual Matrix SetRenderMatrices(ShapePrimitive shapePrimitive, Matrix[]
bones = null; // standard scenery material has no skin and bones
var xnaMatrix = Matrix.Identity;
var hi = shapePrimitive.HierarchyIndex;
while (hi >= 0 && hi < shapePrimitive.Hierarchy.Length)
{
Matrix.Multiply(ref xnaMatrix, ref animatedXNAMatrices[hi], out xnaMatrix);
hi = shapePrimitive.Hierarchy[hi];
}
Matrix.Multiply(ref xnaMatrix, ref xnaDTileTranslation, out xnaMatrix);
while (hi >= 0 && hi < shapePrimitive.Hierarchy.Length)
{
Matrix.Multiply(ref xnaMatrix, ref animatedXNAMatrices[hi], out xnaMatrix);
hi = shapePrimitive.Hierarchy[hi];
}
Matrix.Multiply(ref xnaMatrix, ref xnaDTileTranslation, out xnaMatrix);
return xnaMatrix;
}

Expand Down

0 comments on commit 70fe87a

Please sign in to comment.