Hydrogen Framework  1.3.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Hydrogen.Threading.Jobs.MeshCombiner.TransitionMeshSorter Class Reference

A class defining how to sort TransitionMeshes. More...

+ Inheritance diagram for Hydrogen.Threading.Jobs.MeshCombiner.TransitionMeshSorter:

Public Member Functions

int Compare (TransitionMesh leftSide, TransitionMesh rightSide)
 Compare the specified TransitionMeshes. More...
 

Detailed Description

A class defining how to sort TransitionMeshes.

Definition at line 964 of file MeshCombiner.cs.

Member Function Documentation

int Hydrogen.Threading.Jobs.MeshCombiner.TransitionMeshSorter.Compare ( TransitionMesh  leftSide,
TransitionMesh  rightSide 
)

Compare the specified TransitionMeshes.

Parameters
leftSideLeft Side TransitionMesh.
rightSideRight Side TransitionMesh.

Definition at line 971 of file MeshCombiner.cs.

972  {
973  // Sort by features first? uv1, uv2, colours, tangents? Like wise features should be grouped together
974  // It is an 'AND' logic, and not 'OR'. You can't have optional colours!
975  int compare = leftSide.GetBitMask ().CompareTo (rightSide.GetBitMask ());
976  if (compare != 0)
977  return compare;
978 
979  // Then Sort by meshes -> meshes with similar meshes grouped together
980  compare = leftSide.Material.CompareTo (rightSide.Material);
981 
982  // Then sort by size (largest to smallest) -> larger tmeshes more likely to share fewer tmeshes per mesh.
983  return compare != 0 ? compare : leftSide.VertexCount.CompareTo (rightSide.VertexCount);
984  }