Matrix.cppm 1.1 KB

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