frameworks/rs/scriptc/rs_matrix.rsh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 The Android Open Source Project
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00050 #ifndef __RS_MATRIX_RSH__
00051 #define __RS_MATRIX_RSH__
00052 
00066 _RS_RUNTIME void __attribute__((overloadable))
00067 rsMatrixSet(rs_matrix4x4 *m, uint32_t col, uint32_t row, float v);
00071 _RS_RUNTIME void __attribute__((overloadable))
00072 rsMatrixSet(rs_matrix3x3 *m, uint32_t col, uint32_t row, float v);
00076 _RS_RUNTIME void __attribute__((overloadable))
00077 rsMatrixSet(rs_matrix2x2 *m, uint32_t col, uint32_t row, float v);
00078 
00091 _RS_RUNTIME float __attribute__((overloadable))
00092 rsMatrixGet(const rs_matrix4x4 *m, uint32_t col, uint32_t row);
00096 _RS_RUNTIME float __attribute__((overloadable))
00097 rsMatrixGet(const rs_matrix3x3 *m, uint32_t col, uint32_t row);
00101 _RS_RUNTIME float __attribute__((overloadable))
00102 rsMatrixGet(const rs_matrix2x2 *m, uint32_t col, uint32_t row);
00103 
00109 extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix4x4 *m);
00113 extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix3x3 *m);
00117 extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix2x2 *m);
00118 
00130 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const float *v);
00134 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const float *v);
00138 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const float *v);
00156 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix4x4 *v);
00160 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix3x3 *v);
00164 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix2x2 *v);
00168 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const rs_matrix3x3 *v);
00172 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const rs_matrix2x2 *v);
00173 
00191 extern void __attribute__((overloadable))
00192 rsMatrixLoadRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
00193 
00208 extern void __attribute__((overloadable))
00209 rsMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z);
00210 
00225 extern void __attribute__((overloadable))
00226 rsMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z);
00227 
00247 extern void __attribute__((overloadable))
00248 rsMatrixLoadMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs);
00252 extern void __attribute__((overloadable))
00253 rsMatrixLoadMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs);
00257 extern void __attribute__((overloadable))
00258 rsMatrixLoadMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs);
00259 
00272 extern void __attribute__((overloadable))
00273 rsMatrixMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *rhs);
00277 extern void __attribute__((overloadable))
00278 rsMatrixMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *rhs);
00282 extern void __attribute__((overloadable))
00283 rsMatrixMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *rhs);
00284 
00300 extern void __attribute__((overloadable))
00301 rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
00302 
00318 extern void __attribute__((overloadable))
00319 rsMatrixScale(rs_matrix4x4 *m, float x, float y, float z);
00320 
00336 extern void __attribute__((overloadable))
00337 rsMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z);
00338 
00361 extern void __attribute__((overloadable))
00362 rsMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
00363 
00384 extern void __attribute__((overloadable))
00385 rsMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
00386 
00403 extern void __attribute__((overloadable))
00404 rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
00405 
00406 #if !defined(RS_VERSION) || (RS_VERSION < 14)
00407 
00421 _RS_RUNTIME float4 __attribute__((overloadable))
00422 rsMatrixMultiply(rs_matrix4x4 *m, float4 in);
00423 
00427 _RS_RUNTIME float4 __attribute__((overloadable))
00428 rsMatrixMultiply(rs_matrix4x4 *m, float3 in);
00429 
00433 _RS_RUNTIME float4 __attribute__((overloadable))
00434 rsMatrixMultiply(rs_matrix4x4 *m, float2 in);
00435 
00439 _RS_RUNTIME float3 __attribute__((overloadable))
00440 rsMatrixMultiply(rs_matrix3x3 *m, float3 in);
00441 
00445 _RS_RUNTIME float3 __attribute__((overloadable))
00446 rsMatrixMultiply(rs_matrix3x3 *m, float2 in);
00447 
00451 _RS_RUNTIME float2 __attribute__((overloadable))
00452 rsMatrixMultiply(rs_matrix2x2 *m, float2 in);
00453 #else
00454 
00467 _RS_RUNTIME float4 __attribute__((overloadable))
00468 rsMatrixMultiply(const rs_matrix4x4 *m, float4 in);
00469 
00473 _RS_RUNTIME float4 __attribute__((overloadable))
00474 rsMatrixMultiply(const rs_matrix4x4 *m, float3 in);
00475 
00479 _RS_RUNTIME float4 __attribute__((overloadable))
00480 rsMatrixMultiply(const rs_matrix4x4 *m, float2 in);
00481 
00485 _RS_RUNTIME float3 __attribute__((overloadable))
00486 rsMatrixMultiply(const rs_matrix3x3 *m, float3 in);
00487 
00491 _RS_RUNTIME float3 __attribute__((overloadable))
00492 rsMatrixMultiply(const rs_matrix3x3 *m, float2 in);
00493 
00497 _RS_RUNTIME float2 __attribute__((overloadable))
00498 rsMatrixMultiply(const rs_matrix2x2 *m, float2 in);
00499 #endif
00500 
00501 
00509 extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m);
00510 
00519 extern bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m);
00520 
00526 extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m);
00530 extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix3x3 *m);
00534 extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix2x2 *m);
00535 
00536 
00537 #endif