Source: material/LineMaterial.js

  1. import { MATERIAL_TYPE, DRAW_MODE } from '../const.js';
  2. import { Material } from './Material.js';
  3. /**
  4. * A material for drawing wireframe-style geometries.
  5. * @constructor
  6. * @extends zen3d.Material
  7. * @memberof zen3d
  8. */
  9. function LineMaterial() {
  10. Material.call(this);
  11. this.type = MATERIAL_TYPE.LINE;
  12. /**
  13. * Controls line thickness.
  14. * Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.
  15. * @type {number}
  16. * @default 1
  17. */
  18. this.lineWidth = 1;
  19. /**
  20. * Set draw mode to LINES / LINE_LOOP / LINE_STRIP
  21. * @type {zen3d.DRAW_MODE}
  22. * @default zen3d.DRAW_MODE.LINES
  23. */
  24. this.drawMode = DRAW_MODE.LINES;
  25. }
  26. LineMaterial.prototype = Object.assign(Object.create(Material.prototype), /** @lends zen3d.LineMaterial.prototype */{
  27. constructor: LineMaterial,
  28. copy: function(source) {
  29. Material.prototype.copy.call(this, source);
  30. this.lineWidth = source.lineWidth;
  31. return this;
  32. }
  33. });
  34. export { LineMaterial };