bonesDeclaration.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // Do not edit.
  2. import { ShaderStore } from "../../Engines/shaderStore.js";
  3. const name = "bonesDeclaration";
  4. const shader = `#if NUM_BONE_INFLUENCERS>0
  5. attribute vec4 matricesIndices;attribute vec4 matricesWeights;
  6. #if NUM_BONE_INFLUENCERS>4
  7. attribute vec4 matricesIndicesExtra;attribute vec4 matricesWeightsExtra;
  8. #endif
  9. #ifndef BAKED_VERTEX_ANIMATION_TEXTURE
  10. #ifdef BONETEXTURE
  11. uniform highp sampler2D boneSampler;uniform float boneTextureWidth;
  12. #else
  13. uniform mat4 mBones[BonesPerMesh];
  14. #endif
  15. #ifdef BONES_VELOCITY_ENABLED
  16. uniform mat4 mPreviousBones[BonesPerMesh];
  17. #endif
  18. #ifdef BONETEXTURE
  19. #define inline
  20. mat4 readMatrixFromRawSampler(sampler2D smp,float index)
  21. {float offset=index *4.0;float dx=1.0/boneTextureWidth;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));return mat4(m0,m1,m2,m3);}
  22. #endif
  23. #endif
  24. #endif
  25. `;
  26. // Sideeffect
  27. ShaderStore.IncludesShadersStore[name] = shader;
  28. /** @internal */
  29. export const bonesDeclaration = { name, shader };
  30. //# sourceMappingURL=bonesDeclaration.js.map