26
26
using Microsoft . Xna . Framework . Graphics ;
27
27
using ORTS . Common ;
28
28
using Orts . Simulation . RollingStocks ;
29
+ using Orts . Viewer3D . RollingStock ;
29
30
30
31
namespace Orts . Viewer3D
31
32
{
@@ -47,7 +48,7 @@ public class ParticleEmitterViewer
47
48
int InputCycle ;
48
49
#endif
49
50
50
- public ParticleEmitterViewer ( Viewer viewer , ParticleEmitterData data , WorldPosition worldPosition )
51
+ public ParticleEmitterViewer ( Viewer viewer , ParticleEmitterData data , MSTSWagonViewer car , WorldPosition worldPosition )
51
52
{
52
53
Viewer = viewer ;
53
54
EmitterData = data ;
@@ -338,6 +339,8 @@ struct ParticleVertex
338
339
339
340
internal WorldPosition WorldPosition ;
340
341
342
+ internal MSTSWagonViewer CarViewer ;
343
+
341
344
// Particle buffer goes like this:
342
345
// +--active>-----new>--+
343
346
// | |
@@ -370,6 +373,7 @@ public ParticleEmitterPrimitive(ParticleEmitterViewer particleViewer, ParticleEm
370
373
ParticleDuration = 3 ;
371
374
ParticleColor = Color . White ;
372
375
376
+ CarViewer = car ;
373
377
WorldPosition = worldPosition ;
374
378
375
379
// Initialize the particle accumulator to a random value to de-sync particle emitters from eachother
@@ -413,35 +417,6 @@ public ParticleEmitterPrimitive(ParticleEmitterViewer particleViewer, ParticleEm
413
417
0.9f + ( float ) Viewer . Random . NextDouble ( ) * 0.2f ,
414
418
} ;
415
419
}
416
-
417
- // Initialization step for emitter shape attachment
418
- if ( EmitterData . ShapeIndex != - 1 )
419
- {
420
- if ( EmitterData . ShapeIndex < 0 || EmitterData . ShapeIndex >= CarViewer . TrainCarShape . ResultMatrices . Count ( ) )
421
- {
422
- Trace . TraceWarning ( "Particle emitter in car {0} has invalid shape index defined, shape index {1} does not exist" ,
423
- ( CarViewer . Car as MSTSWagon ) . WagFilePath , EmitterData . ShapeIndex ) ;
424
- EmitterData . ShapeIndex = 0 ;
425
- }
426
- }
427
- else
428
- {
429
- if ( ! String . IsNullOrEmpty ( EmitterData . ShapeHierarchy ) )
430
- {
431
- if ( CarViewer . TrainCarShape . SharedShape . MatrixNames . Contains ( EmitterData . ShapeHierarchy ) )
432
- {
433
- EmitterData . ShapeIndex = CarViewer . TrainCarShape . SharedShape . MatrixNames . IndexOf ( EmitterData . ShapeHierarchy ) ;
434
- }
435
- else
436
- {
437
- Trace . TraceWarning ( "Particle emitter in car {0} has invalid shape index defined, matrix name {1} does not exist" ,
438
- ( CarViewer . Car as MSTSWagon ) . WagFilePath , EmitterData . ShapeHierarchy ) ;
439
- EmitterData . ShapeIndex = 0 ;
440
- }
441
- }
442
- else
443
- EmitterData . ShapeIndex = 0 ;
444
- }
445
420
}
446
421
447
422
void VertexBuffer_ContentLost ( )
@@ -561,7 +536,7 @@ public void Update(float currentTime, ElapsedTime elapsedTime)
561
536
{
562
537
Matrix transform = WorldPosition . XNAMatrix ;
563
538
transform . Translation = Vector3 . Zero ; // Only want rotation data for this step
564
- transform = CarViewer . TrainCarShape . ResultMatrices [ EmitterData . ShapeIndex ] * transform ;
539
+ // rotation = CarViewer.TrainCarShape.ResultMatrices[EmitterData.ShapeIndex] * rotation; // Future: ShapeHierarchy goes here
565
540
566
541
Matrix rotation = transform ;
567
542
rotation . Translation = Vector3 . Zero ; // Last step needed translational effects, next step does not
0 commit comments