Axiom.Graphics.TextureUnitState.AddEffect C# (CSharp) Method

AddEffect() public method

Generic method for setting up texture effects.
Allows you to specify effects directly by using the TextureEffectType enumeration. The arguments that go with it depend on the effect type. Only one effect of each type can be applied to a texture layer.

This method is used internally, but it is better generally for applications to use the more intuitive specialized methods such as SetEnvironmentMap and SetScroll.

public AddEffect ( TextureEffect effect ) : void
effect TextureEffect
return void
		public void AddEffect( TextureEffect effect )
		{
			effect.controller = null;

			// these effects must be unique, so remove any existing
			if ( effect.type == TextureEffectType.EnvironmentMap ||
				 effect.type == TextureEffectType.UVScroll ||
				 effect.type == TextureEffectType.UScroll ||
				 effect.type == TextureEffectType.VScroll ||
				 effect.type == TextureEffectType.Rotate ||
				 effect.type == TextureEffectType.ProjectiveTexture )
			{
				for ( int i = 0; i < effectList.Count; i++ )
				{
					if ( ( (TextureEffect)effectList[ i ] ).type == effect.type )
					{
						effectList.RemoveAt( i );
						break;
					}
				} // for
			}

			// create controller
			if ( IsLoaded )
			{
				CreateEffectController( effect );
			}

			// add to internal list
			effectList.Add( effect );
		}