Matrix.cppm 1.2 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() noexcept;
  8. Matrix& unit() noexcept;
  9. Matrix& set(size_t index, const Vector4& v) noexcept;
  10. Matrix transpose() const noexcept;
  11. const float* getValues() const noexcept;
  12. Matrix& operator*=(const Matrix& other) noexcept;
  13. Matrix operator*(const Matrix& other) const noexcept;
  14. Vector3 operator*(const Vector3& v) const noexcept;
  15. Matrix& scale(const Vector3& v) noexcept;
  16. Matrix& scale(float f) noexcept;
  17. Matrix& translate(const Vector3& v) noexcept;
  18. Matrix& translateX(float tx) noexcept;
  19. Matrix& translateY(float ty) noexcept;
  20. Matrix& translateZ(float tz) noexcept;
  21. Matrix& translateTo(const Vector3& v) noexcept;
  22. Matrix& rotateX(float radians) noexcept;
  23. Matrix& rotateY(float radians) noexcept;
  24. Matrix& rotateZ(float radians) noexcept;
  25. Matrix& rotate(const Quaternion& q) noexcept;
  26. size_t toString(StringBase& b) const noexcept;
  27. private:
  28. Matrix& rotate(float degrees, int a, int b) noexcept;
  29. };
  30. }