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