瀏覽代碼

Merge pull request #10335 from Mugen87/edge

EdgesGeometry: Update docs and minor clean up
Mr.doob 8 年之前
父節點
當前提交
5294c41764
共有 2 個文件被更改,包括 8 次插入23 次删除
  1. 4 21
      docs/api/geometries/EdgesGeometry.html
  2. 4 2
      src/geometries/EdgesGeometry.js

+ 4 - 21
docs/api/geometries/EdgesGeometry.html

@@ -14,24 +14,6 @@
 
 		<div class="desc">This can be used as a helper object to view the edges of a [page:Geometry Geometry] object.</div>
 
-		<!-- <iframe id="scene" src="scenes/geometry-browser.html#EdgeGeometry"></iframe>
-
-		<script>
-
-		// iOS iframe auto-resize workaround
-
-		if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
-
-			var scene = document.getElementById( 'scene' );
-
-			scene.style.width = getComputedStyle( scene ).width;
-			scene.style.height = getComputedStyle( scene ).height;
-			scene.setAttribute( 'scrolling', 'no' );
-
-		}
-
-		</script> -->
-
 		<h2>Example</h2>
 
 		[example:webgl_helpers helpers]
@@ -39,15 +21,16 @@
 		<code>
 var geometry = new THREE.BoxBufferGeometry( 100, 100, 100 );
 var edges = new THREE.EdgesGeometry( geometry );
-var line = new THREE.LineSegments( edges );
+var line = new THREE.LineSegments( edges, new THREE.LineBasicMaterial( { color: 0xffffff } ) );
 scene.add( line );
 		</code>
 
 		<h2>Constructor</h2>
 
-		<h3>[name]( [page:Geometry geometry] )</h3>
+		<h3>[name]( [page:Geometry geometry], [page:Integer thresholdAngle] )</h3>
 		<div>
-		geometry — any geometry object.
+		geometry — Any geometry object.<br />
+		thresholdAngle — An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
 		</div>
 
 		<h2>Source</h2>

+ 4 - 2
src/geometries/EdgesGeometry.js

@@ -1,5 +1,5 @@
 import { BufferGeometry } from '../core/BufferGeometry';
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { Geometry } from '../core/Geometry';
 import { _Math } from '../math/Math';
 
@@ -76,6 +76,8 @@ function EdgesGeometry( geometry, thresholdAngle ) {
 
 		var h = hash[ key ];
 
+		// An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
+
 		if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {
 
 			var vertex = vertices[ h.vert1 ];
@@ -92,7 +94,7 @@ function EdgesGeometry( geometry, thresholdAngle ) {
 
 	}
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( coords ), 3 ) );
+	this.addAttribute( 'position', new Float32BufferAttribute( coords, 3 ) );
 
 }