summaryrefslogtreecommitdiff
path: root/NW4RTools/Enums.cs
blob: 80c22839ab2936bd6da08a787fb43e3604f71bba (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
64
65
66
67
68
using System;

namespace NW4RTools {
	public enum PrimitiveType {
		Quads = 0,
		Triangles = 2,
		TriangleStrip = 3,
		TriangleFan = 4,
		Lines = 5,
		LineStrip = 6,
		Points = 7
	}


	public enum GXCommand {
		Nop = 0,
		LoadBPReg = 0x61,
		LoadCPReg = 0x08,
		LoadXFReg = 0x10,
		LoadPosMtxFromArray = 0x20,
		LoadNrmMtxFromArray = 0x28,
		LoadTexCoordMtxFromArray = 0x30,
		LoadLightFromArray = 0x38,
		CallDL = 0x40,
		UnknownMetrics = 0x44,
		InvalidateVC = 0x48,
		DrawPrimitiveMask = 0x80,
		// TODO: Figure out some better way to store this
		PrimitiveShiftAmount = 3
	}


	public enum TextureFormat {
		I4,
		I8,
		IA4,
		IA8,
		RGB565,
		RGB5A3,
		RGBA8,
		C4 = 8,
		C8 = 9,
		C14X2 = 0xA,
		CMPR = 0xE
	}


	public enum TextureWrapType {
		CLAMP,
		REPEAT,
		MIRROR
	}

	public static class TextureWrapTypeExtensionMethods {
		public static Collada141.fx_sampler_wrap_common ToColladaSamplerWrap(this TextureWrapType t) {
			if (t == TextureWrapType.CLAMP)
				return Collada141.fx_sampler_wrap_common.CLAMP;

			if (t == TextureWrapType.REPEAT)
				return Collada141.fx_sampler_wrap_common.WRAP;

			if (t == TextureWrapType.MIRROR)
				return Collada141.fx_sampler_wrap_common.MIRROR;

			return Collada141.fx_sampler_wrap_common.WRAP;
		}
	}
}