第一段是原本画网格的代码 第二段我使用geometry.merge()方法的代码 不知道哪里写错了 不报错 也出不来 请前辈指教function initObject() { //1.在x轴上定义两个点p1 p2 var geometry = new THREE.Geometry(); geometry.vertices.push(new THREE.Vector3(-500, 0, 0)); geometry.vertices.push(new THREE.Vector3(500, 0, 0)); //2.主要在于这里的算法,从右、下角开始画 for (var i = 0; i <= 20; i++) { //画横线 var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: 0x000000, opacity: 0.2 })); line.position.z = (i * 50) - 500; scene.add(line); var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: 0x000000, opacity: 0.2 })); line.position.x = (i * 50) - 500; line.rotation.y = 90 * Math.PI / 180; //转90度 scene.add(line); } }
添加回答
举报
0/150
提交
取消