Used to supply info to the FrameStarted and FrameEnded events.
Inheritance: System.EventArgs
Example #1
0
		public override bool FrameStarted( FrameEventArgs evt )
		{
			if ( evt.StopRendering )
			{
				return false;
			}

			this._color.x += evt.TimeSinceLastFrame*.6f;
			if ( this._color.x > 1 )
			{
				this._color.x = 0;
			}

			this._color.y += evt.TimeSinceLastFrame*.6f;
			if ( this._color.y > 1 )
			{
				this._color.y = 0;
			}

			this._color.z += evt.TimeSinceLastFrame*.6f;
			if ( this._color.z > 1 )
			{
				this._color.z = 0;
			}
			return base.FrameStarted( evt );
		}
Example #2
0
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			// shoot a ray from the cursor to the plane
			var ray = TrayManager.GetCursorRay( Camera );
			this.mCursorQuery.Ray = ray;
			var result = this.mCursorQuery.Execute();

			if ( result.Count != 0 )
			{
				// using the point of intersection, find the corresponding texel on our texture
				var pt = ray.GetPoint( result[ result.Count - 1 ].Distance );
				this.mBrushPos = ( ( new Vector2( pt.x, -pt.y ) )*( 1.0f/this.mPlaneSize ) + ( new Vector2( 0.5, 0.5 ) ) )*
				                 TEXTURE_SIZE;
			}

			byte freezeAmount = 0;
			this.mTimeSinceLastFreeze += evt.TimeSinceLastFrame;

			// find out how much to freeze the plane based on time passed
			while ( this.mTimeSinceLastFreeze >= 0.1 )
			{
				this.mTimeSinceLastFreeze -= 0.1;
				freezeAmount += 0x04;
			}

			_updateTexture( freezeAmount ); // rebuild texture contents

			this.mPenguinAnimState.AddTime( evt.TimeSinceLastFrame ); // increment penguin idle animation time
			this.mPenguinNode.Yaw( (Real)( new Radian( (Real)evt.TimeSinceLastFrame ) ) ); // spin the penguin around

			return base.FrameRenderingQueued( evt ); // don't forget the parent class updates!
		}
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			this.xtime += evt.TimeSinceLastFrame;
			this.xtime = (float)System.Math.IEEERemainder( this.xtime, 10 );
			( (ThingRendable)this.trend ).AddTime( evt.TimeSinceLastFrame*0.05f );
			this.animState.AddTime( evt.TimeSinceLastFrame );
			return base.FrameRenderingQueued( evt );
		}
Example #4
0
		protected override void OnFrameStarted( object source, FrameEventArgs evt )
		{
			if ( _spinny != null )
				_spinny.Yaw( 10 * evt.TimeSinceLastFrame );

			if ( input.IsKeyPressed( KeyCodes.Space ) )
			{
				if ( _compositorIndex > 0 )
					CompositorManager.Instance.SetCompositorEnabled( this.window.GetViewport( 0 ),
																	 _compositorList[ _compositorIndex ],
																	 false );

				_compositorIndex = ++_compositorIndex % _compositorList.Length;

				CompositorManager.Instance.SetCompositorEnabled( this.window.GetViewport( 0 ),
																 _compositorList[ _compositorIndex ],
																 true );
			}

			if ( input.IsKeyPressed( KeyCodes.D1 ) )
			{
				CompositorManager.Instance.SetCompositorEnabled( this.window.GetViewport( 0 ),
																 _compositorList[ 0 ],
																 !_compositorEnabled[ 0 ] );
				_compositorEnabled[ 0 ] = !_compositorEnabled[ 0 ];
				this.keypressDelay = 0.5f;
			}

			if ( input.IsKeyPressed( KeyCodes.D2 ) )
			{
				CompositorManager.Instance.SetCompositorEnabled( this.window.GetViewport( 0 ),
																 _compositorList[ 1 ],
																 !_compositorEnabled[ 1 ] );
				_compositorEnabled[ 1 ] = !_compositorEnabled[ 1 ];
				this.keypressDelay = 0.5f;
			}

			base.OnFrameStarted( source, evt );
		}
