/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl

https://bitbucket.org/lindenlab/viewer-beta/ · GLSL · 47 lines · 15 code · 9 blank · 23 comment · 0 complexity · 875d467261ced1125ff58c6677d0009b MD5 · raw file

  1. /**
  2. * @file objectSkinV.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. ATTRIBUTE vec4 weight4;
  25. uniform mat4 matrixPalette[32];
  26. mat4 getObjectSkinnedTransform()
  27. {
  28. int i;
  29. vec4 w = fract(weight4);
  30. vec4 index = floor(weight4);
  31. float scale = 1.0/(w.x+w.y+w.z+w.w);
  32. w *= scale;
  33. mat4 mat = matrixPalette[int(index.x)]*w.x;
  34. mat += matrixPalette[int(index.y)]*w.y;
  35. mat += matrixPalette[int(index.z)]*w.z;
  36. mat += matrixPalette[int(index.w)]*w.w;
  37. return mat;
  38. }