skinning_pars_vertex.glsl.js 589 B

12345678910111213141516171819202122232425
  1. export default /* glsl */`
  2. #ifdef USE_SKINNING
  3. uniform mat4 bindMatrix;
  4. uniform mat4 bindMatrixInverse;
  5. uniform highp sampler2D boneTexture;
  6. mat4 getBoneMatrix( const in float i ) {
  7. int size = textureSize( boneTexture, 0 ).x;
  8. int j = int( i ) * 4;
  9. int x = j % size;
  10. int y = j / size;
  11. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  12. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  13. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  14. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  15. return mat4( v1, v2, v3, v4 );
  16. }
  17. #endif
  18. `;