bakedVertexAnimation.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Do not edit.
  2. import { ShaderStore } from "../../Engines/shaderStore.js";
  3. const name = "bakedVertexAnimation";
  4. const shader = `#ifdef BAKED_VERTEX_ANIMATION_TEXTURE
  5. {
  6. #ifdef INSTANCES
  7. #define BVASNAME bakedVertexAnimationSettingsInstanced
  8. #else
  9. #define BVASNAME bakedVertexAnimationSettings
  10. #endif
  11. float VATStartFrame=BVASNAME.x;float VATEndFrame=BVASNAME.y;float VATOffsetFrame=BVASNAME.z;float VATSpeed=BVASNAME.w;float totalFrames=VATEndFrame-VATStartFrame+1.0;float time=bakedVertexAnimationTime*VATSpeed/totalFrames;float frameCorrection=time<1.0 ? 0.0 : 1.0;float numOfFrames=totalFrames-frameCorrection;float VATFrameNum=fract(time)*numOfFrames;VATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);VATFrameNum=floor(VATFrameNum);VATFrameNum+=VATStartFrame+frameCorrection;mat4 VATInfluence;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];
  12. #if NUM_BONE_INFLUENCERS>1
  13. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];
  14. #endif
  15. #if NUM_BONE_INFLUENCERS>2
  16. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];
  17. #endif
  18. #if NUM_BONE_INFLUENCERS>3
  19. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];
  20. #endif
  21. #if NUM_BONE_INFLUENCERS>4
  22. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];
  23. #endif
  24. #if NUM_BONE_INFLUENCERS>5
  25. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];
  26. #endif
  27. #if NUM_BONE_INFLUENCERS>6
  28. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];
  29. #endif
  30. #if NUM_BONE_INFLUENCERS>7
  31. VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];
  32. #endif
  33. finalWorld=finalWorld*VATInfluence;}
  34. #endif
  35. `;
  36. // Sideeffect
  37. ShaderStore.IncludesShadersStore[name] = shader;
  38. /** @internal */
  39. export const bakedVertexAnimation = { name, shader };
  40. //# sourceMappingURL=bakedVertexAnimation.js.map