Advertisement
krzys_h

Untitled

Jan 30th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.03 KB | None | 0 0
  1. diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
  2. index cf0e71e..142390e 100644
  3. --- a/src/graphics/opengl/gldevice.cpp
  4. +++ b/src/graphics/opengl/gldevice.cpp
  5. @@ -566,20 +566,21 @@ void CGLDevice::UpdateLightPositions()
  6.  
  7.      for (int index = 0; index < lightCount; index++)
  8.      {
  9. -        if (m_lights[index].type == LIGHT_SPOT)
  10. +        const Light& light = m_lights[index];
  11. +        if (light.type == LIGHT_SPOT)
  12.          {
  13. -            GLfloat direction[4] = { -m_lights[index].direction.x,
  14. -                -m_lights[index].direction.y,
  15. -                -m_lights[index].direction.z,
  16. +            GLfloat direction[4] = { -light.direction.x,
  17. +                -light.direction.y,
  18. +                -light.direction.z,
  19.                  1.0f };
  20.  
  21.              glLightfv(GL_LIGHT0 + index, GL_SPOT_DIRECTION, direction);
  22.          }
  23. -        else if (m_lights[index].type == LIGHT_DIRECTIONAL)
  24. +        else if (light.type == LIGHT_DIRECTIONAL)
  25.          {
  26. -            GLfloat position[4] = { -m_lights[index].direction.x,
  27. -                -m_lights[index].direction.y,
  28. -                -m_lights[index].direction.z,
  29. +            GLfloat position[4] = { -light.direction.x,
  30. +                -light.direction.y,
  31. +                -light.direction.z,
  32.                  0.0f };
  33.              glLightfv(GL_LIGHT0 + index, GL_POSITION, position);
  34.          }
  35. @@ -592,11 +593,12 @@ void CGLDevice::UpdateLightPositions()
  36.  
  37.      for (int index = 0; index < lightCount; index++)
  38.      {
  39. -        if (m_lights[index].type == LIGHT_POINT)
  40. +        const Light& light = m_lights[index];
  41. +        if (light.type == LIGHT_POINT)
  42.          {
  43. -            GLfloat position[4] = { m_lights[index].position.x,
  44. -                m_lights[index].position.y,
  45. -                m_lights[index].position.z,
  46. +            GLfloat position[4] = { light.position.x,
  47. +                light.position.y,
  48. +                light.position.z,
  49.                  1.0f };
  50.  
  51.              glLightfv(GL_LIGHT0 + index, GL_POSITION, position);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement