@operato/scene-visualizer 1.2.11 → 1.2.13
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/CHANGELOG.md +19 -0
- package/db.sqlite +0 -0
- package/dist/cube.d.ts +1 -3
- package/dist/cube.js +1 -5
- package/dist/cube.js.map +1 -1
- package/dist/cylinder.d.ts +1 -3
- package/dist/cylinder.js +1 -5
- package/dist/cylinder.js.map +1 -1
- package/dist/rack.js +3 -3
- package/dist/rack.js.map +1 -1
- package/dist/sphere.d.ts +1 -3
- package/dist/sphere.js +1 -8
- package/dist/sphere.js.map +1 -1
- package/dist/sprite.d.ts +0 -1
- package/dist/sprite.js +0 -6
- package/dist/sprite.js.map +1 -1
- package/dist/threed/common.js +3 -2
- package/dist/threed/common.js.map +1 -1
- package/dist/threed/real-object-camera-meshed.d.ts +1 -1
- package/dist/threed/real-object-camera-meshed.js +1 -1
- package/dist/threed/real-object-camera-meshed.js.map +1 -1
- package/dist/threed/real-object-dom-element.d.ts +0 -3
- package/dist/threed/real-object-dom-element.js +0 -51
- package/dist/threed/real-object-dom-element.js.map +1 -1
- package/dist/threed/real-object-extrude.d.ts +2 -3
- package/dist/threed/real-object-extrude.js +27 -66
- package/dist/threed/real-object-extrude.js.map +1 -1
- package/dist/threed/real-object-gltf.d.ts +0 -2
- package/dist/threed/real-object-gltf.js +2 -8
- package/dist/threed/real-object-gltf.js.map +1 -1
- package/dist/threed/real-object-mesh.d.ts +3 -2
- package/dist/threed/real-object-mesh.js +22 -13
- package/dist/threed/real-object-mesh.js.map +1 -1
- package/dist/threed/real-object-plane.d.ts +2 -3
- package/dist/threed/real-object-plane.js +6 -7
- package/dist/threed/real-object-plane.js.map +1 -1
- package/dist/threed/real-object-sprite-2d.js +0 -1
- package/dist/threed/real-object-sprite-2d.js.map +1 -1
- package/dist/threed/real-object-text.d.ts +3 -4
- package/dist/threed/real-object-text.js +41 -47
- package/dist/threed/real-object-text.js.map +1 -1
- package/dist/threed/real-object.d.ts +0 -1
- package/dist/threed/real-object.js +14 -18
- package/dist/threed/real-object.js.map +1 -1
- package/dist/wall.d.ts +2 -3
- package/dist/wall.js +4 -5
- package/dist/wall.js.map +1 -1
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +6 -21
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +10 -0
- package/logs/application-2023-03-05-12.log +6 -0
- package/logs/application-2023-03-05-23.log +6 -0
- package/logs/connections-2023-03-05-12.log +35 -0
- package/logs/connections-2023-03-05-23.log +35 -0
- package/package.json +2 -2
- package/src/cube.ts +1 -7
- package/src/cylinder.ts +1 -7
- package/src/rack.ts +3 -4
- package/src/sphere.ts +1 -10
- package/src/sprite.ts +0 -8
- package/src/threed/common.ts +3 -2
- package/src/threed/real-object-camera-meshed.ts +1 -1
- package/src/threed/real-object-dom-element.ts +0 -71
- package/src/threed/real-object-extrude.ts +31 -69
- package/src/threed/real-object-gltf.ts +2 -10
- package/src/threed/real-object-mesh.ts +21 -14
- package/src/threed/real-object-plane.ts +6 -9
- package/src/threed/real-object-sprite-2d.ts +0 -2
- package/src/threed/real-object-text.ts +49 -60
- package/src/threed/real-object.ts +15 -22
- package/src/wall.ts +5 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/logs/application-2023-03-01-03.log +0 -6
- package/logs/application-2023-03-01-13.log +0 -6
- package/logs/application-2023-03-01-15.log +0 -6
- package/logs/application-2023-03-03-00.log +0 -25
- package/logs/application-2023-03-03-01.log +0 -6
|
@@ -15,8 +15,8 @@ export abstract class RealObjectMesh extends RealObject<THREE.Mesh> {
|
|
|
15
15
|
build() {
|
|
16
16
|
super.build()
|
|
17
17
|
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
18
|
+
this.buildGeometry()
|
|
19
|
+
this.buildMaterial()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/* overide */
|
|
@@ -31,27 +31,34 @@ export abstract class RealObjectMesh extends RealObject<THREE.Mesh> {
|
|
|
31
31
|
this.object3d.visible = !this.component.state.hidden
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
buildMaterial(): THREE.Material {
|
|
34
|
+
updateFillStyle() {
|
|
37
35
|
var { fillStyle } = this.component.state
|
|
36
|
+
var material = this.object3d.material as THREE.MeshStandardMaterial
|
|
37
|
+
if (!material) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
38
40
|
|
|
39
|
-
var params: any = {}
|
|
40
41
|
const texture = RealObject.buildFillStyleTexture(this.component)
|
|
41
42
|
|
|
42
43
|
if (texture) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
texture.needsUpdate = true
|
|
45
|
+
material.map = texture
|
|
46
|
+
} else if (typeof fillStyle == 'string') {
|
|
47
|
+
if (fillStyle !== 'transparent') {
|
|
48
|
+
material.color.set(fillStyle)
|
|
49
|
+
} else {
|
|
50
|
+
material.opacity = 0
|
|
49
51
|
}
|
|
50
52
|
}
|
|
53
|
+
}
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
protected abstract buildGeometry(): void
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
buildMaterial(): void {
|
|
58
|
+
this.object3d.material = new THREE.MeshStandardMaterial({
|
|
59
|
+
transparent: true,
|
|
60
|
+
side: THREE.DoubleSide
|
|
61
|
+
})
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
clear() {
|
|
@@ -14,17 +14,14 @@ export class RealObjectPlane extends RealObjectMesh {
|
|
|
14
14
|
buildGeometry() {
|
|
15
15
|
var { width, height } = this.component.state.dimension
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
this.object3d.geometry = new THREE.PlaneGeometry(width, height)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
buildMaterial() /* : THREE.MeshMaterialType | THREE.MeshMaterialType[] */ {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
material.blending = THREE.NoBlending
|
|
27
|
-
|
|
28
|
-
return material
|
|
21
|
+
this.object3d.material = new THREE.MeshStandardMaterial({
|
|
22
|
+
opacity: 0,
|
|
23
|
+
side: THREE.DoubleSide,
|
|
24
|
+
blending: THREE.NoBlending
|
|
25
|
+
})
|
|
29
26
|
}
|
|
30
27
|
}
|
|
@@ -8,8 +8,6 @@ import { createCanvasTexture } from './texture/canvas-texture'
|
|
|
8
8
|
|
|
9
9
|
export class RealObjectSprite2D extends RealObjectSprite {
|
|
10
10
|
buildMaterial() {
|
|
11
|
-
var { fillStyle } = this.component.state
|
|
12
|
-
|
|
13
11
|
var material = new THREE.SpriteMaterial({
|
|
14
12
|
map: createCanvasTexture(this.component),
|
|
15
13
|
alphaTest: 0.1
|
|
@@ -2,51 +2,47 @@
|
|
|
2
2
|
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { RealObjectMesh } from './real-object-mesh'
|
|
6
|
-
|
|
7
5
|
import * as THREE from 'three'
|
|
6
|
+
import { applyAlpha } from './common'
|
|
8
7
|
|
|
9
|
-
import {
|
|
8
|
+
import { RealObjectMesh } from './real-object-mesh'
|
|
9
|
+
import { textTexture } from './texture/text-texture'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* RealObjectText
|
|
13
13
|
*/
|
|
14
14
|
export class RealObjectText extends RealObjectMesh {
|
|
15
|
-
buildGeometry() {
|
|
16
|
-
// TODO component.text의 heavy한 로직을 반복적으로 실행하지 않도록, 캐싱하자.
|
|
17
|
-
var {
|
|
18
|
-
bold = false,
|
|
19
|
-
italic = false,
|
|
20
|
-
fontFamily = 'Serif',
|
|
21
|
-
fontSize = 10,
|
|
22
|
-
fontColor = 'black'
|
|
23
|
-
} = this.component.state
|
|
15
|
+
buildGeometry() {}
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
let { width, height } = textBounds(text, {
|
|
27
|
-
bold,
|
|
28
|
-
italic,
|
|
29
|
-
fontFamily,
|
|
30
|
-
fontSize,
|
|
31
|
-
fontColor
|
|
32
|
-
})
|
|
17
|
+
/* overide */
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
get rotation() {
|
|
20
|
+
const { rotationX = 0, rotationY = 0, rotation = 0 } = this.component.state
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
x: rotationX - Math.PI / 2,
|
|
24
|
+
y: rotationY,
|
|
25
|
+
z: rotation
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
updateDimension() {
|
|
30
|
+
var { width, height } = this.component.state
|
|
45
31
|
|
|
46
|
-
|
|
32
|
+
if (this.object3d.geometry) {
|
|
33
|
+
this.object3d.geometry.dispose()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* scaling으로 해결되지 않기때문에, 새로 geometry를 만드는 방법을 사용한다 */
|
|
37
|
+
this.object3d.geometry = new THREE.PlaneGeometry(width, height)
|
|
47
38
|
}
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
updateText() {
|
|
41
|
+
var material = this.object3d.material as THREE.MeshStandardMaterial
|
|
42
|
+
if (!material) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
50
46
|
var {
|
|
51
47
|
width,
|
|
52
48
|
height,
|
|
@@ -54,44 +50,37 @@ export class RealObjectText extends RealObjectMesh {
|
|
|
54
50
|
italic = false,
|
|
55
51
|
fontFamily = 'Serif',
|
|
56
52
|
fontSize = 10,
|
|
57
|
-
fontColor = 'black'
|
|
53
|
+
fontColor = 'black',
|
|
54
|
+
fillStyle
|
|
58
55
|
} = this.component.state
|
|
59
56
|
|
|
60
|
-
// TODO component.text의 heavy한 로직을 반복적으로 실행하지 않도록, 캐싱하자.
|
|
61
57
|
var text = this.component.text
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
fontColor
|
|
70
|
-
}),
|
|
71
|
-
transparent: true,
|
|
72
|
-
alphaTest: 0.2,
|
|
73
|
-
side: THREE.DoubleSide
|
|
59
|
+
const texture = textTexture(text, width, height, {
|
|
60
|
+
bold,
|
|
61
|
+
italic,
|
|
62
|
+
fontFamily,
|
|
63
|
+
fontSize,
|
|
64
|
+
fontColor
|
|
74
65
|
})
|
|
75
|
-
}
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
x: rotationX - Math.PI / 2,
|
|
87
|
-
y: rotationY,
|
|
88
|
-
z: rotation
|
|
67
|
+
if (texture) {
|
|
68
|
+
material.map = texture
|
|
69
|
+
texture.needsUpdate = true
|
|
70
|
+
} else if (typeof fillStyle == 'string') {
|
|
71
|
+
if (fillStyle !== 'transparent') {
|
|
72
|
+
material.color.set(fillStyle)
|
|
73
|
+
} else {
|
|
74
|
+
material.opacity = 0
|
|
75
|
+
}
|
|
89
76
|
}
|
|
90
77
|
}
|
|
91
78
|
|
|
92
79
|
updateAlpha() {
|
|
93
80
|
// material의 transparency는 항상 true으로 유지되어야 한다.
|
|
94
|
-
|
|
81
|
+
var { alpha = 1, fontColor } = this.component.state
|
|
82
|
+
|
|
83
|
+
applyAlpha(this.object3d.material, alpha, fontColor)
|
|
95
84
|
;(this.object3d.material as any).transparent = true
|
|
96
85
|
}
|
|
97
86
|
}
|
|
@@ -28,6 +28,7 @@ export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
|
|
|
28
28
|
texture.minFilter = THREE.LinearFilter
|
|
29
29
|
texture.encoding = THREE.sRGBEncoding
|
|
30
30
|
texture.repeat.set(1, 1)
|
|
31
|
+
texture.needsUpdate = true
|
|
31
32
|
|
|
32
33
|
component.invalidate()
|
|
33
34
|
},
|
|
@@ -49,9 +50,13 @@ export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
|
|
|
49
50
|
this.clear()
|
|
50
51
|
this.build()
|
|
51
52
|
|
|
53
|
+
this.updateDimension()
|
|
52
54
|
this.updateTransform()
|
|
55
|
+
this.updateFillStyle()
|
|
56
|
+
this.updateStrokeStyle()
|
|
53
57
|
this.updateAlpha()
|
|
54
58
|
this.updateHidden()
|
|
59
|
+
this.updateText()
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
protected getObject3dInstance(): T {
|
|
@@ -243,7 +248,8 @@ export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
|
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
updateDimension() {
|
|
246
|
-
this.
|
|
251
|
+
var { width, height, depth } = this.dimension
|
|
252
|
+
this.object3d.scale.set(width, height, depth)
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
updateAlpha() {
|
|
@@ -270,32 +276,23 @@ export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
|
|
|
270
276
|
this.object3d.visible = !this.component.state.hidden
|
|
271
277
|
}
|
|
272
278
|
|
|
273
|
-
updateStrokeStyle() {
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
updateFillStyle() {
|
|
278
|
-
this.update()
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
updateText() {
|
|
282
|
-
this.update()
|
|
283
|
-
}
|
|
279
|
+
updateStrokeStyle() {}
|
|
280
|
+
updateFillStyle() {}
|
|
281
|
+
updateText() {}
|
|
284
282
|
|
|
285
283
|
onchange(after: Properties, before: Properties) {
|
|
286
|
-
if (hasProperties(this.rebuildingProperties, after)) {
|
|
287
|
-
this.update()
|
|
288
|
-
return
|
|
289
|
-
}
|
|
290
|
-
|
|
291
284
|
if (hasProperties(['cx', 'cy', 'cz', 'zPos', 'left', 'top'], after)) {
|
|
292
|
-
this.
|
|
285
|
+
this.updatePosition()
|
|
293
286
|
}
|
|
294
287
|
|
|
295
288
|
if (hasProperties(['width', 'height', 'depth'], after)) {
|
|
296
289
|
this.updateDimension()
|
|
297
290
|
}
|
|
298
291
|
|
|
292
|
+
if (hasProperties(['rotationX', 'rotationY', 'rotation'], after)) {
|
|
293
|
+
this.updateRotate()
|
|
294
|
+
}
|
|
295
|
+
|
|
299
296
|
if ('scale' in after) {
|
|
300
297
|
this.updateScale()
|
|
301
298
|
}
|
|
@@ -320,8 +317,4 @@ export abstract class RealObject<T extends THREE.Object3D = THREE.Object3D> {
|
|
|
320
317
|
this.updateText()
|
|
321
318
|
}
|
|
322
319
|
}
|
|
323
|
-
|
|
324
|
-
get rebuildingProperties(): string[] {
|
|
325
|
-
return ['width', 'height', 'depth', 'fillStyle', 'strokeStyle', 'text', 'path']
|
|
326
|
-
}
|
|
327
320
|
}
|
package/src/wall.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import { Component, RectPath, Shape } from '@hatiolab/things-scene'
|
|
4
|
+
import { Component, Properties, RectPath, Shape } from '@hatiolab/things-scene'
|
|
5
5
|
import * as THREE from 'three'
|
|
6
6
|
import { RealObject } from './threed/real-object'
|
|
7
7
|
import { RealObjectMesh } from './threed/real-object-mesh'
|
|
@@ -23,14 +23,13 @@ const NATURE = {
|
|
|
23
23
|
|
|
24
24
|
export class Wall3D extends RealObjectMesh {
|
|
25
25
|
buildGeometry() {
|
|
26
|
-
|
|
27
|
-
return new THREE.BoxGeometry(width, depth, height)
|
|
26
|
+
this.object3d.geometry = new THREE.BoxGeometry(1, 1, 1)
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
var {
|
|
29
|
+
updateDimension(): void {
|
|
30
|
+
var { width, height, depth = 1 } = this.component.state
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
this.object3d.scale.set(width, depth, height)
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|