Exemple #1
0
        void EmitBlood( ref Particle p, FXEvent fxEvent )
        {
            //var m   =	Matrix.RotationQuaternion( fxEvent.Rotation );
            //var vel	=	-m.Forward * rand.GaussDistribution(3,1) + rand.GaussRadialDistribution(0, 1.0f);
            //var pos	=	fxEvent.Origin;

            //SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 0.7f );
            //SetupAngles		( ref p, 10 );
            //SetupColor		( ref p, 10, 10, 1, 1 );
            //SetupTiming		( ref p, 0.5f, 0.01f, 0.9f );
            //SetupSize		( ref p, 0.3f, 0.00f );

            var m   =	Matrix.RotationQuaternion( fxEvent.Rotation );
            var dir =	rand.UniformRadialDistribution(0.1f,0.1f) + fxEvent.Velocity;
            var vel	=	Vector3.Up * 3 + rand.GaussRadialDistribution(0.5f,0.5f) + fxEvent.Velocity * rand.NextFloat(0,0.1f);
            var pos	=	fxEvent.Origin;

            var time = rand.NextFloat(0.7f, 1.3f);

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 0.8f );
            SetupAngles		( ref p, 50 );
            SetupColor		( ref p, 20, 20, 0, 1 );
            SetupTiming		( ref p, time, 0.01f, 0.1f );
            SetupSize		( ref p, 0.5f, 0.7f );
        }
Exemple #2
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 6.0f) + sparkDir * 2;
            var pos	=	fxEvent.Origin + rand.UniformRadialDistribution(1,1) * 0.3f;

            SetupMotion		( ref p, pos, vel, -vel );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 500, 500, 0, 1 );
            SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.2f, 0.00f );
        }
Exemple #3
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	sparkDir * rand.GaussDistribution(4,3) + rand.GaussRadialDistribution(0, 0.7f);
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 1 );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 500, 500, 0, 1 );
            SetupTiming		( ref p, 0.5f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.1f, 0.00f );
        }
Exemple #4
0
        //void EmitSpark ( ref Particle p, FXEvent fxEvent )
        //{
        //    var vel	=	rand.GaussRadialDistribution(0, 6.0f);
        //    var pos	=	fxEvent.Origin;
        //    SetupMotion		( ref p, pos, Vector3.Zero, Vector3.Zero );
        //    SetupAngles		( ref p, 160 );
        //    SetupColor		( ref p, 500, 0, 1 );
        //    SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
        //    SetupSize		( ref p, 0.1f, 0.00f );
        //}
        void EmitFire( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 0.3f) + Matrix.RotationQuaternion(fxEvent.Rotation).Backward * 5;
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero );
            SetupAngles		( ref p, 0 );
            SetupColor		( ref p, 500, 500, 0, 1.0f );
            SetupTiming		( ref p, 0.10f, 0.01f, 0.1f );
            SetupSize		( ref p, 0.15f, 0.3f );
        }
Exemple #5
0
        void EmitSmoke( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,0.2f);
            var vel	=	dir * 0.5f;
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, -0.05f );
            SetupAngles		( ref p, 10 );
            SetupColor		( ref p, 5, 5, 0, 1.0f );
            SetupTiming		( ref p, 1.5f, 0.1f, 0.1f );
            SetupSize		( ref p, 0.15f, 0.5f );
        }
Exemple #6
0
        void EmitPuff( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 1.5f);
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, vel, 0, 0.0f );
            SetupAngles		( ref p, 10 );
            SetupTiming		( ref p, 1f, 0.01f, 0.1f );
            SetupSize		( ref p, 0.2f, 0.0f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
        void EmitFire( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.UniformRadialDistribution(0, 0.5f);
            var pos	=	fxEvent.Origin + rand.UniformRadialDistribution(1,1) * 0.1f;

            float time	=	rand.NextFloat(0.1f, 0.3f);

            SetupMotion		( ref p, pos, vel, Vector3.Zero );
            SetupAngles		( ref p, 1 );
            SetupColor		( ref p, 1000, 1000, 0, 1.0f );
            SetupTiming		( ref p, time, 0.01f, 0.1f );
            SetupSize		( ref p, 0.3f, 0.7f );
        }
        void EmitBall( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,1);
            var vel	=	Vector3.Zero;
            var pos	=	fxEvent.Origin;

            float time	=	rand.NextFloat(0.05f, 0.10f);

            SetupMotion		( ref p, pos, Vector3.Zero, Vector3.Zero );
            SetupAngles		( ref p, 100 );
            SetupColor		( ref p, 1000, 1000, 0, 1.0f );
            SetupTiming		( ref p, time, 0.1f, 0.2f );
            SetupSize		( ref p, 0.2f, 0.5f );
        }
