Axiom.Demos.Fresnel.OnFrameStarted C# (CSharp) Method

OnFrameStarted() protected method

protected OnFrameStarted ( object source, FrameEventArgs evt ) : void
source object
evt FrameEventArgs
return void
		protected override void OnFrameStarted( object source, FrameEventArgs evt )
		{
			animTime += evt.TimeSinceLastFrame;

			while ( animTime > FISH_PATH_LENGTH )
			{
				animTime -= FISH_PATH_LENGTH;
			}

			for ( int i = 0; i < NUM_FISH; i++ )
			{
				// animate the fish
				fishAnimations[ i ].AddTime( evt.TimeSinceLastFrame );

				// move the fish
				Vector3 newPos = fishSplines[ i ].Interpolate( animTime / FISH_PATH_LENGTH );
				fishNodes[ i ].Position = newPos;

				// work out the moving direction
				Vector3 direction = fishLastPosition[ i ] - newPos;
				direction.Normalize();
				Quaternion orientation = -Vector3.UnitX.GetRotationTo( direction );
				fishNodes[ i ].Orientation = orientation;
				fishLastPosition[ i ] = newPos;
			}

			base.OnFrameStarted( source, evt );
		}