WindingOrder.js 695 B

123456789101112131415161718192021222324252627282930313233343536
  1. import WebGLConstants from "./WebGLConstants.js";
  2. /**
  3. * Winding order defines the order of vertices for a triangle to be considered front-facing.
  4. *
  5. * @enum {Number}
  6. */
  7. const WindingOrder = {
  8. /**
  9. * Vertices are in clockwise order.
  10. *
  11. * @type {Number}
  12. * @constant
  13. */
  14. CLOCKWISE: WebGLConstants.CW,
  15. /**
  16. * Vertices are in counter-clockwise order.
  17. *
  18. * @type {Number}
  19. * @constant
  20. */
  21. COUNTER_CLOCKWISE: WebGLConstants.CCW,
  22. };
  23. /**
  24. * @private
  25. */
  26. WindingOrder.validate = function (windingOrder) {
  27. return (
  28. windingOrder === WindingOrder.CLOCKWISE ||
  29. windingOrder === WindingOrder.COUNTER_CLOCKWISE
  30. );
  31. };
  32. export default Object.freeze(WindingOrder);