summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs')
-rw-r--r--Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshDataListsSTD.cs83
1 files changed, 83 insertions, 0 deletions
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<Vector3> _vertices;
+
+ private List<Vector3> _normals;
+
+ private List<Vector4> _tangents;
+
+ private List<Bounds> _partsBounds;
+
+ private List<Bounds> _partsBoundsLocal;
+
+ public List<Vector3> Vertices => _vertices;
+
+ public List<Vector3> Normals => _normals;
+
+ public List<Vector4> Tangents => _tangents;
+
+ public List<Bounds> PartsBounds => _partsBounds;
+
+ public List<Bounds> 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<Vector3>();
+ _normals = new List<Vector3>();
+ _tangents = new List<Vector4>();
+ _partsBounds = new List<Bounds>();
+ _partsBoundsLocal = new List<Bounds>();
+ }
+
+ 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;
+ }
+}