@operato/scene-visualizer 1.2.36 → 1.2.39
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 +18 -0
- package/db.sqlite +0 -0
- package/dist/camera copy.d.ts +20 -0
- package/dist/camera copy.js +103 -0
- package/dist/camera copy.js.map +1 -0
- package/dist/camera.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/light.d.ts +15 -0
- package/dist/light.js +131 -0
- package/dist/light.js.map +1 -0
- package/dist/point-light.d.ts +14 -0
- package/dist/point-light.js +77 -0
- package/dist/point-light.js.map +1 -0
- package/dist/rack.d.ts +2 -2
- package/dist/stock.d.ts +1 -1
- package/dist/templates/index.d.ts +20 -0
- package/dist/templates/index.js +2 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/light.d.ts +22 -0
- package/dist/templates/light.js +23 -0
- package/dist/templates/light.js.map +1 -0
- package/dist/templates/point-light.d.ts +22 -0
- package/dist/templates/point-light.js +23 -0
- package/dist/templates/point-light.js.map +1 -0
- package/dist/templates/sprite.js +1 -1
- package/dist/templates/sprite.js.map +1 -1
- package/dist/templates/wall copy.d.ts +19 -0
- package/dist/templates/wall copy.js +20 -0
- package/dist/templates/wall copy.js.map +1 -0
- package/dist/three-container.js +0 -18
- package/dist/three-container.js.map +1 -1
- package/dist/three-modeller.d.ts +0 -0
- package/dist/three-modeller.js +2 -0
- package/dist/three-modeller.js.map +1 -0
- package/dist/three-space.d.ts +86 -0
- package/dist/three-space.js +566 -0
- package/dist/three-space.js.map +1 -0
- package/dist/threed/real-object-camera-meshed.d.ts +1 -1
- package/dist/threed/real-object-dom-element.d.ts +1 -0
- package/dist/threed/real-object-dom-element.js +6 -0
- package/dist/threed/real-object-dom-element.js.map +1 -1
- package/dist/threed/real-object-extrude.d.ts +1 -1
- package/dist/threed/real-object-mesh.d.ts +2 -2
- package/dist/threed/real-object-sprite.d.ts +1 -0
- package/dist/threed/real-object-sprite.js +6 -0
- package/dist/threed/real-object-sprite.js.map +1 -1
- package/dist/threed/texture/canvas-texture.js +25 -7
- package/dist/threed/texture/canvas-texture.js.map +1 -1
- package/helps/scene/component/light.ko.md +12 -0
- package/helps/scene/component/light.md +12 -0
- package/helps/scene/component/light.zh.md +12 -0
- package/icons/light.png +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +9 -24
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +12 -42
- package/logs/application-2023-05-23-21.log +6 -0
- package/logs/application-2023-05-24-21.log +6 -0
- package/logs/application-2023-05-25-00.log +20 -0
- package/logs/connections-2023-05-20-07.log +41 -0
- package/logs/connections-2023-05-23-21.log +41 -0
- package/logs/connections-2023-05-24-21.log +41 -0
- package/logs/connections-2023-05-25-00.log +123 -0
- package/package.json +3 -3
- package/schema.gql +10 -0
- package/src/index.ts +1 -0
- package/src/light.ts +155 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/light.ts +23 -0
- package/src/templates/sprite.ts +1 -1
- package/src/three-container.ts +0 -21
- package/src/three-space.ts +732 -0
- package/src/threed/real-object-dom-element.ts +9 -4
- package/src/threed/real-object-sprite.ts +9 -0
- package/src/threed/texture/canvas-texture.ts +32 -6
- package/translations/en.json +6 -1
- package/translations/ko.json +6 -1
- package/translations/ms.json +6 -1
- package/translations/zh.json +6 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/logs/application-2023-04-30-10.log +0 -6
- package/logs/application-2023-04-30-12.log +0 -6
- package/logs/application-2023-04-30-14.log +0 -6
- package/logs/application-2023-04-30-16.log +0 -15
- package/logs/application-2023-04-30-20.log +0 -6
- package/logs/application-2023-04-30-22.log +0 -6
- package/logs/connections-2023-04-22-10.log +0 -82
- package/logs/connections-2023-04-22-11.log +0 -41
- package/logs/connections-2023-04-24-13.log +0 -82
- package/logs/connections-2023-04-24-14.log +0 -82
- package/logs/connections-2023-04-30-10.log +0 -41
- package/logs/connections-2023-04-30-12.log +0 -41
- package/logs/connections-2023-04-30-14.log +0 -41
- package/logs/connections-2023-04-30-16.log +0 -41
- package/logs/connections-2023-04-30-20.log +0 -41
- package/logs/connections-2023-04-30-22.log +0 -41
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-visualizer",
|
|
3
3
|
"description": "visualizer component for operato-scene",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.39",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
37
37
|
"@things-factory/builder": "^6.0.0",
|
|
38
38
|
"@things-factory/operato-board": "^6.0.0",
|
|
39
|
-
"@types/three": "^0.
|
|
39
|
+
"@types/three": "^0.152.0",
|
|
40
40
|
"@types/tinycolor2": "^1.4.3",
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
42
42
|
"@typescript-eslint/parser": "^4.33.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"prettier --write"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "b9e52c76a2cd160a6f7341aa26694c928ed1051a"
|
|
66
66
|
}
|
package/schema.gql
CHANGED
|
@@ -1360,9 +1360,15 @@ type Mutation {
|
|
|
1360
1360
|
"""To start new scenario instance"""
|
|
1361
1361
|
startScenario(instanceName: String, scenarioName: String!, variables: Object): ScenarioInstance!
|
|
1362
1362
|
|
|
1363
|
+
"""To start posting scenario based on the schedule of the given scenario"""
|
|
1364
|
+
startScenarioSchedule(scenarioId: String!): Scenario!
|
|
1365
|
+
|
|
1363
1366
|
"""To start new scenario instance"""
|
|
1364
1367
|
stopScenario(instanceName: String): ScenarioInstance
|
|
1365
1368
|
|
|
1369
|
+
"""To stop posting scenario based on the schedule of the given scenario"""
|
|
1370
|
+
stopScenarioSchedule(scenarioId: String!): Scenario
|
|
1371
|
+
|
|
1366
1372
|
"""
|
|
1367
1373
|
To synchronize privilege master from graphql directives. Only superuser is permitted.
|
|
1368
1374
|
"""
|
|
@@ -2193,6 +2199,9 @@ type Query {
|
|
|
2193
2199
|
|
|
2194
2200
|
"""To fetch multiple Fonts"""
|
|
2195
2201
|
fonts(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): FontList!
|
|
2202
|
+
|
|
2203
|
+
"""To fetch a Global Board Model"""
|
|
2204
|
+
globalBoardByName(name: String!): Board
|
|
2196
2205
|
grantedRoles: [GrantedRole!]!
|
|
2197
2206
|
grantingRoles(customerId: String!): [GrantedRole!]!
|
|
2198
2207
|
|
|
@@ -2398,6 +2407,7 @@ type Scenario {
|
|
|
2398
2407
|
instances: [ScenarioInstance!]
|
|
2399
2408
|
name: String!
|
|
2400
2409
|
schedule: String
|
|
2410
|
+
scheduleId: String
|
|
2401
2411
|
state: String
|
|
2402
2412
|
steps: [Step!]
|
|
2403
2413
|
timezone: String
|
package/src/index.ts
CHANGED
package/src/light.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Anchor, Component, ComponentNature, Ellipse } from '@hatiolab/things-scene'
|
|
5
|
+
import * as THREE from 'three'
|
|
6
|
+
import { RealObject } from './threed/real-object'
|
|
7
|
+
|
|
8
|
+
const NATURE = {
|
|
9
|
+
mutable: false,
|
|
10
|
+
resizable: true,
|
|
11
|
+
rotatable: true,
|
|
12
|
+
properties: [
|
|
13
|
+
{
|
|
14
|
+
type: 'select',
|
|
15
|
+
label: 'light-type',
|
|
16
|
+
name: 'lightType',
|
|
17
|
+
property: {
|
|
18
|
+
options: ['', 'point', 'directional']
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'number',
|
|
23
|
+
label: 'intensity',
|
|
24
|
+
name: 'intensity'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'number',
|
|
28
|
+
label: 'distance',
|
|
29
|
+
name: 'distance'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'number',
|
|
33
|
+
label: 'decay',
|
|
34
|
+
name: 'decay'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'checkbox',
|
|
38
|
+
label: 'cast-shadow',
|
|
39
|
+
name: 'castShadow'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'number',
|
|
43
|
+
label: 'near',
|
|
44
|
+
name: 'near',
|
|
45
|
+
placeholder: '0.5'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'number',
|
|
49
|
+
label: 'far',
|
|
50
|
+
name: 'far',
|
|
51
|
+
placeholder: '1000'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'number',
|
|
55
|
+
label: 'fov',
|
|
56
|
+
name: 'fov',
|
|
57
|
+
placeholder: '90'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'number',
|
|
61
|
+
label: 'zoom',
|
|
62
|
+
name: 'zoom',
|
|
63
|
+
placeholder: '1'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'checkbox',
|
|
67
|
+
label: 'show-helper',
|
|
68
|
+
name: 'showHelper'
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
help: 'scene/component/light'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export class LightObject extends RealObject<THREE.Light> {
|
|
75
|
+
helper?: THREE.CameraHelper
|
|
76
|
+
|
|
77
|
+
updatePointLight() {
|
|
78
|
+
var {
|
|
79
|
+
lightType = 'point',
|
|
80
|
+
distance = 0, // unlimited
|
|
81
|
+
intensity = 10,
|
|
82
|
+
decay = 1,
|
|
83
|
+
fillStyle: color = 'white',
|
|
84
|
+
castShadow,
|
|
85
|
+
near = 0.5,
|
|
86
|
+
far = 1000,
|
|
87
|
+
fov = 90,
|
|
88
|
+
zoom = 1,
|
|
89
|
+
showHelper
|
|
90
|
+
} = this.component.state
|
|
91
|
+
|
|
92
|
+
this.object3d!.color = new THREE.Color(color)
|
|
93
|
+
if (lightType == 'point') {
|
|
94
|
+
;(this.object3d as THREE.PointLight)!.distance = distance
|
|
95
|
+
;(this.object3d as THREE.PointLight)!.decay = decay
|
|
96
|
+
}
|
|
97
|
+
this.object3d!.intensity = intensity
|
|
98
|
+
this.object3d!.castShadow = castShadow
|
|
99
|
+
if (castShadow) {
|
|
100
|
+
const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
|
|
101
|
+
camera.far = far
|
|
102
|
+
camera.near = near
|
|
103
|
+
camera.fov = fov
|
|
104
|
+
camera.zoom = zoom
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (showHelper) {
|
|
108
|
+
const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
|
|
109
|
+
|
|
110
|
+
if (!this.helper) {
|
|
111
|
+
this.helper = new THREE.CameraHelper(camera!)
|
|
112
|
+
this.object3d.add(this.helper)
|
|
113
|
+
}
|
|
114
|
+
} else if (this.helper) {
|
|
115
|
+
this.object3d.remove(this.helper)
|
|
116
|
+
delete this.helper
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
protected getObject3dInstance(): THREE.Light {
|
|
121
|
+
var { lightType = 'point' } = this.component.state
|
|
122
|
+
|
|
123
|
+
return lightType == 'point' ? new THREE.PointLight() : new THREE.DirectionalLight()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
update() {
|
|
127
|
+
this.clear()
|
|
128
|
+
this.build()
|
|
129
|
+
|
|
130
|
+
this.updateDimension()
|
|
131
|
+
this.updateHidden()
|
|
132
|
+
|
|
133
|
+
this.updatePointLight()
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class PointLight extends Ellipse {
|
|
138
|
+
is3dish() {
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
buildRealObject(): RealObject | undefined {
|
|
143
|
+
return new LightObject(this)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
get anchors(): Array<Anchor> {
|
|
147
|
+
return []
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
get nature(): ComponentNature {
|
|
151
|
+
return NATURE
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
Component.register('light', PointLight)
|
package/src/templates/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import sprite from './sprite'
|
|
|
9
9
|
import wall from './wall'
|
|
10
10
|
import desk from './desk'
|
|
11
11
|
import camera from './camera'
|
|
12
|
+
import light from './light'
|
|
12
13
|
import GLTFObject from './gltf-object'
|
|
13
14
|
|
|
14
15
|
export default [
|
|
@@ -16,6 +17,7 @@ export default [
|
|
|
16
17
|
visualizer,
|
|
17
18
|
rackTable,
|
|
18
19
|
camera,
|
|
20
|
+
light,
|
|
19
21
|
cube,
|
|
20
22
|
cylinder,
|
|
21
23
|
sphere,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const icon = new URL('../../icons/light.png', import.meta.url).href
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
type: 'light',
|
|
5
|
+
description: 'Light',
|
|
6
|
+
group: '3D' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
|
7
|
+
icon,
|
|
8
|
+
model: {
|
|
9
|
+
type: 'light',
|
|
10
|
+
rx: 10,
|
|
11
|
+
ry: 10,
|
|
12
|
+
cx: 150,
|
|
13
|
+
cy: 150,
|
|
14
|
+
zPos: 1000,
|
|
15
|
+
fillStyle: '#fff',
|
|
16
|
+
strokeStyle: '#000',
|
|
17
|
+
alpha: 1,
|
|
18
|
+
hidden: false,
|
|
19
|
+
lineWidth: 1,
|
|
20
|
+
lineDash: 'solid',
|
|
21
|
+
lineCap: 'butt'
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/templates/sprite.ts
CHANGED
package/src/three-container.ts
CHANGED
|
@@ -232,21 +232,8 @@ export class ThreeContainer extends Container implements ThreeDimensionalContain
|
|
|
232
232
|
|
|
233
233
|
// Lights
|
|
234
234
|
var _hemiLight = new THREE.HemisphereLight(0xdddddd, 0x333333, 0.035)
|
|
235
|
-
var _directionalLight = new THREE.DirectionalLight(0xd6e1ff, 0.01)
|
|
236
|
-
var _pointLight1 = new THREE.PointLight(0xd6e1ff, 1, undefined, 2)
|
|
237
|
-
|
|
238
|
-
_pointLight1.power = cameraZPos * 50
|
|
239
|
-
_pointLight1.castShadow = true
|
|
240
|
-
_pointLight1.position.set(0, cameraZPos, 0)
|
|
241
|
-
_pointLight1.shadow.camera.near = 0.1
|
|
242
|
-
_pointLight1.shadow.camera.far = cameraZPos * 2
|
|
243
|
-
|
|
244
|
-
// const helper = new THREE.CameraHelper(_pointLight1.shadow.camera)
|
|
245
|
-
// this._scene3d?.add(helper)
|
|
246
235
|
|
|
247
236
|
this.scene3d!.add(_hemiLight)
|
|
248
|
-
this.scene3d!.add(_pointLight1)
|
|
249
|
-
this._camera.add(_directionalLight)
|
|
250
237
|
|
|
251
238
|
this._mouse = new THREE.Vector2()
|
|
252
239
|
|
|
@@ -258,19 +245,11 @@ export class ThreeContainer extends Container implements ThreeDimensionalContain
|
|
|
258
245
|
this._camera.updateProjectionMatrix()
|
|
259
246
|
|
|
260
247
|
const floor = createFloor(this)
|
|
261
|
-
// if (this._floor) {
|
|
262
|
-
// this.object3d.remove(this._floor)
|
|
263
|
-
// this._floor.clear()
|
|
264
|
-
// delete this._floor
|
|
265
|
-
// }
|
|
266
248
|
|
|
267
249
|
if (floor) {
|
|
268
|
-
// this._floor = floor
|
|
269
250
|
this._scene3d.add(floor)
|
|
270
251
|
}
|
|
271
252
|
|
|
272
|
-
// this.invalidate()
|
|
273
|
-
|
|
274
253
|
// postprocessing
|
|
275
254
|
|
|
276
255
|
var composer = (this.composer = new EffectComposer(renderer3d!))
|