Axiom.Graphics.Material.CreateTechnique C# (CSharp) Method

CreateTechnique() public method

Creates a new Technique for this Material.
A Technique is a single way of rendering geometry in order to achieve the effect you are intending in a material. There are many reason why you would want more than one - the main one being to handle variable graphics card abilities; you might have one technique which is impressive but only runs on 4th-generation graphics cards, for example. In this case you will want to create at least one fallback Technique. The engine will work out which Techniques a card can support and pick the best one.

If multiple Techniques are available, the order in which they are created is important - the engine will consider lower-indexed Techniques to be preferable to higher-indexed Techniques, ie when asked for the 'best' technique it will return the first one in the technique list which is supported by the hardware.

public CreateTechnique ( ) : Technique
return Technique
		public Technique CreateTechnique()
		{
			Technique t = new Technique( this );
			this.techniques.Add( t );
			this._compilationRequired = true;
			return t;
		}

Usage Example

        /// <summary>
        ///		Copies the details of this material into another, preserving the target's handle and name
        ///		(unlike operator=) but copying everything else.
        /// </summary>
        /// <param name="target">Material which will receive this material's settings.</param>
        public void CopyTo(Material target, bool copyUniqueInfo)
        {
            if (copyUniqueInfo)
            {
                target.name     = name;
                target.handle   = handle;
                target.isLoaded = isLoaded;
                target.isManual = isManual;
            }
            // copy basic data
            target.size                     = size;
            target.lastAccessed             = lastAccessed;
            target.receiveShadows           = receiveShadows;
            target.transparencyCastsShadows = transparencyCastsShadows;

            target.RemoveAllTechniques();

            // clone a copy of all the techniques
            for (int i = 0; i < techniques.Count; i++)
            {
                Technique technique    = (Technique)techniques[i];
                Technique newTechnique = target.CreateTechnique();
                technique.CopyTo(newTechnique);

                // only add this technique to supported techniques if its...well....supported :-)
                if (newTechnique.IsSupported)
                {
                    target.InsertSupportedTechnique(newTechnique);
                }
            }

            // clear LOD distances
            target.lodDistances.Clear();

            // copy LOD distances
            for (int i = 0; i < lodDistances.Count; i++)
            {
                target.lodDistances.Add(lodDistances[i]);
            }

            target.compilationRequired = compilationRequired;
        }
All Usage Examples Of Axiom.Graphics.Material::CreateTechnique