glowMapGeneration.fragment.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Do not edit.
  2. import { ShaderStore } from "../Engines/shaderStore.js";
  3. import "./ShadersInclude/helperFunctions.js";
  4. import "./ShadersInclude/clipPlaneFragmentDeclaration.js";
  5. import "./ShadersInclude/clipPlaneFragment.js";
  6. const name = "glowMapGenerationPixelShader";
  7. const shader = `#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)
  8. #include<helperFunctions>
  9. #endif
  10. #ifdef DIFFUSE
  11. varying vec2 vUVDiffuse;uniform sampler2D diffuseSampler;
  12. #endif
  13. #ifdef OPACITY
  14. varying vec2 vUVOpacity;uniform sampler2D opacitySampler;uniform float opacityIntensity;
  15. #endif
  16. #ifdef EMISSIVE
  17. varying vec2 vUVEmissive;uniform sampler2D emissiveSampler;
  18. #endif
  19. #ifdef VERTEXALPHA
  20. varying vec4 vColor;
  21. #endif
  22. uniform vec4 glowColor;uniform float glowIntensity;
  23. #include<clipPlaneFragmentDeclaration>
  24. #define CUSTOM_FRAGMENT_DEFINITIONS
  25. void main(void)
  26. {
  27. #include<clipPlaneFragment>
  28. vec4 finalColor=glowColor;
  29. #ifdef DIFFUSE
  30. vec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);
  31. #ifdef DIFFUSE_ISLINEAR
  32. albedoTexture=toGammaSpace(albedoTexture);
  33. #endif
  34. #ifdef GLOW
  35. finalColor.a*=albedoTexture.a;
  36. #endif
  37. #ifdef HIGHLIGHT
  38. finalColor.a=albedoTexture.a;
  39. #endif
  40. #endif
  41. #ifdef OPACITY
  42. vec4 opacityMap=texture2D(opacitySampler,vUVOpacity);
  43. #ifdef OPACITYRGB
  44. finalColor.a*=getLuminance(opacityMap.rgb);
  45. #else
  46. finalColor.a*=opacityMap.a;
  47. #endif
  48. finalColor.a*=opacityIntensity;
  49. #endif
  50. #ifdef VERTEXALPHA
  51. finalColor.a*=vColor.a;
  52. #endif
  53. #ifdef ALPHATEST
  54. if (finalColor.a<ALPHATESTVALUE)
  55. discard;
  56. #endif
  57. #ifdef EMISSIVE
  58. vec4 emissive=texture2D(emissiveSampler,vUVEmissive);
  59. #ifdef EMISSIVE_ISLINEAR
  60. emissive=toGammaSpace(emissive);
  61. #endif
  62. gl_FragColor=emissive*finalColor*glowIntensity;
  63. #else
  64. gl_FragColor=finalColor*glowIntensity;
  65. #endif
  66. #ifdef HIGHLIGHT
  67. gl_FragColor.a=glowColor.a;
  68. #endif
  69. }`;
  70. // Sideeffect
  71. ShaderStore.ShadersStore[name] = shader;
  72. /** @internal */
  73. export const glowMapGenerationPixelShader = { name, shader };
  74. //# sourceMappingURL=glowMapGeneration.fragment.js.map