diff options
author | Chris Craik <ccraik@google.com> | 2014-03-11 12:20:17 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-03-12 09:44:41 -0700 |
commit | b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0 (patch) | |
tree | 6b92898b802b665b62127766baa87e8261569062 /libs/hwui/Matrix.cpp | |
parent | e361ad7ab15fcf4919a56a6293689d968ee8dcff (diff) |
Fix orthographic shadows projection, simplify shadow reordering
Separate matrix passed to shadow system into two parts, one for
transforming the polygon XY points (using the actual draw matrix) and
a separate one which respects correct 4x4 3d rotations and
translations for determining Z values.
Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
Diffstat (limited to 'libs/hwui/Matrix.cpp')
-rw-r--r-- | libs/hwui/Matrix.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp index 3d6188a0ddfa..f06106b14ee7 100644 --- a/libs/hwui/Matrix.cpp +++ b/libs/hwui/Matrix.cpp @@ -385,9 +385,14 @@ void Matrix4::loadOrtho(float left, float right, float bottom, float top, float mType = kTypeTranslate | kTypeScale | kTypeRectToRect; } +float Matrix4::mapZ(const Vector3& orig) const { + // duplicates logic for mapPoint3d's z coordinate + return orig.x * data[2] + orig.y * data[6] + orig.z * data[kScaleZ] + data[kTranslateZ]; +} + void Matrix4::mapPoint3d(Vector3& vec) const { //TODO: optimize simple case - Vector3 orig(vec); + const Vector3 orig(vec); vec.x = orig.x * data[kScaleX] + orig.y * data[kSkewX] + orig.z * data[8] + data[kTranslateX]; vec.y = orig.x * data[kSkewY] + orig.y * data[kScaleY] + orig.z * data[9] + data[kTranslateY]; vec.z = orig.x * data[2] + orig.y * data[6] + orig.z * data[kScaleZ] + data[kTranslateZ]; |