Matrix.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef CORE_MATRIX_H
  2. #define CORE_MATRIX_H
  3. #include "core/Quaternion.h"
  4. #include "core/Vector.h"
  5. struct CoreMatrixT {
  6. CoreVector4 data[4];
  7. };
  8. typedef struct CoreMatrixT CoreMatrix;
  9. #define CORE_ZERO_MATRIX ((CoreMatrix){0})
  10. #define CORE_UNIT_MATRIX \
  11. ((CoreMatrix){ \
  12. {{{1, 0, 0, 0}}, {{0, 1, 0, 0}}, {{0, 0, 1, 0}}, {{0, 0, 0, 1}}}})
  13. CoreMatrix* coreTransposeMatrix(CoreMatrix* m);
  14. CoreMatrix* coreMulSetMatrix(CoreMatrix* m, const CoreMatrix* a);
  15. CoreMatrix* coreMulMatrix(CoreMatrix* m, const CoreMatrix* a,
  16. const CoreMatrix* b);
  17. CoreVector3* coreMulMatrixV3(CoreVector3* v, const CoreMatrix* m,
  18. const CoreVector3* a);
  19. CoreMatrix* coreScaleMatrix(CoreMatrix* m, const CoreVector3* v);
  20. CoreMatrix* coreScaleMatrixF(CoreMatrix* m, float f);
  21. CoreMatrix* coreTranslateMatrix(CoreMatrix* m, const CoreVector3* v);
  22. CoreMatrix* coreTranslateMatrixX(CoreMatrix* m, float tx);
  23. CoreMatrix* coreTranslateMatrixY(CoreMatrix* m, float ty);
  24. CoreMatrix* coreTranslateMatrixZ(CoreMatrix* m, float tz);
  25. CoreMatrix* coreTranslateMatrixTo(CoreMatrix* m, const CoreVector3* v);
  26. CoreMatrix* coreRotateMatrixX(CoreMatrix* m, float degrees);
  27. CoreMatrix* coreRotateMatrixY(CoreMatrix* m, float degrees);
  28. CoreMatrix* coreRotateMatrixZ(CoreMatrix* m, float degrees);
  29. CoreMatrix* coreRotateMatrix(CoreMatrix* m, const CoreQuaternion* q);
  30. #ifdef IMPORT_CORE
  31. #define Matrix CoreMatrix
  32. #define ZERO_MATRIX CORE_ZERO_MATRIX
  33. #define UNIT_MATRIX CORE_UNIT_MATRIX
  34. #define transposeMatrix coreTransposeMatrix
  35. #define mulSetMatrix coreMulSetMatrix
  36. #define mulMatrix coreMulMatrix
  37. #define mulMatrixV3 coreMulMatrixV3
  38. #define scaleMatrix coreScaleMatrix
  39. #define scaleMatrixF coreScaleMatrixF
  40. #define translateMatrix coreTranslateMatrix
  41. #define translateMatrixX coreTranslateMatrixX
  42. #define translateMatrixY coreTranslateMatrixY
  43. #define translateMatrixZ coreTranslateMatrixZ
  44. #define translateMatrixTo coreTranslateMatrixTo
  45. #define rotateMatrixX coreRotateMatrixX
  46. #define rotateMatrixY coreRotateMatrixY
  47. #define rotateMatrixZ coreRotateMatrixZ
  48. #define rotateMatrix coreRotateMatrix
  49. #define toStringMatrix coreToStringMatrix
  50. #endif
  51. #endif