summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODGroupSettings.cs
blob: b0d123f1c654ca4da73afe7d4972ce54223da17f (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using UnityEngine;

namespace NGS.MeshFusionPro;

public struct LODGroupSettings
{
	public float size;

	public int lodCount;

	public LODFadeMode fadeMode;

	public bool animateCrossFading;

	public float[] screenTransitionsHeight;

	public float[] fadeTransitionsWidth;

	public LODGroupSettings(LODGroup group)
	{
		size = group.size;
		lodCount = group.lodCount;
		fadeMode = group.fadeMode;
		animateCrossFading = group.animateCrossFading;
		screenTransitionsHeight = new float[lodCount];
		fadeTransitionsWidth = new float[lodCount];
		LOD[] lODs = group.GetLODs();
		for (int i = 0; i < lodCount; i++)
		{
			LOD lOD = lODs[i];
			screenTransitionsHeight[i] = lOD.screenRelativeTransitionHeight;
			fadeTransitionsWidth[i] = lOD.fadeTransitionWidth;
		}
	}

	public bool IsEqual(LODGroupSettings settings, float screenHeightThreshold = 0.0001f, float fadeWidthThreshold = 0.0001f)
	{
		if (lodCount != settings.lodCount)
		{
			return false;
		}
		if (fadeMode != settings.fadeMode)
		{
			return false;
		}
		if (animateCrossFading != settings.animateCrossFading)
		{
			return false;
		}
		for (int i = 0; i < lodCount; i++)
		{
			if (Mathf.Abs(screenTransitionsHeight[i] - settings.screenTransitionsHeight[i]) > screenHeightThreshold)
			{
				return false;
			}
			if (Mathf.Abs(fadeTransitionsWidth[i] - settings.fadeTransitionsWidth[i]) > fadeWidthThreshold)
			{
				return false;
			}
		}
		return true;
	}
}