Skip to content

Commit

Permalink
Merge "libagl: Transform the vertex if using eye space lighting with …
Browse files Browse the repository at this point in the history
…point lights"
  • Loading branch information
pixelflinger authored and android code review committed Sep 20, 2012
2 parents 09a22fc + d5b1cda commit 8a2b542
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions opengl/libagl/light.cpp
Expand Up @@ -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 {
Expand Down

0 comments on commit 8a2b542

Please sign in to comment.