Exemple #9
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	(sparkDir * rand.GaussDistribution(1,1) + rand.GaussRadialDistribution(0, 1f))*0.7f;
            var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);
            var pos		=	fxEvent.Origin;
            var time	=	rand.GaussDistribution(1,0.2f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 160 );
            SetupTiming		( ref p, time, 0.01f, 0.9f );
            SetupSize		( ref p, 0.1f, 0.00f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
Exemple #10
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	rand.GaussRadialDistribution(0, 1f)*2 + Vector3.Up;
            var accel	=	-vel*1 + rand.GaussRadialDistribution(0, 1.2f);
            var pos		=	fxEvent.Origin + Vector3.Up * rand.GaussDistribution(1,0.5f);
            var time	=	rand.GaussDistribution(1.0f,0.2f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 160 );
            SetupTiming		( ref p, time, 0.01f, 0.9f );
            SetupSize		( ref p, 0.25f, 0.00f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
Exemple #11
0
        void EmitSmoke( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,1);
            var vel	=	dir * 0.5f;
            var pos	=	fxEvent.Origin + dir;

            float time	=	rand.NextFloat(1.4f, 1.6f);

            SetupMotion		( ref p, pos, vel, -vel*1.5f );
            SetupAngles		( ref p, 10 );
            SetupColor		( ref p, 0.1f, 0.1f, 0, 0.7f );
            SetupTiming		( ref p, time, 0.1f, 0.2f );
            SetupSize		( ref p, 1.2f, 1.2f );

            p.Effects	=	ParticleFX.LitShadow;
        }
Exemple #12
0
        void EmitPuff( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	Vector3.Zero;
            var accel	=	Vector3.Zero;
            var pos		=	fxEvent.Origin + rand.NextVector3( new Vector3(-24,-5,-24), new Vector3(24,-2,24) );
            var time	=	rand.GaussDistribution(10,0.5f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 30 );
            SetupTiming		( ref p, time, 0.2f, 0.2f );
            SetupSize		( ref p, 2.5f, 2.5f );

            p.Color0		=	new Color4(0.0f, 0.0f, 0.0f, 0.0f);
            p.Color1		=	new Color4(0.2f, 0.2f, 0.2f, 0.2f);
            p.Effects		=	ParticleFX.LitShadow;
        }
Exemple #13
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	rand.GaussRadialDistribution(0, 0.03f);
            var accel	=	rand.GaussRadialDistribution(0, 0.03f);
            var pos		=	fxEvent.Origin + rand.NextVector3( new Vector3(-20,-5,-20), new Vector3(20,0,20) );
            var time	=	rand.GaussDistribution(3,0.5f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 5 );
            SetupTiming		( ref p, time, 0.2f, 0.8f );
            SetupSize		( ref p, 0.1f, 0.00f );

            p.Color0		=	new Color4(0.0f, 0.0f, 0.0f, 0.0f);
            p.Color1		=	new Color4(0.7f, 0.7f, 0.7f, 0.7f);
            p.Effects		=	ParticleFX.Lit;
        }
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            //var vel		=	(sparkDir * rand.GaussDistribution(1,1) + rand.GaussRadialDistribution(0, 1f))*0.7f;
            //var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);
            //var pos		=	fxEvent.Origin;
            //var time	=	rand.GaussDistribution(1,0.2f);

            //SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            //SetupAngles		( ref p, 160 );
            //SetupTiming		( ref p, time, 0.01f, 0.9f );
            //SetupSize		( ref p, 0.1f, 0.00f );
            //SetupColor		( ref p, 500, 500, 0, 1 );

            var vel		=	rand.GaussRadialDistribution(0, 3.0f) + sparkDir * 2;
            var pos		=	fxEvent.Origin;// + rand.UniformRadialDistribution(1,1) * 0.0f;
            var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);

            SetupMotion		( ref p, pos, vel, accel );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 1000, 1000, 0, 1 );
            SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.15f, 0.00f );
        }
