Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 1 | /* |
Miao Wang | a80121f | 2016-02-26 13:58:13 -0800 | [diff] [blame] | 2 | * Copyright (C) 2016 The Android Open Source Project |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 17 | // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 20 | * rs_matrix.rsh: Matrix Functions |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 21 | * |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 22 | * These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4. |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 23 | * They are particularly useful for graphical transformations and are compatible |
| 24 | * with OpenGL. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 25 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 26 | * We use a zero-based index for rows and columns. E.g. the last element of a |
| 27 | * rs_matrix4x4 is found at (3, 3). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 28 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 29 | * RenderScript uses column-major matrices and column-based vectors. Transforming |
| 30 | * a vector is done by postmultiplying the vector, e.g. (matrix * vector), |
| 31 | * as provided by rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 32 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 33 | * To create a transformation matrix that performs two transformations at once, |
| 34 | * multiply the two source matrices, with the first transformation as the right |
| 35 | * argument. E.g. to create a transformation matrix that applies the |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 36 | * transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1). |
| 37 | * This derives from s2 * (s1 * v), which is (s2 * s1) * v. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 38 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 39 | * We have two style of functions to create transformation matrices: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 40 | * rsMatrixLoadTransformation and rsMatrixTransformation. The former |
| 41 | * style simply stores the transformation matrix in the first argument. The latter |
| 42 | * modifies a pre-existing transformation matrix so that the new transformation |
| 43 | * happens first. E.g. if you call rsMatrixTranslate() on a matrix that already |
| 44 | * does a scaling, the resulting matrix when applied to a vector will first do the |
| 45 | * translation then the scaling. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 46 | */ |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 47 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 48 | #ifndef RENDERSCRIPT_RS_MATRIX_RSH |
| 49 | #define RENDERSCRIPT_RS_MATRIX_RSH |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 50 | |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 51 | #include "rs_vector_math.rsh" |
| 52 | |
| 53 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 54 | * rsExtractFrustumPlanes: Compute frustum planes |
| 55 | * |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 56 | * Computes 6 frustum planes from the view projection matrix |
| 57 | * |
| 58 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 59 | * viewProj: Matrix to extract planes from. |
| 60 | * left: Left plane. |
| 61 | * right: Right plane. |
| 62 | * top: Top plane. |
| 63 | * bottom: Bottom plane. |
| 64 | * near: Near plane. |
| 65 | * far: Far plane. |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 66 | */ |
Miao Wang | a80121f | 2016-02-26 13:58:13 -0800 | [diff] [blame] | 67 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
| 68 | static inline void __attribute__((overloadable)) |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 69 | rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* right, float4* top, |
| 70 | float4* bottom, float4* near, float4* far) { |
| 71 | // x y z w = a b c d in the plane equation |
| 72 | left->x = viewProj->m[3] + viewProj->m[0]; |
| 73 | left->y = viewProj->m[7] + viewProj->m[4]; |
| 74 | left->z = viewProj->m[11] + viewProj->m[8]; |
| 75 | left->w = viewProj->m[15] + viewProj->m[12]; |
| 76 | |
| 77 | right->x = viewProj->m[3] - viewProj->m[0]; |
| 78 | right->y = viewProj->m[7] - viewProj->m[4]; |
| 79 | right->z = viewProj->m[11] - viewProj->m[8]; |
| 80 | right->w = viewProj->m[15] - viewProj->m[12]; |
| 81 | |
| 82 | top->x = viewProj->m[3] - viewProj->m[1]; |
| 83 | top->y = viewProj->m[7] - viewProj->m[5]; |
| 84 | top->z = viewProj->m[11] - viewProj->m[9]; |
| 85 | top->w = viewProj->m[15] - viewProj->m[13]; |
| 86 | |
| 87 | bottom->x = viewProj->m[3] + viewProj->m[1]; |
| 88 | bottom->y = viewProj->m[7] + viewProj->m[5]; |
| 89 | bottom->z = viewProj->m[11] + viewProj->m[9]; |
| 90 | bottom->w = viewProj->m[15] + viewProj->m[13]; |
| 91 | |
| 92 | near->x = viewProj->m[3] + viewProj->m[2]; |
| 93 | near->y = viewProj->m[7] + viewProj->m[6]; |
| 94 | near->z = viewProj->m[11] + viewProj->m[10]; |
| 95 | near->w = viewProj->m[15] + viewProj->m[14]; |
| 96 | |
| 97 | far->x = viewProj->m[3] - viewProj->m[2]; |
| 98 | far->y = viewProj->m[7] - viewProj->m[6]; |
| 99 | far->z = viewProj->m[11] - viewProj->m[10]; |
| 100 | far->w = viewProj->m[15] - viewProj->m[14]; |
| 101 | |
| 102 | float len = length(left->xyz); |
| 103 | *left /= len; |
| 104 | len = length(right->xyz); |
| 105 | *right /= len; |
| 106 | len = length(top->xyz); |
| 107 | *top /= len; |
| 108 | len = length(bottom->xyz); |
| 109 | *bottom /= len; |
| 110 | len = length(near->xyz); |
| 111 | *near /= len; |
| 112 | len = length(far->xyz); |
| 113 | *far /= len; |
| 114 | } |
Miao Wang | a80121f | 2016-02-26 13:58:13 -0800 | [diff] [blame] | 115 | #endif |
| 116 | |
| 117 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 118 | extern void __attribute__((overloadable)) |
| 119 | rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* righ, float4* top, |
| 120 | float4* bottom, float4* near, float4* far); |
| 121 | #endif |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 122 | |
| 123 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 124 | * rsIsSphereInFrustum: Checks if a sphere is within the frustum planes |
| 125 | * |
| 126 | * Returns true if the sphere is within the 6 frustum planes. |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 127 | * |
| 128 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 129 | * sphere: float4 representing the sphere. |
| 130 | * left: Left plane. |
| 131 | * right: Right plane. |
| 132 | * top: Top plane. |
| 133 | * bottom: Bottom plane. |
| 134 | * near: Near plane. |
| 135 | * far: Far plane. |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 136 | */ |
Miao Wang | a80121f | 2016-02-26 13:58:13 -0800 | [diff] [blame] | 137 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 138 | static inline bool __attribute__((always_inline, overloadable)) |
| 139 | rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom, |
| 140 | float4* near, float4* far) { |
| 141 | float distToCenter = dot(left->xyz, sphere->xyz) + left->w; |
| 142 | if (distToCenter < -sphere->w) { |
| 143 | return false; |
| 144 | } |
| 145 | distToCenter = dot(right->xyz, sphere->xyz) + right->w; |
| 146 | if (distToCenter < -sphere->w) { |
| 147 | return false; |
| 148 | } |
| 149 | distToCenter = dot(top->xyz, sphere->xyz) + top->w; |
| 150 | if (distToCenter < -sphere->w) { |
| 151 | return false; |
| 152 | } |
| 153 | distToCenter = dot(bottom->xyz, sphere->xyz) + bottom->w; |
| 154 | if (distToCenter < -sphere->w) { |
| 155 | return false; |
| 156 | } |
| 157 | distToCenter = dot(near->xyz, sphere->xyz) + near->w; |
| 158 | if (distToCenter < -sphere->w) { |
| 159 | return false; |
| 160 | } |
| 161 | distToCenter = dot(far->xyz, sphere->xyz) + far->w; |
| 162 | if (distToCenter < -sphere->w) { |
| 163 | return false; |
| 164 | } |
| 165 | return true; |
| 166 | } |
Miao Wang | a80121f | 2016-02-26 13:58:13 -0800 | [diff] [blame] | 167 | #endif |
| 168 | |
| 169 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 170 | extern bool __attribute__((overloadable)) |
| 171 | rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom, |
| 172 | float4* near, float4* far); |
| 173 | #endif |
Jean-Luc Brouillet | 4fbd903 | 2015-04-02 14:46:27 -0700 | [diff] [blame] | 174 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 175 | /* |
| 176 | * rsMatrixGet: Get one element |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 177 | * |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 178 | * Returns one element of a matrix. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 179 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 180 | * Warning: The order of the column and row parameters may be unexpected. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 181 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 182 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 183 | * m: Matrix to extract the element from. |
| 184 | * col: Zero-based column of the element to be extracted. |
| 185 | * row: Zero-based row of the element to extracted. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 186 | */ |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 187 | extern float __attribute__((overloadable)) |
| 188 | rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 189 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 190 | extern float __attribute__((overloadable)) |
| 191 | rsMatrixGet(const rs_matrix3x3* m, uint32_t col, uint32_t row); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 192 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 193 | extern float __attribute__((overloadable)) |
| 194 | rsMatrixGet(const rs_matrix2x2* m, uint32_t col, uint32_t row); |
| 195 | |
| 196 | /* |
| 197 | * rsMatrixInverse: Inverts a matrix in place |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 198 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 199 | * Returns true if the matrix was successfully inverted. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 200 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 201 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 202 | * m: Matrix to invert. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 203 | */ |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 204 | extern bool __attribute__((overloadable)) |
| 205 | rsMatrixInverse(rs_matrix4x4* m); |
| 206 | |
| 207 | /* |
| 208 | * rsMatrixInverseTranspose: Inverts and transpose a matrix in place |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 209 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 210 | * The matrix is first inverted then transposed. Returns true if the matrix was |
| 211 | * successfully inverted. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 212 | * |
| 213 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 214 | * m: Matrix to modify. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 215 | */ |
| 216 | extern bool __attribute__((overloadable)) |
| 217 | rsMatrixInverseTranspose(rs_matrix4x4* m); |
| 218 | |
| 219 | /* |
| 220 | * rsMatrixLoad: Load or copy a matrix |
| 221 | * |
| 222 | * Set the elements of a matrix from an array of floats or from another matrix. |
| 223 | * |
| 224 | * If loading from an array, the floats should be in row-major order, i.e. the element a |
| 225 | * row 0, column 0 should be first, followed by the element at |
| 226 | * row 0, column 1, etc. |
| 227 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 228 | * If loading from a matrix and the source is smaller than the destination, the rest |
| 229 | * of the destination is filled with elements of the identity matrix. E.g. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 230 | * loading a rs_matrix2x2 into a rs_matrix4x4 will give: |
| 231 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 232 | * m00 m01 0.0 0.0 |
| 233 | * m10 m11 0.0 0.0 |
| 234 | * 0.0 0.0 1.0 0.0 |
| 235 | * 0.0 0.0 0.0 1.0 |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 236 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 237 | * |
| 238 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 239 | * destination: Matrix to set. |
| 240 | * array: Array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size. |
| 241 | * source: Source matrix. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 242 | */ |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 243 | extern void __attribute__((overloadable)) |
| 244 | rsMatrixLoad(rs_matrix4x4* destination, const float* array); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 245 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 246 | extern void __attribute__((overloadable)) |
| 247 | rsMatrixLoad(rs_matrix3x3* destination, const float* array); |
| 248 | |
| 249 | extern void __attribute__((overloadable)) |
| 250 | rsMatrixLoad(rs_matrix2x2* destination, const float* array); |
| 251 | |
| 252 | extern void __attribute__((overloadable)) |
| 253 | rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix4x4* source); |
| 254 | |
| 255 | extern void __attribute__((overloadable)) |
| 256 | rsMatrixLoad(rs_matrix3x3* destination, const rs_matrix3x3* source); |
| 257 | |
| 258 | extern void __attribute__((overloadable)) |
| 259 | rsMatrixLoad(rs_matrix2x2* destination, const rs_matrix2x2* source); |
| 260 | |
| 261 | extern void __attribute__((overloadable)) |
| 262 | rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix3x3* source); |
| 263 | |
| 264 | extern void __attribute__((overloadable)) |
| 265 | rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix2x2* source); |
| 266 | |
| 267 | /* |
| 268 | * rsMatrixLoadFrustum: Load a frustum projection matrix |
| 269 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 270 | * Constructs a frustum projection matrix, transforming the box identified by |
| 271 | * the six clipping planes left, right, bottom, top, near, far. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 272 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 273 | * To apply this projection to a vector, multiply the vector by the created |
| 274 | * matrix using rsMatrixMultiply(). |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 275 | * |
| 276 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 277 | * m: Matrix to set. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 278 | */ |
| 279 | extern void __attribute__((overloadable)) |
| 280 | rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top, |
| 281 | float near, float far); |
| 282 | |
| 283 | /* |
| 284 | * rsMatrixLoadIdentity: Load identity matrix |
| 285 | * |
| 286 | * Set the elements of a matrix to the identity matrix. |
| 287 | * |
| 288 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 289 | * m: Matrix to set. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 290 | */ |
| 291 | extern void __attribute__((overloadable)) |
| 292 | rsMatrixLoadIdentity(rs_matrix4x4* m); |
| 293 | |
| 294 | extern void __attribute__((overloadable)) |
| 295 | rsMatrixLoadIdentity(rs_matrix3x3* m); |
| 296 | |
| 297 | extern void __attribute__((overloadable)) |
| 298 | rsMatrixLoadIdentity(rs_matrix2x2* m); |
| 299 | |
| 300 | /* |
| 301 | * rsMatrixLoadMultiply: Multiply two matrices |
| 302 | * |
| 303 | * Sets m to the matrix product of lhs * rhs. |
| 304 | * |
| 305 | * To combine two 4x4 transformaton matrices, multiply the second transformation matrix |
| 306 | * by the first transformation matrix. E.g. to create a transformation matrix that applies |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 307 | * the transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1). |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 308 | * |
| 309 | * Warning: Prior to version 21, storing the result back into right matrix is not supported and |
| 310 | * will result in undefined behavior. Use rsMatrixMulitply instead. E.g. instead of doing |
| 311 | * rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l). |
| 312 | * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected. |
| 313 | * |
| 314 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 315 | * m: Matrix to set. |
| 316 | * lhs: Left matrix of the product. |
| 317 | * rhs: Right matrix of the product. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 318 | */ |
| 319 | extern void __attribute__((overloadable)) |
| 320 | rsMatrixLoadMultiply(rs_matrix4x4* m, const rs_matrix4x4* lhs, const rs_matrix4x4* rhs); |
| 321 | |
| 322 | extern void __attribute__((overloadable)) |
| 323 | rsMatrixLoadMultiply(rs_matrix3x3* m, const rs_matrix3x3* lhs, const rs_matrix3x3* rhs); |
| 324 | |
| 325 | extern void __attribute__((overloadable)) |
| 326 | rsMatrixLoadMultiply(rs_matrix2x2* m, const rs_matrix2x2* lhs, const rs_matrix2x2* rhs); |
| 327 | |
| 328 | /* |
| 329 | * rsMatrixLoadOrtho: Load an orthographic projection matrix |
| 330 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 331 | * Constructs an orthographic projection matrix, transforming the box identified by the |
| 332 | * six clipping planes left, right, bottom, top, near, far into a unit cube |
| 333 | * with a corner at (-1, -1, -1) and the opposite at (1, 1, 1). |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 334 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 335 | * To apply this projection to a vector, multiply the vector by the created matrix |
| 336 | * using rsMatrixMultiply(). |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 337 | * |
| 338 | * See https://en.wikipedia.org/wiki/Orthographic_projection . |
| 339 | * |
| 340 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 341 | * m: Matrix to set. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 342 | */ |
| 343 | extern void __attribute__((overloadable)) |
| 344 | rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near, |
| 345 | float far); |
| 346 | |
| 347 | /* |
| 348 | * rsMatrixLoadPerspective: Load a perspective projection matrix |
| 349 | * |
| 350 | * Constructs a perspective projection matrix, assuming a symmetrical field of view. |
| 351 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 352 | * To apply this projection to a vector, multiply the vector by the created matrix |
| 353 | * using rsMatrixMultiply(). |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 354 | * |
| 355 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 356 | * m: Matrix to set. |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 357 | * fovy: Field of view, in degrees along the Y axis. |
| 358 | * aspect: Ratio of x / y. |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 359 | * near: Near clipping plane. |
| 360 | * far: Far clipping plane. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 361 | */ |
| 362 | extern void __attribute__((overloadable)) |
| 363 | rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far); |
| 364 | |
| 365 | /* |
| 366 | * rsMatrixLoadRotate: Load a rotation matrix |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 367 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 368 | * This function creates a rotation matrix. The axis of rotation is the (x, y, z) vector. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 369 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 370 | * To rotate a vector, multiply the vector by the created matrix using rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 371 | * |
| 372 | * See http://en.wikipedia.org/wiki/Rotation_matrix . |
| 373 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 374 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 375 | * m: Matrix to set. |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 376 | * rot: How much rotation to do, in degrees. |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 377 | * x: X component of the vector that is the axis of rotation. |
| 378 | * y: Y component of the vector that is the axis of rotation. |
| 379 | * z: Z component of the vector that is the axis of rotation. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 380 | */ |
| 381 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 382 | rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 383 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 384 | /* |
| 385 | * rsMatrixLoadScale: Load a scaling matrix |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 386 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 387 | * This function creates a scaling matrix, where each component of a vector is multiplied |
| 388 | * by a number. This number can be negative. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 389 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 390 | * To scale a vector, multiply the vector by the created matrix using rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 391 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 392 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 393 | * m: Matrix to set. |
| 394 | * x: Multiple to scale the x components by. |
| 395 | * y: Multiple to scale the y components by. |
| 396 | * z: Multiple to scale the z components by. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 397 | */ |
| 398 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 399 | rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 400 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 401 | /* |
| 402 | * rsMatrixLoadTranslate: Load a translation matrix |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 403 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 404 | * This function creates a translation matrix, where a number is added to each element of |
| 405 | * a vector. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 406 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 407 | * To translate a vector, multiply the vector by the created matrix using |
| 408 | * rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 409 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 410 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 411 | * m: Matrix to set. |
| 412 | * x: Number to add to each x component. |
| 413 | * y: Number to add to each y component. |
| 414 | * z: Number to add to each z component. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 415 | */ |
| 416 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 417 | rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 418 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 419 | /* |
| 420 | * rsMatrixMultiply: Multiply a matrix by a vector or another matrix |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 421 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 422 | * For the matrix by matrix variant, sets m to the matrix product m * rhs. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 423 | * |
| 424 | * When combining two 4x4 transformation matrices using this function, the resulting |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 425 | * matrix will correspond to performing the rhs transformation first followed by |
| 426 | * the original m transformation. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 427 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 428 | * For the matrix by vector variant, returns the post-multiplication of the vector |
| 429 | * by the matrix, ie. m * in. |
| 430 | * |
| 431 | * When multiplying a float3 to a rs_matrix4x4, the vector is expanded with (1). |
| 432 | * |
| 433 | * When multiplying a float2 to a rs_matrix4x4, the vector is expanded with (0, 1). |
| 434 | * |
| 435 | * When multiplying a float2 to a rs_matrix3x3, the vector is expanded with (0). |
| 436 | * |
| 437 | * Starting with API 14, this function takes a const matrix as the first argument. |
| 438 | * |
| 439 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 440 | * m: Left matrix of the product and the matrix to be set. |
| 441 | * rhs: Right matrix of the product. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 442 | */ |
| 443 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 444 | rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 445 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 446 | extern void __attribute__((overloadable)) |
| 447 | rsMatrixMultiply(rs_matrix3x3* m, const rs_matrix3x3* rhs); |
| 448 | |
| 449 | extern void __attribute__((overloadable)) |
| 450 | rsMatrixMultiply(rs_matrix2x2* m, const rs_matrix2x2* rhs); |
| 451 | |
| 452 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 453 | extern float4 __attribute__((overloadable)) |
| 454 | rsMatrixMultiply(rs_matrix4x4* m, float4 in); |
| 455 | #endif |
| 456 | |
| 457 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 458 | extern float4 __attribute__((overloadable)) |
| 459 | rsMatrixMultiply(rs_matrix4x4* m, float3 in); |
| 460 | #endif |
| 461 | |
| 462 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 463 | extern float4 __attribute__((overloadable)) |
| 464 | rsMatrixMultiply(rs_matrix4x4* m, float2 in); |
| 465 | #endif |
| 466 | |
| 467 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 468 | extern float3 __attribute__((overloadable)) |
| 469 | rsMatrixMultiply(rs_matrix3x3* m, float3 in); |
| 470 | #endif |
| 471 | |
| 472 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 473 | extern float3 __attribute__((overloadable)) |
| 474 | rsMatrixMultiply(rs_matrix3x3* m, float2 in); |
| 475 | #endif |
| 476 | |
| 477 | #if !defined(RS_VERSION) || (RS_VERSION <= 13) |
| 478 | extern float2 __attribute__((overloadable)) |
| 479 | rsMatrixMultiply(rs_matrix2x2* m, float2 in); |
| 480 | #endif |
| 481 | |
| 482 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 483 | extern float4 __attribute__((overloadable)) |
| 484 | rsMatrixMultiply(const rs_matrix4x4* m, float4 in); |
| 485 | #endif |
| 486 | |
| 487 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 488 | extern float4 __attribute__((overloadable)) |
| 489 | rsMatrixMultiply(const rs_matrix4x4* m, float3 in); |
| 490 | #endif |
| 491 | |
| 492 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 493 | extern float4 __attribute__((overloadable)) |
| 494 | rsMatrixMultiply(const rs_matrix4x4* m, float2 in); |
| 495 | #endif |
| 496 | |
| 497 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 498 | extern float3 __attribute__((overloadable)) |
| 499 | rsMatrixMultiply(const rs_matrix3x3* m, float3 in); |
| 500 | #endif |
| 501 | |
| 502 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 503 | extern float3 __attribute__((overloadable)) |
| 504 | rsMatrixMultiply(const rs_matrix3x3* m, float2 in); |
| 505 | #endif |
| 506 | |
| 507 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
| 508 | extern float2 __attribute__((overloadable)) |
| 509 | rsMatrixMultiply(const rs_matrix2x2* m, float2 in); |
| 510 | #endif |
| 511 | |
| 512 | /* |
| 513 | * rsMatrixRotate: Apply a rotation to a transformation matrix |
| 514 | * |
| 515 | * Multiply the matrix m with a rotation matrix. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 516 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 517 | * This function modifies a transformation matrix to first do a rotation. The axis of |
| 518 | * rotation is the (x, y, z) vector. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 519 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 520 | * To apply this combined transformation to a vector, multiply the vector by the created |
| 521 | * matrix using rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 522 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 523 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 524 | * m: Matrix to modify. |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 525 | * rot: How much rotation to do, in degrees. |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 526 | * x: X component of the vector that is the axis of rotation. |
| 527 | * y: Y component of the vector that is the axis of rotation. |
| 528 | * z: Z component of the vector that is the axis of rotation. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 529 | */ |
| 530 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 531 | rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 532 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 533 | /* |
| 534 | * rsMatrixScale: Apply a scaling to a transformation matrix |
| 535 | * |
| 536 | * Multiply the matrix m with a scaling matrix. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 537 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 538 | * This function modifies a transformation matrix to first do a scaling. When scaling, |
| 539 | * each component of a vector is multiplied by a number. This number can be negative. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 540 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 541 | * To apply this combined transformation to a vector, multiply the vector by the created |
| 542 | * matrix using rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 543 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 544 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 545 | * m: Matrix to modify. |
| 546 | * x: Multiple to scale the x components by. |
| 547 | * y: Multiple to scale the y components by. |
| 548 | * z: Multiple to scale the z components by. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 549 | */ |
| 550 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 551 | rsMatrixScale(rs_matrix4x4* m, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 552 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 553 | /* |
| 554 | * rsMatrixSet: Set one element |
| 555 | * |
| 556 | * Set an element of a matrix. |
| 557 | * |
| 558 | * Warning: The order of the column and row parameters may be unexpected. |
| 559 | * |
| 560 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 561 | * m: Matrix that will be modified. |
| 562 | * col: Zero-based column of the element to be set. |
| 563 | * row: Zero-based row of the element to be set. |
| 564 | * v: Value to set. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 565 | */ |
| 566 | extern void __attribute__((overloadable)) |
| 567 | rsMatrixSet(rs_matrix4x4* m, uint32_t col, uint32_t row, float v); |
| 568 | |
| 569 | extern void __attribute__((overloadable)) |
| 570 | rsMatrixSet(rs_matrix3x3* m, uint32_t col, uint32_t row, float v); |
| 571 | |
| 572 | extern void __attribute__((overloadable)) |
| 573 | rsMatrixSet(rs_matrix2x2* m, uint32_t col, uint32_t row, float v); |
| 574 | |
| 575 | /* |
| 576 | * rsMatrixTranslate: Apply a translation to a transformation matrix |
| 577 | * |
| 578 | * Multiply the matrix m with a translation matrix. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 579 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 580 | * This function modifies a transformation matrix to first do a translation. When |
| 581 | * translating, a number is added to each component of a vector. |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 582 | * |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 583 | * To apply this combined transformation to a vector, multiply the vector by the |
| 584 | * created matrix using rsMatrixMultiply(). |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 585 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 586 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 587 | * m: Matrix to modify. |
| 588 | * x: Number to add to each x component. |
| 589 | * y: Number to add to each y component. |
| 590 | * z: Number to add to each z component. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 591 | */ |
| 592 | extern void __attribute__((overloadable)) |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 593 | rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 594 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 595 | /* |
| 596 | * rsMatrixTranspose: Transpose a matrix place |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 597 | * |
Stephen Hines | 271efdf | 2014-10-01 20:25:12 -0700 | [diff] [blame] | 598 | * Transpose the matrix m in place. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 599 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 600 | * Parameters: |
Pirama Arumuga Nainar | 37fb08a | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 601 | * m: Matrix to transpose. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 602 | */ |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 603 | extern void __attribute__((overloadable)) |
| 604 | rsMatrixTranspose(rs_matrix4x4* m); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 605 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 606 | extern void __attribute__((overloadable)) |
| 607 | rsMatrixTranspose(rs_matrix3x3* m); |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 608 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 609 | extern void __attribute__((overloadable)) |
| 610 | rsMatrixTranspose(rs_matrix2x2* m); |
| 611 | |
| 612 | #endif // RENDERSCRIPT_RS_MATRIX_RSH |