예제 #1
0
        /// <summary>
        ///     Creates a basic time-based texture coordinate modifier designed for creating rotating textures.
        /// </summary>
        /// <remarks>
        ///     This simple method allows you to easily create constant-speed rotating textures. If you want more
        ///     control, look up the ControllerManager.CreateTextureWaveTransformer for more complex wave-based
        ///     scrollers / stretchers / rotaters.
        /// </remarks>
        /// <param name="layer">The texture unit to animate.</param>
        /// <param name="speed">Speed of the rotation, in counter-clockwise revolutions per second.</param>
        /// <returns>A newly created controller object that will be updated during the main render loop.</returns>
        public Controller <Real> CreateTextureRotator(TextureUnitState layer, Real speed)
        {
            IControllerValue <Real>    val  = new TexCoordModifierControllerValue(layer, false, false, false, false, true);
            IControllerFunction <Real> func = new MultipyControllerFunction(-speed, true);

            return(CreateController(val, func));
        }
예제 #2
0
        /// <summary>
        ///     Creates a basic time-based texture coordinate modifier designed for creating rotating textures.
        /// </summary>
        /// <remarks>
        ///     This simple method allows you to easily create constant-speed scrolling textures. If you want more
        ///     control, look up the ControllerManager.CreateTextureWaveTransformer for more complex wave-based
        ///     scrollers / stretchers / rotaters.
        /// </remarks>
        /// <param name="layer">The texture unit to animate.</param>
        /// <param name="speedU">Horizontal speed, in wraps per second.</param>
        /// <param name="speedV">Vertical speed, in wraps per second.</param>
        /// <returns>A newly created controller object that will be updated during the main render loop.</returns>
        public Controller <float> CreateTextureScroller(TextureUnitState layer, float speedU, float speedV)
        {
            IControllerValue <float>    val        = null;
            IControllerFunction <float> func       = null;
            Controller <float>          controller = null;

            // if both u and v speeds are the same, we can use a single controller for it
            if (speedU != 0 && (speedU == speedV))
            {
                // create the value and function
                val  = new TexCoordModifierControllerValue(layer, true, true);
                func = new MultipyControllerFunction(-speedU, true);

                // create the controller (uses FrameTime for source by default)
                controller = CreateController(val, func);
            }
            else
            {
                // create seperate for U
                if (speedU != 0)
                {
                    // create the value and function
                    val  = new TexCoordModifierControllerValue(layer, true, false);
                    func = new MultipyControllerFunction(-speedU, true);

                    // create the controller (uses FrameTime for source by default)
                    controller = CreateController(val, func);
                }

                // create seperate for V
                if (speedV != 0)
                {
                    // create the value and function
                    val  = new TexCoordModifierControllerValue(layer, false, true);
                    func = new MultipyControllerFunction(-speedV, true);

                    // create the controller (uses FrameTime for source by default)
                    controller = CreateController(val, func);
                }
            }

            // TODO: Revisit, since we can't return 2 controllers in the case of non equal U and V speeds
            return(controller);
        }
예제 #3
0
        /// <summary>
        ///     Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures.
        /// </summary>
        /// <remarks>
        ///     This simple method allows you to easily create constant-speed scrolling textures. If you want more
        ///     control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based
        ///     scrollers / stretchers / rotaters.
        /// </remarks>
        /// <param name="layer">The texture unit to animate.</param>
        /// <param name="speed">speed, in wraps per second.</param>
        /// <returns>A newly created controller object that will be updated during the main render loop.</returns>
        public Controller <Real> CreateTextureVScroller(TextureUnitState layer, Real speed)
        {
            IControllerValue <Real>    val        = null;
            IControllerFunction <Real> func       = null;
            Controller <Real>          controller = null;

            // if both u and v speeds are the same, we can use a single controller for it
            if (speed != 0)
            {
                // create the value and function
                val  = new TexCoordModifierControllerValue(layer, false, true);
                func = new MultipyControllerFunction(-speed, true);

                // create the controller (uses FrameTime for source by default)
                controller = CreateController(val, func);
            }

            return(controller);
        }