Exemple #15
0
 protected void SetupColor( ref Particle p, Color4 color0, Color4 color1 )
 {
     p.Color0		=	color0;
     p.Color1		=	color1;
 }
Exemple #16
0
 protected void SetupAngles( ref Particle p, float angularLength )
 {
     float angle0	=	rand.NextFloat(0,1) * MathUtil.TwoPi;
     float angle1	=	angle0 + MathUtil.DegreesToRadians(angularLength) * (rand.NextFloat(0,1)>0.5 ? 1 : -1);
     p.Rotation0		=	angle0;
     p.Rotation1		=	angle1;
 }
Exemple #17
0
 protected void SetupSize( ref Particle p, float size0, float size1 )
 {
     p.Size0	=	size0;
     p.Size1	=	size1;
 }
Exemple #18
0
 protected void SetupColor( ref Particle p, float intensity0, float intensity1, float alpha0, float alpha1 )
 {
     intensity0 *= alpha0;
     intensity1 *= alpha1;
     p.Color0		=	new Color4( intensity0, intensity0, intensity0, alpha0 );
     p.Color1		=	new Color4( intensity1, intensity1, intensity1, alpha1 );
 }
		/// <summary>
		/// Injects hard particle.
		/// </summary>
		/// <param name="particle"></param>
		public void InjectParticle ( Particle particle )
		{
			if (renderWorld.IsPaused) {
				return;
			}

			if (Images==null) {
				throw new InvalidOperationException("Images must be set");
			}

			if (injectionCount>=MaxInjectingParticles) {
				toMuchInjectedParticles = true;
				return;
			}

			if (particle.LifeTime<=0) {
				return;
			}

			toMuchInjectedParticles = false;

			injectionBufferCPU[ injectionCount ] = particle;
			injectionCount ++;
		}
Exemple #20
0
 protected void SetupTiming( ref Particle p, float totalTime, float fadeIn, float fadeOut )
 {
     p.LifeTime		=	totalTime;
     p.FadeIn		=	fadeIn;
     p.FadeOut		=	fadeOut;
 }
Exemple #21
0
 /*-----------------------------------------------------------------------------------------
  *
  *	Particle helper functions
  *
 -----------------------------------------------------------------------------------------*/
 protected static void SetupMotion( ref Particle p, Vector3 origin, Vector3 velocity, Vector3 accel, float damping=0, float gravity=0 )
 {
     p.Position		=	origin;
     p.Velocity		=	velocity;
     p.Acceleration	=	accel;
     p.Damping		=	damping;
     p.Gravity		=	gravity;
 }
