浏览代码

Docs: Use BufferGeometry in "Drawing lines" guide.

Mugen87 5 年之前
父节点
当前提交
c1e9997846
共有 2 个文件被更改,包括 12 次插入8 次删除
  1. 6 4
      docs/manual/en/introduction/Drawing-lines.html
  2. 6 4
      docs/manual/zh/introduction/Drawing-lines.html

+ 6 - 4
docs/manual/en/introduction/Drawing-lines.html

@@ -39,10 +39,12 @@ var material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
 			</p>
 
 			<code>
-var geometry = new THREE.Geometry();
-geometry.vertices.push(new THREE.Vector3( -10, 0, 0) );
-geometry.vertices.push(new THREE.Vector3( 0, 10, 0) );
-geometry.vertices.push(new THREE.Vector3( 10, 0, 0) );
+var points = [];
+points.push( new THREE.Vector3( - 10, 0, 0 ) );
+points.push( new THREE.Vector3( 0, 10, 0 ) );
+points.push( new THREE.Vector3( 10, 0, 0 ) );
+
+var geometry = new THREE.BufferGeometry().setFromPoints( points );
 			</code>
 
 			<p>Note that lines are drawn between each consecutive pair of vertices, but not between the first and last (the line is not closed.)</p>

+ 6 - 4
docs/manual/zh/introduction/Drawing-lines.html

@@ -41,10 +41,12 @@ var material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
 			</p>
 
 			<code>
-var geometry = new THREE.Geometry();
-geometry.vertices.push(new THREE.Vector3( -10, 0, 0) );
-geometry.vertices.push(new THREE.Vector3( 0, 10, 0) );
-geometry.vertices.push(new THREE.Vector3( 10, 0, 0) );
+var points = [];
+points.push( new THREE.Vector3( - 10, 0, 0 ) );
+points.push( new THREE.Vector3( 0, 10, 0 ) );
+points.push( new THREE.Vector3( 10, 0, 0 ) );
+
+var geometry = new THREE.BufferGeometry().setFromPoints( points );
 			</code>
 
 			<p>注意,线是画在每一对连续的顶点之间的,而不是在第一个顶点和最后一个顶点之间绘制线条(线条并未闭合)。</p>