提交 5294c417 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10335 from Mugen87/edge

EdgesGeometry: Update docs and minor clean up
......@@ -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>
......
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 ) );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册