浏览代码

dev-example

linbingquan 5 年之前
父节点
当前提交
80dbe6ae3f
共有 1 个文件被更改,包括 30 次插入28 次删除
  1. 30 28
      examples/webgl_lines_dashed.html

+ 30 - 28
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 ) );