1
0

LineDashedMaterial.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { LineBasicMaterial } from './LineBasicMaterial.js';
  2. /**
  3. * A material for rendering line primitives.
  4. *
  5. * Materials define the appearance of renderable 3D objects.
  6. *
  7. * ```js
  8. * const material = new THREE.LineDashedMaterial( {
  9. * color: 0xffffff,
  10. * scale: 1,
  11. * dashSize: 3,
  12. * gapSize: 1,
  13. * } );
  14. * ```
  15. *
  16. * @augments LineBasicMaterial
  17. */
  18. class LineDashedMaterial extends LineBasicMaterial {
  19. /**
  20. * Constructs a new line dashed material.
  21. *
  22. * @param {Object} [parameters] - An object with one or more properties
  23. * defining the material's appearance. Any property of the material
  24. * (including any property from inherited materials) can be passed
  25. * in here. Color values can be passed any type of value accepted
  26. * by {@link Color#set}.
  27. */
  28. constructor( parameters ) {
  29. super();
  30. /**
  31. * This flag can be used for type testing.
  32. *
  33. * @type {boolean}
  34. * @readonly
  35. * @default true
  36. */
  37. this.isLineDashedMaterial = true;
  38. this.type = 'LineDashedMaterial';
  39. /**
  40. * The scale of the dashed part of a line.
  41. *
  42. * @type {number}
  43. * @default 1
  44. */
  45. this.scale = 1;
  46. /**
  47. * The size of the dash. This is both the gap with the stroke.
  48. *
  49. * @type {number}
  50. * @default 3
  51. */
  52. this.dashSize = 3;
  53. /**
  54. * The size of the gap.
  55. *
  56. * @type {number}
  57. * @default 1
  58. */
  59. this.gapSize = 1;
  60. this.setValues( parameters );
  61. }
  62. copy( source ) {
  63. super.copy( source );
  64. this.scale = source.scale;
  65. this.dashSize = source.dashSize;
  66. this.gapSize = source.gapSize;
  67. return this;
  68. }
  69. }
  70. export { LineDashedMaterial };
粤ICP备19079148号