Line.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr;
  11. <h1>线([name])</h1>
  12. <p class="desc">
  13. 一条连续的线。<br /><br />
  14. 它几乎和[page:LineSegments]是一样的,唯一的区别是它在渲染时使用的是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP],
  15. 而不是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]。
  16. </p>
  17. <h2>代码示例</h2>
  18. <code>
  19. const material = new THREE.LineBasicMaterial({
  20. color: 0x0000ff
  21. });
  22. const points = [];
  23. points.push( new THREE.Vector3( - 10, 0, 0 ) );
  24. points.push( new THREE.Vector3( 0, 10, 0 ) );
  25. points.push( new THREE.Vector3( 10, 0, 0 ) );
  26. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  27. const line = new THREE.Line( geometry, material );
  28. scene.add( line );
  29. </code>
  30. <h2>构造器</h2>
  31. <h3>[name]( [param:BufferGeometry geometry], [param:Material material] )</h3>
  32. <p>
  33. [page:BufferGeometry geometry] —— 表示线段的顶点,默认值是一个新的[page:BufferGeometry]。<br />
  34. [page:Material material] —— 线的材质,默认值是一个新的具有随机颜色的[page:LineBasicMaterial]。<br />
  35. </p>
  36. <h2>属性</h2>
  37. <p>共有属性请参见其基类[page:Object3D]。</p>
  38. <h3>[property:BufferGeometry geometry]</h3>
  39. <p>表示线段的顶点。</p>
  40. <h3>[property:Boolean isLine]</h3>
  41. <p>
  42. Read-only flag to check if a given object is of type [name].
  43. </p>
  44. <h3>[property:Material material]</h3>
  45. <p>线的材质。</p>
  46. <h3>[property:Array morphTargetInfluences]</h3>
  47. <p>
  48. An array of weights typically from 0-1 that specify how much of the morph is applied.
  49. Undefined by default, but reset to a blank array by [page:.updateMorphTargets]().
  50. </p>
  51. <h3>[property:Object morphTargetDictionary]</h3>
  52. <p>
  53. A dictionary of morphTargets based on the morphTarget.name property.
  54. Undefined by default, but rebuilt [page:.updateMorphTargets]().
  55. </p>
  56. <h2>方法</h2>
  57. <p>共有方法请参见其基类 [page:Object3D]。</p>
  58. <h3>[method:this computeLineDistances]()</h3>
  59. <p>
  60. 计算[page:LineDashedMaterial]所需的距离的值的数组。
  61. 对于几何体中的每一个顶点,这个方法计算出了当前点到线的起始点的累积长度。
  62. </p>
  63. <h3>[method:undefined raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
  64. <p>
  65. 在一条投射出去的[page:Ray](射线)和这条线之间产生交互。
  66. [page:Raycaster.intersectObject]将会调用这个方法。
  67. </p>
  68. <h3>[method:undefined updateMorphTargets]()</h3>
  69. <p>
  70. Updates the morphTargets to have no influence on the object. Resets the
  71. [page:.morphTargetInfluences] and [page:.morphTargetDictionary] properties.
  72. </p>
  73. <h2>源代码</h2>
  74. <p>
  75. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  76. </p>
  77. </body>
  78. </html>