Eigenes Matrix Struct multiplizieren
-
adonis schrieb:
struct Matrix { Matrix(); Matrix(float m11, float m12, float m13, float m14, float m21,float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) :m11(m11),m12(m12),m13(m13),m14(m14),m21(m21),m22(m22),m23(m23),m24(m24),m31(m31),m32(m32),m33(m33),m34(m34),m41(m41),m42(m42),m43(m43),m44(m44){} Matrix operator*(Matrix &other); float m11; float m12; float m13; float m14; float m21; float m22; float m23; float m24; float m31; float m32; float m33; float m34; float m41; float m42; float m43; float m44; static Matrix CreateFromQuaternion() { } static Matrix CreateLookAt() { } static Matrix CreatePerspectiveFieldOfView() { } static Matrix CreateScale(float Scale) { Matrix m; m.m11 = Scale; m.m12 = 0; m.m13 = 0; m.m14 = 0; m.m21 = 0; m.m22 = Scale; m.m23 = 0; m.m24 = 0; m.m31 = 0; m.m32 = 0; m.m33 = Scale; m.m34 = 0; m.m41 = 0; m.m42 = 0; m.m43 = 0; m.m44 = Scale; return m; } static Matrix CreateFromAxisAngle() { } static Matrix CreateFromYawPitchRoll() { } }; Matrix Matrix::operator*(Matrix &other ) { return Matrix(m11 * other.m11 + m12 * other.m21 + m13 * other.m31 + m14 * other.m41, m11 * other.m12 + m12 * other.m22 + m13 * other.m32 + m14 * other.m42, m11 * other.m13 + m12 * other.m23 + m13 * other.m33 + m14 * other.m43, m11 * other.m14 + m12 * other.m24 + m13 * other.m34 + m14 * other.m44, m21 * other.m11 + m12 * other.m21 + m13 * other.m31 + m14 * other.m41, m21 * other.m22, m21 * other.m23, m21 * other.m24, m31 * other.m31, m31 * other.m32, m31 * other.m33, m31 * other.m34, m41 * other.m41, m41 * other.m42, m41 * other.m43, m41 * other.m44); }
Und du bist dir auch ganz sicher, dass du keine Arrays brauchst?
Matrix();
entweder..
1. Zeile löschen
2. das Semikolon durch zwei geschweifte Klammern ersetzen (Option 1 spart dir dann eine Zeile)
3. Außerhalb definieren.