1 #ifndef DALI_INTERNAL_MATRIX_UTILS_H
2 #define DALI_INTERNAL_MATRIX_UTILS_H
5 * Copyright (c) 2022 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 * So we only need 8 values to multiplication.
64 * Use this method in time critical path as it does not require temporaries.
66 * result = projection * lhs
69 * @param[out] result Result of the multiplication
70 * @param[in] lhs Matrix, this cannot be same matrix as result
71 * @param[in] projection Projection Matrix, this can be same matrix as result
73 void MultiplyProjectionMatrix(Dali::Matrix& result, const Dali::Matrix& lhs, const Dali::Matrix& projection);
76 * @brief Function to multiply two matrices and store the result onto first one.
78 * result = result * rhs
81 * @note This method might copy data internally.
84 * @param[in,out] result Result of the multiplication
85 * @param[in] rhs Matrix, this can be same matrix as result
87 void MultiplyAssign(Dali::Matrix& result, const Dali::Matrix& rhs);
92 * @copydoc Dali::Matrix3::Multiply
94 void Multiply(Dali::Matrix3& result, const Dali::Matrix3& lhs, const Dali::Matrix3& rhs);
97 * @brief Function to multiply two matrices and store the result onto first one.
99 * result = result * rhs
102 * @note This method might copy data internally.
105 * @param[in,out] result Result of the multiplication
106 * @param[in] rhs Matrix, this can be same matrix as result
108 void MultiplyAssign(Dali::Matrix3& result, const Dali::Matrix3& rhs);
110 } // namespace MatrixUtils
111 } // namespace Internal
114 #endif // DALI_INTERNAL_MATH_UTILS_H