Line2.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Line2NodeMaterial } from 'three/webgpu';
  2. import { LineSegments2 } from './LineSegments2.js';
  3. import { LineGeometry } from '../LineGeometry.js';
  4. /**
  5. * A polyline drawn between vertices.
  6. *
  7. * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to
  8. * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a
  9. * chain of points.
  10. *
  11. * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer},
  12. * import the class from `lines/Line2.js`.
  13. *
  14. * @augments LineSegments2
  15. * @three_import import { Line2 } from 'three/addons/lines/webgpu/Line2.js';
  16. */
  17. class Line2 extends LineSegments2 {
  18. /**
  19. * Constructs a new wide line.
  20. *
  21. * @param {LineGeometry} [geometry] - The line geometry.
  22. * @param {Line2NodeMaterial} [material] - The line material.
  23. */
  24. constructor( geometry = new LineGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) {
  25. super( geometry, material );
  26. /**
  27. * This flag can be used for type testing.
  28. *
  29. * @type {boolean}
  30. * @readonly
  31. * @default true
  32. */
  33. this.isLine2 = true;
  34. this.type = 'Line2';
  35. }
  36. }
  37. export { Line2 };