From 8e13e7e2874adc8982e16d1d2ed2e28d7480b45f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Sun, 19 May 2024 16:05:58 +0800 Subject: +1.57 --- .../NGS.MeshFusionPro/MeshDataListsSTD.cs | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs (limited to 'Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs') diff --git a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs new file mode 100644 index 0000000..1bf34eb --- /dev/null +++ b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NGS.MeshFusionPro; + +public class MeshDataListsSTD : CombinedMeshDataInternal +{ + private CombinedMesh _root; + + private List _vertices; + + private List _normals; + + private List _tangents; + + private List _partsBounds; + + private List _partsBoundsLocal; + + public List Vertices => _vertices; + + public List Normals => _normals; + + public List Tangents => _tangents; + + public List PartsBounds => _partsBounds; + + public List PartsBoundsLocal => _partsBoundsLocal; + + public Bounds Bounds { get; set; } + + public override Bounds GetBounds() + { + return Bounds; + } + + public override Bounds GetBounds(CombinedMeshPart part) + { + return _partsBounds[part.Index]; + } + + public void ApplyDataToMesh() + { + Mesh mesh = _root.Mesh; + mesh.SetVertices(_vertices); + mesh.SetNormals(_normals); + mesh.SetTangents(_tangents); + mesh.bounds = Bounds; + } + + protected override void OnInitialized() + { + _root = base.Root; + _vertices = new List(); + _normals = new List(); + _tangents = new List(); + _partsBounds = new List(); + _partsBoundsLocal = new List(); + } + + protected override void OnAddPart(CombinedMeshPart part, Mesh mesh, Matrix4x4 transform) + { + Bounds bounds = mesh.bounds; + Bounds item = bounds.Transform(transform); + _partsBounds.Add(item); + _partsBoundsLocal.Add(bounds); + } + + protected override void OnRemovePart(CombinedMeshPart part) + { + _partsBounds.RemoveAt(part.Index); + _partsBoundsLocal.RemoveAt(part.Index); + } + + protected override void OnMeshUpdated() + { + Mesh mesh = _root.Mesh; + mesh.GetVertices(_vertices); + mesh.GetNormals(_normals); + mesh.GetTangents(_tangents); + Bounds = mesh.bounds; + } +} -- cgit v1.1-26-g67d0