Matrix.cppm 1.0 KB

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