我遇到ShapePath问题,在转换为几何图形时会自动关闭形状吗?
var path = new THREE.ShapePath();
path.moveTo(0, 0);
path.lineTo(0,50);
path.lineTo(50,50);
var shapes = path.toShapes(true);
for ( var j = 0; j < shapes.length; j ++ ) {
var shape = shapes[ j ];
console.log(shape);
var material = new THREE.MeshLambertMaterial( {
color: Math.random() * 0xffffff
});
var geometry = new THREE.ShapeBufferGeometry( shape );
var mesh = new THREE.Mesh( geometry, material );
scene.add(mesh);
}
我期望的是L样式的形状,相反,我正在渲染一个三角形。
我真的只想将路径拉伸为实心L形。
对最佳方法有何想法?
答案 0 :(得分:0)
如果创建一个L形的封闭轮廓,则可以绘制预期的结果,如以下示例所示:https://jsfiddle.net/zbeLk6jw/1/
var path = new THREE.ShapePath();
path.moveTo(0, 0);
path.lineTo(0,50);
path.lineTo(10,50);
path.lineTo(10,10);
path.lineTo(25,10);
path.lineTo(25,0);