Example #5
0
		public override bool FrameEnded( FrameEventArgs evt )
		{
			return base.FrameEnded( evt );
		}
Example #6
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evt"></param>
		/// <returns></returns>
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			// let character update animations and camera
			this.chara.AddTime( evt.TimeSinceLastFrame );
			return base.FrameRenderingQueued( evt );
		}
Example #7
0
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			this.fountainPivot.Yaw( evt.TimeSinceLastFrame*30 ); // spin the fountains around
			return base.FrameRenderingQueued( evt ); // don't forget the parent class updates!
		}
Example #8
0
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			if ( heightUpdateCountdown > 0 )
			{
				heightUpdateCountdown -= evt.TimeSinceLastFrame;
				if ( heightUpdateCountdown <= 0 )
				{
					terrainGroup.Update();
					heightUpdateCountdown = 0;
				}
			}
			//if ( terrainGroup.IsDerivedDataUpdateInProgress )
			//{
			//    TrayManager.MoveWidgetToTray( infoLabel, TrayLocation.Top, 0 );
			//    infoLabel.Show();
			//    if ( terrainsImported )
			//    {
			//        infoLabel.Caption = "Building terrain, please wait..";
			//    }
			//    else
			//    {
			//        infoLabel.Caption = "Updating textures, patience...";
			//    }
			//}
			//else
			{
				TrayManager.RemoveWidgetFromTray( infoLabel );
				infoLabel.Hide();
				
			}
			return base.FrameRenderingQueued( evt );
		}
Example #9
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evt"></param>
		/// <returns></returns>
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			this._pivot.Position = new Vector3( 0, Utility.Sin( Root.Timer.Milliseconds/150.0f )*10, 0 );
			this._pivot.Yaw( (Real)( new Degree( (Real)( -evt.TimeSinceLastFrame*15f ) ) ) );
			return base.FrameRenderingQueued( evt );
		}
Example #10
0
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			if ( this.mode != Mode.Normal )
			{
				// fire ray
				Ray ray;
				ray = TrayManager.GetCursorRay( Camera );

				var rayResult = this.terrainGroup.RayIntersects( ray );
				if ( rayResult.Hit )
				{
					this.editMarker.IsVisible = true;
					this.editNode.Position = rayResult.Position;

					// figure out which terrains this affects
					List<Axiom.Components.Terrain.Terrain> terrainList;
					var brushSizeWorldSpace = TerrainWorldSize*this.brushSizeTerrainSpace;
					var sphere = new Sphere( rayResult.Position, brushSizeWorldSpace );
					this.terrainGroup.SphereIntersects( sphere, out terrainList );

					foreach ( var ti in terrainList )
					{
						DoTerrainModify( ti, rayResult.Position, evt.TimeSinceLastFrame );
					}
				}
				else
				{
					this.editMarker.IsVisible = false;
				}
			}

			if ( !this.fly )
			{
				// clamp to terrain
				var camPos = Camera.Position;
				var ray = new Ray( new Vector3( camPos.x, this.terrainPos.y + 10000, camPos.z ), Vector3.NegativeUnitY );

				TerrainGroup.RayResult rayResult = this.terrainGroup.RayIntersects( ray );
				Real distanceAboveTerrain = 50;
				Real fallSpeed = 300;
				Real newy = camPos.y;
				if ( rayResult.Hit )
				{
					if ( camPos.y > rayResult.Position.y + distanceAboveTerrain )
					{
						this.fallVelocity += evt.TimeSinceLastFrame*20;
						this.fallVelocity = Utility.Min( this.fallVelocity, fallSpeed );
						newy = camPos.y - this.fallVelocity*evt.TimeSinceLastFrame;
					}
					newy = Utility.Max( rayResult.Position.y + distanceAboveTerrain, newy );
					Camera.Position = new Vector3( camPos.x, newy, camPos.z );
				}
			}

			if ( this.heightUpdateCountDown > 0 )
			{
				this.heightUpdateCountDown -= evt.TimeSinceLastFrame;
				if ( this.heightUpdateCountDown <= 0 )
				{
					this.terrainGroup.Update();
					this.heightUpdateCountDown = 0;
				}
			}

			if ( this.terrainGroup.IsDerivedDataUpdateInProgress )
			{
				TrayManager.MoveWidgetToTray( this.infoLabel, TrayLocation.Top, 0 );
				this.infoLabel.Show();
				if ( this.terrainsImported )
				{
					this.infoLabel.Caption = "Building terrain, please wait...";
				}
				else
				{
					this.infoLabel.Caption = "Updating textures, patience...";
				}
			}
			else
			{
				TrayManager.RemoveWidgetFromTray( this.infoLabel );
				this.infoLabel.Hide();
				if ( this.terrainsImported )
				{
					SaveTerrains( true );
					this.terrainsImported = false;
				}
			}

			return base.FrameRenderingQueued( evt );
		}