예제 #4
0
        /// <summary>
        ///     Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures.
        /// </summary>
        /// <remarks>
        ///     This simple method allows you to easily create constant-speed scrolling textures. If you want more
        ///     control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based
        ///     scrollers / stretchers / rotaters.
        /// </remarks>
        /// <param name="layer">The texture unit to animate.</param>
        /// <param name="speed">speed, in wraps per second.</param>
        /// <returns>A newly created controller object that will be updated during the main render loop.</returns>
        public Controller <Real> CreateTextureUScroller(TextureUnitState layer, Real speed)
        {
            IControllerValue <Real>    val        = null;
            IControllerFunction <Real> func       = null;
            Controller <Real>          controller = null;

            // Don't create a controller if the speed is zero
            if (speed != 0)
            {
                // create the value and function
                val  = new TexCoordModifierControllerValue(layer, true);
                func = new MultipyControllerFunction(-speed, true);

                // create the controller (uses FrameTime for source by default)
                controller = CreateController(val, func);
            }

            return(controller);
        }
예제 #5
0
        /// <summary>
        ///	    Creates a very flexible time-based texture transformation which can alter the scale, position or
        ///	    rotation of a texture based on a wave function.
        /// </summary>
        /// <param name="layer">The texture unit to effect.</param>
        /// <param name="type">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param>
        /// <param name="waveType">The shape of the wave, see WaveformType enum for details.</param>
        /// <param name="baseVal">The base value of the output.</param>
        /// <param name="frequency">The speed of the wave in cycles per second.</param>
        /// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param>
        /// <param name="amplitude">Scales the output so that instead of lying within 0..1 it lies within 0..(1 * amplitude) for exaggerated effects</param>
        /// <returns>A newly created controller object that will be updated during the main render loop.</returns>
        public Controller <Real> CreateTextureWaveTransformer(TextureUnitState layer, TextureTransform type,
                                                              WaveformType waveType, Real baseVal, Real frequency, Real phase,
                                                              Real amplitude)
        {
            IControllerValue <Real>    val      = null;
            IControllerFunction <Real> function = null;

            // determine which type of controller value this layer needs
            switch (type)
            {
            case TextureTransform.TranslateU:
                val = new TexCoordModifierControllerValue(layer, true, false);
                break;

            case TextureTransform.TranslateV:
                val = new TexCoordModifierControllerValue(layer, false, true);
                break;

            case TextureTransform.ScaleU:
                val = new TexCoordModifierControllerValue(layer, false, false, true, false, false);
                break;

            case TextureTransform.ScaleV:
                val = new TexCoordModifierControllerValue(layer, false, false, false, true, false);
                break;

            case TextureTransform.Rotate:
                val = new TexCoordModifierControllerValue(layer, false, false, false, false, true);
                break;
            }             // switch

            // create a new waveform controller function
            function = new WaveformControllerFunction(waveType, baseVal, frequency, phase, amplitude, true);

            // finally, create the controller using frame time as the source value
            return(CreateController(this.frameTimeController, val, function));
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TexCoordModifierControllerValue obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #7
0
		/// <summary>
		///	    Creates a very flexible time-based texture transformation which can alter the scale, position or
		///	    rotation of a texture based on a wave function.	
		/// </summary>
		/// <param name="layer">The texture unit to effect.</param>
		/// <param name="type">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param>
		/// <param name="waveType">The shape of the wave, see WaveformType enum for details.</param>
		/// <param name="baseVal">The base value of the output.</param>
		/// <param name="frequency">The speed of the wave in cycles per second.</param>
		/// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param>
		/// <param name="amplitude">Scales the output so that instead of lying within 0..1 it lies within 0..(1 * amplitude) for exaggerated effects</param>
		/// <returns>A newly created controller object that will be updated during the main render loop.</returns>
		public Controller<Real> CreateTextureWaveTransformer( TextureUnitState layer, TextureTransform type,
		                                                      WaveformType waveType, Real baseVal, Real frequency, Real phase,
		                                                      Real amplitude )
		{
			IControllerValue<Real> val = null;
			IControllerFunction<Real> function = null;

			// determine which type of controller value this layer needs
			switch ( type )
			{
				case TextureTransform.TranslateU:
					val = new TexCoordModifierControllerValue( layer, true, false );
					break;

				case TextureTransform.TranslateV:
					val = new TexCoordModifierControllerValue( layer, false, true );
					break;

				case TextureTransform.ScaleU:
					val = new TexCoordModifierControllerValue( layer, false, false, true, false, false );
					break;

				case TextureTransform.ScaleV:
					val = new TexCoordModifierControllerValue( layer, false, false, false, true, false );
					break;

				case TextureTransform.Rotate:
					val = new TexCoordModifierControllerValue( layer, false, false, false, false, true );
					break;
			} // switch

			// create a new waveform controller function
			function = new WaveformControllerFunction( waveType, baseVal, frequency, phase, amplitude, true );

			// finally, create the controller using frame time as the source value
			return CreateController( this.frameTimeController, val, function );
		}
예제 #8
0
		/// <summary>
		///     Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures.
		/// </summary>
		/// <remarks>
		///     This simple method allows you to easily create constant-speed scrolling textures. If you want more
		///     control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based
		///     scrollers / stretchers / rotaters.
		/// </remarks>
		/// <param name="layer">The texture unit to animate.</param>
		/// <param name="speed">speed, in wraps per second.</param>
		/// <returns>A newly created controller object that will be updated during the main render loop.</returns>
		public Controller<Real> CreateTextureVScroller( TextureUnitState layer, Real speed )
		{
			IControllerValue<Real> val = null;
			IControllerFunction<Real> func = null;
			Controller<Real> controller = null;

			// if both u and v speeds are the same, we can use a single controller for it
			if ( speed != 0 )
			{
				// create the value and function
				val = new TexCoordModifierControllerValue( layer, false, true );
				func = new MultipyControllerFunction( -speed, true );

				// create the controller (uses FrameTime for source by default)
				controller = CreateController( val, func );
			}

			return controller;
		}
예제 #9
0
		/// <summary>
		///     Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures.
		/// </summary>
		/// <remarks>
		///     This simple method allows you to easily create constant-speed scrolling textures. If you want more
		///     control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based
		///     scrollers / stretchers / rotaters.
		/// </remarks>
		/// <param name="layer">The texture unit to animate.</param>
		/// <param name="speed">speed, in wraps per second.</param>
		/// <returns>A newly created controller object that will be updated during the main render loop.</returns>
		public Controller<Real> CreateTextureUScroller( TextureUnitState layer, Real speed )
		{
			IControllerValue<Real> val = null;
			IControllerFunction<Real> func = null;
			Controller<Real> controller = null;

			// Don't create a controller if the speed is zero
			if ( speed != 0 )
			{
				// create the value and function
				val = new TexCoordModifierControllerValue( layer, true );
				func = new MultipyControllerFunction( -speed, true );

				// create the controller (uses FrameTime for source by default)
				controller = CreateController( val, func );
			}

			return controller;
		}
예제 #10
0
		/// <summary>
		///     Creates a basic time-based texture coordinate modifier designed for creating rotating textures.
		/// </summary>
		/// <remarks>
		///     This simple method allows you to easily create constant-speed rotating textures. If you want more
		///     control, look up the ControllerManager.CreateTextureWaveTransformer for more complex wave-based
		///     scrollers / stretchers / rotaters.
		/// </remarks>
		/// <param name="layer">The texture unit to animate.</param>
		/// <param name="speed">Speed of the rotation, in counter-clockwise revolutions per second.</param>
		/// <returns>A newly created controller object that will be updated during the main render loop.</returns>
		public Controller<Real> CreateTextureRotator( TextureUnitState layer, Real speed )
		{
			IControllerValue<Real> val = new TexCoordModifierControllerValue( layer, false, false, false, false, true );
			IControllerFunction<Real> func = new MultipyControllerFunction( -speed, true );

			return CreateController( val, func );
		}