PageRenderTime 40ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 67 lines | 52 code | 15 blank | 0 comment | 0 complexity | becd7292bb9915c5d42b3a9e49f94555 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file shinySimpleSkinnedV.glsl
  3. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  4. * Second Life Viewer Source Code
  5. * Copyright (C) 2007, Linden Research, Inc.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation;
  10. * version 2.1 of the License only.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  22. * $/LicenseInfo$
  23. */
  24. uniform mat4 texture_matrix0;
  25. uniform mat4 texture_matrix1;
  26. uniform mat4 modelview_matrix;
  27. uniform mat4 projection_matrix;
  28. ATTRIBUTE vec3 position;
  29. ATTRIBUTE vec3 normal;
  30. ATTRIBUTE vec4 diffuse_color;
  31. ATTRIBUTE vec2 texcoord0;
  32. VARYING vec4 vertex_color;
  33. VARYING vec2 vary_texcoord0;
  34. VARYING vec3 vary_texcoord1;
  35. void calcAtmospherics(vec3 inPositionEye);
  36. mat4 getObjectSkinnedTransform();
  37. void main()
  38. {
  39. mat4 mat = getObjectSkinnedTransform();
  40. mat = modelview_matrix * mat;
  41. vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
  42. vec4 norm = vec4(position.xyz, 1.0);
  43. norm.xyz += normal.xyz;
  44. norm.xyz = (mat*norm).xyz;
  45. norm.xyz = normalize(norm.xyz-pos.xyz);
  46. vec3 ref = reflect(pos.xyz, -norm.xyz);
  47. vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
  48. vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
  49. calcAtmospherics(pos.xyz);
  50. vertex_color = diffuse_color;
  51. gl_Position = projection_matrix*vec4(pos, 1.0);
  52. }