|
|
@ -89,17 +89,18 @@ export default class ClxRenderer extends BaseRenderer { |
|
|
const clxPillarMesh = new THREE.Mesh(clxPillarGeometry, clxPillarMaterial); |
|
|
const clxPillarMesh = new THREE.Mesh(clxPillarGeometry, clxPillarMaterial); |
|
|
|
|
|
|
|
|
const clxForkGeometry = this.createClxFork(item, option); |
|
|
const clxForkGeometry = this.createClxFork(item, option); |
|
|
const clxForkMaterial = new THREE.MeshPhongMaterial({color: 0xff111111}); |
|
|
const clxForkMaterial = new THREE.MeshPhongMaterial({color: 0xff444444}); |
|
|
const clxForkMesh = new THREE.Mesh(clxForkGeometry, clxForkMaterial); |
|
|
const clxForkMesh = new THREE.Mesh(clxForkGeometry, clxForkMaterial); |
|
|
|
|
|
|
|
|
const clxGemelGeometry =this.createClxGemel(item, option) |
|
|
const clxGemelGeometryL =this.createClxGemel(true) |
|
|
const clxGemelMaterial = new THREE.MeshPhongMaterial({color: 0xff888888}); |
|
|
const clxGemelGeometryR =this.createClxGemel(false) |
|
|
const clxGemelMeshL1 = new THREE.Mesh(clxGemelGeometry, clxGemelMaterial); |
|
|
const clxGemelMaterial = new THREE.MeshPhongMaterial({color: 0xff555555}); |
|
|
const clxGemelMeshL2 = new THREE.Mesh(clxGemelGeometry, clxGemelMaterial); |
|
|
const clxGemelMeshL1 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial); |
|
|
const clxGemelMeshR1 = new THREE.Mesh(clxGemelGeometry, clxGemelMaterial); |
|
|
const clxGemelMeshL2 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial); |
|
|
const clxGemelMeshR2 = new THREE.Mesh(clxGemelGeometry, clxGemelMaterial); |
|
|
const clxGemelMeshR1 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial); |
|
|
|
|
|
const clxGemelMeshR2 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial); |
|
|
|
|
|
|
|
|
const d = 0.5 |
|
|
const d = 1.5 |
|
|
|
|
|
|
|
|
group.add(clxPedestalMesh) |
|
|
group.add(clxPedestalMesh) |
|
|
const groupPillar = new THREE.Group() |
|
|
const groupPillar = new THREE.Group() |
|
|
@ -109,7 +110,7 @@ export default class ClxRenderer extends BaseRenderer { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ac = Math.asin(d/2) |
|
|
const ac = Math.asin(d/(2 * 0.8)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clxGemelMeshL1.position.z = 0.5 - d/4 |
|
|
clxGemelMeshL1.position.z = 0.5 - d/4 |
|
|
@ -392,28 +393,88 @@ export default class ClxRenderer extends BaseRenderer { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 创建clx的铰链
|
|
|
// 创建clx的铰链
|
|
|
createClxGemel(item: ItemJson, option?: RendererCudOption) { |
|
|
createClxGemel(isLeft: boolean = false) { |
|
|
const width = 0.08 |
|
|
const width = 0.08 |
|
|
const depth = 1.1 |
|
|
const depth = 0.9 |
|
|
|
|
|
const dd = 0.02 |
|
|
const shape = new THREE.Shape(); |
|
|
const shape = new THREE.Shape(); |
|
|
shape.moveTo(-width/2, -depth/2); |
|
|
shape.moveTo(-width/2, -depth/2 + dd); |
|
|
shape.lineTo(width/2, -depth/2); |
|
|
shape.lineTo(-width/2 + dd, -depth/2); |
|
|
shape.lineTo(width/2, depth/2); |
|
|
shape.lineTo(width/2 - dd, -depth/2); |
|
|
shape.lineTo(-width/2, depth/2); |
|
|
shape.lineTo(width/2, -depth/2 + dd); |
|
|
|
|
|
shape.lineTo(width/2, depth/2 - dd); |
|
|
|
|
|
shape.lineTo(width/2 - dd, depth/2); |
|
|
|
|
|
shape.lineTo(-width/2 + dd, depth/2); |
|
|
|
|
|
shape.lineTo(-width/2, depth/2 - dd); |
|
|
shape.closePath() |
|
|
shape.closePath() |
|
|
|
|
|
|
|
|
|
|
|
const shapeBar = new THREE.Shape(); |
|
|
|
|
|
shapeBar.moveTo(0, 0); // 起点在圆心
|
|
|
|
|
|
shapeBar.absarc(0, 0, 0.02, 0, Math.PI * 2, false); // 从0到π绘制半圆
|
|
|
|
|
|
shapeBar.closePath() |
|
|
|
|
|
|
|
|
|
|
|
const geometries: THREE.BufferGeometry[] = [] |
|
|
|
|
|
|
|
|
const curveL1 = new THREE.CatmullRomCurve3( |
|
|
const curveL1 = new THREE.CatmullRomCurve3( |
|
|
[new THREE.Vector3(-0.35, 0, 0), new THREE.Vector3(-0.30, 0, 0)], |
|
|
[new THREE.Vector3(-0.35 + (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(-0.30 + (isLeft ? 0.05 : 0), 0, 0)], |
|
|
false, // 闭合曲线
|
|
|
false, // 闭合曲线
|
|
|
'catmullrom', |
|
|
'catmullrom', |
|
|
0 |
|
|
0 |
|
|
) |
|
|
) |
|
|
const curveL2 = new THREE.CatmullRomCurve3( |
|
|
const curveL2 = new THREE.CatmullRomCurve3( |
|
|
[new THREE.Vector3(0.30, 0, 0), new THREE.Vector3(0.35, 0, 0)], |
|
|
[new THREE.Vector3(-0.15 + (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(-0.1 + (isLeft ? 0.05 : 0), 0, 0)], |
|
|
|
|
|
false, // 闭合曲线
|
|
|
|
|
|
'catmullrom', |
|
|
|
|
|
0 |
|
|
|
|
|
) |
|
|
|
|
|
const curveL3 = new THREE.CatmullRomCurve3( |
|
|
|
|
|
[new THREE.Vector3(0.15 - (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(0.1 - (isLeft ? 0.05 : 0), 0, 0)], |
|
|
false, // 闭合曲线
|
|
|
false, // 闭合曲线
|
|
|
'catmullrom', |
|
|
'catmullrom', |
|
|
0 |
|
|
0 |
|
|
) |
|
|
) |
|
|
|
|
|
const curveL4 = new THREE.CatmullRomCurve3( |
|
|
|
|
|
[new THREE.Vector3(0.30 - (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(0.35 - (isLeft ? 0.05 : 0), 0, 0)], |
|
|
|
|
|
false, // 闭合曲线
|
|
|
|
|
|
'catmullrom', |
|
|
|
|
|
0 |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (!isLeft) { |
|
|
|
|
|
const curveBar1 = new THREE.CatmullRomCurve3( |
|
|
|
|
|
[new THREE.Vector3(-0.36, -0.4, 0), new THREE.Vector3(0.36, -0.4, 0)], |
|
|
|
|
|
false, // 闭合曲线
|
|
|
|
|
|
'catmullrom', |
|
|
|
|
|
0 |
|
|
|
|
|
) |
|
|
|
|
|
const curveBar2 = new THREE.CatmullRomCurve3( |
|
|
|
|
|
[new THREE.Vector3(-0.36, 0, 0), new THREE.Vector3(0.36, 0, 0)], |
|
|
|
|
|
false, // 闭合曲线
|
|
|
|
|
|
'catmullrom', |
|
|
|
|
|
0 |
|
|
|
|
|
) |
|
|
|
|
|
const curveBar3 = new THREE.CatmullRomCurve3( |
|
|
|
|
|
[new THREE.Vector3(-0.36, 0.4, 0), new THREE.Vector3(0.36, 0.4, 0)], |
|
|
|
|
|
false, // 闭合曲线
|
|
|
|
|
|
'catmullrom', |
|
|
|
|
|
0 |
|
|
|
|
|
) |
|
|
|
|
|
geometries.push(new THREE.ExtrudeGeometry(shapeBar, { |
|
|
|
|
|
steps: 1, |
|
|
|
|
|
bevelEnabled: false, |
|
|
|
|
|
extrudePath: curveBar1 |
|
|
|
|
|
})) |
|
|
|
|
|
geometries.push(new THREE.ExtrudeGeometry(shapeBar, { |
|
|
|
|
|
steps: 1, |
|
|
|
|
|
bevelEnabled: false, |
|
|
|
|
|
extrudePath: curveBar2 |
|
|
|
|
|
})) |
|
|
|
|
|
geometries.push(new THREE.ExtrudeGeometry(shapeBar, { |
|
|
|
|
|
steps: 1, |
|
|
|
|
|
bevelEnabled: false, |
|
|
|
|
|
extrudePath: curveBar3 |
|
|
|
|
|
})) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const geometryL1 = new THREE.ExtrudeGeometry(shape, { |
|
|
const geometryL1 = new THREE.ExtrudeGeometry(shape, { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
@ -427,7 +488,21 @@ export default class ClxRenderer extends BaseRenderer { |
|
|
extrudePath: curveL2 |
|
|
extrudePath: curveL2 |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return mergeGeometries([geometryL1, geometryL2]) |
|
|
const geometryL3 = new THREE.ExtrudeGeometry(shape, { |
|
|
|
|
|
steps: 1, |
|
|
|
|
|
bevelEnabled: false, |
|
|
|
|
|
extrudePath: curveL3 |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const geometryL4 = new THREE.ExtrudeGeometry(shape, { |
|
|
|
|
|
steps: 1, |
|
|
|
|
|
bevelEnabled: false, |
|
|
|
|
|
extrudePath: curveL4 |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
geometries.push(geometryL1, geometryL2, geometryL3, geometryL4) |
|
|
|
|
|
|
|
|
|
|
|
return mergeGeometries(geometries) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|