summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/NGS.MeshFusionPro/CombinedMeshFactory.cs
blob: 850efd8c6daeb4f330332bb7fa819ec66cabd89a (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
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);
	}
}