summaryrefslogtreecommitdiff
path: root/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs')
-rw-r--r--Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs b/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs
new file mode 100644
index 0000000..850efd8
--- /dev/null
+++ b/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs
@@ -0,0 +1,43 @@
+using UnityEngine;
+
+namespace NGS.MeshFusionPro;
+
+public class CombinedMeshFactory : ICombinedMeshFactory
+{
+ private IMeshToolsFactory _tools;
+
+ private IMovableCombinedMeshFactory _movableMeshFactory;
+
+ public CombinedMeshFactory(MeshType meshType, CombineMethod combineMethod, MoveMethod moveMethod = MoveMethod.Simple)
+ {
+ if (meshType == MeshType.Standard)
+ {
+ _tools = new SimpleToolsSTDFactory();
+ if (moveMethod == MoveMethod.Simple)
+ {
+ _movableMeshFactory = new SimpleMovableMeshSTDFactory(_tools);
+ }
+ else
+ {
+ _movableMeshFactory = new JobsMovableMeshSTDFactory(_tools);
+ }
+ return;
+ }
+ _tools = new SimpleToolsLWFactory();
+ if (moveMethod == MoveMethod.Simple)
+ {
+ Debug.Log("Simple mover not implemented yet for lightweight meshes. Jobs mover will be used instead");
+ }
+ _movableMeshFactory = new JobsMovableMeshLWFactory(_tools);
+ }
+
+ public CombinedMesh CreateCombinedMesh()
+ {
+ return new CombinedMesh(_tools.CreateMeshCombiner(), _tools.CreateMeshCutter());
+ }
+
+ public CombinedMesh CreateMovableCombinedMesh(out ICombinedMeshMover mover)
+ {
+ return _movableMeshFactory.CreateMovableMesh(out mover);
+ }
+}