CustomShaderMode.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * An enum describing how the {@link CustomShader} will be added to the
  3. * fragment shader. This determines how the shader interacts with the material.
  4. *
  5. * @enum {String}
  6. *
  7. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  8. */
  9. const CustomShaderMode = {
  10. /**
  11. * The custom shader will be used to modify the results of the material stage
  12. * before lighting is applied.
  13. *
  14. * @type {String}
  15. * @constant
  16. */
  17. MODIFY_MATERIAL: "MODIFY_MATERIAL",
  18. /**
  19. * The custom shader will be used instead of the material stage. This is a hint
  20. * to optimize out the material processing code.
  21. *
  22. * @type {String}
  23. * @constant
  24. */
  25. REPLACE_MATERIAL: "REPLACE_MATERIAL",
  26. };
  27. /**
  28. * Convert the shader mode to an uppercase identifier for use in GLSL define
  29. * directives. For example: <code>#define CUSTOM_SHADER_MODIFY_MATERIAL</code>
  30. * @param {CustomShaderMode} customShaderMode The shader mode
  31. * @return {String} The name of the GLSL macro to use
  32. *
  33. * @private
  34. */
  35. CustomShaderMode.getDefineName = function (customShaderMode) {
  36. return `CUSTOM_SHADER_${customShaderMode}`;
  37. };
  38. export default Object.freeze(CustomShaderMode);