Property support for light positioning.
Tune up the light size to make it look better.
Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index b9ce872..6dfd925 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -85,8 +85,9 @@
}
void ShadowTessellator::tessellateSpotShadow(float width, float height,
- const mat4& receiverTransform, int screenWidth, int screenHeight,
- const mat4& casterTransform, VertexBuffer& shadowVertexBuffer) {
+ const Vector3& lightPosScale, const mat4& receiverTransform,
+ int screenWidth, int screenHeight, const mat4& casterTransform,
+ VertexBuffer& shadowVertexBuffer) {
const int vertexCount = 4;
Vector3 polygon[vertexCount];
generateCasterPolygon(width, height, casterTransform, vertexCount, polygon);
@@ -97,7 +98,8 @@
const int layers = 2;
const float strength = 0.5;
int maximal = max(screenWidth, screenHeight);
- Vector3 lightCenter(screenWidth / 2, 0, maximal);
+ Vector3 lightCenter(screenWidth * lightPosScale.x, screenHeight * lightPosScale.y,
+ maximal * lightPosScale.z);
#if DEBUG_SHADOW
ALOGD("light center %f %f %f", lightCenter.x, lightCenter.y, lightCenter.z);
#endif
@@ -108,7 +110,7 @@
reverseReceiverTransform.loadInverse(receiverTransform);
reverseReceiverTransform.mapPoint3d(lightCenter);
- const float lightSize = maximal / 8;
+ const float lightSize = maximal / 4;
const int lightVertexCount = 16;
SpotShadow::createSpotShadow(polygon, vertexCount, lightCenter, lightSize,