From 80dbe6ae3f30aa0da3d9710862b68cb62f0e6ecc Mon Sep 17 00:00:00 2001 From: linbingquan <695601626@qq.com> Date: Tue, 21 Apr 2020 22:20:28 +0800 Subject: [PATCH] dev-example --- examples/webgl_lines_dashed.html | 58 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/examples/webgl_lines_dashed.html b/examples/webgl_lines_dashed.html index cda474c777..6dc3dfff07 100644 --- a/examples/webgl_lines_dashed.html +++ b/examples/webgl_lines_dashed.html @@ -51,9 +51,9 @@ objects.push( line ); scene.add( line ); - var geometryCube = cube( 50 ); + var geometryBox = box( 50, 50, 50 ); - var lineSegments = new THREE.LineSegments( geometryCube, new THREE.LineDashedMaterial( { color: 0xffaa00, dashSize: 3, gapSize: 1 } ) ); + var lineSegments = new THREE.LineSegments( geometryBox, new THREE.LineDashedMaterial( { color: 0xffaa00, dashSize: 3, gapSize: 1 } ) ); lineSegments.computeLineDistances(); objects.push( lineSegments ); @@ -75,49 +75,51 @@ } - function cube( size ) { + function box( width, height, depth ) { - var h = size * 0.5; + width = width * 0.5, + height = height * 0.5, + depth = depth * 0.5; var geometry = new THREE.BufferGeometry(); var position = []; position.push( - - h, - h, - h, - - h, h, - h, + - width, - height, - depth, + - width, height, - depth, - - h, h, - h, - h, h, - h, + - width, height, - depth, + width, height, - depth, - h, h, - h, - h, - h, - h, + width, height, - depth, + width, - height, - depth, - h, - h, - h, - - h, - h, - h, + width, - height, - depth, + - width, - height, - depth, - - h, - h, h, - - h, h, h, + - width, - height, depth, + - width, height, depth, - - h, h, h, - h, h, h, + - width, height, depth, + width, height, depth, - h, h, h, - h, - h, h, + width, height, depth, + width, - height, depth, - h, - h, h, - - h, - h, h, + width, - height, depth, + - width, - height, depth, - - h, - h, - h, - - h, - h, h, + - width, - height, - depth, + - width, - height, depth, - - h, h, - h, - - h, h, h, + - width, height, - depth, + - width, height, depth, - h, h, - h, - h, h, h, + width, height, - depth, + width, height, depth, - h, - h, - h, - h, - h, h + width, - height, - depth, + width, - height, depth ); geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) ); -- GitLab