|
|
|
@ -126,9 +126,8 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
|
extrudePath: curve // 设置挤出轨迹
|
|
|
|
} |
|
|
|
// 创建挤出几何体
|
|
|
|
const geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
|
// const material = new THREE.MeshBasicMaterial({color: 0xffdddbca});
|
|
|
|
// const mesh = new THREE.Mesh(geometry, material);
|
|
|
|
let geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fd = 0.03 |
|
|
|
@ -170,8 +169,38 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
|
} |
|
|
|
// 创建挤出几何体
|
|
|
|
const geometryBf = new THREE.ExtrudeGeometry(shapeBf, optionsBf) |
|
|
|
geometry = mergeGeometries([geometry, geometryBf]) |
|
|
|
const material = new THREE.MeshBasicMaterial({color: 0xffdddbca}); |
|
|
|
const mesh = new THREE.Mesh(geometry, material); |
|
|
|
|
|
|
|
const shapeD = new THREE.Shape(); |
|
|
|
shapeD.moveTo(-0.3, -0.25); |
|
|
|
shapeD.lineTo(-0.3, 0.25); |
|
|
|
shapeD.lineTo(0.3, 0.25); |
|
|
|
shapeD.lineTo(0.3, -0.25); |
|
|
|
shapeD.closePath() |
|
|
|
|
|
|
|
return mergeGeometries([geometry, geometryBf]) |
|
|
|
const curveD = new THREE.CatmullRomCurve3( |
|
|
|
[new THREE.Vector3(0, 1.45, -1), new THREE.Vector3(0, 1.45, 1)], |
|
|
|
false, // 闭合曲线
|
|
|
|
'catmullrom', |
|
|
|
0 |
|
|
|
) |
|
|
|
|
|
|
|
const optionsD = { |
|
|
|
steps: 1, |
|
|
|
bevelSegments: 0.05, |
|
|
|
bevelEnabled: true, |
|
|
|
extrudePath: curveD // 设置挤出轨迹
|
|
|
|
} |
|
|
|
|
|
|
|
const geometryD = new THREE.ExtrudeGeometry(shapeD, optionsD) |
|
|
|
const meshD = new THREE.Mesh(geometryD, material); |
|
|
|
mesh.updateMatrix() |
|
|
|
meshD.updateMatrix() |
|
|
|
const result = CSG.subtract(mesh, meshD) |
|
|
|
|
|
|
|
return result.geometry |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|