|
1 |
| -// COPYRIGHT 2011, 2012, 2013, 2014 by the Open Rails project. |
2 |
| -// |
| 1 | +// COPYRIGHT 2009 - 2023 by the Open Rails project. |
| 2 | +// |
3 | 3 | // This file is part of Open Rails.
|
4 |
| -// |
| 4 | +// |
5 | 5 | // Open Rails is free software: you can redistribute it and/or modify
|
6 | 6 | // it under the terms of the GNU General Public License as published by
|
7 | 7 | // the Free Software Foundation, either version 3 of the License, or
|
8 | 8 | // (at your option) any later version.
|
9 |
| -// |
| 9 | +// |
10 | 10 | // Open Rails is distributed in the hope that it will be useful,
|
11 | 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 | 13 | // GNU General Public License for more details.
|
14 |
| -// |
| 14 | +// |
15 | 15 | // You should have received a copy of the GNU General Public License
|
16 | 16 | // along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
|
17 | 17 |
|
18 |
| -// This file is the responsibility of the 3D & Environment Team. |
| 18 | +// This file is the responsibility of the 3D & Environment Team. |
19 | 19 |
|
20 | 20 | // Enable this define to debug the inputs to the particle emitters from other parts of the program.
|
21 | 21 | //#define DEBUG_EMITTER_INPUT
|
22 | 22 |
|
| 23 | +using System; |
| 24 | +using System.Collections.Generic; |
23 | 25 | using Microsoft.Xna.Framework;
|
24 | 26 | using Microsoft.Xna.Framework.Graphics;
|
25 |
| -using Microsoft.Xna.Framework.Graphics.PackedVector; |
26 |
| -using Orts.Simulation.RollingStocks; |
27 | 27 | using ORTS.Common;
|
28 |
| -using System; |
29 |
| -using System.Collections.Generic; |
30 |
| -using System.Runtime.InteropServices; |
| 28 | +using Orts.Simulation.RollingStocks; |
31 | 29 |
|
32 | 30 | namespace Orts.Viewer3D
|
33 | 31 | {
|
@@ -211,9 +209,6 @@ struct ParticleVertex
|
211 | 209 |
|
212 | 210 | Viewer viewer;
|
213 | 211 | GraphicsDevice graphicsDevice;
|
214 |
| - |
215 |
| - static float windDisplacementX; |
216 |
| - static float windDisplacementZ; |
217 | 212 |
|
218 | 213 | public ParticleEmitterPrimitive(Viewer viewer, ParticleEmitterData data, WorldPosition worldPosition)
|
219 | 214 | {
|
@@ -321,9 +316,6 @@ int GetCountFreeParticles()
|
321 | 316 |
|
322 | 317 | public void Update(float currentTime, ElapsedTime elapsedTime)
|
323 | 318 | {
|
324 |
| - windDisplacementX = viewer.Simulator.Weather.WindInstantaneousDirection.X * 0.25f; |
325 |
| - windDisplacementZ = viewer.Simulator.Weather.WindInstantaneousDirection.Y * 0.25f; |
326 |
| - |
327 | 319 | var velocity = WorldPosition.Location - LastWorldPosition.Location;
|
328 | 320 | velocity.X += (WorldPosition.TileX - LastWorldPosition.TileX) * 2048;
|
329 | 321 | velocity.Z += (WorldPosition.TileZ - LastWorldPosition.TileZ) * 2048;
|
@@ -369,15 +361,15 @@ public void Update(float currentTime, ElapsedTime elapsedTime)
|
369 | 361 | initialVelocity.X += (float)(Viewer.Random.NextDouble() - 0.5f) * ParticleEmitterViewer.InitialSpreadRate;
|
370 | 362 | initialVelocity.Z += (float)(Viewer.Random.NextDouble() - 0.5f) * ParticleEmitterViewer.InitialSpreadRate;
|
371 | 363 |
|
372 |
| - // Target/final velocity vaies in X, Y and Z. |
| 364 | + // Target/final velocity varies in X, Y and Z. |
373 | 365 | var targetVelocity = globalTargetVelocity;
|
374 | 366 | targetVelocity.X += Noise.Generate(time + PerlinStart[0]) * ParticleEmitterViewer.SpreadRate;
|
375 | 367 | targetVelocity.Y += Noise.Generate(time + PerlinStart[1]) * ParticleEmitterViewer.SpreadRate;
|
376 | 368 | targetVelocity.Z += Noise.Generate(time + PerlinStart[2]) * ParticleEmitterViewer.SpreadRate;
|
377 | 369 |
|
378 | 370 | // Add wind speed
|
379 |
| - targetVelocity.X += windDisplacementX; |
380 |
| - targetVelocity.Z += windDisplacementZ; |
| 371 | + targetVelocity.X += viewer.Simulator.Weather.WindInstantaneousSpeedMpS * viewer.Simulator.Weather.WindInstantaneousDirection.X; |
| 372 | + targetVelocity.Z += viewer.Simulator.Weather.WindInstantaneousSpeedMpS * viewer.Simulator.Weather.WindInstantaneousDirection.Y; |
381 | 373 |
|
382 | 374 | // ActionDuration is variable too.
|
383 | 375 | var duration = ParticleDuration * (1 + Noise.Generate(time + PerlinStart[3]) * ParticleEmitterViewer.DurationVariation);
|
|
0 commit comments