diff options
author | Jean-Luc Brouillet <jeanluc@google.com> | 2014-09-05 17:44:48 -0700 |
---|---|---|
committer | Jean-Luc Brouillet <jeanluc@google.com> | 2014-09-08 15:40:58 -0700 |
commit | 1bb2eed69caa28cf8198d58db7d9134cc2f563f5 (patch) | |
tree | a13139843a108be78b86d4f1eef0fe574055c1a7 /rsMatrix4x4.h | |
parent | 33164686a7ac88d4eda38201be4127937e9c12b0 (diff) | |
download | rs-1bb2eed69caa28cf8198d58db7d9134cc2f563f5.tar.gz |
Improve rsMatrix* documentation, fix bugs
Improves the user-facing documentation. Fix the incorrect row & column
naming on the Get/Set API. Fix a bug where rsMatrixLoadMultiply could
not have the destination be one of the source,
e.g. rsMatrixLoadMultiply(&l, &l, &r)
Change-Id: I42207aacf4ebe815d4a79db2aaa9c44f85864696
Diffstat (limited to 'rsMatrix4x4.h')
-rw-r--r-- | rsMatrix4x4.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/rsMatrix4x4.h b/rsMatrix4x4.h index 44c33d1d..8e4a5867 100644 --- a/rsMatrix4x4.h +++ b/rsMatrix4x4.h @@ -25,12 +25,12 @@ namespace android { namespace renderscript { struct Matrix4x4 : public rs_matrix4x4 { - float get(uint32_t x, uint32_t y) const { - return m[x*4 + y]; + float get(uint32_t col, uint32_t row) const { + return m[col*4 + row]; } - void set(uint32_t x, uint32_t y, float v) { - m[x*4 + y] = v; + void set(uint32_t col, uint32_t row, float v) { + m[col*4 + row] = v; } void loadIdentity(); @@ -48,6 +48,7 @@ struct Matrix4x4 : public rs_matrix4x4 { void loadFrustum(float l, float r, float b, float t, float n, float f); void loadPerspective(float fovy, float aspect, float near, float far); + // Note: This assumes that the input vector (in) is of length 3. void vectorMultiply(float *v4out, const float *v3in) const; bool inverse(); @@ -58,9 +59,7 @@ struct Matrix4x4 : public rs_matrix4x4 { void multiply(const rs_matrix4x4 *rhs) { - Matrix4x4 tmp; - tmp.loadMultiply(this, rhs); - load(&tmp); + loadMultiply(this, rhs); } void rotate(float rot, float x, float y, float z) { Matrix4x4 tmp; |