Guest User

GZDoom lightmode calculation

a guest
Sep 30th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. int gl_CalcLightLevel(int lightlevel, int rellight, bool weapon)
  2. {
  3.     int light;
  4.  
  5.     if (lightlevel == 0) return 0;
  6.  
  7.     if ((glset.lightmode & 2) && lightlevel < 192 && !weapon)
  8.     {
  9.         light = xs_CRoundToInt(192.f - (192-lightlevel)* 1.95f);
  10.     }
  11.     else
  12.     {
  13.         light=lightlevel;
  14.     }
  15.  
  16.     if (light<gl_light_ambient && glset.lightmode != 8)     // ambient clipping only if not using software lighting model.
  17.     {
  18.         light = gl_light_ambient;
  19.         if (rellight<0) rellight>>=1;
  20.     }
  21.     return clamp(light+rellight, 0, 255);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment