diff options
Diffstat (limited to '')
-rw-r--r-- | NW4RTools/Types.cs | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/NW4RTools/Types.cs b/NW4RTools/Types.cs new file mode 100644 index 0000000..7887f1c --- /dev/null +++ b/NW4RTools/Types.cs @@ -0,0 +1,137 @@ +using System; + +namespace NW4RTools { + public enum ByteEndian { + LittleEndian, + BigEndian + } + + + public struct Color { + public byte r, g, b, a; + } + + public struct Vec3 { + public float x, y, z; + } + + public struct Vec2 { + public float x, y; + } + + public struct Matrix { + public float v00, v01, v02, v03, v10, v11, v12, v13, v20, v21, v22, v23; + + public float this[int x, int y] { + get { + switch (y) { + case 0: + switch (x) { + case 0: + return v00; + break; + case 1: + return v01; + break; + case 2: + return v02; + break; + case 3: + return v03; + break; + } + break; + case 1: + switch (x) { + case 0: + return v10; + break; + case 1: + return v11; + break; + case 2: + return v12; + break; + case 3: + return v13; + break; + } + break; + case 2: + switch (x) { + case 0: + return v20; + break; + case 1: + return v21; + break; + case 2: + return v22; + break; + case 3: + return v23; + break; + } + break; + } + + throw new IndexOutOfRangeException(); + } + + set { + switch (y) { + case 0: + switch (x) { + case 0: + v00 = value; + break; + case 1: + v01 = value; + break; + case 2: + v02 = value; + break; + case 3: + v03 = value; + break; + } + break; + case 1: + switch (x) { + case 0: + v10 = value; + break; + case 1: + v11 = value; + break; + case 2: + v12 = value; + break; + case 3: + v13 = value; + break; + } + break; + case 2: + switch (x) { + case 0: + v20 = value; + break; + case 1: + v21 = value; + break; + case 2: + v22 = value; + break; + case 3: + v23 = value; + break; + } + break; + } + + throw new IndexOutOfRangeException(); + } + } + } +} |