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

GetBestTechnique() public method

Gets the best supported technique.
This method returns the lowest-index supported Technique in this material (since lower-indexed Techniques are considered to be better than higher-indexed ones).

The best supported technique is only available after this material has been compiled, which typically happens on loading the material. Therefore, if this method returns null, try calling Material.Load.

public GetBestTechnique ( ) : Technique
return Technique
		public Technique GetBestTechnique()
		{
			return this.GetBestTechnique( 0 );
		}

Same methods

Material::GetBestTechnique ( int lodIndex ) : Technique
Material::GetBestTechnique ( int lodIndex, IRenderable renderable ) : Technique

Usage Example

 /// <summary>
 /// Set up the rendering for a tree type.  Should be called once per tree type(master trees).
 /// </summary>
 public int SetupRenderMaterial(Material mat, bool setPosition)
 {
     int index = 0;
     if (meterRenderingOfTrees)
     {
         loadMaterialMeter.Enter();
     }
     // mvsm.SetTreeRenderPass() is a special version of SetPass() that just sets the stuff we need for tree rendering
     Pass usedPass = ((Axiom.SceneManagers.Multiverse.SceneManager)TerrainManager.Instance.SceneManager).SetTreeRenderPass(mat.GetBestTechnique(0).GetPass(0), forest);
     if ( setPosition && usedPass.HasVertexProgram )
     {
         index =  usedPass.VertexProgramParameters.GetParamIndex("g_vTreePosition");
     }
     if (meterRenderingOfTrees)
     {
         loadMaterialMeter.Exit();
     }
     return index;
 }