// ╔════════════════════════════════════════════════════════════════╗
// ║ 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;
using System.Collections.Generic;
using UnityEngine;
#endregion
namespace NWH.DWP2.MeshDecimation
{
///
/// Tracks mesh decimation history for undo/redo operations during progressive mesh simplification.
///
public class History
{
///
/// Unique identifier for this history entry.
///
public int id;
///
/// List of triangle indices that were removed during this step.
///
public List removedTriangles = new();
///
/// List of vertex replacement operations performed during this step.
///
public List replacedVertex = new();
///
/// Records a triangle removal operation.
///
/// Index of the triangle that was removed.
public void RemovedTriangle(int f)
{
removedTriangles.Add(f);
}
///
/// Records a vertex replacement operation including original and new vertex data.
///
/// Face index.
/// Original vertex index in the triangle.
/// Vertex ID being replaced.
/// Original vertex normal.
/// Original texture coordinates.
/// New vertex ID.
/// New vertex normal.
/// New texture coordinates.
public void ReplaceVertex(int f, int u, int v, Vector3 normal, Vector2 uv, int newV, Vector3 newNormal,
Vector2 newUv)
{
ArrayList list = new();
list.Insert(0, f);
list.Insert(1, u);
list.Insert(2, v);
list.Insert(3, normal);
list.Insert(4, uv);
list.Insert(5, newV);
list.Insert(6, newNormal);
list.Insert(7, newUv);
replacedVertex.Add(list);
}
}
}