Axiom.Graphics.Material.CompareTo C# (CSharp) Méthode

CompareTo() public méthode

Used for comparing 2 Material objects.
This comparison will be used in RenderQueue group sorting of Materials materials. If this object is transparent and the object being compared is not, this is greater that obj. If this object is not transparent and the object being compared is, obj is greater than this.
public CompareTo ( object obj ) : int
obj object
Résultat int
		public int CompareTo( object obj )
		{
			Debug.Assert( obj is Material, "Materials cannot be compared to objects of type '" + obj.GetType().Name );

			Material material = obj as Material;

			// compare this Material with the incoming object to compare to.
			if ( this.IsTransparent && !material.IsTransparent )
			{
				return -1;
			}
			else if ( !this.IsTransparent && material.IsTransparent )
			{
				return 1;
			}
			else
			{
				return 0;
			}
		}