Browse Source

Docs: Use BufferGeometry in "Drawing lines" guide.

Mugen87 5 years ago
parent
commit
c1e9997846

+ 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>