summaryrefslogtreecommitdiff
path: root/NW4RTools/Types.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NW4RTools/Types.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/NW4RTools/Types.cs b/NW4RTools/Types.cs
index 78723dc..619303e 100644
--- a/NW4RTools/Types.cs
+++ b/NW4RTools/Types.cs
@@ -9,19 +9,65 @@ namespace NW4RTools {
public struct Color {
public byte r, g, b, a;
+
+ public uint Rgba {
+ get {
+ return ((uint)r << 24) | ((uint)g << 16) | ((uint)b << 8) | (uint)a;
+ }
+ set {
+ r = (byte)((value & 0xFF000000) >> 24);
+ g = (byte)((value & 0x00FF0000) >> 16);
+ b = (byte)((value & 0x0000FF00) >> 8);
+ a = (byte)(value & 0x000000FF);
+ }
+ }
+
+ public Color(byte _r, byte _g, byte _b, byte _a) {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
}
public struct Vec3 {
public float x, y, z;
+
+ public Vec3(float _x, float _y, float _z) {
+ x = _x;
+ y = _y;
+ z = _z;
+ }
}
public struct Vec2 {
public float x, y;
+
+ public Vec2(float _x, float _y) {
+ x = _x;
+ y = _y;
+ }
}
+ // TODO: Convert this to a packed struct, and change this[,] to use pointers
public struct Matrix {
public float v00, v01, v02, v03, v10, v11, v12, v13, v20, v21, v22, v23;
+ public void Identity() {
+ v00 = 1.0f;
+ v01 = 0.0f;
+ v02 = 0.0f;
+ v03 = 0.0f;
+ v10 = 0.0f;
+ v11 = 1.0f;
+ v12 = 0.0f;
+ v13 = 0.0f;
+ v20 = 0.0f;
+ v21 = 0.0f;
+ v22 = 1.0f;
+ v23 = 0.0f;
+ }
+
public float this[int x, int y] {
get {
switch (y) {