summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsMatrix.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-06-17 16:52:59 -0700
committerJason Sams <rjsams@android.com>2009-06-17 16:52:59 -0700
commit9c54bdbf458e3c9433d237ae71cf47c4ec47d852 (patch)
tree5c740a213b3ac7518184f53692191d0f3cd8cc48 /libs/rs/rsMatrix.cpp
parentb37c0a5db65cd8b72cac6a3250faddd1aecb722e (diff)
downloadframeworks_base-9c54bdbf458e3c9433d237ae71cf47c4ec47d852.zip
frameworks_base-9c54bdbf458e3c9433d237ae71cf47c4ec47d852.tar.gz
frameworks_base-9c54bdbf458e3c9433d237ae71cf47c4ec47d852.tar.bz2
Implement default programs and implement defaults and parents for imports.
Diffstat (limited to 'libs/rs/rsMatrix.cpp')
-rw-r--r--libs/rs/rsMatrix.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/rs/rsMatrix.cpp b/libs/rs/rsMatrix.cpp
index e68d5ac..258b836 100644
--- a/libs/rs/rsMatrix.cpp
+++ b/libs/rs/rsMatrix.cpp
@@ -136,4 +136,26 @@ void Matrix::loadMultiply(const Matrix *lhs, const Matrix *rhs)
}
}
+void Matrix::loadOrtho(float l, float r, float b, float t, float n, float f) {
+ loadIdentity();
+ m[0] = 2 / (r - l);
+ m[5] = 2 / (t - b);
+ m[10]= -2 / (f - n);
+ m[12]= -(r + l) / (r - l);
+ m[13]= -(t + b) / (t - b);
+ m[14]= -(f + n) / (f - n);
+}
+
+void Matrix::loadFrustum(float l, float r, float b, float t, float n, float f) {
+ loadIdentity();
+ m[0] = 2 * n / (r - l);
+ m[5] = 2 * n / (t - b);
+ m[8] = (r + l) / (r - l);
+ m[9] = (t + b) / (t - b);
+ m[10]= -(f + n) / (f - n);
+ m[11]= -1;
+ m[14]= -2*f*n / (f - n);
+ m[15]= 0;
+}
+