bones300Declaration.fx 778 B

123456789101112131415161718192021222324252627282930
  1. #if NUM_BONE_INFLUENCERS > 0
  2. #ifdef BONETEXTURE
  3. uniform sampler2D boneSampler;
  4. #else
  5. uniform mat4 mBones[BonesPerMesh];
  6. #endif
  7. in vec4 matricesIndices;
  8. in vec4 matricesWeights;
  9. #if NUM_BONE_INFLUENCERS > 4
  10. in vec4 matricesIndicesExtra;
  11. in vec4 matricesWeightsExtra;
  12. #endif
  13. #ifdef BONETEXTURE
  14. mat4 readMatrixFromRawSampler(sampler2D smp, float index)
  15. {
  16. mat4 result;
  17. float offset = index * 4.0;
  18. float dx = 1.0 / boneTextureWidth;
  19. result[0] = texture(smp, vec2(dx * (offset + 0.5), 0.));
  20. result[1] = texture(smp, vec2(dx * (offset + 1.5), 0.));
  21. result[2] = texture(smp, vec2(dx * (offset + 2.5), 0.));
  22. result[3] = texture(smp, vec2(dx * (offset + 3.5), 0.));
  23. return result;
  24. }
  25. #endif
  26. #endif