@fmsim/machine 2.0.0-beta.3 → 2.0.0-beta.6
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/carrier.js +2 -2
- package/dist/carrier.js.map +1 -1
- package/dist/factories/agv-3d.js +33 -6
- package/dist/factories/agv-3d.js.map +1 -1
- package/dist/factories/machine-3d.js +395 -56
- package/dist/factories/machine-3d.js.map +1 -1
- package/dist/factories/oht-3d.js +34 -8
- package/dist/factories/oht-3d.js.map +1 -1
- package/dist/factories/shuttle-3d.js +32 -6
- package/dist/factories/shuttle-3d.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/carrier.ts +2 -2
- package/src/factories/agv-3d.ts +32 -6
- package/src/factories/machine-3d.ts +446 -40
- package/src/factories/oht-3d.ts +32 -8
- package/src/factories/shuttle-3d.ts +30 -6
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import * as THREE from 'three'
|
|
14
14
|
import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js'
|
|
15
|
-
import { RealObjectGroup, registerRealObjectFactory } from '@hatiolab/things-scene'
|
|
15
|
+
import { RealObjectGroup, registerRealObjectFactory, disposeObject3D } from '@hatiolab/things-scene'
|
|
16
16
|
import type { Component } from '@hatiolab/things-scene'
|
|
17
17
|
import { TRANSPORT_SURFACE_HEIGHT } from './machine-3d.js'
|
|
18
18
|
|
|
@@ -21,6 +21,7 @@ const FORK_COLOR = 0x777777
|
|
|
21
21
|
const DEFAULT_BODY_COLOR = 0x6688cc
|
|
22
22
|
|
|
23
23
|
export class Shuttle3D extends RealObjectGroup {
|
|
24
|
+
private _ownMeshes: THREE.Mesh[] = []
|
|
24
25
|
get effectiveDepth(): number {
|
|
25
26
|
const { depth } = this.component.state
|
|
26
27
|
return depth || TRANSPORT_SURFACE_HEIGHT
|
|
@@ -80,7 +81,6 @@ export class Shuttle3D extends RealObjectGroup {
|
|
|
80
81
|
baseMesh.position.y = baseH / 2
|
|
81
82
|
baseMesh.castShadow = true
|
|
82
83
|
baseMesh.receiveShadow = true
|
|
83
|
-
this.object3d.add(baseMesh)
|
|
84
84
|
|
|
85
85
|
// ── 2. 좌우 마스트 기둥 (statusColor 적용) ──
|
|
86
86
|
const mastBaseY = baseH
|
|
@@ -109,7 +109,6 @@ export class Shuttle3D extends RealObjectGroup {
|
|
|
109
109
|
|
|
110
110
|
const mastMesh = new THREE.Mesh(BufferGeometryUtils.mergeGeometries(mastGeometries), mastMat)
|
|
111
111
|
mastMesh.castShadow = true
|
|
112
|
-
this.object3d.add(mastMesh)
|
|
113
112
|
|
|
114
113
|
// ── 3. 상단 포크 (2개의 평행 암 + 백 플레이트) ──
|
|
115
114
|
const forkBaseY = mastBaseY + mastH
|
|
@@ -141,14 +140,39 @@ export class Shuttle3D extends RealObjectGroup {
|
|
|
141
140
|
|
|
142
141
|
const forkMesh = new THREE.Mesh(BufferGeometryUtils.mergeGeometries(forkGeometries), forkMat)
|
|
143
142
|
forkMesh.castShadow = true
|
|
144
|
-
|
|
143
|
+
|
|
144
|
+
this._ownMeshes = [baseMesh, mastMesh, forkMesh]
|
|
145
|
+
for (const m of this._ownMeshes) this.object3d.add(m)
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
updateDimension() {}
|
|
148
|
-
|
|
149
|
+
|
|
150
|
+
update() {
|
|
151
|
+
for (const m of this._ownMeshes) {
|
|
152
|
+
this.object3d.remove(m)
|
|
153
|
+
disposeObject3D(m)
|
|
154
|
+
}
|
|
155
|
+
this._ownMeshes = []
|
|
156
|
+
this.build()
|
|
157
|
+
this.updateTransform()
|
|
158
|
+
this.updateAlpha()
|
|
159
|
+
this.updateHidden()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
updateAlpha() {
|
|
163
|
+
const { alpha = 1 } = this.component.state
|
|
164
|
+
for (const m of this._ownMeshes) {
|
|
165
|
+
const materials = Array.isArray(m.material) ? m.material : [m.material]
|
|
166
|
+
for (const mat of materials) {
|
|
167
|
+
;(mat as THREE.MeshStandardMaterial).opacity = alpha
|
|
168
|
+
;(mat as THREE.MeshStandardMaterial).transparent = alpha < 1
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
149
172
|
|
|
150
173
|
onchange(after: Record<string, unknown>, before: Record<string, unknown>) {
|
|
151
|
-
if ('width' in after || 'height' in after || 'depth' in after ||
|
|
174
|
+
if ('width' in after || 'height' in after || 'depth' in after ||
|
|
175
|
+
'fillStyle' in after || 'strokeStyle' in after || 'id' in after) {
|
|
152
176
|
this.update()
|
|
153
177
|
return
|
|
154
178
|
}
|