Skip to content

Commit a3e7e6f

Browse files
committed
Add .dds support and update manual.
1 parent 10d297f commit a3e7e6f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,14 @@ Detailed spec
344344
1) In the ``Content`` folder there is the default ``LightGlow.png``, which is displayed if
345345
no changes are done to the .eng file.
346346
2) In such folder there is also an ``ORTSLightGlow.png``, which is maybe more realistic.
347-
3) adding a line within the .eng file it is possible to select either ORTSLightGlow.png or any other .png.
347+
3) adding a line within the .eng file it is possible to select either ORTSLightGlow.png or any other picture
348+
with extension ``.png, .jpg, bmp, .gif, .ace, or .dds``.
349+
350+
348351
Here an example for the legacy Acela loco::
349352

350353
Lights ( 17
351-
ORTSGraphic ( "ORTSLightGlow.png")
354+
ORTSGraphic ( "ORTSLightGlow.png" )
352355
Light (
353356
comment( Sphere of light )
354357
Type ( 1 )
@@ -357,7 +360,7 @@ Detailed spec
357360
The code first searches for the .png file by building its directory starting from the directory of
358361
the .eng file; in this case the line could be e.g.::
359362

360-
ORTSGraphic ( "ORTSAcelaLightGlow.png")
363+
ORTSGraphic ( "ORTSAcelaLightGlow.png" )
361364

362365
4) The ``ORTSGraphic`` line can be added also for one or more ``Light()`` blocks. In that case the
363366
.png file is used only for the related Light block. Here an example::

Source/RunActivity/Viewer3D/Materials.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using System.IO;
2525
using System.Linq;
2626
using System.Threading;
27+
using Microsoft.CodeAnalysis.VisualBasic.Syntax;
2728
using Microsoft.Xna.Framework;
2829
using Microsoft.Xna.Framework.Graphics;
2930
using Orts.Viewer3D.Common;
@@ -179,7 +180,13 @@ public static Texture2D Get(GraphicsDevice graphicsDevice, string path)
179180

180181
if (ext == ".ace")
181182
return Orts.Formats.Msts.AceFile.Texture2DFromFile(graphicsDevice, path);
182-
183+
else if (ext == ".dds" && File.Exists(path))
184+
{
185+
Texture2D ddsTexture;
186+
DDSLib.DDSFromFile(path, graphicsDevice, true, out ddsTexture);
187+
return ddsTexture;
188+
}
189+
183190
using (var stream = File.OpenRead(path))
184191
{
185192
if (ext == ".gif" || ext == ".jpg" || ext == ".png")

0 commit comments

Comments
 (0)