blob: ca4c318e151ba666867f692339c6535776ea1294 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
using System;
using UnityEngine;
namespace NGS.MeshFusionPro;
public class CombineTreeNode : BinaryTreeNode<ICombineSource>
{
private CombineTree _tree;
private UniversalObjectsCombiner _combiner;
public event Action<CombinedObject> onStaticCombinedObjectCreated;
public event Action<DynamicCombinedObject> onDynamicCombinedObjectCreated;
public event Action<CombinedLODGroup> onCombinedLODGroupCreated;
public CombineTreeNode(CombineTree tree, Vector3 center, Vector3 size, bool isLeaf)
: base(center, size, isLeaf)
{
_tree = tree;
}
public override void Add(ICombineSource source)
{
if (_combiner == null)
{
_combiner = new UniversalObjectsCombiner(_tree.CombinedMeshFactory, _tree.VertexLimit);
_combiner.onStaticCombinedObjectCreated += this.onStaticCombinedObjectCreated;
_combiner.onDynamicCombinedObjectCreated += this.onDynamicCombinedObjectCreated;
_combiner.onCombinedLODGroupCreated += this.onCombinedLODGroupCreated;
}
_combiner.AddSource(source);
}
public override void Remove(ICombineSource source)
{
_combiner.RemoveSource(source);
}
public void Combine()
{
_combiner?.Combine();
}
}
|