Line2.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. */
  16. class Line2 extends LineSegments2 {
  17. /**
  18. * Constructs a new wide line.
  19. *
  20. * @param {LineGeometry} [geometry] - The line geometry.
  21. * @param {Line2NodeMaterial} [material] - The line material.
  22. */
  23. constructor( geometry = new LineGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) {
  24. super( geometry, material );
  25. /**
  26. * This flag can be used for type testing.
  27. *
  28. * @type {boolean}
  29. * @readonly
  30. * @default true
  31. */
  32. this.isLine2 = true;
  33. this.type = 'Line2';
  34. }
  35. }
  36. export { Line2 };
粤ICP备19079148号