Exemple #22
0
        public RailTrail( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            var p = new Particle();

            p.TimeLag		=	0;

            var m = Matrix.RotationQuaternion( fxEvent.Rotation );
            var up = m.Up;
            var rt = m.Right;

            int count = Math.Min((int)(fxEvent.Velocity.Length() * 20), 2000);

            //
            //	Overall color
            //

            //
            //	Beam :
            //
            p.ImageIndex	=	sfxSystem.GetSpriteIndex("railTrace");

            if (true) {
                var pos		=	fxEvent.Origin;
                var pos1	=	fxEvent.Origin + fxEvent.Velocity;

                SetupMotion	( ref p, pos, Vector3.Zero, Vector3.Zero, 0, 0 );
                SetupTiming	( ref p, 0.2f, 0.01f, 0.9f );
                SetupSize	( ref p, 0.1f, 0.0f );
                SetupAngles	( ref p, 160 );

                p.Color0		=	GetRailColor();
                p.Color1		=	GetRailColor();

                p.TailPosition	=	pos1;
                p.Effects	|=	ParticleFX.Beam;

                rw.ParticleSystem.InjectParticle( p );
            }

            //
            //	Spiral :
            //
            p.ImageIndex	=	sfxSystem.GetSpriteIndex("railDot");
            p.Effects		=	ParticleFX.None;

            for (int i=0; i<count; i++) {

                var t		=	i * 0.1f;
                var c		=	(float)Math.Cos(t);
                var s		=	(float)Math.Sin(t);

                #if true
                var pos		=	fxEvent.Origin + rt * c * 0.05f + up * s * 0.05f + fxEvent.Velocity * (i+0)/(float)count;
                var vel		=	rt * c * 0.15f + up * s * 0.15f + rand.GaussRadialDistribution(0,0.03f);
                #else
                var pos		=	fxEvent.Origin + rt * c * 0.01f + up * s * 0.01f + fxEvent.Velocity * (i+0)/(float)count;
                var vel		=	rt * c * 0.15f + up * s * 0.15f + rand.GaussRadialDistribution(0,0.02f);
                #endif

                var time	=	rand.GaussDistribution(1, 0.2f);

                SetupMotion	( ref p, pos, vel, Vector3.Zero, 0, 0 );
                SetupColor	( ref p, 1000, 1000, 1, 1 );
                SetupTiming	( ref p, time, 0.5f, 0.5f );
                SetupSize	( ref p, 0.03f, 0.0f );
                SetupAngles	( ref p, 160 );

                p.TimeLag		=	-0.1f;
                p.Color0		=	GetRailColor();
                p.Color1		=	GetRailColor();

                p.TailPosition	=	Vector3.Zero;

                //SfxInstance.rw.Debug.Trace( p.Position, 0.2f, Color.Yellow );
                rw.ParticleSystem.InjectParticle( p );
            }

            //
            //	Trace
            //
            p.ImageIndex	=	sfxSystem.GetSpriteIndex("railDot");
            p.Effects		=	ParticleFX.None;

            for (int i=0; i<count/3; i++) {

                var pos		=	fxEvent.Origin + fxEvent.Velocity * (i*3)/(float)count;
                var vel		=	rand.GaussRadialDistribution(0,0.1f);
                var time	=	rand.GaussDistribution(1, 0.2f);

                SetupMotion	( ref p, pos, vel, Vector3.Zero, 0, 0 );
                SetupColor	( ref p, 0, 200, 0, 1 );
                SetupTiming	( ref p, time, 0.5f, 0.5f );
                SetupSize	( ref p, 0.05f, 0.0f );
                SetupAngles	( ref p, 160 );

                p.TimeLag		=	-0.1f;
                p.Color0		=	GetRailColor();
                p.Color1		=	GetRailColor();

                p.TailPosition	=	Vector3.Zero;

                //SfxInstance.rw.Debug.Trace( p.Position, 0.2f, Color.Yellow );
                rw.ParticleSystem.InjectParticle( p );
            }
        }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="dt"></param>
            public override void Update( float dt, FXEvent fxEvent )
            {
                var old_time	=	time;
                var new_time	=	time + dt;
                var fxOrigin	=	fxEvent.Origin;

                if ( !stopped ) {

                    for ( int part=emitCount; true; part++ ) {

                        float prt_time	= GetParticleEmitTime( part );
                        float prt_dt	= prt_time - old_time;

                        if (prt_time <= new_time) {

                            float addTime	=	new_time - prt_time;

                            fxEvent.Origin	=	fxOrigin - fxEvent.Velocity * addTime;

                            var p = new Particle();
                            p.TimeLag		=	addTime;
                            p.ImageIndex	=	spriteIndex;
                            p.Position		=	fxEvent.Origin;

                            emit( ref p, fxEvent );

                            //SfxInstance.rw.Debug.Trace( p.Position, 0.2f, Color.Yellow );
                            SfxInstance.rw.ParticleSystem.InjectParticle( p );

                            emitCount++;

                        } else {
                            break;
                        }
                    }

                    if ( !looped && ( time >= delay + period ) ) {
                        stopped = true;
                    }

                    time += dt;
                }

                fxEvent.Origin	=	fxOrigin;
            }
