bonesVertex.fx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #if NUM_BONE_INFLUENCERS > 0
  2. mat4 influence;
  3. #ifdef BONETEXTURE
  4. influence = readMatrixFromRawSampler(boneSampler, matricesIndices[0]) * matricesWeights[0];
  5. #if NUM_BONE_INFLUENCERS > 1
  6. influence += readMatrixFromRawSampler(boneSampler, matricesIndices[1]) * matricesWeights[1];
  7. #endif
  8. #if NUM_BONE_INFLUENCERS > 2
  9. influence += readMatrixFromRawSampler(boneSampler, matricesIndices[2]) * matricesWeights[2];
  10. #endif
  11. #if NUM_BONE_INFLUENCERS > 3
  12. influence += readMatrixFromRawSampler(boneSampler, matricesIndices[3]) * matricesWeights[3];
  13. #endif
  14. #if NUM_BONE_INFLUENCERS > 4
  15. influence += readMatrixFromRawSampler(boneSampler, matricesIndicesExtra[0]) * matricesWeightsExtra[0];
  16. #endif
  17. #if NUM_BONE_INFLUENCERS > 5
  18. influence += readMatrixFromRawSampler(boneSampler, matricesIndicesExtra[1]) * matricesWeightsExtra[1];
  19. #endif
  20. #if NUM_BONE_INFLUENCERS > 6
  21. influence += readMatrixFromRawSampler(boneSampler, matricesIndicesExtra[2]) * matricesWeightsExtra[2];
  22. #endif
  23. #if NUM_BONE_INFLUENCERS > 7
  24. influence += readMatrixFromRawSampler(boneSampler, matricesIndicesExtra[3]) * matricesWeightsExtra[3];
  25. #endif
  26. #else
  27. influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
  28. #if NUM_BONE_INFLUENCERS > 1
  29. influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
  30. #endif
  31. #if NUM_BONE_INFLUENCERS > 2
  32. influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
  33. #endif
  34. #if NUM_BONE_INFLUENCERS > 3
  35. influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
  36. #endif
  37. #if NUM_BONE_INFLUENCERS > 4
  38. influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
  39. #endif
  40. #if NUM_BONE_INFLUENCERS > 5
  41. influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
  42. #endif
  43. #if NUM_BONE_INFLUENCERS > 6
  44. influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
  45. #endif
  46. #if NUM_BONE_INFLUENCERS > 7
  47. influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
  48. #endif
  49. #endif
  50. finalWorld = finalWorld * influence;
  51. #endif