summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 17:03:57 +0800
committerchai <215380520@qq.com>2024-05-19 17:03:57 +0800
commitcf58771365b5953c6eac548b172aae880d1f0acd (patch)
treea49757a4b5c447cbf877584d482367a6bfe33b10 /Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs
parenteed315deae356ddfb17f28305e7cde6cdfc43313 (diff)
* rename
Diffstat (limited to 'Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs')
-rw-r--r--Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs112
1 files changed, 0 insertions, 112 deletions
diff --git a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs
deleted file mode 100644
index 2fd39af..0000000
--- a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombineTree.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace NGS.MeshFusionPro;
-
-public class CombineTree : BinaryTree<CombineTreeNode, ICombineSource>
-{
- private ICombinedMeshFactory _factory;
-
- private float _leafSize;
-
- private int _vertexLimit;
-
- public float LeafSize => _leafSize;
-
- public int VertexLimit => _vertexLimit;
-
- public ICombinedMeshFactory CombinedMeshFactory => _factory;
-
- public event Action<CombinedObject> onStaticCombinedObjectCreated;
-
- public event Action<DynamicCombinedObject> onDynamicCombinedObjectCreated;
-
- public event Action<CombinedLODGroup> onCombinedLODGroupCreated;
-
- public CombineTree(ICombinedMeshFactory factory, float leafSize, int vertexLimit)
- {
- _factory = factory;
- _leafSize = leafSize;
- _vertexLimit = vertexLimit;
- }
-
- public void Combine()
- {
- TreeTraversal(delegate(CombineTreeNode node, int depth)
- {
- node.Combine();
- return true;
- });
- }
-
- protected override CombineTreeNode CreateRoot(ICombineSource source)
- {
- return CreateNode(source.Position, Vector3.one * _leafSize, isLeaf: true);
- }
-
- protected override CombineTreeNode CreateNode(Vector3 center, Vector3 size, bool isLeaf)
- {
- CombineTreeNode combineTreeNode = new CombineTreeNode(this, center, size, isLeaf);
- combineTreeNode.onStaticCombinedObjectCreated += this.onStaticCombinedObjectCreated;
- combineTreeNode.onDynamicCombinedObjectCreated += this.onDynamicCombinedObjectCreated;
- combineTreeNode.onCombinedLODGroupCreated += this.onCombinedLODGroupCreated;
- return combineTreeNode;
- }
-
- protected override CombineTreeNode ExpandRoot(CombineTreeNode root, ICombineSource target)
- {
- Bounds bounds = root.Bounds;
- Bounds bounds2 = target.Bounds;
- Vector3 center = Vector3.zero;
- Vector3 size = Vector3.zero;
- Vector3 center2 = Vector3.zero;
- bool flag = false;
- for (int i = 0; i < 3; i++)
- {
- if (bounds2.min[i] < bounds.min[i])
- {
- size = bounds.size;
- size[i] *= 2f;
- center = bounds.center;
- center[i] -= bounds.size[i] / 2f;
- center2 = bounds.center;
- center2[i] -= bounds.size[i];
- break;
- }
- if (bounds2.max[i] > bounds.max[i])
- {
- size = bounds.size;
- size[i] *= 2f;
- center = bounds.center;
- center[i] += bounds.size[i] / 2f;
- center2 = bounds.center;
- center2[i] += bounds.size[i];
- flag = true;
- break;
- }
- }
- CombineTreeNode combineTreeNode = CreateNode(center, size, isLeaf: false);
- CombineTreeNode combineTreeNode2 = CreateNode(center2, bounds.size, root.IsLeaf);
- if (flag)
- {
- combineTreeNode.SetChilds(base.RootInternal, combineTreeNode2);
- }
- else
- {
- combineTreeNode.SetChilds(combineTreeNode2, base.RootInternal);
- }
- return combineTreeNode;
- }
-
- protected override bool Includes(CombineTreeNode node, ICombineSource source)
- {
- Bounds bounds = node.Bounds;
- Bounds bounds2 = source.Bounds;
- return bounds.Contains(bounds2);
- }
-
- protected override bool Intersects(CombineTreeNode node, ICombineSource source)
- {
- return node.Bounds.Contains(source.Position);
- }
-}