API reaview cleanup
Change-Id: Ib1aaf81130ffa6b5e6c60096c27c969e8891db3f
diff --git a/graphics/java/android/renderscript/Matrix4f.java b/graphics/java/android/renderscript/Matrix4f.java
index 5ffc21a..ea97509 100644
--- a/graphics/java/android/renderscript/Matrix4f.java
+++ b/graphics/java/android/renderscript/Matrix4f.java
@@ -31,6 +31,15 @@
loadIdentity();
}
+ public Matrix4f(float[] dataArray) {
+ mMat = new float[16];
+ System.arraycopy(dataArray, 0, mMat, 0, mMat.length);
+ }
+
+ public float[] getArray() {
+ return mMat;
+ }
+
public float get(int i, int j) {
return mMat[i*4 + j];
}
@@ -147,6 +156,10 @@
mMat[14]= -(f + n) / (f - n);
}
+ public void loadOrthoWindow(int w, int h) {
+ loadOrtho(0,w, h,0, -1,1);
+ }
+
public void loadFrustum(float l, float r, float b, float t, float n, float f) {
loadIdentity();
mMat[0] = 2 * n / (r - l);
@@ -159,6 +172,14 @@
mMat[15]= 0;
}
+ public void loadPerspective(float fovy, float aspect, float near, float far) {
+ float top = near * (float)Math.tan((float) (fovy * Math.PI / 360.0f));
+ float bottom = -top;
+ float left = bottom * aspect;
+ float right = top * aspect;
+ loadFrustum(left, right, bottom, top, near, far);
+ }
+
public void multiply(Matrix4f rhs) {
Matrix4f tmp = new Matrix4f();
tmp.loadMultiply(this, rhs);