Matrix.cppm 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. export module Core.Matrix;
  2. export import Core.Quaternion;
  3. export namespace Core {
  4. class Matrix final {
  5. Vector4 data[4];
  6. public:
  7. Matrix();
  8. Matrix& unit();
  9. Matrix& set(size_t index, const Vector4& v);
  10. Matrix transpose() const;
  11. const float* getValues() const;
  12. Matrix& operator*=(const Matrix& other);
  13. Matrix operator*(const Matrix& other) const;
  14. Vector3 operator*(const Vector3& v) const;
  15. Matrix& scale(const Vector3& v);
  16. Matrix& scale(float f);
  17. Matrix& translate(const Vector3& v);
  18. Matrix& translateX(float tx);
  19. Matrix& translateY(float ty);
  20. Matrix& translateZ(float tz);
  21. Matrix& translateTo(const Vector3& v);
  22. Matrix& rotateX(float radians);
  23. Matrix& rotateY(float radians);
  24. Matrix& rotateZ(float radians);
  25. Matrix& rotate(const Quaternion& q);
  26. size_t toString(char* s, size_t n) const;
  27. private:
  28. Matrix& rotate(float degrees, int a, int b);
  29. };
  30. }