Threejs绘制多边形
作者:互联网
Threejs绘制多边形,使用THREE.Shape()
function createPolygon(){ var group = new THREE.Group(); var rectLength = 120, rectWidth = 40; var rectShape = new THREE.Shape(); rectShape.moveTo( 10, 10 ,0); rectShape.lineTo( 10, 20,0 ); rectShape.lineTo( 15, 25,0 ); rectShape.lineTo( 20,25, 0 ); rectShape.lineTo( 30, 20,0 ); rectShape.lineTo( 30, 10,0 ); rectShape.lineTo( 10, 10,0 ); var geometry2 = new THREE.ShapeGeometry( rectShape); var material2 = new THREE.MeshBasicMaterial( { color: 0xff0000, side: THREE.DoubleSide } ); var mesh2 = new THREE.Mesh( geometry2, material2 ) ; group.add(mesh2); return group; }
########################
标签:rectShape,10,Threejs,lineTo,多边形,THREE,var,new,绘制 来源: https://www.cnblogs.com/herd/p/15565428.html