// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using System.Collections;
#endregion
namespace NWH.DWP2.MeshDecimation
{
///
/// Comparer for sorting vertices by their edge collapse cost during mesh decimation.
///
public class Comparer : IComparer
{
private Vert vx;
private Vert vy;
///
/// Compares two vertices based on their edge collapse cost.
///
/// First vertex to compare.
/// Second vertex to compare.
/// -1 if x has lower cost, 0 if equal, 1 if x has higher cost.
public int Compare(object x, object y)
{
vx = (Vert)x;
vy = (Vert)y;
if (vx == vy)
{
return 0;
}
if (vx.cost < vy.cost)
{
return -1;
}
return 1;
}
}
}