Skip to content

Commit 5e59187

Browse files
committed
fix: Do not allow non-ACE/DDS textures in content
1 parent 978a9b7 commit 5e59187

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ Detailed spec
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.
347347
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``.
348+
with extension ``.ace`` or ``.dds``.
349349

350350

351351
Here an example for the legacy Acela loco::
@@ -357,13 +357,13 @@ Detailed spec
357357
Type ( 1 )
358358
Conditions (...
359359

360-
The code first searches for the .png file by building its directory starting from the directory of
360+
The code first searches for the file by building its directory starting from the directory of
361361
the .eng file; in this case the line could be e.g.::
362362

363-
ORTSGraphic ( "ORTSAcelaLightGlow.png" )
363+
ORTSGraphic ( "ORTSAcelaLightGlow.dds" )
364364

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

368368
Light (
369369
comment( Head light outer right bright )
@@ -386,7 +386,7 @@ Detailed spec
386386
Elevation ( -50 -50 -50 )
387387
)
388388
)
389-
ORTSGraphic (BigLightGlow.png)
389+
ORTSGraphic (BigLightGlow.dds)
390390
)
391391

392392
OR searches for the file as it does for the general file for all lights, as explained above.

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ public LightGlowMaterial(Viewer viewer, string textureName)
988988
: base(viewer, textureName)
989989
{
990990
// TODO: This should happen on the loader thread.
991-
LightGlowTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, textureName);
991+
LightGlowTexture = textureName.StartsWith(Viewer.ContentPath, StringComparison.OrdinalIgnoreCase) ? SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, textureName) : Viewer.TextureManager.Get(textureName);
992992
}
993993

994994
public override void SetState(GraphicsDevice graphicsDevice, Material previousMaterial)

Source/RunActivity/Viewer3D/MSTSSky.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ public MSTSSkyMaterial(Viewer viewer)
543543
string mstsSkySunTexture = Viewer.Simulator.RoutePath + @"\envfiles\textures\" + mstsskysatellitetexture[0].TextureName.ToString();
544544
string mstsSkyMoonTexture = Viewer.Simulator.RoutePath + @"\envfiles\textures\" + mstsskysatellitetexture[1].TextureName.ToString();
545545

546-
MSTSSkySunTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, mstsSkySunTexture);
547-
MSTSSkyMoonTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, mstsSkyMoonTexture);
546+
MSTSSkySunTexture = Viewer.TextureManager.Get(mstsSkySunTexture);
547+
MSTSSkyMoonTexture = Viewer.TextureManager.Get(mstsSkyMoonTexture);
548548
}
549549
else
550550
MSTSSkyMoonTexture = SharedTextureManager.Get(Viewer.RenderProcess.GraphicsDevice, System.IO.Path.Combine(Viewer.ContentPath, "MoonMap.png"));

0 commit comments

Comments
 (0)