summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/NGS.MeshFusionPro/MeshCombinerBase.cs
blob: 34804fdbed0c7247ac3240f2169aafdcecea0f28 (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
using System;
using System.Collections.Generic;
using UnityEngine;

namespace NGS.MeshFusionPro;

public abstract class MeshCombinerBase : IMeshCombiner
{
	public void Combine(Mesh mesh, IList<MeshCombineInfo> infos)
	{
		ValidateMesh(mesh);
		ValidateCombineInfos(infos);
		CombineInternal(mesh, infos);
	}

	protected abstract void CombineInternal(Mesh mesh, IList<MeshCombineInfo> infos);

	protected virtual void ValidateMesh(Mesh mesh)
	{
		if (mesh == null)
		{
			throw new ArgumentNullException("mesh");
		}
		if (mesh.subMeshCount > 1)
		{
			throw new ArgumentException("BaseMeshCombiner::input 'mesh' should have 1 submesh");
		}
	}

	protected virtual void ValidateCombineInfos(IList<MeshCombineInfo> infos)
	{
		if (infos == null)
		{
			throw new ArgumentNullException("MeshCombineInfos is null");
		}
		for (int i = 0; i < infos.Count; i++)
		{
			if (infos[i].mesh == null)
			{
				throw new ArgumentNullException("MeshCombineInfo.mesh is null");
			}
		}
	}
}