Advertisement
Guest User

Untitled

a guest
Aug 17th, 2014
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. float light_f = (float)light / 255.0;
  2. light_f = pow(light_f, 2.2f); // gamma -> linear space
  3. light_f = light_f * light_amount;
  4. light_f = pow(light_f, 1.0f/2.2f); // linear -> gamma space
  5. if(light_f > 1.0)
  6. light_f = 1.0;
  7. light = 255.0 * light_f + 0.5;
  8.  
  9. replaced with:
  10.  
  11. light = core::clamp(core::round32(light*sqrtf(light_amount)), 0, 255);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement