particles.fragment.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Do not edit.
  2. import { ShaderStore } from "../Engines/shaderStore.js";
  3. import "./ShadersInclude/clipPlaneFragmentDeclaration.js";
  4. import "./ShadersInclude/imageProcessingDeclaration.js";
  5. import "./ShadersInclude/logDepthDeclaration.js";
  6. import "./ShadersInclude/helperFunctions.js";
  7. import "./ShadersInclude/imageProcessingFunctions.js";
  8. import "./ShadersInclude/fogFragmentDeclaration.js";
  9. import "./ShadersInclude/clipPlaneFragment.js";
  10. import "./ShadersInclude/logDepthFragment.js";
  11. import "./ShadersInclude/fogFragment.js";
  12. const name = "particlesPixelShader";
  13. const shader = `#ifdef LOGARITHMICDEPTH
  14. #extension GL_EXT_frag_depth : enable
  15. #endif
  16. varying vec2 vUV;varying vec4 vColor;uniform vec4 textureMask;uniform sampler2D diffuseSampler;
  17. #include<clipPlaneFragmentDeclaration>
  18. #include<imageProcessingDeclaration>
  19. #include<logDepthDeclaration>
  20. #include<helperFunctions>
  21. #include<imageProcessingFunctions>
  22. #ifdef RAMPGRADIENT
  23. varying vec4 remapRanges;uniform sampler2D rampSampler;
  24. #endif
  25. #include<fogFragmentDeclaration>
  26. #define CUSTOM_FRAGMENT_DEFINITIONS
  27. void main(void) {
  28. #define CUSTOM_FRAGMENT_MAIN_BEGIN
  29. #include<clipPlaneFragment>
  30. vec4 textureColor=texture2D(diffuseSampler,vUV);vec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;
  31. #ifdef RAMPGRADIENT
  32. float alpha=baseColor.a;float remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);vec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));baseColor.rgb*=rampColor.rgb;float finalAlpha=baseColor.a;baseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);
  33. #endif
  34. #ifdef BLENDMULTIPLYMODE
  35. float sourceAlpha=vColor.a*textureColor.a;baseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);
  36. #endif
  37. #include<logDepthFragment>
  38. #include<fogFragment>(color,baseColor)
  39. #ifdef IMAGEPROCESSINGPOSTPROCESS
  40. baseColor.rgb=toLinearSpace(baseColor.rgb);
  41. #else
  42. #ifdef IMAGEPROCESSING
  43. baseColor.rgb=toLinearSpace(baseColor.rgb);baseColor=applyImageProcessing(baseColor);
  44. #endif
  45. #endif
  46. gl_FragColor=baseColor;
  47. #define CUSTOM_FRAGMENT_MAIN_END
  48. }`;
  49. // Sideeffect
  50. ShaderStore.ShadersStore[name] = shader;
  51. /** @internal */
  52. export const particlesPixelShader = { name, shader };
  53. //# sourceMappingURL=particles.fragment.js.map