@fmsim/machine 2.0.0-beta.56 → 2.0.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factories/machine-3d.js +40 -5
- package/dist/factories/machine-3d.js.map +1 -1
- package/dist/templates/scanner.js +1 -1
- package/dist/templates/scanner.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/factories/machine-3d.ts +46 -7
- package/src/templates/scanner.ts +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fmsim/machine",
|
|
3
3
|
"description": "Layout View를 구성하는 설비(machine)들과 유닛을 구현한 모듈입니다.",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.57",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"things-scene": true,
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"prettier --write"
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1ab528e8429a5ecc73804f658e4a2618e37f039a"
|
|
59
59
|
}
|
|
@@ -30,8 +30,8 @@ interface MCS3DConfig {
|
|
|
30
30
|
roughness: number
|
|
31
31
|
/** statusColor 미사용 시 기본 색상 */
|
|
32
32
|
defaultColor: number
|
|
33
|
-
/** 'box' | 'hexagon' */
|
|
34
|
-
shape: 'box' | 'hexagon' | 'plane'
|
|
33
|
+
/** 'box' | 'hexagon' | 'plane' | 'triangle' */
|
|
34
|
+
shape: 'box' | 'hexagon' | 'plane' | 'triangle'
|
|
35
35
|
/** mesh 생성 전 가시성 판정 — false 반환 시 mesh 미생성 */
|
|
36
36
|
isVisible?: (component: Component) => boolean
|
|
37
37
|
/** 부모 대비 크기 비율 (기본 1.0). < 1이면 부모 중심에 배치. */
|
|
@@ -76,9 +76,14 @@ class MCSRealObject3D extends RealObjectGroup {
|
|
|
76
76
|
this._config = config
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
// width, height 절대값 (음수 값은 양수로 취급)
|
|
79
|
+
// width, height 절대값 (음수 값은 양수로 취급).
|
|
80
|
+
// `resizable:false` 컴포넌트(예: Scanner)는 state.width/height 가 없고
|
|
81
|
+
// bounds 만 있을 수 있으므로 bounds 를 fallback 으로 사용.
|
|
80
82
|
protected get absSize(): { w: number; h: number } {
|
|
81
|
-
const
|
|
83
|
+
const state = (this.component.state || {}) as any
|
|
84
|
+
const bounds = (this.component.bounds || {}) as any
|
|
85
|
+
const width = state.width ?? bounds.width ?? 10
|
|
86
|
+
const height = state.height ?? bounds.height ?? 10
|
|
82
87
|
return { w: Math.abs(width), h: Math.abs(height) }
|
|
83
88
|
}
|
|
84
89
|
|
|
@@ -221,6 +226,37 @@ class MCSRealObject3D extends RealObjectGroup {
|
|
|
221
226
|
return geo
|
|
222
227
|
}
|
|
223
228
|
|
|
229
|
+
/**
|
|
230
|
+
* 삼각형 prism — 2D Triangle 의 꼭짓점(state.x1/y1, x2/y2, x3/y3) 을 그대로 사용.
|
|
231
|
+
* things-scene 의 TriangleExtrude 와 동일한 방식 — 각 Scanner 인스턴스의
|
|
232
|
+
* 실제 정점 배치(방향, 비대칭 등) 가 3D 에 반영된다.
|
|
233
|
+
*
|
|
234
|
+
* `geometry.center()` 로 로컬 원점을 bounding-box 중심으로 맞추므로
|
|
235
|
+
* 후속 placement 와 정합.
|
|
236
|
+
*/
|
|
237
|
+
private buildTriangleGeometry(d: number): THREE.BufferGeometry {
|
|
238
|
+
const state = (this.component.state || {}) as any
|
|
239
|
+
const { x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0 } = state
|
|
240
|
+
|
|
241
|
+
const shape = new THREE.Shape()
|
|
242
|
+
shape.moveTo(x1, y1)
|
|
243
|
+
shape.lineTo(x2, y2)
|
|
244
|
+
shape.lineTo(x3, y3)
|
|
245
|
+
shape.closePath()
|
|
246
|
+
|
|
247
|
+
const geo = new THREE.ExtrudeGeometry(shape, {
|
|
248
|
+
steps: 1,
|
|
249
|
+
depth: d,
|
|
250
|
+
bevelEnabled: false,
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
// bounding box 중심으로 원점 정렬 후 Y-up 좌표계로 회전
|
|
254
|
+
geo.center()
|
|
255
|
+
geo.rotateX(Math.PI / 2)
|
|
256
|
+
|
|
257
|
+
return this.removeBottomFace(geo)
|
|
258
|
+
}
|
|
259
|
+
|
|
224
260
|
// ── Build ──
|
|
225
261
|
|
|
226
262
|
protected _ownMesh?: THREE.Mesh
|
|
@@ -248,7 +284,9 @@ class MCSRealObject3D extends RealObjectGroup {
|
|
|
248
284
|
? this.buildPlaneGeometry(w, h)
|
|
249
285
|
: shape === 'hexagon'
|
|
250
286
|
? this.buildHexagonGeometry(w, depth, h)
|
|
251
|
-
:
|
|
287
|
+
: shape === 'triangle'
|
|
288
|
+
? this.buildTriangleGeometry(depth)
|
|
289
|
+
: this.buildBoxGeometry(w, depth, h)
|
|
252
290
|
|
|
253
291
|
const isPlane = shape === 'plane'
|
|
254
292
|
const material = isPlane
|
|
@@ -998,7 +1036,8 @@ class NodeRealObject3D extends RealObjectGroup {
|
|
|
998
1036
|
|
|
999
1037
|
registerRealObjectFactory('Node', (component: Component) => new NodeRealObject3D(component))
|
|
1000
1038
|
|
|
1001
|
-
// Scanner —
|
|
1039
|
+
// Scanner — 2D Triangle 실루엣과 정합되는 삼각형 prism.
|
|
1040
|
+
// 이송 표면 높이의 0.2배(=6) 얇은 기둥 — 원래 값 유지, shape 만 'box' → 'triangle'.
|
|
1002
1041
|
const SCANNER_CONFIG: MCS3DConfig = {
|
|
1003
1042
|
...DEFAULTS,
|
|
1004
1043
|
defaultDepth: TRANSPORT_SURFACE_HEIGHT * 0.2,
|
|
@@ -1007,6 +1046,6 @@ const SCANNER_CONFIG: MCS3DConfig = {
|
|
|
1007
1046
|
metalness: 0.3,
|
|
1008
1047
|
roughness: 0.7,
|
|
1009
1048
|
defaultColor: 0x888888,
|
|
1010
|
-
shape: '
|
|
1049
|
+
shape: 'triangle',
|
|
1011
1050
|
}
|
|
1012
1051
|
registerRealObjectFactory('Scanner', (component: Component) => new MCSRealObject3D(component, SCANNER_CONFIG))
|