summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs')
-rw-r--r--Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs b/Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs
new file mode 100644
index 0000000..cf76052
--- /dev/null
+++ b/Thronefall_v1.0/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs
@@ -0,0 +1,39 @@
+namespace NGS.MeshFusionPro;
+
+public class DynamicCombinedObjectMatcher : CombinedObjectMatcher<DynamicCombinedObject, DynamicCombineSource>
+{
+ private RendererSettings _settings;
+
+ private int _vertexCount;
+
+ private int _vertexLimit;
+
+ public DynamicCombinedObjectMatcher(int vertexLimit)
+ {
+ _vertexLimit = vertexLimit;
+ }
+
+ public override void StartMatching(DynamicCombinedObject combinedObject)
+ {
+ _settings = combinedObject.RendererSettings;
+ _vertexCount = combinedObject.VertexCount;
+ }
+
+ public override bool CanAddSource(DynamicCombineSource source)
+ {
+ if (!_settings.Equals(source.Base.RendererSettings))
+ {
+ return false;
+ }
+ if (_vertexCount + source.Base.CombineInfo.vertexCount > _vertexLimit)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public override void SourceAdded(DynamicCombineSource source)
+ {
+ _vertexCount += source.Base.CombineInfo.vertexCount;
+ }
+}