blob: ae5189f8165f5d1ad2f84288353ec4fd20f36f94 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
using System;
using System.Collections.Generic;
namespace NGS.MeshFusionPro;
public class UniversalObjectsCombiner
{
private StaticObjectsCombiner _staticCombiner;
private DynamicObjectsCombiner _dynamicCombiner;
private LODGroupsCombiner _lodCombiner;
public event Action<CombinedObject> onStaticCombinedObjectCreated;
public event Action<DynamicCombinedObject> onDynamicCombinedObjectCreated;
public event Action<CombinedLODGroup> onCombinedLODGroupCreated;
public UniversalObjectsCombiner(ICombinedMeshFactory factory, int vertexLimit)
{
_staticCombiner = new StaticObjectsCombiner(factory, vertexLimit);
_dynamicCombiner = new DynamicObjectsCombiner(factory, vertexLimit);
_lodCombiner = new LODGroupsCombiner(factory, vertexLimit);
_staticCombiner.onCombinedObjectCreated += delegate(CombinedObject r)
{
this.onStaticCombinedObjectCreated?.Invoke(r);
};
_dynamicCombiner.onCombinedObjectCreated += delegate(DynamicCombinedObject r)
{
this.onDynamicCombinedObjectCreated?.Invoke(r);
};
_lodCombiner.onCombinedObjectCreated += delegate(CombinedLODGroup r)
{
this.onCombinedLODGroupCreated?.Invoke(r);
};
}
public void AddSource(ICombineSource source)
{
if (source is CombineSource source2)
{
_staticCombiner.AddSource(source2);
return;
}
if (source is DynamicCombineSource source3)
{
_dynamicCombiner.AddSource(source3);
return;
}
if (source is LODGroupCombineSource source4)
{
_lodCombiner.AddSource(source4);
return;
}
throw new NotImplementedException("Unknown Combine Source");
}
public void AddSources(IEnumerable<ICombineSource> sources)
{
foreach (ICombineSource source in sources)
{
AddSource(source);
}
}
public void RemoveSource(ICombineSource source)
{
if (source is CombineSource source2)
{
_staticCombiner.RemoveSource(source2);
return;
}
if (source is DynamicCombineSource source3)
{
_dynamicCombiner.RemoveSource(source3);
return;
}
if (source is LODGroupCombineSource source4)
{
_lodCombiner.RemoveSource(source4);
return;
}
throw new NotImplementedException("Unknown Combine Source");
}
public void Combine()
{
if (_staticCombiner.ContainSources)
{
_staticCombiner.Combine();
}
if (_dynamicCombiner.ContainSources)
{
_dynamicCombiner.Combine();
}
if (_lodCombiner.ContainSources)
{
_lodCombiner.Combine();
}
}
}
|