@operato/scene-visualizer 8.0.0-beta.1 → 8.0.0-beta.2
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/package.json +2 -2
- package/CHANGELOG.md +0 -649
- package/attachments/0d91a37d-c2d7-4c6d-88dc-a29e5bbea361.png +0 -0
- package/attachments/1b07c8d3-07d5-4007-b02e-031ee1755539.glb +0 -0
- package/attachments/226c6c23-c4fd-46c8-93e3-3d3d9c4bb8a9.glb +0 -0
- package/attachments/4425ca46-cf1d-476d-9185-dcb881ecad1f.glb +0 -0
- package/attachments/51e7c45d-6eae-4baf-a4e2-ba979b7e77cd.glb +0 -0
- package/attachments/54427925-c109-4499-875c-fb14207b95c5.glb +0 -0
- package/attachments/8cc70a65-e20f-4187-83c8-64deb3faf3d9.glb +0 -0
- package/attachments/964d004d-1fe7-4224-89a6-2b6e86db233c.glb +0 -0
- package/attachments/ff47fd63-6f1c-4a69-b965-9bb03797a415.png +0 -0
- package/db.sqlite +0 -0
- package/demo/index-modeller.html +0 -112
- package/demo/index.html +0 -109
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -25
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -25
- package/logs/application-2025-01-07-10.log +0 -106
- package/logs/application-2025-01-07-14.log +0 -4
- package/logs/application-2025-01-07-15.log +0 -4
- package/logs/connections-2025-01-07-10.log +0 -106
- package/logs/connections-2025-01-07-14.log +0 -53
- package/logs/connections-2025-01-07-15.log +0 -53
- package/schema.graphql +0 -4552
- package/src/banner.ts +0 -88
- package/src/camera.ts +0 -132
- package/src/component.d.ts +0 -10
- package/src/cube.ts +0 -39
- package/src/cylinder.ts +0 -39
- package/src/desk.ts +0 -135
- package/src/editors/index.ts +0 -13
- package/src/editors/property-editor-gltf-info.ts +0 -135
- package/src/editors/property-editor-location-increase-pattern.ts +0 -260
- package/src/effects/outline.ts +0 -54
- package/src/ellipse.ts +0 -37
- package/src/gltf-object.ts +0 -117
- package/src/html-overlay-element.ts +0 -13
- package/src/index.ts +0 -29
- package/src/light.ts +0 -155
- package/src/polygon.ts +0 -88
- package/src/rack-table-cell.ts +0 -386
- package/src/rack-table.ts +0 -1296
- package/src/rack.ts +0 -232
- package/src/rect.ts +0 -39
- package/src/scene/component.ts +0 -38
- package/src/sphere.ts +0 -39
- package/src/sprite.ts +0 -30
- package/src/stock.ts +0 -262
- package/src/templates/3d-container.ts +0 -21
- package/src/templates/banner.ts +0 -21
- package/src/templates/camera.ts +0 -25
- package/src/templates/cube.ts +0 -20
- package/src/templates/cylinder.ts +0 -20
- package/src/templates/desk.ts +0 -20
- package/src/templates/gltf-object.ts +0 -20
- package/src/templates/index.ts +0 -29
- package/src/templates/light.ts +0 -23
- package/src/templates/pallet.ts +0 -20
- package/src/templates/rack-table.ts +0 -21
- package/src/templates/sphere.ts +0 -20
- package/src/templates/sprite.ts +0 -21
- package/src/templates/visualizer.ts +0 -21
- package/src/templates/wall.ts +0 -20
- package/src/text.ts +0 -10
- package/src/three-container-editor.ts +0 -187
- package/src/three-container.ts +0 -724
- package/src/three-controls.ts +0 -778
- package/src/three-layout.ts +0 -25
- package/src/three-space.ts +0 -732
- package/src/threed/common.ts +0 -21
- package/src/threed/floor/floor.ts +0 -62
- package/src/threed/html/elements.ts +0 -27
- package/src/threed/index.ts +0 -15
- package/src/threed/real-object-camera-meshed.ts +0 -67
- package/src/threed/real-object-camera.ts +0 -41
- package/src/threed/real-object-dom-element.ts +0 -55
- package/src/threed/real-object-dummy.ts +0 -13
- package/src/threed/real-object-extrude.ts +0 -210
- package/src/threed/real-object-gltf.ts +0 -136
- package/src/threed/real-object-group.ts +0 -35
- package/src/threed/real-object-mesh.ts +0 -74
- package/src/threed/real-object-plane.ts +0 -27
- package/src/threed/real-object-scene.ts +0 -84
- package/src/threed/real-object-sprite-2d.ts +0 -54
- package/src/threed/real-object-sprite.ts +0 -64
- package/src/threed/real-object-text.ts +0 -86
- package/src/threed/real-object.ts +0 -326
- package/src/threed/texture/canvas-texture.ts +0 -67
- package/src/threed/texture/text-texture.ts +0 -100
- package/src/threed/three-dimensional-container.ts +0 -9
- package/src/threed/utils/bound-uv-generator.ts +0 -80
- package/src/visualizer.ts +0 -319
- package/src/wall.ts +0 -50
- package/tsconfig.json +0 -24
- package/tsconfig.tsbuildinfo +0 -1
- package/web-dev-server.config.mjs +0 -27
package/src/banner.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three'
|
|
5
|
-
import { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'
|
|
6
|
-
import { RealObject } from './threed/real-object'
|
|
7
|
-
|
|
8
|
-
const NATURE: ComponentNature = {
|
|
9
|
-
mutable: false,
|
|
10
|
-
resizable: true,
|
|
11
|
-
rotatable: true,
|
|
12
|
-
properties: [
|
|
13
|
-
{
|
|
14
|
-
type: 'color',
|
|
15
|
-
label: 'box-color',
|
|
16
|
-
name: 'boxColor',
|
|
17
|
-
property: 'boxColor'
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
help: 'scene/component/banner'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class Banner3D extends RealObject {
|
|
24
|
-
build() {
|
|
25
|
-
super.build()
|
|
26
|
-
|
|
27
|
-
var { width = 1, height = 1, depth = 1 } = this.component.state
|
|
28
|
-
|
|
29
|
-
this.object3d.add(this.createCube(width, height, depth))
|
|
30
|
-
|
|
31
|
-
let textureBoard = this.createTextureBoard(width, depth)
|
|
32
|
-
textureBoard.position.set(0, 0, 0.5 * height + 1)
|
|
33
|
-
this.object3d.add(textureBoard)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
createCube(w: number, h: number, d: number) {
|
|
37
|
-
var { boxColor = '#ccaa76' } = this.component.state
|
|
38
|
-
|
|
39
|
-
var geometry = new THREE.BoxGeometry(w, d, h)
|
|
40
|
-
var material = new THREE.MeshStandardMaterial({
|
|
41
|
-
color: boxColor,
|
|
42
|
-
side: THREE.FrontSide
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
var cube = new THREE.Mesh(geometry, material)
|
|
46
|
-
cube.castShadow = true
|
|
47
|
-
|
|
48
|
-
return cube
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
createTextureBoard(w: number, h: number) {
|
|
52
|
-
var boardMaterial
|
|
53
|
-
|
|
54
|
-
let { fillStyle = '#ccaa76' } = this.component.state
|
|
55
|
-
const texture = RealObject.buildFillStyleTexture(this.component)
|
|
56
|
-
|
|
57
|
-
if (texture) {
|
|
58
|
-
boardMaterial = new THREE.MeshStandardMaterial({ map: texture })
|
|
59
|
-
} else {
|
|
60
|
-
boardMaterial = new THREE.MeshStandardMaterial({
|
|
61
|
-
color: fillStyle || '#ccaa76',
|
|
62
|
-
side: THREE.FrontSide
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var boardGeometry = new THREE.PlaneGeometry(w, h, 1, 1)
|
|
67
|
-
var boardMesh = new THREE.Mesh(boardGeometry, boardMaterial)
|
|
68
|
-
boardMesh.castShadow = true
|
|
69
|
-
|
|
70
|
-
return boardMesh
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export class Banner extends RectPath(Shape) {
|
|
75
|
-
is3dish() {
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get nature() {
|
|
80
|
-
return NATURE
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
buildRealObject(): RealObject | undefined {
|
|
84
|
-
return new Banner3D(this)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
Component.register('banner', Banner)
|
package/src/camera.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'
|
|
5
|
-
import * as THREE from 'three'
|
|
6
|
-
import { RealObject } from './threed/real-object'
|
|
7
|
-
|
|
8
|
-
const DEFAULT = {
|
|
9
|
-
far: 100000,
|
|
10
|
-
fov: 80,
|
|
11
|
-
near: 1,
|
|
12
|
-
zoom: 1
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const NATURE: ComponentNature = {
|
|
16
|
-
mutable: false,
|
|
17
|
-
resizable: true,
|
|
18
|
-
rotatable: true,
|
|
19
|
-
properties: [
|
|
20
|
-
{
|
|
21
|
-
type: 'number',
|
|
22
|
-
label: 'near',
|
|
23
|
-
name: 'near'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'number',
|
|
27
|
-
label: 'far',
|
|
28
|
-
name: 'far'
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: 'number',
|
|
32
|
-
label: 'fov',
|
|
33
|
-
name: 'fov'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'number',
|
|
37
|
-
label: 'zoom',
|
|
38
|
-
name: 'zoom'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'checkbox',
|
|
42
|
-
label: 'show-helper',
|
|
43
|
-
name: 'showHelper'
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
help: 'scene/component/camera'
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export class Camera3D extends RealObject<THREE.Mesh> {
|
|
50
|
-
camera?: THREE.PerspectiveCamera
|
|
51
|
-
helper?: THREE.CameraHelper
|
|
52
|
-
|
|
53
|
-
protected getObject3dInstance() {
|
|
54
|
-
return new THREE.Mesh()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
updateCamera() {
|
|
58
|
-
var {
|
|
59
|
-
near = DEFAULT.near,
|
|
60
|
-
far = DEFAULT.far,
|
|
61
|
-
fov = DEFAULT.fov,
|
|
62
|
-
zoom = DEFAULT.zoom,
|
|
63
|
-
showHelper
|
|
64
|
-
} = this.component.state
|
|
65
|
-
|
|
66
|
-
this.camera!.far = far
|
|
67
|
-
this.camera!.fov = fov
|
|
68
|
-
this.camera!.near = near
|
|
69
|
-
this.camera!.zoom = zoom
|
|
70
|
-
|
|
71
|
-
if (showHelper) {
|
|
72
|
-
if (!this.helper) {
|
|
73
|
-
this.helper = new THREE.CameraHelper(this.camera!)
|
|
74
|
-
this.object3d.add(this.helper)
|
|
75
|
-
}
|
|
76
|
-
} else if (this.helper) {
|
|
77
|
-
this.object3d.remove(this.helper)
|
|
78
|
-
delete this.helper
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
build() {
|
|
83
|
-
super.build()
|
|
84
|
-
|
|
85
|
-
var { width = 0, height = 0, depth = 0, fillStyle = 'lightgray' } = this.component.state
|
|
86
|
-
|
|
87
|
-
this.object3d.geometry = new THREE.BoxGeometry(width, depth, height)
|
|
88
|
-
this.object3d.material = new THREE.MeshStandardMaterial({ color: fillStyle, side: THREE.FrontSide })
|
|
89
|
-
|
|
90
|
-
this.camera = new THREE.PerspectiveCamera()
|
|
91
|
-
this.camera.position.set(0, 0, 0)
|
|
92
|
-
|
|
93
|
-
this.object3d.add(this.camera)
|
|
94
|
-
this.object3d.lookAt(0, 0, 0)
|
|
95
|
-
|
|
96
|
-
this.updateCamera()
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export class Camera extends RectPath(Shape) {
|
|
101
|
-
static _image: HTMLImageElement
|
|
102
|
-
|
|
103
|
-
is3dish() {
|
|
104
|
-
return true
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
static get image() {
|
|
108
|
-
if (!Camera._image) {
|
|
109
|
-
Camera._image = new Image()
|
|
110
|
-
Camera._image.src = new URL('../icons/camera-big.png', import.meta.url).href
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return Camera._image
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
render(context: CanvasRenderingContext2D) {
|
|
117
|
-
var { left, top, width, height } = this.bounds
|
|
118
|
-
|
|
119
|
-
context.beginPath()
|
|
120
|
-
this.drawImage(context, Camera.image, left, top, width, height)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
buildRealObject(): RealObject | undefined {
|
|
124
|
-
return new Camera3D(this)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get nature(): ComponentNature {
|
|
128
|
-
return NATURE
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
Component.register('camera', Camera)
|
package/src/component.d.ts
DELETED
package/src/cube.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'
|
|
5
|
-
import * as THREE from 'three'
|
|
6
|
-
import { RealObject } from './threed/real-object'
|
|
7
|
-
import { RealObjectMesh } from './threed/real-object-mesh'
|
|
8
|
-
|
|
9
|
-
const NATURE: ComponentNature = {
|
|
10
|
-
mutable: false,
|
|
11
|
-
resizable: true,
|
|
12
|
-
rotatable: true,
|
|
13
|
-
properties: [],
|
|
14
|
-
help: 'scene/component/cube'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class Cube3D extends RealObjectMesh {
|
|
18
|
-
buildGeometry() {
|
|
19
|
-
var { width = 0, height = 0, depth = 0 } = this.component.state
|
|
20
|
-
|
|
21
|
-
this.object3d.geometry = new THREE.BoxGeometry(width, depth, height)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class Cube extends RectPath(Shape) {
|
|
26
|
-
is3dish() {
|
|
27
|
-
return true
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
buildRealObject(): RealObject | undefined {
|
|
31
|
-
return new Cube3D(this)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get nature() {
|
|
35
|
-
return NATURE
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
Component.register('cube', Cube)
|
package/src/cylinder.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Component, ComponentNature, Ellipse } from '@hatiolab/things-scene'
|
|
5
|
-
import * as THREE from 'three'
|
|
6
|
-
import { RealObject } from './threed/real-object'
|
|
7
|
-
import { RealObjectMesh } from './threed/real-object-mesh'
|
|
8
|
-
|
|
9
|
-
const NATURE: ComponentNature = {
|
|
10
|
-
mutable: false,
|
|
11
|
-
resizable: true,
|
|
12
|
-
rotatable: true,
|
|
13
|
-
properties: [],
|
|
14
|
-
help: 'scene/component/cylinder'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class Cylinder3D extends RealObjectMesh {
|
|
18
|
-
buildGeometry() {
|
|
19
|
-
var { depth = 0, rx = 0 } = this.component.state
|
|
20
|
-
|
|
21
|
-
this.object3d.geometry = new THREE.CylinderGeometry(rx, rx, depth, 25)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class Cylinder extends Ellipse {
|
|
26
|
-
is3dish() {
|
|
27
|
-
return true
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
buildRealObject(): RealObject | undefined {
|
|
31
|
-
return new Cylinder3D(this)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get nature() {
|
|
35
|
-
return NATURE
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
Component.register('cylinder', Cylinder)
|
package/src/desk.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'
|
|
5
|
-
import * as THREE from 'three'
|
|
6
|
-
import { RealObject } from './threed/real-object'
|
|
7
|
-
|
|
8
|
-
const NATURE: ComponentNature = {
|
|
9
|
-
mutable: false,
|
|
10
|
-
resizable: true,
|
|
11
|
-
rotatable: true,
|
|
12
|
-
properties: [
|
|
13
|
-
{
|
|
14
|
-
type: 'color',
|
|
15
|
-
label: 'leg-color',
|
|
16
|
-
name: 'legColor',
|
|
17
|
-
property: 'legColor'
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
help: 'scene/component/desk'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class Desk3D extends RealObject {
|
|
24
|
-
get boardThickness() {
|
|
25
|
-
var { depth } = this.component.state
|
|
26
|
-
|
|
27
|
-
return Math.min(10, depth / 10)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get legThickness() {
|
|
31
|
-
var { width, height } = this.component.state
|
|
32
|
-
|
|
33
|
-
var min = Math.min(width, height)
|
|
34
|
-
|
|
35
|
-
return Math.min(10, min / 10)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get margin() {
|
|
39
|
-
return Math.min(this.legThickness / 5, 2)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
build() {
|
|
43
|
-
super.build()
|
|
44
|
-
|
|
45
|
-
var { width, height, depth } = this.component.state
|
|
46
|
-
|
|
47
|
-
var top = (depth - this.boardThickness) / 2
|
|
48
|
-
|
|
49
|
-
var legs = this.createDeskLegs(width, height, depth)
|
|
50
|
-
legs.position.set(0, -this.boardThickness / 2, 0)
|
|
51
|
-
legs.castShadow = true
|
|
52
|
-
|
|
53
|
-
this.object3d.add(legs)
|
|
54
|
-
|
|
55
|
-
let board = this.createDeskBoard(width, height)
|
|
56
|
-
board.position.set(0, top, 0)
|
|
57
|
-
board.rotation.x = Math.PI / 2
|
|
58
|
-
board.castShadow = true
|
|
59
|
-
|
|
60
|
-
this.object3d.add(board)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
createDeskLegs(w: number, h: number, d: number) {
|
|
64
|
-
var { legColor } = this.component.state
|
|
65
|
-
|
|
66
|
-
var legThickness = this.legThickness
|
|
67
|
-
var margin = this.margin
|
|
68
|
-
d -= this.boardThickness
|
|
69
|
-
|
|
70
|
-
var legs = new THREE.Group()
|
|
71
|
-
|
|
72
|
-
var posX = w / 2 - legThickness / 2 - margin
|
|
73
|
-
var posY = h / 2 - legThickness / 2 - margin
|
|
74
|
-
var posZ = 0
|
|
75
|
-
|
|
76
|
-
for (var i = 0; i < 4; i++) {
|
|
77
|
-
var geometry = new THREE.BoxGeometry(legThickness, d, legThickness)
|
|
78
|
-
var material = new THREE.MeshStandardMaterial({
|
|
79
|
-
color: legColor || '#252525'
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
var leg = new THREE.Mesh(geometry, material)
|
|
83
|
-
leg.castShadow = true
|
|
84
|
-
|
|
85
|
-
switch (i) {
|
|
86
|
-
case 0:
|
|
87
|
-
leg.position.set(posX, posZ, posY)
|
|
88
|
-
break
|
|
89
|
-
case 1:
|
|
90
|
-
leg.position.set(posX, posZ, -posY)
|
|
91
|
-
break
|
|
92
|
-
case 2:
|
|
93
|
-
leg.position.set(-posX, posZ, posY)
|
|
94
|
-
break
|
|
95
|
-
case 3:
|
|
96
|
-
leg.position.set(-posX, posZ, -posY)
|
|
97
|
-
break
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
legs.add(leg)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return legs
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
createDeskBoard(w: number, h: number) {
|
|
107
|
-
var { fillStyle } = this.component.state
|
|
108
|
-
|
|
109
|
-
var d = 10
|
|
110
|
-
|
|
111
|
-
var boardMaterial = new THREE.MeshStandardMaterial({
|
|
112
|
-
color: fillStyle || '#ccaa76'
|
|
113
|
-
})
|
|
114
|
-
var boardGeometry = new THREE.BoxGeometry(w, h, d, 1, 1)
|
|
115
|
-
var board = new THREE.Mesh(boardGeometry, boardMaterial)
|
|
116
|
-
|
|
117
|
-
return board
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export class Desk extends RectPath(Shape) {
|
|
122
|
-
is3dish() {
|
|
123
|
-
return true
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
buildRealObject(): RealObject | undefined {
|
|
127
|
-
return new Desk3D(this)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
get nature() {
|
|
131
|
-
return NATURE
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
Component.register('desk', Desk)
|
package/src/editors/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import './property-editor-location-increase-pattern'
|
|
2
|
-
import './property-editor-gltf-info'
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
{
|
|
6
|
-
type: 'location-increase-pattern',
|
|
7
|
-
element: 'property-editor-location-increase-pattern'
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
type: 'gltf-info',
|
|
11
|
-
element: 'property-editor-gltf-info'
|
|
12
|
-
}
|
|
13
|
-
]
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
import '@material/web/button/elevated-button.js'
|
|
3
|
-
import '@operato/i18n/ox-i18n.js'
|
|
4
|
-
|
|
5
|
-
import { css, html, PropertyValues, TemplateResult } from 'lit'
|
|
6
|
-
import { customElement, property, state } from 'lit/decorators.js'
|
|
7
|
-
|
|
8
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
9
|
-
import { Component } from '@hatiolab/things-scene'
|
|
10
|
-
|
|
11
|
-
import * as THREE from 'three'
|
|
12
|
-
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
|
|
13
|
-
|
|
14
|
-
@customElement('property-editor-gltf-info')
|
|
15
|
-
export default class GLTFInfoEditor extends OxPropertyEditor {
|
|
16
|
-
static styles = [
|
|
17
|
-
...OxPropertyEditor.styles,
|
|
18
|
-
css`
|
|
19
|
-
div[info] {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
div[info] * {
|
|
26
|
-
align-self: center;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
div[info] title {
|
|
30
|
-
font-weight: bold;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
div[info] md-elevated-button {
|
|
34
|
-
margin-left: auto;
|
|
35
|
-
--md-icon-size: 24px;
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
@property({ type: String }) src?: string
|
|
41
|
-
|
|
42
|
-
@state() width: number = 0
|
|
43
|
-
@state() height: number = 0
|
|
44
|
-
@state() depth: number = 0
|
|
45
|
-
|
|
46
|
-
editorTemplate(value: any, spec: PropertySpec): TemplateResult {
|
|
47
|
-
const valid = this.width && this.height && this.depth
|
|
48
|
-
|
|
49
|
-
var property = spec.property || {}
|
|
50
|
-
var { action } = property
|
|
51
|
-
|
|
52
|
-
return html`
|
|
53
|
-
<fieldset fullwidth>
|
|
54
|
-
<legend><ox-i18n msgid="label.gltf-info">GLTF info.</ox-i18n></legend>
|
|
55
|
-
|
|
56
|
-
<div>
|
|
57
|
-
<div info>
|
|
58
|
-
<div label>[W x H x D] :</div>
|
|
59
|
-
${valid
|
|
60
|
-
? html` <div value>${this.width} x ${this.height} x ${this.depth}</div>
|
|
61
|
-
<md-elevated-button
|
|
62
|
-
@click=${(e: MouseEvent) => {
|
|
63
|
-
this.dispatchEvent(
|
|
64
|
-
new CustomEvent('i-need-selected', {
|
|
65
|
-
bubbles: true,
|
|
66
|
-
composed: true,
|
|
67
|
-
detail: {
|
|
68
|
-
callback: (selected: any[]) => {
|
|
69
|
-
typeof action === 'function' &&
|
|
70
|
-
action(selected[0], {
|
|
71
|
-
width: this.width,
|
|
72
|
-
height: this.height,
|
|
73
|
-
depth: this.depth
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
)
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
<md-icon>autorenew</md-icon>
|
|
82
|
-
</md-elevated-button>`
|
|
83
|
-
: html` <div></div> `}
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</fieldset>
|
|
87
|
-
`
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
updated(changes: PropertyValues<this>) {
|
|
91
|
-
if (changes.has('src')) {
|
|
92
|
-
this.dispatchEvent(
|
|
93
|
-
new CustomEvent('i-need-selected', {
|
|
94
|
-
bubbles: true,
|
|
95
|
-
composed: true,
|
|
96
|
-
detail: {
|
|
97
|
-
callback: async (selected: any[]) => {
|
|
98
|
-
await this.fetchSourceInfo(selected[0], this.src!)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async fetchSourceInfo(component: Component, src: string) {
|
|
107
|
-
if (!src || !src.trim()) {
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
const path = component.app.url(src)
|
|
113
|
-
|
|
114
|
-
let gltfLoader = new GLTFLoader()
|
|
115
|
-
|
|
116
|
-
gltfLoader.setCrossOrigin('use-credentials')
|
|
117
|
-
|
|
118
|
-
return new Promise((resolve: any) => {
|
|
119
|
-
gltfLoader.load(path, gltf => {
|
|
120
|
-
var box = new THREE.Box3().setFromObject(gltf.scene)
|
|
121
|
-
var { x, y, z } = box.getSize(new THREE.Vector3())
|
|
122
|
-
|
|
123
|
-
this.width = Math.floor(x)
|
|
124
|
-
this.depth = Math.floor(y)
|
|
125
|
-
this.height = Math.floor(z)
|
|
126
|
-
|
|
127
|
-
resolve()
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
} catch (e) {
|
|
131
|
-
console.error(e)
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|