summaryrefslogtreecommitdiff
path: root/NW4RTools/Models/Material.cs
blob: a28240c4e79e519bfe2d1d80e3816ad4eb6bc249 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;

namespace NW4RTools.Models {
	public class ChanCtrl {
		public UInt32 Flags;
		public Color MatColor, AmbColor;
		public UInt32 FlagC, FlagA;
	}


	// TODO: Rename this class?
	public class SRTSettingInfo {
		public float ScaleX, ScaleY, Rotate, TranslateX, TranslateY;

		public byte CameraID;
		public byte LightID;
		public byte MapType;
		public byte Flags;
		public Matrix TexMatrix;

		public SRTSettingInfo() {
			ScaleX = 1.0f;
			ScaleY = 1.0f;

			CameraID = 0xFF;
			LightID = 0xFF;
			Flags = 1;

			TexMatrix.Identity();
		}
	}



	public class Material {
		public UInt32 Index, Flags;

		// ResGenMode
		public byte TexCoordGenCount, ChanCount, TevStageCount, IndStageCount;
		public UInt32 CullMode;

		// ResMatMisc
		public byte ZCompLoc, LightSetID, FogID;
		public byte[] IndirectTexMtxCalcMethod1;
		public byte[] IndirectTexMtxCalcMethod2;

		// ResTexObj and ResTlutObj
		public byte[][] TexObj;
		
		public UInt32 TlutFlag;
		public byte[] TlutObj;

		// ResTexSrt
		public UInt32 TexMatrixType;
		public SRTSettingInfo[] SRTSettings;

		// ResMatChan
		public ChanCtrl[] ChanCtrls;

		// Other
		public List<TextureInfo> TextureInfos;
		public Shader ShaderRef;

		// Display Lists
		public byte[] PixDL;
		public byte[] TevColorDL;
		public byte[] IndMtxAndScaleDL;
		public byte[] TexCoordGenDL;

		public Material() {
			IndirectTexMtxCalcMethod1 = new byte[4];
			IndirectTexMtxCalcMethod2 = new byte[4];
			TexObj = new byte[8][];
			// todo
			SRTSettings = new SRTSettingInfo[8];
			ChanCtrls = new ChanCtrl[2];
			TextureInfos = new List<TextureInfo>();
		}
	}
}