Guest User

Untitled

a guest
May 3rd, 2013
35
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GameGlobalShaderConstantSetter(Sky *sky, bool *force_fog_off,
  2. f32 *fog_range, Client *client):
  3. m_sky(sky),
  4. m_force_fog_off(force_fog_off),
  5. m_fog_range(fog_range),
  6. m_client(client)
  7. {}
  8. ~GameGlobalShaderConstantSetter() {}
  9.  
  10. virtual void onSetConstants(video::IMaterialRendererServices *services,
  11. bool is_highlevel)
  12. {
  13. if(!is_highlevel)
  14. return;
  15.  
  16. // Background color
  17. video::SColor bgcolor = m_sky->getBgColor();
  18. video::SColorf bgcolorf(bgcolor);
  19. float bgcolorfa[4] = {
  20. bgcolorf.r,
  21. bgcolorf.g,
  22. bgcolorf.b,
  23. bgcolorf.a,
  24. };
  25. services->setPixelShaderConstant("skyBgColor", bgcolorfa, 4);
  26.  
  27. // Fog distance
  28. float fog_distance = *m_fog_range;
  29. if(*m_force_fog_off)
  30. fog_distance = 10000*BS;
  31. services->setPixelShaderConstant("fogDistance", &fog_distance, 1);
  32.  
  33. // Day-night ratio
  34. u32 daynight_ratio = m_client->getEnv().getDayNightRatio();
  35. float daynight_ratio_f = (float)daynight_ratio / 1000.0;
  36. services->setPixelShaderConstant("dayNightRatio", &daynight_ratio_f, 1);
  37. video::SMaterial texture=m_sky->getMaterial(1);
  38. services->setPixelShaderConstant("glow", (float*)&texture, 1);
  39. texture=m_sky->getMaterial(2);
  40. services->setPixelShaderConstant("color", (float*)&texture, 1);
  41. }
  42. };
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×