summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Agopian <pixelflinger@gmail.com>2012-09-19 20:39:05 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-19 20:39:05 -0700
commit516efc1bea1c05492c5d4636a589cfc686661842 (patch)
treebee1f89817ecb4d2dae19198ec8ef60d39cf72a5
parente917bfbd19c265ef09c90f93f5dc175fc62259f5 (diff)
parent8a2b54235a45f92827b13723380065d1ce308236 (diff)
downloadnative-516efc1bea1c05492c5d4636a589cfc686661842.tar.gz
am 8a2b5423: Merge "libagl: Transform the vertex if using eye space lighting with point lights"
* commit '8a2b54235a45f92827b13723380065d1ce308236': libagl: Transform the vertex if using eye space lighting with point lights
-rw-r--r--opengl/libagl/light.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp
index ca715db607..fafec3fa2c 100644
--- a/opengl/libagl/light.cpp
+++ b/opengl/libagl/light.cpp
@@ -381,7 +381,14 @@ void lightVertex(ogles_context_t* c, vertex_t* v)
// compute vertex-to-light vector
if (ggl_unlikely(l.position.w)) {
// lightPos/1.0 - vertex/vertex.w == lightPos*vertex.w - vertex
+#if !OBJECT_SPACE_LIGHTING
+ vec4_t o;
+ const transform_t& mv = c->transforms.modelview.transform;
+ mv.point4(&mv, &o, &v->obj);
+ vss3(d.v, l.objPosition.v, o.w, o.v);
+#else
vss3(d.v, l.objPosition.v, v->obj.w, v->obj.v);
+#endif
sqDist = dot3(d.v, d.v);
vscale3(d.v, d.v, gglSqrtRecipx(sqDist));
} else {