Improve Matrix identity functions and add Quaternion to matrix function (#765)

* Edit matrix identity fn and add quaternion to matrix fn

* Change matrix identity macros to constants

---------

Co-authored-by: Tonis <tanton@paysure.solutions>
This commit is contained in:
Tonis
2023-05-16 12:50:01 +03:00
committed by GitHub
parent 3a725d1348
commit a877d4458c
4 changed files with 43 additions and 4 deletions

View File

@@ -105,9 +105,13 @@ define matrix4_ortho = matrix::ortho<double>;
define matrix4_perspective = matrix::perspective<double>;
define matrix4f_ortho = matrix::ortho<float>;
define matrix4f_perspective = matrix::perspective<float>;
macro Matrix4 matrix4_indentity() => { .m = { [0] = 1, [5] = 1, [10] = 1, [15] = 1 } };
macro Matrix3 matrix3_indentity() => { .m = { [0] = 1, [4] = 1, [8] = 1 } };
macro Matrix2 matrix2_indentity() => { .m = { [0] = 1, [3] = 1 } };
define MATRIX2_IDENTITY = matrix::IDENTITY2<double>;
define MATRIX2F_IDENTITY = matrix::IDENTITY2<float>;
define MATRIX3_IDENTITY = matrix::IDENTITY3<double>;
define MATRIX3F_IDENTITY = matrix::IDENTITY3<float>;
define MATRIX4_IDENTITY = matrix::IDENTITY4<double>;
define MATRIX4F_IDENTITY = matrix::IDENTITY4<float>;
/**
* @require types::is_numerical($typeof(x)) `The input must be a numerical value or numerical vector`