Skip to content

Commit

Permalink
Automatic merge of X1.3.1-196-g253eec25a and 7 pull requests
Browse files Browse the repository at this point in the history
- Pull request #79 at 7d9f14b: Update version calculation for new unstable versions
- Pull request #226 at 26983e9: EmbedIO web server graphical track monitor
- Pull request #227 at 6ec1539: EmbedIO web server graphical train driving monitor
- Pull request #228 at 72c0146: adds links to OR on Elvas Tower
- Pull request #232 at f119329: JSON consist format: https://blueprints.launchpad.net/or/+spec/consist-editor
- Pull request #234 at 3ac34fe: Rehabilitate unit testing suite, migrate to xUnit 2
- Pull request #237 at abd68c3: Fixed 3D cab loading with undefined cabview control in CVF file https://bugs.launchpad.net/or/+bug/1888945
  • Loading branch information
openrails-bot committed Jul 25, 2020
9 parents adb2caf + 253eec2 + 7d9f14b + 26983e9 + 6ec1539 + 72c0146 + f119329 + 3ac34fe + abd68c3 commit a8ee060
Show file tree
Hide file tree
Showing 101 changed files with 1,405 additions and 1,209 deletions.
Binary file removed Source/3rdPartyLibs/Monogame/CppNet.dll
Binary file not shown.
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/MonoGame.Framework.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.D3DCompiler.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.DXGI.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.Direct2D1.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.Direct3D11.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.XAudio2.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.XInput.dll
Binary file not shown.
Binary file removed Source/3rdPartyLibs/Monogame/SharpDX.dll
Binary file not shown.
6 changes: 2 additions & 4 deletions Source/ContentChecker/ContentChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\3rdPartyLibs\Monogame\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86" />
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Source/ContentChecker/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ protected static GraphicsDevice GetGraphicsDevice()
IsFullScreen = false,
};

_graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, parameters);
_graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.NullReference, IntPtr.Zero,
parameters);
}
return _graphicsDevice;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Contrib/ActivityEditor/AEWizard/ActivityDescr.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using LibAE;
using LibAE.Formats;

namespace AEWizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\3rdPartyLibs\Monogame\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using Color = System.Drawing.Color;

namespace ActivityEditor.Engine
{
Expand Down
7 changes: 2 additions & 5 deletions Source/Contrib/ActivityEditor/LibAE/LibAE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\3rdPartyLibs\Monogame\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86" />
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\3rdPartyLibs\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -95,7 +92,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
Expand Down
5 changes: 1 addition & 4 deletions Source/Contrib/DataCollector/DataCollector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
<ApplicationIcon>..\..\ORTS.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdPartyLibs\Monogame\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
Expand Down
21 changes: 10 additions & 11 deletions Source/Contrib/TrackViewer/Drawing/BasicShapes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using System.Windows.Media.Imaging;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Orts.Viewer3D;
using Orts.Viewer3D.Popups;

namespace ORTS.TrackViewer.Drawing
Expand Down Expand Up @@ -113,7 +112,7 @@ private static void LoadAndHighlightTexture(GraphicsDevice graphicsDevice, strin
Texture2D tempTexture;
try
{
tempTexture = SharedTextureManager.Get(graphicsDevice, fullFileName);
tempTexture = Texture2D.FromFile(graphicsDevice, fullFileName);
}
catch
{
Expand All @@ -140,7 +139,7 @@ static Texture2D ColorScaledTexture(Texture2D texture, GraphicsDevice graphicsDe
pixels[i] = ColorWithHighlights.Highlighted(pixels[i], offset);
}

Texture2D outTexture = new Texture2D(graphicsDevice, texture.Width, texture.Height, false, SurfaceFormat.Color);
Texture2D outTexture = new Texture2D(graphicsDevice, texture.Width, texture.Height, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);
outTexture.SetData<Color>(pixels);
return outTexture;
}
Expand All @@ -154,13 +153,13 @@ static Texture2D ColorScaledTexture(Texture2D texture, GraphicsDevice graphicsDe
private static Texture2D CreateCircleTexture(GraphicsDevice graphicsDevice, int outerRadius)
{
int radius = (outerRadius - 2)/2; // So circle doesn't go out of bounds
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, false, SurfaceFormat.Color);
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);

Color[] data = new Color[outerRadius * outerRadius];

// Colour the entire texture transparent first.
for (int i = 0; i < data.Length; i++)
data[i] = Color.Transparent;
data[i] = Color.TransparentWhite;

// Work out the minimum step necessary using trigonometry + sine approximation.
double angleStep = 1f / radius;
Expand All @@ -187,7 +186,7 @@ private static Texture2D CreateCircleTexture(GraphicsDevice graphicsDevice, int
private static Texture2D CreateDiscTexture(GraphicsDevice graphicsDevice, int outerRadius)
{
int radius = (outerRadius - 1) / 2;
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, false, SurfaceFormat.Color);
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);

Color[] data = new Color[outerRadius * outerRadius];

Expand All @@ -202,7 +201,7 @@ private static Texture2D CreateDiscTexture(GraphicsDevice graphicsDevice, int ou
}
else
{
data[i] = Color.Transparent;
data[i] = Color.TransparentWhite;
}
}
}
Expand All @@ -221,7 +220,7 @@ private static Texture2D CreateRingTexture(GraphicsDevice graphicsDevice, int ou
{
int radius = (outerRadius - 1) / 2;
int innerRadius = (2 * radius) / 3;
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, false, SurfaceFormat.Color);
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);

