diff options
author | Martin Storsjo <martin@martin.st> | 2012-04-24 00:50:56 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-07-12 16:59:20 +0300 |
commit | d5b1cda91ea5826e0fe8fa20d7daad57dc9ffd8b (patch) | |
tree | 3ba0b98933f39c88c137c3b4b6317de5e6b913b9 /opengl | |
parent | db1597a98958b78dc0d8eced19ae1406382b70d6 (diff) | |
download | frameworks_native-d5b1cda91ea5826e0fe8fa20d7daad57dc9ffd8b.zip frameworks_native-d5b1cda91ea5826e0fe8fa20d7daad57dc9ffd8b.tar.gz frameworks_native-d5b1cda91ea5826e0fe8fa20d7daad57dc9ffd8b.tar.bz2 |
libagl: Transform the vertex if using eye space lighting with point lights
This fixes lighting when using point lights, when eye space
lighting is used (which is the default).
Change-Id: I0cd0d2329893d6b5f8af3b1e595274c2076fc322
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libagl/light.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp index ca715db..fafec3f 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 { |