PageRenderTime 37ms CodeModel.GetById 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 53 lines | 44 code | 9 blank | 0 comment | 0 complexity | 6fb4464f41580d5c52e9f19aea7f2942 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file transportF.glsl
  3. *
  4. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  5. * Second Life Viewer Source Code
  6. * Copyright (C) 2007, Linden Research, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation;
  11. * version 2.1 of the License only.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  23. * $/LicenseInfo$
  24. */
  25. //////////////////////////////////////////////////////////
  26. // The fragment shader for the terrain atmospherics
  27. //////////////////////////////////////////////////////////
  28. vec3 getAdditiveColor();
  29. vec3 getAtmosAttenuation();
  30. uniform sampler2D cloudMap;
  31. uniform vec4 cloud_pos_density1;
  32. vec3 atmosTransport(vec3 light) {
  33. light *= getAtmosAttenuation().r;
  34. light += getAdditiveColor() * 2.0;
  35. return light;
  36. }
  37. vec3 fullbrightAtmosTransport(vec3 light) {
  38. float brightness = dot(light.rgb, vec3(0.33333));
  39. return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness);
  40. }
  41. vec3 fullbrightShinyAtmosTransport(vec3 light) {
  42. float brightness = dot(light.rgb, vec3(0.33333));
  43. return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness);
  44. }