Color[] data = new Color[outerRadius * outerRadius];

Expand All @@ -237,7 +236,7 @@ private static Texture2D CreateRingTexture(GraphicsDevice graphicsDevice, int ou
}
else
{
data[i] = Color.Transparent;
data[i] = Color.TransparentWhite;
}
}
}
Expand All @@ -257,7 +256,7 @@ private static Texture2D CreateCrossedRingTexture(GraphicsDevice graphicsDevice,
int radius = (outerRadius - 1) / 2;
int innerRadius = (3 * radius) / 4;
int crossWidth = 5;
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, false, SurfaceFormat.Color);
Texture2D texture = new Texture2D(graphicsDevice, outerRadius, outerRadius, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);

Color[] data = new Color[outerRadius * outerRadius];

Expand All @@ -266,7 +265,7 @@ private static Texture2D CreateCrossedRingTexture(GraphicsDevice graphicsDevice,
for (int y = -radius; y <= radius; y++)
{
int i = (x + radius) * outerRadius + (y + radius);
data[i] = Color.Transparent; //default
data[i] = Color.TransparentWhite; //default
int r2 = x * x + y * y;
if (r2 <= radius * radius)
{
Expand Down
1 change: 0 additions & 1 deletion Source/Contrib/TrackViewer/Drawing/DrawColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using ORTS.TrackViewer.UserInterface;
using Color = Microsoft.Xna.Framework.Color;

namespace ORTS.TrackViewer.Drawing
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Contrib/TrackViewer/Drawing/DrawMultiplePaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Orts.Formats.Msts;
using ORTS.Menu;
Expand Down
35 changes: 18 additions & 17 deletions Source/Contrib/TrackViewer/Drawing/DrawTerrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class DrawTerrain
//basic graphics
private GraphicsDevice device;
private BasicEffect basicEffect;
private VertexDeclaration vertexDeclaration;

//Managin textures
private TerrainTextureManager textureManager;
Expand Down Expand Up @@ -135,7 +136,7 @@ public DrawTerrain(string routePath, MessageDelegate messageDelegate, DrawWorldT
public void LoadContent(GraphicsDevice graphicsDevice)
{
this.device = graphicsDevice;
basicEffect = new BasicEffect(this.device)
basicEffect = new BasicEffect(this.device, null)
{
TextureEnabled = true,
World = Matrix.Identity
Expand All @@ -148,10 +149,12 @@ public void LoadContent(GraphicsDevice graphicsDevice)
/// </summary>
public void Clear()
{
vertexDeclaration?.Dispose();
textureManager?.Dispose();
loadedTerrainTiles.Clear();
terrainTiles.Clear();

vertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
textureManager = new TerrainTextureManager(terrtexPath, device, messageDelegate);
SetTerrainReduction();
DiscardVertexBuffers();
Expand Down Expand Up @@ -351,7 +354,7 @@ void CreateVertexBuffers()

if (vertices.Count() > 0)
{
VertexBuffer buffer = new VertexBuffer(device, typeof(VertexPositionTexture), vertices.Count(), BufferUsage.WriteOnly);
VertexBuffer buffer = new VertexBuffer(this.device, VertexPositionTexture.SizeInBytes * vertices.Count(), BufferUsage.WriteOnly);
int vertexCount = vertices.Count();
buffer.SetData(vertices.ToArray(), 0, vertexCount);
vertexBuffers.Add(textureName, buffer);
Expand Down Expand Up @@ -401,23 +404,22 @@ public void Draw(DrawArea drawArea)
{
UpdateCamera(drawArea);

device.SamplerStates[0] = new SamplerState
{
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
Filter = TextureFilter.Point
};
device.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
device.SamplerStates[0].AddressV = TextureAddressMode.Wrap;

foreach (string textureName in vertexBuffers.Keys)
{
basicEffect.Texture = textureManager[textureName].Texture;
basicEffect.Begin();
foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
{
device.SetVertexBuffer(vertexBuffers[textureName]);
pass.Apply();
pass.Begin();
device.VertexDeclaration = this.vertexDeclaration;
device.Vertices[0].SetSource(vertexBuffers[textureName], 0, VertexPositionTexture.SizeInBytes);
device.DrawPrimitives(PrimitiveType.TriangleList, 0, vertexBufferCounts[textureName]);
pass.End();
}
basicEffect.End();
}

UpdateStatusInformation(drawArea.MouseLocation);
Expand Down Expand Up @@ -942,13 +944,13 @@ public void ReduceToFactor(int requestedScaleFactor)
try
{
var renderTarget = GetRenderTarget(newWidth, newHeight);
device.SetRenderTarget(renderTarget);
device.SetRenderTarget(0, renderTarget);
device.Clear(Color.White);
spriteBatch.Begin();
var fullTarget = new Rectangle(0, 0, newWidth, newHeight);
spriteBatch.Draw(Texture, fullTarget, Color.White);
spriteBatch.End();
device.SetRenderTarget(null);
device.SetRenderTarget(0, null);

//The rendered texture is not very stable: it is in memory of the renderTarget which depends on the video buffer
//Rescaling the screen or so makes it invalid. So we really copy out the data and put it in a new texture.
Expand Down Expand Up @@ -984,10 +986,10 @@ private static bool IsPowerOfTwo(int x)

private Texture2D GetStableTextureFromRenderTarget(RenderTarget2D renderTarget)
{
var renderedTexture = renderTarget;
var renderedTexture = renderTarget.GetTexture();
int width = renderedTexture.Width;
int height = renderedTexture.Height;
var scaledTexture = new Texture2D(device, width, height, false, SurfaceFormat.Color);
var scaledTexture = new Texture2D(device, width, height, 0, TextureUsage.AutoGenerateMipMap, SurfaceFormat.Color);
Color[] data = GetColorDataArray(width * height);
renderedTexture.GetData<Color>(data);
scaledTexture.SetData(data);
Expand Down Expand Up @@ -1021,10 +1023,9 @@ private static RenderTarget2D GetRenderTarget(int width, int height)
private static RenderTarget2D GetNewRenderTarget(int width, int height)
{
//todo Handle situations where backbuffer is not large enough to support width and height
PresentationParameters pp = device.PresentationParameters;
var renderTarget =
new RenderTarget2D(device, width, height,
false, SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);
1, SurfaceFormat.Color, device.DepthStencilBuffer.MultiSampleType, device.DepthStencilBuffer.MultiSampleQuality);
return renderTarget;

}
Expand Down
30 changes: 14 additions & 16 deletions Source/Contrib/TrackViewer/Drawing/ShadowDrawArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ private void SetRendertargetSizes()
{
shadowMapCombined.Dispose();
}
var pp = graphicsDevice.PresentationParameters;
shadowRenderTargetCombined = new RenderTarget2D(graphicsDevice, Nouter * blockW, Nouter * blockH, false, SurfaceFormat.Color,
pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);
shadowRenderTargetCombined = new RenderTarget2D(graphicsDevice, Nouter * blockW, Nouter * blockH, 1, SurfaceFormat.Color,
graphicsDevice.DepthStencilBuffer.MultiSampleType, graphicsDevice.DepthStencilBuffer.MultiSampleQuality);
shadowDrawArea.SetScreenSize(0, 0, blockW, blockH);

// create initial empty subtextures
Expand All @@ -202,9 +201,8 @@ private void SetRendertargetSizes()
{
shadowMapsSingle[i].Dispose();
}
pp = graphicsDevice.PresentationParameters;
shadowRenderTargetSingle[i] = new RenderTarget2D(graphicsDevice, 1 * blockW, 1 * blockH, false, SurfaceFormat.Color,
pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);
shadowRenderTargetSingle[i] = new RenderTarget2D(graphicsDevice, 1 * blockW, 1 * blockH, 1, SurfaceFormat.Color,
graphicsDevice.DepthStencilBuffer.MultiSampleType, graphicsDevice.DepthStencilBuffer.MultiSampleQuality);
shadowMapsSingle[i] = new Texture2D(graphicsDevice, 1, 1);
}
}
Expand Down Expand Up @@ -419,7 +417,7 @@ enum ShiftDirection {Left, Right, Up, Down};
try
{ // I got errors: The render target must not be set on the device when calling GetTexture()
// even if I just before this set graphicsDevice.SetRenderTarget(0, null); I have no idea why
shadowMapsSingle[orderIndex] = shadowRenderTargetSingle[orderIndex];
shadowMapsSingle[orderIndex] = shadowRenderTargetSingle[orderIndex].GetTexture();
}
catch { }
}
Expand Down Expand Up @@ -537,21 +535,21 @@ private void RenderASingleBlockTexture(Color backgroundColor, DrawingDelegate dr
shadowDrawArea.Update();

// Rendering the tracks to a single texture
graphicsDevice.SetRenderTarget(shadowRenderTargetSingle[nextRectangleToDraw]);
graphicsDevice.SetRenderTarget(0, shadowRenderTargetSingle[nextRectangleToDraw]);
graphicsDevice.Clear(backgroundColor);
spriteBatch.Begin();
drawRoutine(shadowDrawArea);
//shadowDrawArea.DrawBorder(Color.Black); //debug
spriteBatch.End();
graphicsDevice.SetRenderTarget(null);
shadowMapsSingle[nextRectangleToDraw] = shadowRenderTargetSingle[nextRectangleToDraw];
graphicsDevice.SetRenderTarget(0, null);
shadowMapsSingle[nextRectangleToDraw] = shadowRenderTargetSingle[nextRectangleToDraw].GetTexture();

needToDrawRectangle[nextRectangleToDraw] = false;
}
catch {
graphicsDevice.SetRenderTarget(null); // return control to main render target
graphicsDevice.SetRenderTarget(0, null); // return control to main render target
}
graphicsDevice.SetRenderTarget(null);
graphicsDevice.SetRenderTarget(0, null);
}

/// <summary>
Expand All @@ -565,7 +563,7 @@ private void RenderCombinedTexture(Color backgroundColor)
// texture is (still) larger than the complete screen. In that case we want to draw something
// that is larger than the graphics device. This will give an error, which should not be there
// after rescaling has been done properly.
graphicsDevice.SetRenderTarget(shadowRenderTargetCombined);
graphicsDevice.SetRenderTarget(0, shadowRenderTargetCombined);
graphicsDevice.Clear(backgroundColor);
spriteBatch.Begin();
for (int i = 0; i < Nsubblocks; i++)
Expand All @@ -574,11 +572,11 @@ private void RenderCombinedTexture(Color backgroundColor)
spriteBatch.Draw(shadowMapsSingle[i], position, null, Color.White, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0);
}
spriteBatch.End();
graphicsDevice.SetRenderTarget(null);
shadowMapCombined = shadowRenderTargetCombined;
graphicsDevice.SetRenderTarget(0, null);
shadowMapCombined = shadowRenderTargetCombined.GetTexture();
}
catch {
graphicsDevice.SetRenderTarget(null); // return control to main render target
graphicsDevice.SetRenderTarget(0, null); // return control to main render target
}
}

Expand Down

0 comments on commit a8ee060

Please sign in to comment.