PageRenderTime 102ms CodeModel.GetById 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/app_settings/shaders/class2/effects/blurV.glsl

https://bitbucket.org/lindenlab/viewer-beta/
text | 55 lines | 47 code | 8 blank | 0 comment | 0 complexity | 23694dd7f7b27fb3e391147e571ef463 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file blurV.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. uniform vec2 texelSize;
  26. uniform vec2 blurDirection;
  27. uniform float blurWidth;
  28. void main(void)
  29. {
  30. // Transform vertex
  31. gl_Position = ftransform();
  32. vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
  33. vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
  34. // for (int i = 0; i < 7; i++) {
  35. // gl_TexCoord[i].st = s + (i * blurDelta);
  36. // }
  37. // MANUALLY UNROLL
  38. gl_TexCoord[0].st = s;
  39. gl_TexCoord[1].st = s + blurDelta;
  40. gl_TexCoord[2].st = s + (2. * blurDelta);
  41. gl_TexCoord[3].st = s + (3. * blurDelta);
  42. gl_TexCoord[4].st = s + (4. * blurDelta);
  43. gl_TexCoord[5].st = s + (5. * blurDelta);
  44. gl_TexCoord[6].st = s + (6. * blurDelta);
  45. // gl_TexCoord[0].st = s;
  46. // gl_TexCoord[1].st = blurDelta;
  47. }