diff options
| author | chai <215380520@qq.com> | 2024-05-19 16:05:58 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 16:05:58 +0800 |
| commit | 8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (patch) | |
| tree | 63ef85c460288891f5a593d69afeca16cba050b3 /Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs | |
| parent | c5f145786f4c6d2fe4bea831dfc16e52228920a5 (diff) | |
+1.57
Diffstat (limited to 'Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs')
| -rw-r--r-- | Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs new file mode 100644 index 0000000..ae5189f --- /dev/null +++ b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/UniversalObjectsCombiner.cs @@ -0,0 +1,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(); + } + } +} |
