diff options
author | Brian <[email protected]> | 2007-05-21 08:57:18 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-05-21 08:57:18 -0600 |
commit | a8676c45ccab52117c70f2e90fd820d745261f51 (patch) | |
tree | ccb2f3a5f82d1063577de5b0f39602e9299ce95f | |
parent | 9e8a961dd7d7b717a9fb4ecdea1c1b60ea355efe (diff) |
if light position is local, treat it as a homogeneous coord and divide by W (see bug 11009)
-rw-r--r-- | src/mesa/main/light.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 92d8a0ae0d4..6e057614bad 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1117,6 +1117,13 @@ compute_light_positions( GLcontext *ctx ) } light->_VP_inf_spot_attenuation = 1.0; } + else { + /* positional light w/ homogeneous coordinate, divide by W */ + GLfloat wInv = 1.0 / light->_Position[3]; + light->_Position[0] *= wInv; + light->_Position[1] *= wInv; + light->_Position[2] *= wInv; + } if (light->_Flags & LIGHT_SPOT) { if (ctx->_NeedEyeCoords) { |