1 #ifndef DALI_INTERNAL_MATRIX_UTILS_H
2 #define DALI_INTERNAL_MATRIX_UTILS_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
34 * @brief Function to convert from Quaternion to Matrix as float16 array form
37 * @param[out] result Result stored float16 array. It must have at least 16 * sizeof(float) bytes.
38 * @param[in] rotation Input Quaternion.
40 void ConvertQuaternion(float*& result, const Dali::Quaternion& rotation);
45 * @copydoc Dali::Matrix::Multiply
47 void Multiply(Dali::Matrix& result, const Dali::Matrix& lhs, const Dali::Matrix& rhs);
50 * @copydoc Dali::Matrix::Multiply
52 void Multiply(Dali::Matrix& result, const Dali::Matrix& lhs, const Dali::Quaternion& rhs);
55 * @brief Function to multiply projection matrix and store the result onto third.
57 * This API assume that projection is Projection Matrix which top/bottom/left/right is symmetrical.
59 * Perspective matrix only has 0, 5, 10, 11, 14 (14 is const value, 1.0f).
60 * Orthographic matrix only has 0, 5, 10, 14, 15 (15 is const value, 1.0f).
61 * If window rotated, we use 1, 4 index instead of 0, 5.
62 * If reflect plane used, we use 2, 6 index.
63 * So we only need 10 values to multiplication.
65 * Use this method in time critical path as it does not require temporaries.
67 * result = projection * lhs
70 * @param[out] result Result of the multiplication
71 * @param[in] lhs Matrix, this cannot be same matrix as result
72 * @param[in] projection Projection Matrix, this can be same matrix as result
74 void MultiplyProjectionMatrix(Dali::Matrix& result, const Dali::Matrix& lhs, const Dali::Matrix& projection);
77 * @brief Function to multiply two matrices and store the result onto first one.
79 * result = result * rhs
82 * @note This method might copy data internally.
85 * @param[in,out] result Result of the multiplication
86 * @param[in] rhs Matrix, this can be same matrix as result
88 void MultiplyAssign(Dali::Matrix& result, const Dali::Matrix& rhs);
93 * @copydoc Dali::Matrix3::Multiply
95 void Multiply(Dali::Matrix3& result, const Dali::Matrix3& lhs, const Dali::Matrix3& rhs);
98 * @brief Function to multiply two matrices and store the result onto first one.
100 * result = result * rhs
103 * @note This method might copy data internally.
106 * @param[in,out] result Result of the multiplication
107 * @param[in] rhs Matrix, this can be same matrix as result
109 void MultiplyAssign(Dali::Matrix3& result, const Dali::Matrix3& rhs);
111 } // namespace MatrixUtils
112 } // namespace Internal
115 #endif // DALI_INTERNAL_MATH_UTILS_H