blob: 3ed35a467505f16e08aa8d5b6ffd5aad02ccb87e [file] [log] [blame]
Jason Sams044e2ee2011-08-08 16:52:30 -07001/*
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07002 * Copyright (C) 2015 The Android Open Source Project
Jason Sams044e2ee2011-08-08 16:52:30 -07003 *
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
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070017// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
18
19/*
20 * rs_matrix.rsh: Matrix functions
Jason Sams044e2ee2011-08-08 16:52:30 -070021 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070022 * These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
23 * They are particularly useful for graphical transformations and are
24 * compatible with OpenGL.
25 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070026 * We use a zero-based index for rows and columns. E.g. the last element of
27 * a rs_matrix4x4 is found at (3, 3).
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070028 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070029 * RenderScript uses column-major matrices and column-based vectors.
30 * Transforming a vector is done by postmultiplying the vector,
31 * e.g. (matrix * vector), as provided by rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070032 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070033 * To create a transformation matrix that performs two transformations at
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070034 * once, multiply the two source matrices, with the first transformation as the
35 * right argument. E.g. to create a transformation matrix that applies the
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070036 * transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1).
37 * This derives from s2 * (s1 * v), which is (s2 * s1) * v.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070038 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070039 * We have two style of functions to create transformation matrices:
40 * rsMatrixLoadTransformation and rsMatrixTransformation. The
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070041 * former style simply stores the transformation matrix in the first argument.
42 * The latter modifies a pre-existing transformation matrix so that the new
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070043 * transformation happens first. E.g. if you call rsMatrixTranslate()
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070044 * on a matrix that already does a scaling, the resulting matrix when applied
45 * to a vector will first do the translation then the scaling.
Jason Sams044e2ee2011-08-08 16:52:30 -070046 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070047#ifndef RENDERSCRIPT_RS_MATRIX_RSH
48#define RENDERSCRIPT_RS_MATRIX_RSH
Jason Sams044e2ee2011-08-08 16:52:30 -070049
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070050/*
51 * rsMatrixGet: Get one element
Jason Sams044e2ee2011-08-08 16:52:30 -070052 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070053 * Returns one element of a matrix.
Jason Sams044e2ee2011-08-08 16:52:30 -070054 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070055 * Warning: The order of the column and row parameters may be unexpected.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070056 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070057 * Parameters:
58 * m The matrix to extract the element from.
59 * col The zero-based column of the element to be extracted.
60 * row The zero-based row of the element to extracted.
Jason Sams044e2ee2011-08-08 16:52:30 -070061 */
Jean-Luc Brouillet129c1472015-03-02 15:37:07 -080062extern float __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070063 rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row);
Jason Sams044e2ee2011-08-08 16:52:30 -070064
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070065extern float __attribute__((overloadable))
66 rsMatrixGet(const rs_matrix3x3* m, uint32_t col, uint32_t row);
Jason Sams044e2ee2011-08-08 16:52:30 -070067
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070068extern float __attribute__((overloadable))
69 rsMatrixGet(const rs_matrix2x2* m, uint32_t col, uint32_t row);
70
71/*
72 * rsMatrixInverse: Inverts a matrix in place
Jason Sams044e2ee2011-08-08 16:52:30 -070073 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070074 * Returns true if the matrix was successfully inverted.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070075 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070076 * Parameters:
77 * m The matrix to invert.
Jason Sams044e2ee2011-08-08 16:52:30 -070078 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070079extern bool __attribute__((overloadable))
80 rsMatrixInverse(rs_matrix4x4* m);
81
82/*
83 * rsMatrixInverseTranspose: Inverts and transpose a matrix in place
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -070084 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070085 * The matrix is first inverted then transposed.
86 * Returns true if the matrix was successfully inverted.
87 *
88 * Parameters:
89 * m The matrix to modify.
90 */
91extern bool __attribute__((overloadable))
92 rsMatrixInverseTranspose(rs_matrix4x4* m);
93
94/*
95 * rsMatrixLoad: Load or copy a matrix
96 *
97 * Set the elements of a matrix from an array of floats or from another matrix.
98 *
99 * If loading from an array, the floats should be in row-major order, i.e. the element a
100 * row 0, column 0 should be first, followed by the element at
101 * row 0, column 1, etc.
102 *
103 * If loading from a matrix and the source is smaller than the destination, the rest of the
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700104 * destination is filled with elements of the identity matrix. E.g.
105 * loading a rs_matrix2x2 into a rs_matrix4x4 will give:
106 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700107 * m00 m01 0.0 0.0
108 * m10 m11 0.0 0.0
109 * 0.0 0.0 1.0 0.0
110 * 0.0 0.0 0.0 1.0
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700111 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700112 *
113 * Parameters:
114 * destination The matrix to set.
115 * array The array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
116 * source The source matrix.
Jason Sams044e2ee2011-08-08 16:52:30 -0700117 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700118extern void __attribute__((overloadable))
119 rsMatrixLoad(rs_matrix4x4* destination, const float* array);
Jason Sams044e2ee2011-08-08 16:52:30 -0700120
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700121extern void __attribute__((overloadable))
122 rsMatrixLoad(rs_matrix3x3* destination, const float* array);
123
124extern void __attribute__((overloadable))
125 rsMatrixLoad(rs_matrix2x2* destination, const float* array);
126
127extern void __attribute__((overloadable))
128 rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix4x4* source);
129
130extern void __attribute__((overloadable))
131 rsMatrixLoad(rs_matrix3x3* destination, const rs_matrix3x3* source);
132
133extern void __attribute__((overloadable))
134 rsMatrixLoad(rs_matrix2x2* destination, const rs_matrix2x2* source);
135
136extern void __attribute__((overloadable))
137 rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix3x3* source);
138
139extern void __attribute__((overloadable))
140 rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix2x2* source);
141
142/*
143 * rsMatrixLoadFrustum: Load a frustum projection matrix
144 *
145 * Constructs a frustum projection matrix, transforming the box
146 * identified by the six clipping planes left, right, bottom, top,
147 * near, far.
148 *
149 * To apply this projection to a vector, multiply the vector by the
150 * created matrix using rsMatrixMultiply().
151 *
152 * Parameters:
153 * m The matrix to set.
154 */
155extern void __attribute__((overloadable))
156 rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top,
157 float near, float far);
158
159/*
160 * rsMatrixLoadIdentity: Load identity matrix
161 *
162 * Set the elements of a matrix to the identity matrix.
163 *
164 * Parameters:
165 * m The matrix to set.
166 */
167extern void __attribute__((overloadable))
168 rsMatrixLoadIdentity(rs_matrix4x4* m);
169
170extern void __attribute__((overloadable))
171 rsMatrixLoadIdentity(rs_matrix3x3* m);
172
173extern void __attribute__((overloadable))
174 rsMatrixLoadIdentity(rs_matrix2x2* m);
175
176/*
177 * rsMatrixLoadMultiply: Multiply two matrices
178 *
179 * Sets m to the matrix product of lhs * rhs.
180 *
181 * To combine two 4x4 transformaton matrices, multiply the second transformation matrix
182 * by the first transformation matrix. E.g. to create a transformation matrix that applies
183 * the transformation s1 followed by s2, call
184 * rsMatrixLoadMultiply(&combined, &s2, &s1).
185 *
186 * Warning: Prior to version 21, storing the result back into right matrix is not supported and
187 * will result in undefined behavior. Use rsMatrixMulitply instead. E.g. instead of doing
188 * rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
189 * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
190 *
191 * Parameters:
192 * m The matrix to set.
193 * lhs The left matrix of the product.
194 * rhs The right matrix of the product.
195 */
196extern void __attribute__((overloadable))
197 rsMatrixLoadMultiply(rs_matrix4x4* m, const rs_matrix4x4* lhs, const rs_matrix4x4* rhs);
198
199extern void __attribute__((overloadable))
200 rsMatrixLoadMultiply(rs_matrix3x3* m, const rs_matrix3x3* lhs, const rs_matrix3x3* rhs);
201
202extern void __attribute__((overloadable))
203 rsMatrixLoadMultiply(rs_matrix2x2* m, const rs_matrix2x2* lhs, const rs_matrix2x2* rhs);
204
205/*
206 * rsMatrixLoadOrtho: Load an orthographic projection matrix
207 *
208 * Constructs an orthographic projection matrix, transforming the box
209 * identified by the six clipping planes left, right, bottom, top,
210 * near, far into a unit cube with a corner at
211 * (-1, -1, -1) and the opposite at (1, 1, 1).
212 *
213 * To apply this projection to a vector, multiply the vector by the
214 * created matrix using rsMatrixMultiply().
215 *
216 * See https://en.wikipedia.org/wiki/Orthographic_projection .
217 *
218 * Parameters:
219 * m The matrix to set.
220 */
221extern void __attribute__((overloadable))
222 rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near,
223 float far);
224
225/*
226 * rsMatrixLoadPerspective: Load a perspective projection matrix
227 *
228 * Constructs a perspective projection matrix, assuming a symmetrical field of view.
229 *
230 * To apply this projection to a vector, multiply the vector by the
231 * created matrix using rsMatrixMultiply().
232 *
233 * Parameters:
234 * m The matrix to set.
235 * fovy Field of view, in degrees along the Y axis.
236 * aspect Ratio of x / y.
237 * near The near clipping plane.
238 * far The far clipping plane.
239 */
240extern void __attribute__((overloadable))
241 rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
242
243/*
244 * rsMatrixLoadRotate: Load a rotation matrix
Jason Sams044e2ee2011-08-08 16:52:30 -0700245 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700246 * This function creates a rotation matrix. The axis of rotation is the
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700247 * (x, y, z) vector.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700248 *
249 * To rotate a vector, multiply the vector by the created matrix
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700250 * using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700251 *
252 * See http://en.wikipedia.org/wiki/Rotation_matrix .
253 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700254 * Parameters:
255 * m The matrix to set.
256 * rot How much rotation to do, in degrees.
257 * x The x component of the vector that is the axis of rotation.
258 * y The y component of the vector that is the axis of rotation.
259 * z The z component of the vector that is the axis of rotation.
Jason Sams044e2ee2011-08-08 16:52:30 -0700260 */
261extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700262 rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700263
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700264/*
265 * rsMatrixLoadScale: Load a scaling matrix
Jason Sams044e2ee2011-08-08 16:52:30 -0700266 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700267 * This function creates a scaling matrix, where each component of a
268 * vector is multiplied by a number. This number can be negative.
269 *
270 * To scale a vector, multiply the vector by the created matrix
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700271 * using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700272 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700273 * Parameters:
274 * m The matrix to set.
275 * x The multiple to scale the x components by.
276 * y The multiple to scale the y components by.
277 * z The multiple to scale the z components by.
Jason Sams044e2ee2011-08-08 16:52:30 -0700278 */
279extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700280 rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700281
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700282/*
283 * rsMatrixLoadTranslate: Load a translation matrix
Jason Sams044e2ee2011-08-08 16:52:30 -0700284 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700285 * This function creates a translation matrix, where a
286 * number is added to each element of a vector.
287 *
288 * To translate a vector, multiply the vector by the created matrix
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700289 * using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700290 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700291 * Parameters:
292 * m The matrix to set.
293 * x The number to add to each x component.
294 * y The number to add to each y component.
295 * z The number to add to each z component.
Jason Sams044e2ee2011-08-08 16:52:30 -0700296 */
297extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700298 rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700299
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700300/*
301 * rsMatrixMultiply: Multiply a matrix by a vector or another matrix
Jason Sams044e2ee2011-08-08 16:52:30 -0700302 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700303 * For the matrix by matrix variant, sets m to the matrix product m * rhs.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700304 *
305 * When combining two 4x4 transformation matrices using this function, the resulting
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700306 * matrix will correspond to performing the rhs transformation first followed by
307 * the original m transformation.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700308 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700309 * For the matrix by vector variant, returns the post-multiplication of the vector
310 * by the matrix, ie. m * in.
311 *
312 * When multiplying a float3 to a rs_matrix4x4, the vector is expanded with (1).
313 *
314 * When multiplying a float2 to a rs_matrix4x4, the vector is expanded with (0, 1).
315 *
316 * When multiplying a float2 to a rs_matrix3x3, the vector is expanded with (0).
317 *
318 * Starting with API 14, this function takes a const matrix as the first argument.
319 *
320 * Parameters:
321 * m The left matrix of the product and the matrix to be set.
322 * rhs The right matrix of the product.
Jason Sams044e2ee2011-08-08 16:52:30 -0700323 */
324extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700325 rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs);
Jason Sams044e2ee2011-08-08 16:52:30 -0700326
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700327extern void __attribute__((overloadable))
328 rsMatrixMultiply(rs_matrix3x3* m, const rs_matrix3x3* rhs);
329
330extern void __attribute__((overloadable))
331 rsMatrixMultiply(rs_matrix2x2* m, const rs_matrix2x2* rhs);
332
333#if !defined(RS_VERSION) || (RS_VERSION <= 13)
334extern float4 __attribute__((overloadable))
335 rsMatrixMultiply(rs_matrix4x4* m, float4 in);
336#endif
337
338#if !defined(RS_VERSION) || (RS_VERSION <= 13)
339extern float4 __attribute__((overloadable))
340 rsMatrixMultiply(rs_matrix4x4* m, float3 in);
341#endif
342
343#if !defined(RS_VERSION) || (RS_VERSION <= 13)
344extern float4 __attribute__((overloadable))
345 rsMatrixMultiply(rs_matrix4x4* m, float2 in);
346#endif
347
348#if !defined(RS_VERSION) || (RS_VERSION <= 13)
349extern float3 __attribute__((overloadable))
350 rsMatrixMultiply(rs_matrix3x3* m, float3 in);
351#endif
352
353#if !defined(RS_VERSION) || (RS_VERSION <= 13)
354extern float3 __attribute__((overloadable))
355 rsMatrixMultiply(rs_matrix3x3* m, float2 in);
356#endif
357
358#if !defined(RS_VERSION) || (RS_VERSION <= 13)
359extern float2 __attribute__((overloadable))
360 rsMatrixMultiply(rs_matrix2x2* m, float2 in);
361#endif
362
363#if (defined(RS_VERSION) && (RS_VERSION >= 14))
364extern float4 __attribute__((overloadable))
365 rsMatrixMultiply(const rs_matrix4x4* m, float4 in);
366#endif
367
368#if (defined(RS_VERSION) && (RS_VERSION >= 14))
369extern float4 __attribute__((overloadable))
370 rsMatrixMultiply(const rs_matrix4x4* m, float3 in);
371#endif
372
373#if (defined(RS_VERSION) && (RS_VERSION >= 14))
374extern float4 __attribute__((overloadable))
375 rsMatrixMultiply(const rs_matrix4x4* m, float2 in);
376#endif
377
378#if (defined(RS_VERSION) && (RS_VERSION >= 14))
379extern float3 __attribute__((overloadable))
380 rsMatrixMultiply(const rs_matrix3x3* m, float3 in);
381#endif
382
383#if (defined(RS_VERSION) && (RS_VERSION >= 14))
384extern float3 __attribute__((overloadable))
385 rsMatrixMultiply(const rs_matrix3x3* m, float2 in);
386#endif
387
388#if (defined(RS_VERSION) && (RS_VERSION >= 14))
389extern float2 __attribute__((overloadable))
390 rsMatrixMultiply(const rs_matrix2x2* m, float2 in);
391#endif
392
393/*
394 * rsMatrixRotate: Apply a rotation to a transformation matrix
395 *
396 * Multiply the matrix m with a rotation matrix.
Jason Sams044e2ee2011-08-08 16:52:30 -0700397 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700398 * This function modifies a transformation matrix to first do a rotation.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700399 * The axis of rotation is the (x, y, z) vector.
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700400 *
401 * To apply this combined transformation to a vector, multiply
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700402 * the vector by the created matrix using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700403 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700404 * Parameters:
405 * m The matrix to modify.
406 * rot How much rotation to do, in degrees.
407 * x The x component of the vector that is the axis of rotation.
408 * y The y component of the vector that is the axis of rotation.
409 * z The z component of the vector that is the axis of rotation.
Jason Sams044e2ee2011-08-08 16:52:30 -0700410 */
411extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700412 rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700413
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700414/*
415 * rsMatrixScale: Apply a scaling to a transformation matrix
416 *
417 * Multiply the matrix m with a scaling matrix.
Jason Sams044e2ee2011-08-08 16:52:30 -0700418 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700419 * This function modifies a transformation matrix to first do a scaling.
420 * When scaling, each component of a vector is multiplied by a number.
421 * This number can be negative.
422 *
423 * To apply this combined transformation to a vector, multiply
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700424 * the vector by the created matrix using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700425 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700426 * Parameters:
427 * m The matrix to modify.
428 * x The multiple to scale the x components by.
429 * y The multiple to scale the y components by.
430 * z The multiple to scale the z components by.
Jason Sams044e2ee2011-08-08 16:52:30 -0700431 */
432extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700433 rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700434
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700435/*
436 * rsMatrixSet: Set one element
437 *
438 * Set an element of a matrix.
439 *
440 * Warning: The order of the column and row parameters may be unexpected.
441 *
442 * Parameters:
443 * m The matrix that will be modified.
444 * col The zero-based column of the element to be set.
445 * row The zero-based row of the element to be set.
446 * v The value to set.
447 */
448extern void __attribute__((overloadable))
449 rsMatrixSet(rs_matrix4x4* m, uint32_t col, uint32_t row, float v);
450
451extern void __attribute__((overloadable))
452 rsMatrixSet(rs_matrix3x3* m, uint32_t col, uint32_t row, float v);
453
454extern void __attribute__((overloadable))
455 rsMatrixSet(rs_matrix2x2* m, uint32_t col, uint32_t row, float v);
456
457/*
458 * rsMatrixTranslate: Apply a translation to a transformation matrix
459 *
460 * Multiply the matrix m with a translation matrix.
Jason Sams044e2ee2011-08-08 16:52:30 -0700461 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700462 * This function modifies a transformation matrix to first
463 * do a translation. When translating, a number is added
464 * to each component of a vector.
465 *
466 * To apply this combined transformation to a vector, multiply
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700467 * the vector by the created matrix using rsMatrixMultiply().
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700468 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700469 * Parameters:
470 * m The matrix to modify.
471 * x The number to add to each x component.
472 * y The number to add to each y component.
473 * z The number to add to each z component.
Jason Sams044e2ee2011-08-08 16:52:30 -0700474 */
475extern void __attribute__((overloadable))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700476 rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
Jason Sams044e2ee2011-08-08 16:52:30 -0700477
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700478/*
479 * rsMatrixTranspose: Transpose a matrix place
Jason Sams044e2ee2011-08-08 16:52:30 -0700480 *
Jean-Luc Brouillet1bb2eed2014-09-05 17:44:48 -0700481 * Transpose the matrix m in place.
Jason Sams044e2ee2011-08-08 16:52:30 -0700482 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700483 * Parameters:
484 * m The matrix to transpose.
Jason Sams044e2ee2011-08-08 16:52:30 -0700485 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700486extern void __attribute__((overloadable))
487 rsMatrixTranspose(rs_matrix4x4* m);
Jason Sams044e2ee2011-08-08 16:52:30 -0700488
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700489extern void __attribute__((overloadable))
490 rsMatrixTranspose(rs_matrix3x3* m);
Jason Sams044e2ee2011-08-08 16:52:30 -0700491
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -0700492extern void __attribute__((overloadable))
493 rsMatrixTranspose(rs_matrix2x2* m);
494
495#endif // RENDERSCRIPT_RS_MATRIX_RSH