Exemple #24
0
 protected void SetupAnglesAbs( ref Particle p, float angularLength )
 {
     p.Rotation0	=	rand.NextFloat(0,1) * MathUtil.TwoPi;
     p.Rotation1	=	p.Rotation0 + angularLength;
 }
		/// <summary>
		/// Updates internal state of interface.
		/// </summary>
		/// <param name="gameTime"></param>
		public override void Update ( GameTime gameTime )
		{
			console.Update( gameTime );

			testLayer.Color	=	Color.White;

			//sceneView.Camera.SetupCameraFov( new Vector3(20,10,20), Vector3.Zero, Vector3.Up, Vector3.Zero, MathUtil.DegreesToRadians(90), 0.1f, 1000, 1,0, 1 );
			Hud.Clear(HudFps);
			Hud.Add(HudFps, Color.Orange, "FPS     : {0,6:0.00}", gameTime.Fps );
			//Hud.Add(HudFps, Color.Orange, "FPS avg : {0,6:0.00}", gameTime.AverageFrameRate );
			//Hud.Add(HudFps, Color.Orange, "FPS max : {0,6:0.00}", gameTime.MaxFrameRate );
			//Hud.Add(HudFps, Color.Orange, "FPS min : {0,6:0.00}", gameTime.MinFrameRate );


			testLayer.Clear();
			testLayer.BlendMode = SpriteBlendMode.AlphaBlend;

			int line = 0;
			foreach ( var debugString in Hud.GetLines() ) {
				testLayer.DrawDebugString( debugFont, 0+1, line*8+1, debugString.Text, Color.Black );
				testLayer.DrawDebugString( debugFont, 0+0, line*8+0, debugString.Text, debugString.Color );
				line++;
			}

			//-- animation --

			frame += gameTime.ElapsedSec * 24;

			var transformsLocal  = new Matrix[ animScene.Nodes.Count ];
			var transformsGlobal = new Matrix[ animScene.Nodes.Count ];

			animScene.GetAnimSnapshot( frame, animScene.FirstFrame, animScene.LastFrame, AnimationMode.Repeat, transformsLocal );
			animScene.ComputeAbsoluteTransforms( transformsLocal, transformsGlobal );

			for (int i=0; i<animInstances.Count; i++) {
				animInstances[i].Item1.World = transformsGlobal[ animInstances[i].Item2 ];
			}

			//-- skinning --

			var bonesLocal  = new Matrix[ skinScene.Nodes.Count ];

			var rand = new Random(4546);
			
			for (int i=0; i<skinInstances.Count; i++) {
				skinScene.GetAnimSnapshot( frame * rand.NextFloat(0.7f, 1.3f)/3.0f + rand.NextFloat(0,20), skinScene.FirstFrame, skinScene.LastFrame, AnimationMode.Repeat, bonesLocal );
				skinScene.ComputeBoneTransforms( bonesLocal, skinInstances[i].Item1.BoneTransforms );
				//skinInstances[i].Item1.World = transformsGlobal[ animInstances[i].Item2 ];
			}


			var vp = Game.RenderSystem.DisplayBounds;

			if (Game.Keyboard.IsKeyDown(Keys.K)) {
				masterView.ParticleSystem.KillParticles();
			}

			if (Game.Keyboard.IsKeyDown(Keys.P)) {

				var t = gameTime.Total.TotalSeconds * 0.8f;

				var position = 	Vector3.UnitZ * (-10) + Vector3.UnitY * 5 + Vector3.UnitX * 20;
				position += new Vector3( 8* (float)Math.Cos(t*1.3f), 0, 8*(float)Math.Sin(t*1.7f) );
				
				fireLight.Position = position;


				var p = new Particle();
				p.FadeIn		=	0.2f;
				p.FadeOut		=	0.2f;
				p.Color0		=	new Color4(2000,2000,2000, 0);
				p.Color1		=	new Color4(2000,2000,2000, 0.2f);
				p.ImageIndex	=	0;
				p.TimeLag		=	0;

				for (int i=0; i<150; i++) {
					p.Velocity		=	(rand2.UniformRadialDistribution(0.0f,0.5f) + Vector3.Up * 3.0f) * Math.Abs(rand2.GaussDistribution(1, 0.25f));
					p.Position		=	position + rand2.UniformRadialDistribution(0.0f,0.15f);
					p.LifeTime		=	rand2.GaussDistribution(1.5f,0.25f);
					p.Size0			=	0.2f;
					p.Size1			=	0.0f;
					p.Rotation0		=	rand2.NextFloat(0,3.14f*2);
					p.Rotation1		=	rand2.NextFloat(0,3.14f*2);
					p.Gravity		=	0.0f;
					p.ImageIndex	=	0;
					//var 
					masterView.ParticleSystem.InjectParticle( p );
				}//*/

				for (int i=0; i<5; i++) {
					p.FadeIn		=	0.2f;
					p.FadeOut		=	0.2f;

					p.Color0		=	new Color4(1000,1000,1000, 0);
					p.Color1		=	new Color4(1000,1000,1000, 0.3f);

					p.Velocity		=	(rand2.UniformRadialDistribution(0.0f,0.5f) + Vector3.Up * 3.0f) * Math.Abs(rand2.GaussDistribution(1, 0.025f));
					p.Position		=	position;// + rand.NextVector3( -Vector3.One * 2, Vector3.One * 2);
					p.LifeTime		=	rand2.GaussDistribution(0.5f,0.1f);
					p.Size0			=	1.4f;
					p.Size1			=	3.4f;
					p.Rotation0		=	rand2.NextFloat(0,3.14f*2);
					p.Rotation1		=	p.Rotation0 + rand2.NextFloat(-1,1);
					p.Gravity		=	0;
					p.ImageIndex	=	0;
					//var 
					masterView.ParticleSystem.InjectParticle( p );
				}//*/

				for (int i=0; i<2; i++) {
					p = new Particle();

					p.FadeIn		=	0.2f;
					p.FadeOut		=	0.2f;
					p.Color0		=	new Color4(1,1,1, 0);
					p.Color1		=	new Color4(4,4,4, 1.0f);
					p.ImageIndex	=	0;
					p.TimeLag		=	0;

					p.Velocity		=	rand2.GaussRadialDistribution(0.5f,0.1f) + Vector3.Up * rand2.GaussDistribution(3.5f,0.15f);
					p.Position		=	position;// + rand.NextVector3( -Vector3.One * 2, Vector3.One * 2);
					p.LifeTime		=	rand2.GaussDistribution(2.4f,0.25f);
					p.Size0			=	1.2f;
					p.Size1			=	2.5f;
					p.Rotation0		=	0;//rand2.NextFloat(0,3.14f*2);
					p.Rotation1		=	p.Rotation0 + rand2.NextFloat(-0.5f,0.5f);
					p.Gravity		=	0.05f;
					p.ImageIndex	=	1;
					//var 
					masterView.ParticleSystem.InjectParticle( p );
				}
			}


			/*if ( game.Keyboard.IsKeyDown(Keys.R) ) {
				testLayer.Clear();
				testLayer.DrawDebugString( debugFont, 10, 276, rand.Next().ToString(), Color.White );

			} */
			//testLayer.Draw( masterView.HdrTexture,	 -200,  0, 200,150, Color.White );
			//testLayer.Draw( masterView.DiffuseTexture,	    0,  0, 200,150, Color.White );
			//testLayer.Draw( masterView.SpecularTexture, 200,  0, 200,150, Color.White );
			//testLayer.Draw( masterView.NormalMapTexture, 400,  0, 200,150, Color.White );
			//testLayer.Draw( masterView.Target, 200,200,300,200, Color.White);

			//if (videoPlayer.State==MediaState.Playing) {
			//	testLayer.Draw( videoPlayer.GetTexture(), 20,0,300,200, Color.White);
			//}//*/

			//Log.Message("{0}", videoPlayer.State);

			//masterView.IsPaused  = Game.Keyboard.IsKeyDown(Keys.O);


			if ( Game.Keyboard.IsKeyDown(Keys.PageDown) ) {
				angle -= 0.01f;
			}
			if ( Game.Keyboard.IsKeyDown(Keys.PageUp) ) {
				angle += 0.01f;
			}

			//testLayer.SetTransform( new Vector2(200,0), new Vector2(128+5,128+5), angle );

			var m = UpdateCam( gameTime );

			var ratio = vp.Width / (float)vp.Height;

			Game.Keyboard.ScanKeyboard = !Console.Show;

			masterView.Camera.SetupCameraFov(m.TranslationVector, m.TranslationVector + m.Forward, m.Up, MathUtil.DegreesToRadians(90), 0.1f, 1000, 1, 0, ratio);
		}