Example #11
0
		public virtual bool frameRenderingQueued( FrameEventArgs evt )
		{
			if ( mStyle == CameraStyle.FreeLook )
			{
				// build our acceleration vector based on keyboard input composite
				Vector3 accel = Vector3.Zero;
				if ( mGoingForward )
					accel += mCamera.Direction;
				if ( mGoingBack )
					accel -= mCamera.Direction;
				if ( mGoingRight )
					accel += mCamera.Right;
				if ( mGoingLeft )
					accel -= mCamera.Right;
				if ( mGoingUp )
					accel += mCamera.Up;
				if ( mGoingDown )
					accel -= mCamera.Up;

				// if accelerating, try to reach top speed in a certain time
				if ( accel.LengthSquared != 0 )
				{
					accel.Normalize();
					mVelocity += accel * TopSpeed * evt.TimeSinceLastFrame * 10;
				}
				// if not accelerating, try to stop in a certain time
				else
					mVelocity -= mVelocity * evt.TimeSinceLastFrame * 10;

				// keep camera velocity below top speed and above zero
				if ( mVelocity.LengthSquared > TopSpeed * TopSpeed )
				{
					mVelocity.Normalize();
					mVelocity *= TopSpeed;
				}
				else if ( mVelocity.LengthSquared < 0.1 )
					mVelocity = Vector3.Zero;

				if ( mVelocity != Vector3.Zero )
					mCamera.Move( mVelocity * evt.TimeSinceLastFrame );
			}

			return true;
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evt"></param>
		/// <returns></returns>
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			this.animState.AddTime( evt.TimeSinceLastFrame );
			return base.FrameRenderingQueued( evt );
		}
Example #13
0
			public void FrameEnded( object source, FrameEventArgs e )
			{
				foreach ( var world in this.pWorlds.Values )
				{
					world.FrameEnd( e.TimeSinceLastFrame );
				}
			}
Example #14
0
			public void FrameStarted( object source, FrameEventArgs e )
			{
				foreach ( var world in this.pWorlds.Values )
				{
					world.FrameStart( e.TimeSinceLastFrame );

					// Notify of all active cameras
					// Previously we did this in cameraPreRenderScene, but that had the effect
					// of causing unnecessary unloading of pages if a camera was rendered
					// intermittently, so we assume that all cameras we're told to watch are 'active'
					foreach ( var c in this.pCameraList )
					{
						world.NotifyCamera( c );
					}
				}
			}
Example #15
0
		/// <summary>
		/// </summary>
		/// <param name="evt"> </param>
		/// <returns> </returns>
		public override bool FrameRenderingQueued( FrameEventArgs evt )
		{
			burnCPU();
			return base.FrameRenderingQueued( evt ); // don't forget the parent class updates!
		}
Example #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="evt"></param>
 /// <returns></returns>
 public override bool FrameRenderingQueued( FrameEventArgs evt )
 {
     rotateSpeed = evt.TimeSinceLastFrame * 20;
     if ( spinLight )
     {
         lightPivots[ 0 ].Rotate( lightRotationAxes[ 0 ], rotateSpeed * 2 );
     }
     return base.FrameRenderingQueued( evt );
 }