@operato/scene-visualizer 9.2.2 → 10.0.0-beta.10
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.d.ts +263 -0
- package/dist/carrier.js +272 -0
- package/dist/carrier.js.map +1 -0
- package/dist/desk.d.ts +238 -3
- package/dist/desk.js +1 -2
- package/dist/desk.js.map +1 -1
- package/dist/editors/index.d.ts +3 -0
- package/dist/editors/index.js +15 -0
- package/dist/editors/index.js.map +1 -1
- package/dist/editors/property-editor-gltf-fill-targets.d.ts +20 -0
- package/dist/editors/property-editor-gltf-fill-targets.js +313 -0
- package/dist/editors/property-editor-gltf-fill-targets.js.map +1 -0
- package/dist/editors/property-editor-gltf-info.d.ts +25 -3
- package/dist/editors/property-editor-gltf-info.js +333 -73
- package/dist/editors/property-editor-gltf-info.js.map +1 -1
- package/dist/editors/property-editor-gltf-play-targets.d.ts +25 -0
- package/dist/editors/property-editor-gltf-play-targets.js +388 -0
- package/dist/editors/property-editor-gltf-play-targets.js.map +1 -0
- package/dist/editors/property-editor-location-increase-pattern.js +87 -95
- package/dist/editors/property-editor-location-increase-pattern.js.map +1 -1
- package/dist/editors/property-editor-stocker-location.d.ts +13 -0
- package/dist/editors/property-editor-stocker-location.js +151 -0
- package/dist/editors/property-editor-stocker-location.js.map +1 -0
- package/dist/editors/property-editor-stocker-ports.d.ts +8 -0
- package/dist/editors/property-editor-stocker-ports.js +112 -0
- package/dist/editors/property-editor-stocker-ports.js.map +1 -0
- package/dist/effects/outline.js +1 -1
- package/dist/effects/outline.js.map +1 -1
- package/dist/index.d.ts +8 -17
- package/dist/index.js +10 -17
- package/dist/index.js.map +1 -1
- package/dist/rack-table-3d.d.ts +16 -0
- package/dist/rack-table-3d.js +95 -0
- package/dist/rack-table-3d.js.map +1 -0
- package/dist/rack-table-cell.d.ts +238 -3
- package/dist/rack-table-cell.js +44 -51
- package/dist/rack-table-cell.js.map +1 -1
- package/dist/rack-table-location.d.ts +37 -0
- package/dist/rack-table-location.js +227 -0
- package/dist/rack-table-location.js.map +1 -0
- package/dist/rack-table.d.ts +13 -29
- package/dist/rack-table.js +121 -380
- package/dist/rack-table.js.map +1 -1
- package/dist/rack.d.ts +16 -5
- package/dist/rack.js +106 -19
- package/dist/rack.js.map +1 -1
- package/dist/signal-tower.d.ts +492 -0
- package/dist/signal-tower.js +275 -0
- package/dist/signal-tower.js.map +1 -0
- package/dist/stock-hub.d.ts +25 -0
- package/dist/stock-hub.js +147 -0
- package/dist/stock-hub.js.map +1 -0
- package/dist/stock.d.ts +52 -8
- package/dist/stock.js +223 -120
- package/dist/stock.js.map +1 -1
- package/dist/stocker-3d.d.ts +23 -0
- package/dist/stocker-3d.js +352 -0
- package/dist/stocker-3d.js.map +1 -0
- package/dist/stocker-port-3d.d.ts +14 -0
- package/dist/stocker-port-3d.js +80 -0
- package/dist/stocker-port-3d.js.map +1 -0
- package/dist/stocker-port.d.ts +254 -0
- package/dist/stocker-port.js +123 -0
- package/dist/stocker-port.js.map +1 -0
- package/dist/stocker.d.ts +340 -0
- package/dist/stocker.js +370 -0
- package/dist/stocker.js.map +1 -0
- package/dist/tank.d.ts +492 -0
- package/dist/tank.js +312 -0
- package/dist/tank.js.map +1 -0
- package/dist/templates/carrier.d.ts +19 -0
- package/dist/templates/carrier.js +20 -0
- package/dist/templates/carrier.js.map +1 -0
- package/dist/templates/cube.js +1 -1
- package/dist/templates/cube.js.map +1 -1
- package/dist/templates/cylinder.js +3 -3
- package/dist/templates/cylinder.js.map +1 -1
- package/dist/templates/index.d.ts +38 -38
- package/dist/templates/index.js +15 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/rack-table.d.ts +2 -0
- package/dist/templates/rack-table.js +4 -2
- package/dist/templates/rack-table.js.map +1 -1
- package/dist/templates/signal-tower.d.ts +21 -0
- package/dist/templates/signal-tower.js +22 -0
- package/dist/templates/signal-tower.js.map +1 -0
- package/dist/templates/sphere.d.ts +1 -0
- package/dist/templates/sphere.js +5 -4
- package/dist/templates/sphere.js.map +1 -1
- package/dist/templates/stock-hub.d.ts +14 -0
- package/dist/templates/stock-hub.js +15 -0
- package/dist/templates/stock-hub.js.map +1 -0
- package/dist/templates/stocker-port.d.ts +17 -0
- package/dist/templates/stocker-port.js +17 -0
- package/dist/templates/stocker-port.js.map +1 -0
- package/dist/templates/stocker.d.ts +27 -0
- package/dist/templates/stocker.js +38 -0
- package/dist/templates/stocker.js.map +1 -0
- package/dist/templates/tank.d.ts +21 -0
- package/dist/templates/tank.js +22 -0
- package/dist/templates/tank.js.map +1 -0
- package/dist/templates/vehicle.d.ts +19 -0
- package/dist/templates/vehicle.js +20 -0
- package/dist/templates/vehicle.js.map +1 -0
- package/dist/templates/visualizer.js +1 -1
- package/dist/templates/visualizer.js.map +1 -1
- package/dist/vehicle.d.ts +248 -0
- package/dist/vehicle.js +133 -0
- package/dist/vehicle.js.map +1 -0
- package/dist/visualizer.d.ts +5 -5
- package/dist/visualizer.js +72 -68
- package/dist/visualizer.js.map +1 -1
- package/icons/carrier.png +0 -0
- package/icons/signal-tower.png +0 -0
- package/icons/stock-hub.png +0 -0
- package/icons/tank.png +0 -0
- package/icons/vehicle.png +0 -0
- package/package.json +16 -18
- package/translations/en.json +6 -0
- package/translations/ja.json +5 -0
- package/translations/ko.json +6 -1
- package/translations/ms.json +5 -0
- package/translations/zh.json +5 -0
- package/dist/banner.d.ts +0 -15
- package/dist/banner.js +0 -76
- package/dist/banner.js.map +0 -1
- package/dist/camera.d.ts +0 -20
- package/dist/camera.js +0 -108
- package/dist/camera.js.map +0 -1
- package/dist/cube.d.ts +0 -13
- package/dist/cube.js +0 -38
- package/dist/cube.js.map +0 -1
- package/dist/cylinder.d.ts +0 -11
- package/dist/cylinder.js +0 -38
- package/dist/cylinder.js.map +0 -1
- package/dist/ellipse.d.ts +0 -5
- package/dist/ellipse.js +0 -22
- package/dist/ellipse.js.map +0 -1
- package/dist/gltf-object.d.ts +0 -20
- package/dist/gltf-object.js +0 -104
- package/dist/gltf-object.js.map +0 -1
- package/dist/html-overlay-element.d.ts +0 -1
- package/dist/html-overlay-element.js +0 -12
- package/dist/html-overlay-element.js.map +0 -1
- package/dist/light.d.ts +0 -15
- package/dist/light.js +0 -135
- package/dist/light.js.map +0 -1
- package/dist/polygon.d.ts +0 -17
- package/dist/polygon.js +0 -64
- package/dist/polygon.js.map +0 -1
- package/dist/rect.d.ts +0 -5
- package/dist/rect.js +0 -36
- package/dist/rect.js.map +0 -1
- package/dist/scene/component.d.ts +0 -1
- package/dist/scene/component.js +0 -29
- package/dist/scene/component.js.map +0 -1
- package/dist/sphere.d.ts +0 -11
- package/dist/sphere.js +0 -38
- package/dist/sphere.js.map +0 -1
- package/dist/sprite.d.ts +0 -9
- package/dist/sprite.js +0 -28
- package/dist/sprite.js.map +0 -1
- package/dist/text.d.ts +0 -1
- package/dist/text.js +0 -9
- package/dist/text.js.map +0 -1
- package/dist/three-container-editor.d.ts +0 -22
- package/dist/three-container-editor.js +0 -132
- package/dist/three-container-editor.js.map +0 -1
- package/dist/three-container.d.ts +0 -85
- package/dist/three-container.js +0 -565
- package/dist/three-container.js.map +0 -1
- package/dist/three-controls.d.ts +0 -11
- package/dist/three-controls.js +0 -616
- package/dist/three-controls.js.map +0 -1
- package/dist/three-layout.d.ts +0 -8
- package/dist/three-layout.js +0 -20
- package/dist/three-layout.js.map +0 -1
- package/dist/three-space.d.ts +0 -85
- package/dist/three-space.js +0 -570
- package/dist/three-space.js.map +0 -1
- package/dist/threed/common.d.ts +0 -22
- package/dist/threed/common.js +0 -19
- package/dist/threed/common.js.map +0 -1
- package/dist/threed/floor/floor.d.ts +0 -3
- package/dist/threed/floor/floor.js +0 -51
- package/dist/threed/floor/floor.js.map +0 -1
- package/dist/threed/html/elements.d.ts +0 -2
- package/dist/threed/html/elements.js +0 -21
- package/dist/threed/html/elements.js.map +0 -1
- package/dist/threed/index.d.ts +0 -15
- package/dist/threed/index.js +0 -16
- package/dist/threed/index.js.map +0 -1
- package/dist/threed/real-object-camera-meshed.d.ts +0 -12
- package/dist/threed/real-object-camera-meshed.js +0 -49
- package/dist/threed/real-object-camera-meshed.js.map +0 -1
- package/dist/threed/real-object-camera.d.ts +0 -9
- package/dist/threed/real-object-camera.js +0 -31
- package/dist/threed/real-object-camera.js.map +0 -1
- package/dist/threed/real-object-dom-element.d.ts +0 -9
- package/dist/threed/real-object-dom-element.js +0 -40
- package/dist/threed/real-object-dom-element.js.map +0 -1
- package/dist/threed/real-object-dummy.d.ts +0 -6
- package/dist/threed/real-object-dummy.js +0 -11
- package/dist/threed/real-object-dummy.js.map +0 -1
- package/dist/threed/real-object-extrude.d.ts +0 -21
- package/dist/threed/real-object-extrude.js +0 -173
- package/dist/threed/real-object-extrude.js.map +0 -1
- package/dist/threed/real-object-gltf.d.ts +0 -16
- package/dist/threed/real-object-gltf.js +0 -101
- package/dist/threed/real-object-gltf.js.map +0 -1
- package/dist/threed/real-object-group.d.ts +0 -5
- package/dist/threed/real-object-group.js +0 -11
- package/dist/threed/real-object-group.js.map +0 -1
- package/dist/threed/real-object-mesh.d.ts +0 -13
- package/dist/threed/real-object-mesh.js +0 -75
- package/dist/threed/real-object-mesh.js.map +0 -1
- package/dist/threed/real-object-plane.d.ts +0 -5
- package/dist/threed/real-object-plane.js +0 -22
- package/dist/threed/real-object-plane.js.map +0 -1
- package/dist/threed/real-object-scene.d.ts +0 -21
- package/dist/threed/real-object-scene.js +0 -67
- package/dist/threed/real-object-scene.js.map +0 -1
- package/dist/threed/real-object-sprite-2d.d.ts +0 -14
- package/dist/threed/real-object-sprite-2d.js +0 -45
- package/dist/threed/real-object-sprite-2d.js.map +0 -1
- package/dist/threed/real-object-sprite.d.ts +0 -11
- package/dist/threed/real-object-sprite.js +0 -50
- package/dist/threed/real-object-sprite.js.map +0 -1
- package/dist/threed/real-object-text.d.ts +0 -15
- package/dist/threed/real-object-text.js +0 -64
- package/dist/threed/real-object-text.js.map +0 -1
- package/dist/threed/real-object.d.ts +0 -64
- package/dist/threed/real-object.js +0 -260
- package/dist/threed/real-object.js.map +0 -1
- package/dist/threed/texture/canvas-texture.d.ts +0 -4
- package/dist/threed/texture/canvas-texture.js +0 -49
- package/dist/threed/texture/canvas-texture.js.map +0 -1
- package/dist/threed/texture/text-texture.d.ts +0 -8
- package/dist/threed/texture/text-texture.js +0 -79
- package/dist/threed/texture/text-texture.js.map +0 -1
- package/dist/threed/three-dimensional-container.d.ts +0 -8
- package/dist/threed/three-dimensional-container.js +0 -2
- package/dist/threed/three-dimensional-container.js.map +0 -1
- package/dist/threed/utils/bound-uv-generator.d.ts +0 -16
- package/dist/threed/utils/bound-uv-generator.js +0 -42
- package/dist/threed/utils/bound-uv-generator.js.map +0 -1
- package/dist/wall.d.ts +0 -13
- package/dist/wall.js +0 -45
- package/dist/wall.js.map +0 -1
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { error } from '@hatiolab/things-scene';
|
|
6
|
-
import { RealObject } from './real-object.js';
|
|
7
|
-
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
8
|
-
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
9
|
-
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
|
|
12
|
-
export class RealObjectGLTF extends RealObject {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.objectSize = new THREE.Vector3();
|
|
16
|
-
}
|
|
17
|
-
static get GLTFLoader() {
|
|
18
|
-
return RealObjectGLTF._GLTFLoader;
|
|
19
|
-
}
|
|
20
|
-
build() {
|
|
21
|
-
super.build();
|
|
22
|
-
var { src: source } = this.component.state;
|
|
23
|
-
if (!source) {
|
|
24
|
-
this.clear();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let gltfLoader = new GLTFLoader();
|
|
28
|
-
// Optional: Provide a DRACOLoader instance to decode compressed mesh data
|
|
29
|
-
const dracoLoader = new DRACOLoader();
|
|
30
|
-
dracoLoader.setDecoderPath('/node_modules/three/examples/jsm/libs/draco/');
|
|
31
|
-
gltfLoader.setDRACOLoader(dracoLoader);
|
|
32
|
-
const ktx2Loader = new KTX2Loader();
|
|
33
|
-
ktx2Loader.setTranscoderPath(`/node_modules/three/examples/jsm/libs/basis/`);
|
|
34
|
-
ktx2Loader.detectSupport(this.threeContainer.renderer3d);
|
|
35
|
-
gltfLoader.setKTX2Loader(ktx2Loader);
|
|
36
|
-
gltfLoader.setMeshoptDecoder(MeshoptDecoder);
|
|
37
|
-
var fullsource = this.component.app.url(source);
|
|
38
|
-
gltfLoader.setCrossOrigin('use-credentials');
|
|
39
|
-
gltfLoader.load(fullsource, gltf => {
|
|
40
|
-
this.gltfLoaded(gltf);
|
|
41
|
-
}, xhr => {
|
|
42
|
-
console.log(Math.round((xhr.loaded / xhr.total) * 100) + '% loaded');
|
|
43
|
-
}, err => {
|
|
44
|
-
error('GLTFLoader.load', err);
|
|
45
|
-
this.clear();
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
gltfLoaded(gltf) {
|
|
49
|
-
let scene = gltf.scene;
|
|
50
|
-
var animations = gltf.animations;
|
|
51
|
-
var object = scene.clone();
|
|
52
|
-
object.userData.context = this;
|
|
53
|
-
object.traverse((child) => {
|
|
54
|
-
if (child.isMesh) {
|
|
55
|
-
child.castShadow = true;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
var boundingBox = new THREE.Box3().setFromObject(object);
|
|
59
|
-
var center = boundingBox.getCenter(object.position);
|
|
60
|
-
this.objectSize = boundingBox.getSize(this.objectSize);
|
|
61
|
-
center.multiplyScalar(-1);
|
|
62
|
-
// 오브젝트 공백을 최소로 하기위해서 clear() 를 최대한 pending함.
|
|
63
|
-
this.clear();
|
|
64
|
-
this.pivot = new THREE.Object3D();
|
|
65
|
-
this.object3d.add(this.pivot);
|
|
66
|
-
this.pivot.add(object);
|
|
67
|
-
this.updateDimension();
|
|
68
|
-
if (animations && animations.length) {
|
|
69
|
-
for (var i = 0; i < animations.length; i++) {
|
|
70
|
-
var animation = animations[i];
|
|
71
|
-
var action = this.threeContainer.mixer.clipAction(animation);
|
|
72
|
-
action.play();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
console.log('no animations..');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
clear() {
|
|
80
|
-
// TODO gltf object 리소스 해제가 필요하면, 여기에 추가.
|
|
81
|
-
// 반복적으로 로딩하면 WebGL 리소스 부족으로 오류 발생.
|
|
82
|
-
return super.clear();
|
|
83
|
-
}
|
|
84
|
-
updateDimension() {
|
|
85
|
-
var { width = 1, height = 1, depth = 1 } = this.component.state;
|
|
86
|
-
var { x = 1, y = 1, z = 1 } = this.objectSize || {};
|
|
87
|
-
this.pivot && this.pivot.scale.set(width / x, depth / y, height / z);
|
|
88
|
-
this.component.invalidate();
|
|
89
|
-
}
|
|
90
|
-
updateSource() {
|
|
91
|
-
this.build();
|
|
92
|
-
}
|
|
93
|
-
onchange(after, before) {
|
|
94
|
-
super.onchange(after, before);
|
|
95
|
-
if ('src' in after) {
|
|
96
|
-
this.updateSource();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
RealObjectGLTF._GLTFLoader = new GLTFLoader();
|
|
101
|
-
//# sourceMappingURL=real-object-gltf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-gltf.js","sourceRoot":"","sources":["../../src/threed/real-object-gltf.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MA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KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAA;QAEpE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAA;IAC7B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE7B,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACnB,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;IACH,CAAC;;AArHc,0BAAW,GAAG,IAAI,UAAU,EAAE,AAAnB,CAAmB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\nimport { error } from '@hatiolab/things-scene'\n\nimport { RealObject } from './real-object.js'\n\nimport { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'\nimport { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'\nimport { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js'\n// @ts-ignore\nimport { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js'\nimport { Properties } from '@hatiolab/things-scene'\n\nexport class RealObjectGLTF extends RealObject {\n private static _GLTFLoader = new GLTFLoader()\n\n private pivot?: THREE.Object3D\n private objectSize?: THREE.Vector3 = new THREE.Vector3()\n\n static get GLTFLoader() {\n return RealObjectGLTF._GLTFLoader\n }\n\n build() {\n super.build()\n\n var { src: source } = this.component.state\n\n if (!source) {\n this.clear()\n return\n }\n\n let gltfLoader = new GLTFLoader()\n\n // Optional: Provide a DRACOLoader instance to decode compressed mesh data\n const dracoLoader = new DRACOLoader()\n dracoLoader.setDecoderPath('/node_modules/three/examples/jsm/libs/draco/')\n gltfLoader.setDRACOLoader(dracoLoader)\n\n const ktx2Loader = new KTX2Loader()\n ktx2Loader.setTranscoderPath(`/node_modules/three/examples/jsm/libs/basis/`)\n ktx2Loader.detectSupport(this.threeContainer!.renderer3d!)\n gltfLoader.setKTX2Loader(ktx2Loader)\n\n gltfLoader.setMeshoptDecoder(MeshoptDecoder)\n\n var fullsource = this.component.app.url(source)\n gltfLoader.setCrossOrigin('use-credentials')\n\n gltfLoader.load(\n fullsource,\n gltf => {\n this.gltfLoaded(gltf)\n },\n xhr => {\n console.log(Math.round((xhr.loaded / xhr.total) * 100) + '% loaded')\n },\n err => {\n error('GLTFLoader.load', err)\n this.clear()\n }\n )\n }\n\n private gltfLoaded(gltf: GLTF) {\n let scene = gltf.scene\n\n var animations = gltf.animations\n var object = scene.clone()\n object.userData.context = this\n\n object.traverse((child: THREE.Object3D) => {\n if ((child as any).isMesh) {\n child.castShadow = true\n }\n })\n\n var boundingBox = new THREE.Box3().setFromObject(object)\n var center = boundingBox.getCenter(object.position)\n this.objectSize = boundingBox.getSize(this.objectSize!)\n\n center.multiplyScalar(-1)\n\n // 오브젝트 공백을 최소로 하기위해서 clear() 를 최대한 pending함.\n this.clear()\n\n this.pivot = new THREE.Object3D()\n this.object3d.add(this.pivot)\n this.pivot.add(object)\n\n this.updateDimension()\n\n if (animations && animations.length) {\n for (var i = 0; i < animations.length; i++) {\n var animation = animations[i]\n var action = this.threeContainer!.mixer!.clipAction(animation)\n action.play()\n }\n } else {\n console.log('no animations..')\n }\n }\n\n clear() {\n // TODO gltf object 리소스 해제가 필요하면, 여기에 추가.\n // 반복적으로 로딩하면 WebGL 리소스 부족으로 오류 발생.\n\n return super.clear()\n }\n\n updateDimension() {\n var { width = 1, height = 1, depth = 1 } = this.component.state\n\n var { x = 1, y = 1, z = 1 } = this.objectSize || {}\n\n this.pivot && this.pivot.scale.set(width / x, depth / y, height / z)\n\n this.component.invalidate()\n }\n\n updateSource() {\n this.build()\n }\n\n onchange(after: Properties, before: Properties) {\n super.onchange(after, before)\n\n if ('src' in after) {\n this.updateSource()\n }\n }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { RealObject } from './real-object.js';
|
|
6
|
-
export class RealObjectGroup extends RealObject {
|
|
7
|
-
getObject3dInstance() {
|
|
8
|
-
return new THREE.Group();
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=real-object-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-group.js","sourceRoot":"","sources":["../../src/threed/real-object-group.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,OAAO,eAAgB,SAAQ,UAAuB;IAChD,mBAAmB;QAC3B,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;CAyBF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport * as THREE from 'three'\nimport { RealObject } from './real-object.js'\n\nexport class RealObjectGroup extends RealObject<THREE.Group> {\n protected getObject3dInstance() {\n return new THREE.Group()\n }\n\n // build() {\n // super.build()\n\n // var { left = 0, top = 0, width = 0, height = 0 } = this.component.bounds\n\n // let cx = left + width / 2 - canvasSize.width / 2\n // let cy = top + height / 2 - canvasSize.height / 2\n // // let cz = this.state.rx\n\n // this.object3d.position.x = cx\n // this.object3d.position.z = cy\n // }\n\n // createChildrenObject() {\n // var { components } = this._model\n\n // components.forEach((component: Model) => {\n // var item = component.getRealObject()\n // if (item) {\n // this.object3d.add(item.object3d)\n // }\n // })\n // }\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { RealObject } from './real-object.js';
|
|
3
|
-
export declare abstract class RealObjectMesh extends RealObject<THREE.Mesh> {
|
|
4
|
-
protected getObject3dInstance(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
5
|
-
build(): void;
|
|
6
|
-
updateAlpha(): void;
|
|
7
|
-
updateHidden(): void;
|
|
8
|
-
updateFillStyle(): void;
|
|
9
|
-
updateDimension(): void;
|
|
10
|
-
protected abstract buildGeometry(): void;
|
|
11
|
-
buildMaterial(): void;
|
|
12
|
-
clear(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
13
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { applyAlpha } from './common.js';
|
|
6
|
-
import { RealObject } from './real-object.js';
|
|
7
|
-
export class RealObjectMesh extends RealObject {
|
|
8
|
-
getObject3dInstance() {
|
|
9
|
-
return new THREE.Mesh();
|
|
10
|
-
}
|
|
11
|
-
build() {
|
|
12
|
-
super.build();
|
|
13
|
-
this.buildGeometry();
|
|
14
|
-
this.buildMaterial();
|
|
15
|
-
}
|
|
16
|
-
/* overide */
|
|
17
|
-
updateAlpha() {
|
|
18
|
-
var { alpha = 1, fillStyle } = this.component.state;
|
|
19
|
-
applyAlpha(this.object3d.material, alpha, fillStyle);
|
|
20
|
-
}
|
|
21
|
-
updateHidden() {
|
|
22
|
-
this.object3d.visible = !this.component.state.hidden;
|
|
23
|
-
}
|
|
24
|
-
updateFillStyle() {
|
|
25
|
-
var { fillStyle } = this.component.state;
|
|
26
|
-
var material = this.object3d.material;
|
|
27
|
-
if (!material) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const texture = RealObject.buildFillStyleTexture(this.component);
|
|
31
|
-
if (texture) {
|
|
32
|
-
texture.needsUpdate = true;
|
|
33
|
-
material.map = texture;
|
|
34
|
-
}
|
|
35
|
-
else if (typeof fillStyle == 'string') {
|
|
36
|
-
if (fillStyle !== 'transparent') {
|
|
37
|
-
material.color.set(fillStyle);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
material.opacity = 0;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
updateDimension() {
|
|
45
|
-
var { width, height } = this.component.bounds;
|
|
46
|
-
var { depth = 1 } = this.component.state;
|
|
47
|
-
if (!this.object3d) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this.object3d.geometry.computeBoundingBox();
|
|
51
|
-
let bbox = this.object3d.geometry.boundingBox;
|
|
52
|
-
if (bbox) {
|
|
53
|
-
let originalWidth = bbox.max.x - bbox.min.x;
|
|
54
|
-
let originalDepth = bbox.max.y - bbox.min.y;
|
|
55
|
-
let originalHeight = bbox.max.z - bbox.min.z;
|
|
56
|
-
this.object3d.scale.set(width / originalWidth, depth / originalDepth, height / originalHeight);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
buildMaterial() {
|
|
60
|
-
this.object3d.material = new THREE.MeshStandardMaterial({
|
|
61
|
-
transparent: true,
|
|
62
|
-
side: THREE.DoubleSide
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
clear() {
|
|
66
|
-
this.object3d.traverse((mesh) => {
|
|
67
|
-
if (mesh.isMesh) {
|
|
68
|
-
mesh.geometry.dispose();
|
|
69
|
-
(mesh.material.length ? mesh.material : [mesh.material]).forEach((m) => m.dispose && m.dispose());
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return super.clear();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=real-object-mesh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-mesh.js","sourceRoot":"","sources":["../../src/threed/real-object-mesh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KA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QAAQ,CAAC,CAAC,IAAS,EAAE,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CACtB;gBAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;YACzG,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,KAAK,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\n\nimport { applyAlpha } from './common.js'\nimport { RealObject } from './real-object.js'\n\nexport abstract class RealObjectMesh extends RealObject<THREE.Mesh> {\n protected getObject3dInstance() {\n return new THREE.Mesh()\n }\n\n build() {\n super.build()\n\n this.buildGeometry()\n this.buildMaterial()\n }\n\n /* overide */\n\n updateAlpha() {\n var { alpha = 1, fillStyle } = this.component.state\n\n applyAlpha(this.object3d.material, alpha, fillStyle)\n }\n\n updateHidden() {\n this.object3d.visible = !this.component.state.hidden\n }\n\n updateFillStyle() {\n var { fillStyle } = this.component.state\n var material = this.object3d.material as THREE.MeshStandardMaterial\n if (!material) {\n return\n }\n\n const texture = RealObject.buildFillStyleTexture(this.component)\n\n if (texture) {\n texture.needsUpdate = true\n material.map = texture\n } else if (typeof fillStyle == 'string') {\n if (fillStyle !== 'transparent') {\n material.color.set(fillStyle)\n } else {\n material.opacity = 0\n }\n }\n }\n\n updateDimension(): void {\n var { width, height } = this.component.bounds\n var { depth = 1 } = this.component.state\n\n if (!this.object3d) {\n return\n }\n\n this.object3d.geometry.computeBoundingBox()\n\n let bbox = this.object3d.geometry.boundingBox\n\n if (bbox) {\n let originalWidth = bbox.max.x - bbox.min.x\n let originalDepth = bbox.max.y - bbox.min.y\n let originalHeight = bbox.max.z - bbox.min.z\n\n this.object3d.scale.set(width / originalWidth, depth / originalDepth, height / originalHeight)\n }\n }\n\n protected abstract buildGeometry(): void\n\n buildMaterial(): void {\n this.object3d.material = new THREE.MeshStandardMaterial({\n transparent: true,\n side: THREE.DoubleSide\n })\n }\n\n clear() {\n this.object3d.traverse((mesh: any) => {\n if (mesh.isMesh) {\n mesh.geometry.dispose()\n ;(mesh.material.length ? mesh.material : [mesh.material]).forEach((m: any) => m.dispose && m.dispose())\n }\n })\n\n return super.clear()\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/*
|
|
5
|
-
Inspired by http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/
|
|
6
|
-
*/
|
|
7
|
-
import * as THREE from 'three';
|
|
8
|
-
import { RealObjectMesh } from './real-object-mesh.js';
|
|
9
|
-
export class RealObjectPlane extends RealObjectMesh {
|
|
10
|
-
buildGeometry() {
|
|
11
|
-
var { width, height } = this.component.state.dimension;
|
|
12
|
-
this.object3d.geometry = new THREE.PlaneGeometry(width, height);
|
|
13
|
-
}
|
|
14
|
-
buildMaterial() {
|
|
15
|
-
this.object3d.material = new THREE.MeshStandardMaterial({
|
|
16
|
-
opacity: 0,
|
|
17
|
-
side: THREE.DoubleSide,
|
|
18
|
-
blending: THREE.NoBlending
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=real-object-plane.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-plane.js","sourceRoot":"","sources":["../../src/threed/real-object-plane.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;EAEE;AAEF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,aAAa;QACX,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAA;QAEtD,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACjE,CAAC;IAED,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,oBAAoB,CAAC;YACtD,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,KAAK,CAAC,UAAU;YACtB,QAAQ,EAAE,KAAK,CAAC,UAAU;SAC3B,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\n/* \n Inspired by http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/\n*/\n\nimport * as THREE from 'three'\n\nimport { RealObjectMesh } from './real-object-mesh.js'\n\nexport class RealObjectPlane extends RealObjectMesh {\n buildGeometry() {\n var { width, height } = this.component.state.dimension\n\n this.object3d.geometry = new THREE.PlaneGeometry(width, height)\n }\n\n buildMaterial() /* : THREE.MeshMaterialType | THREE.MeshMaterialType[] */ {\n this.object3d.material = new THREE.MeshStandardMaterial({\n opacity: 0,\n side: THREE.DoubleSide,\n blending: THREE.NoBlending\n })\n }\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { RealObject } from './real-object.js';
|
|
3
|
-
export declare class RealObjectScene extends RealObject<THREE.Scene> {
|
|
4
|
-
private _floor?;
|
|
5
|
-
private _animationMixer?;
|
|
6
|
-
protected getObject3dInstance(): THREE.Scene;
|
|
7
|
-
dispose(): void;
|
|
8
|
-
clear(): THREE.Scene;
|
|
9
|
-
get floor(): THREE.Mesh;
|
|
10
|
-
set floor(floor: THREE.Mesh | undefined);
|
|
11
|
-
build(): void;
|
|
12
|
-
updateTransform(): void;
|
|
13
|
-
updateTransformReverse(): void;
|
|
14
|
-
updateDimension(): void;
|
|
15
|
-
updatePosition(): void;
|
|
16
|
-
updateRotate(): void;
|
|
17
|
-
updateScale(): void;
|
|
18
|
-
updateAlpha(): void;
|
|
19
|
-
updateHidden(): void;
|
|
20
|
-
get animationMixer(): THREE.AnimationMixer;
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { RealObject } from './real-object.js';
|
|
6
|
-
import { createFloor } from './floor/floor.js';
|
|
7
|
-
export class RealObjectScene extends RealObject {
|
|
8
|
-
getObject3dInstance() {
|
|
9
|
-
return new THREE.Scene();
|
|
10
|
-
}
|
|
11
|
-
dispose() {
|
|
12
|
-
this.object3d.children.forEach(child => {
|
|
13
|
-
;
|
|
14
|
-
child['dispose'] && child['dispose']();
|
|
15
|
-
this.object3d.remove(child);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
clear() {
|
|
19
|
-
if (this._floor) {
|
|
20
|
-
this.object3d.remove(this._floor);
|
|
21
|
-
if (this._floor.material instanceof Array) {
|
|
22
|
-
;
|
|
23
|
-
this._floor.material.forEach(material => material.dispose());
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this._floor.material.dispose();
|
|
27
|
-
}
|
|
28
|
-
this._floor.geometry.dispose();
|
|
29
|
-
delete this._floor;
|
|
30
|
-
}
|
|
31
|
-
return super.clear();
|
|
32
|
-
}
|
|
33
|
-
get floor() {
|
|
34
|
-
return this._floor;
|
|
35
|
-
}
|
|
36
|
-
set floor(floor) {
|
|
37
|
-
if (this._floor) {
|
|
38
|
-
this.object3d.remove(this._floor);
|
|
39
|
-
this._floor.clear();
|
|
40
|
-
delete this._floor;
|
|
41
|
-
}
|
|
42
|
-
if (floor) {
|
|
43
|
-
this._floor = floor;
|
|
44
|
-
this.object3d.add(floor);
|
|
45
|
-
}
|
|
46
|
-
this.component.invalidate();
|
|
47
|
-
}
|
|
48
|
-
build() {
|
|
49
|
-
super.build();
|
|
50
|
-
this.floor = createFloor(this.component);
|
|
51
|
-
}
|
|
52
|
-
updateTransform() { }
|
|
53
|
-
updateTransformReverse() { }
|
|
54
|
-
updateDimension() { }
|
|
55
|
-
updatePosition() { }
|
|
56
|
-
updateRotate() { }
|
|
57
|
-
updateScale() { }
|
|
58
|
-
updateAlpha() { }
|
|
59
|
-
updateHidden() { }
|
|
60
|
-
get animationMixer() {
|
|
61
|
-
if (!this._animationMixer) {
|
|
62
|
-
this._animationMixer = new THREE.AnimationMixer(this.object3d);
|
|
63
|
-
}
|
|
64
|
-
return this._animationMixer;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=real-object-scene.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-scene.js","sourceRoot":"","sources":["../../src/threed/real-object-scene.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,OAAO,eAAgB,SAAQ,UAAuB;IAIhD,mBAAmB;QAC3B,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACrC,CAAC;YAAC,KAAa,CAAC,SAAS,CAAC,IAAK,KAAa,CAAC,SAAS,CAAC,EAAE,CAAA;YAEzD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK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AAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1C,CAAC;IAED,eAAe,KAAI,CAAC;IACpB,sBAAsB,KAAI,CAAC;IAC3B,eAAe,KAAI,CAAC;IACpB,cAAc,KAAI,CAAC;IACnB,YAAY,KAAI,CAAC;IACjB,WAAW,KAAI,CAAC;IAChB,WAAW,KAAI,CAAC;IAChB,YAAY,KAAI,CAAC;IAEjB,IAAI,cAAc;QAChB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAChE,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\n\nimport { RealObject } from './real-object.js'\nimport { createFloor } from './floor/floor.js'\n\nexport class RealObjectScene extends RealObject<THREE.Scene> {\n private _floor?: THREE.Mesh\n private _animationMixer?: THREE.AnimationMixer\n\n protected getObject3dInstance() {\n return new THREE.Scene()\n }\n\n dispose() {\n this.object3d.children.forEach(child => {\n ;(child as any)['dispose'] && (child as any)['dispose']()\n\n this.object3d.remove(child)\n })\n }\n\n clear() {\n if (this._floor) {\n this.object3d.remove(this._floor)\n\n if (this._floor.material instanceof Array) {\n ;(this._floor.material as THREE.Material[]).forEach(material => material.dispose())\n } else {\n this._floor.material.dispose()\n }\n this._floor.geometry.dispose()\n\n delete this._floor\n }\n\n return super.clear()\n }\n\n get floor(): THREE.Mesh {\n return this._floor!\n }\n\n set floor(floor: THREE.Mesh | undefined) {\n if (this._floor) {\n this.object3d.remove(this._floor)\n this._floor.clear()\n delete this._floor\n }\n\n if (floor) {\n this._floor = floor\n this.object3d.add(floor)\n }\n\n this.component.invalidate()\n }\n\n build() {\n super.build()\n\n this.floor = createFloor(this.component)\n }\n\n updateTransform() {}\n updateTransformReverse() {}\n updateDimension() {}\n updatePosition() {}\n updateRotate() {}\n updateScale() {}\n updateAlpha() {}\n updateHidden() {}\n\n get animationMixer(): THREE.AnimationMixer {\n if (!this._animationMixer) {\n this._animationMixer = new THREE.AnimationMixer(this.object3d)\n }\n\n return this._animationMixer\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { RealObjectSprite } from './real-object-sprite.js';
|
|
2
|
-
export declare class RealObjectSprite2D extends RealObjectSprite {
|
|
3
|
-
buildMaterial(): void;
|
|
4
|
-
get scale(): {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
z: any;
|
|
8
|
-
};
|
|
9
|
-
update(): void;
|
|
10
|
-
updateFillStyle(): void;
|
|
11
|
-
updateStrokeStyle(): void;
|
|
12
|
-
updateAlpha(): void;
|
|
13
|
-
updateText(): void;
|
|
14
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { RealObjectSprite } from './real-object-sprite.js';
|
|
6
|
-
import { createCanvasTexture } from './texture/canvas-texture.js';
|
|
7
|
-
export class RealObjectSprite2D extends RealObjectSprite {
|
|
8
|
-
buildMaterial() {
|
|
9
|
-
var material = this.object3d.material;
|
|
10
|
-
if (material) {
|
|
11
|
-
material.dispose();
|
|
12
|
-
}
|
|
13
|
-
this.object3d.material = new THREE.SpriteMaterial({
|
|
14
|
-
map: createCanvasTexture(this.component),
|
|
15
|
-
alphaTest: 0.01,
|
|
16
|
-
sizeAttenuation: false
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
get scale() {
|
|
20
|
-
const { width, height } = this.component.bounds;
|
|
21
|
-
const { width: parentWidth, height: parentHeight } = this.threeContainer.bounds;
|
|
22
|
-
const { scale = 1 } = this.component.state;
|
|
23
|
-
return {
|
|
24
|
-
x: (scale * width) / parentWidth,
|
|
25
|
-
y: (scale * height) / parentHeight,
|
|
26
|
-
z: scale
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
update() {
|
|
30
|
-
this.build();
|
|
31
|
-
}
|
|
32
|
-
updateFillStyle() {
|
|
33
|
-
this.update();
|
|
34
|
-
}
|
|
35
|
-
updateStrokeStyle() {
|
|
36
|
-
this.update();
|
|
37
|
-
}
|
|
38
|
-
updateAlpha() {
|
|
39
|
-
this.update();
|
|
40
|
-
}
|
|
41
|
-
updateText() {
|
|
42
|
-
this.update();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=real-object-sprite-2d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-sprite-2d.js","sourceRoot":"","sources":["../../src/threed/real-object-sprite-2d.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,MAAM,OAAO,kBAAmB,SAAQ,gBAAgB;IACtD,aAAa;QACX,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAgC,CAAA;QAC7D,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,EAAE,CAAA;QACpB,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC;YAChD,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC;YACxC,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,KAAK;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,KAAK;QACP,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;QAC/C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,cAAe,CAAC,MAAM,CAAA;QAChF,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAE1C,OAAO;YACL,CAAC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,WAAW;YAChC,CAAC,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,YAAY;YAClC,CAAC,EAAE,KAAK;SACT,CAAA;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,eAAe;QACb,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED,WAAW;QACT,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED,UAAU;QACR,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\nimport { RealObjectSprite } from './real-object-sprite.js'\nimport { createCanvasTexture } from './texture/canvas-texture.js'\n\nexport class RealObjectSprite2D extends RealObjectSprite {\n buildMaterial() {\n var material = this.object3d.material as THREE.SpriteMaterial\n if (material) {\n material.dispose()\n }\n\n this.object3d.material = new THREE.SpriteMaterial({\n map: createCanvasTexture(this.component),\n alphaTest: 0.01,\n sizeAttenuation: false\n })\n }\n\n get scale() {\n const { width, height } = this.component.bounds\n const { width: parentWidth, height: parentHeight } = this.threeContainer!.bounds\n const { scale = 1 } = this.component.state\n\n return {\n x: (scale * width) / parentWidth,\n y: (scale * height) / parentHeight,\n z: scale\n }\n }\n\n update() {\n this.build()\n }\n\n updateFillStyle() {\n this.update()\n }\n\n updateStrokeStyle() {\n this.update()\n }\n\n updateAlpha() {\n this.update()\n }\n\n updateText() {\n this.update()\n }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { RealObject } from './real-object.js';
|
|
3
|
-
export declare abstract class RealObjectSprite extends RealObject<THREE.Sprite> {
|
|
4
|
-
protected getObject3dInstance(): THREE.Sprite;
|
|
5
|
-
build(): void;
|
|
6
|
-
abstract buildMaterial(): void;
|
|
7
|
-
get cz(): any;
|
|
8
|
-
updateAlpha(): void;
|
|
9
|
-
updateHidden(): void;
|
|
10
|
-
updateFillStyle(): void;
|
|
11
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { applyAlpha } from './common.js';
|
|
6
|
-
import { RealObject } from './real-object.js';
|
|
7
|
-
export class RealObjectSprite extends RealObject {
|
|
8
|
-
getObject3dInstance() {
|
|
9
|
-
return new THREE.Sprite();
|
|
10
|
-
}
|
|
11
|
-
build() {
|
|
12
|
-
super.build();
|
|
13
|
-
this.buildMaterial();
|
|
14
|
-
}
|
|
15
|
-
/* overide */
|
|
16
|
-
get cz() {
|
|
17
|
-
var { zPos = 0 } = this.component.state;
|
|
18
|
-
var { height } = this.component.bounds;
|
|
19
|
-
var { tz = 0 } = this.component.delta();
|
|
20
|
-
return zPos + tz + height / 2;
|
|
21
|
-
}
|
|
22
|
-
updateAlpha() {
|
|
23
|
-
var { alpha = 1, fillStyle } = this.component.state;
|
|
24
|
-
applyAlpha(this.object3d.material, alpha, fillStyle);
|
|
25
|
-
}
|
|
26
|
-
updateHidden() {
|
|
27
|
-
this.object3d.visible = !this.component.state.hidden;
|
|
28
|
-
}
|
|
29
|
-
updateFillStyle() {
|
|
30
|
-
var { fillStyle } = this.component.state;
|
|
31
|
-
var material = this.object3d.material;
|
|
32
|
-
if (!material) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const texture = RealObject.buildFillStyleTexture(this.component);
|
|
36
|
-
if (texture) {
|
|
37
|
-
texture.needsUpdate = true;
|
|
38
|
-
material.map = texture;
|
|
39
|
-
}
|
|
40
|
-
else if (typeof fillStyle == 'string') {
|
|
41
|
-
if (fillStyle !== 'transparent') {
|
|
42
|
-
material.color.set(fillStyle);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
material.opacity = 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=real-object-sprite.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-object-sprite.js","sourceRoot":"","sources":["../../src/threed/real-object-sprite.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,OAAgB,gBAAiB,SAAQ,UAAwB;IAC3D,mBAAmB;QAC3B,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,CAAA;IAC3B,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QAEb,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAID,aAAa;IAEb,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QACvC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAA;QACtC,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAW,CAAA;QAEhD,OAAO,IAAI,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,WAAW;QACT,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAEnD,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACtD,CAAC;IAED,YAAY;QACV,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAA;IACtD,CAAC;IAED,eAAe;QACb,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QACxC,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAgC,CAAA;QAC7D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAM;QACR,CAAC;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEhE,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,WAAW,GAAG,IAAI,CAAA;YAC1B,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAA;QACxB,CAAC;aAAM,IAAI,OAAO,SAAS,IAAI,QAAQ,EAAE,CAAC;YACxC,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;gBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAC/B,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\nimport { applyAlpha } from './common.js'\nimport { DELTA } from '@hatiolab/things-scene'\n\nimport { RealObject } from './real-object.js'\n\nexport abstract class RealObjectSprite extends RealObject<THREE.Sprite> {\n protected getObject3dInstance() {\n return new THREE.Sprite()\n }\n\n build() {\n super.build()\n\n this.buildMaterial()\n }\n\n abstract buildMaterial(): void\n\n /* overide */\n\n get cz() {\n var { zPos = 0 } = this.component.state\n var { height } = this.component.bounds\n var { tz = 0 } = this.component.delta() as DELTA\n\n return zPos + tz + height / 2\n }\n\n updateAlpha() {\n var { alpha = 1, fillStyle } = this.component.state\n\n applyAlpha(this.object3d.material, alpha, fillStyle)\n }\n\n updateHidden() {\n this.object3d.visible = !this.component.state.hidden\n }\n\n updateFillStyle() {\n var { fillStyle } = this.component.state\n var material = this.object3d.material as THREE.SpriteMaterial\n if (!material) {\n return\n }\n\n const texture = RealObject.buildFillStyleTexture(this.component)\n\n if (texture) {\n texture.needsUpdate = true\n material.map = texture\n } else if (typeof fillStyle == 'string') {\n if (fillStyle !== 'transparent') {\n material.color.set(fillStyle)\n } else {\n material.opacity = 0\n }\n }\n }\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RealObjectMesh } from './real-object-mesh.js';
|
|
2
|
-
/**
|
|
3
|
-
* RealObjectText
|
|
4
|
-
*/
|
|
5
|
-
export declare class RealObjectText extends RealObjectMesh {
|
|
6
|
-
buildGeometry(): void;
|
|
7
|
-
get rotation(): {
|
|
8
|
-
x: number;
|
|
9
|
-
y: any;
|
|
10
|
-
z: number;
|
|
11
|
-
};
|
|
12
|
-
updateDimension(): void;
|
|
13
|
-
updateText(): void;
|
|
14
|
-
updateAlpha(): void;
|
|
15
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { applyAlpha } from './common.js';
|
|
6
|
-
import { RealObjectMesh } from './real-object-mesh.js';
|
|
7
|
-
import { textTexture } from './texture/text-texture.js';
|
|
8
|
-
/**
|
|
9
|
-
* RealObjectText
|
|
10
|
-
*/
|
|
11
|
-
export class RealObjectText extends RealObjectMesh {
|
|
12
|
-
buildGeometry() { }
|
|
13
|
-
/* overide */
|
|
14
|
-
get rotation() {
|
|
15
|
-
const { rotationX = 0, rotationY = 0, rotation = 0 } = this.component.state;
|
|
16
|
-
return {
|
|
17
|
-
x: rotationX - Math.PI / 2,
|
|
18
|
-
y: rotationY,
|
|
19
|
-
z: -rotation
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
updateDimension() {
|
|
23
|
-
var { width, height } = this.component.state;
|
|
24
|
-
if (this.object3d.geometry) {
|
|
25
|
-
this.object3d.geometry.dispose();
|
|
26
|
-
}
|
|
27
|
-
/* scaling으로 해결되지 않기때문에, 새로 geometry를 만드는 방법을 사용한다 */
|
|
28
|
-
this.object3d.geometry = new THREE.PlaneGeometry(width, height);
|
|
29
|
-
}
|
|
30
|
-
updateText() {
|
|
31
|
-
var material = this.object3d.material;
|
|
32
|
-
if (!material) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
var { width, height, bold = false, italic = false, fontFamily = 'Serif', fontSize = 10, fontColor = 'black', fillStyle } = this.component.state;
|
|
36
|
-
var text = this.component.text;
|
|
37
|
-
const texture = textTexture(text, width, height, {
|
|
38
|
-
bold,
|
|
39
|
-
italic,
|
|
40
|
-
fontFamily,
|
|
41
|
-
fontSize,
|
|
42
|
-
fontColor
|
|
43
|
-
});
|
|
44
|
-
if (texture) {
|
|
45
|
-
material.map = texture;
|
|
46
|
-
texture.needsUpdate = true;
|
|
47
|
-
}
|
|
48
|
-
else if (typeof fillStyle == 'string') {
|
|
49
|
-
if (fillStyle !== 'transparent') {
|
|
50
|
-
material.color.set(fillStyle);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
material.opacity = 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
updateAlpha() {
|
|
58
|
-
// material의 transparency는 항상 true으로 유지되어야 한다.
|
|
59
|
-
var { alpha = 1, fontColor } = this.component.state;
|
|
60
|
-
applyAlpha(this.object3d.material, alpha, fontColor);
|
|
61
|
-
this.object3d.material.transparent = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//# sourceMapping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,MAAM,EACN,IAAI,GAAG,KAAK,EACZ,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,OAAO,EACnB,SAAS,EACV,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAExB,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAA;QAE9B,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;YAC/C,IAAI;YACJ,MAAM;YACN,UAAU;YACV,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,IAAI,OAAO,EAAE,CAAC;YACZ,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAA;YACtB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAA;QAC5B,CAAC;aAAM,IAAI,OAAO,SAAS,IAAI,QAAQ,EAAE,CAAC;YACxC,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;gBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAC/B,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,WAAW;QACT,8CAA8C;QAC9C,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAEnD,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CACnD;QAAC,IAAI,CAAC,QAAQ,CAAC,QAAgB,CAAC,WAAW,GAAG,IAAI,CAAA;IACrD,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as THREE from 'three'\nimport { applyAlpha } from './common.js'\n\nimport { RealObjectMesh } from './real-object-mesh.js'\nimport { textTexture } from './texture/text-texture.js'\n\n/**\n * RealObjectText\n */\nexport class RealObjectText extends RealObjectMesh {\n buildGeometry() {}\n\n /* overide */\n\n get rotation() {\n const { rotationX = 0, rotationY = 0, rotation = 0 } = this.component.state\n\n return {\n x: rotationX - Math.PI / 2,\n y: rotationY,\n z: -rotation\n }\n }\n\n updateDimension() {\n var { width, height } = this.component.state\n\n if (this.object3d.geometry) {\n this.object3d.geometry.dispose()\n }\n\n /* scaling으로 해결되지 않기때문에, 새로 geometry를 만드는 방법을 사용한다 */\n this.object3d.geometry = new THREE.PlaneGeometry(width, height)\n }\n\n updateText() {\n var material = this.object3d.material as THREE.MeshStandardMaterial\n if (!material) {\n return\n }\n\n var {\n width,\n height,\n bold = false,\n italic = false,\n fontFamily = 'Serif',\n fontSize = 10,\n fontColor = 'black',\n fillStyle\n } = this.component.state\n\n var text = this.component.text\n\n const texture = textTexture(text, width, height, {\n bold,\n italic,\n fontFamily,\n fontSize,\n fontColor\n })\n\n if (texture) {\n material.map = texture\n texture.needsUpdate = true\n } else if (typeof fillStyle == 'string') {\n if (fillStyle !== 'transparent') {\n material.color.set(fillStyle)\n } else {\n material.opacity = 0\n }\n }\n }\n\n updateAlpha() {\n // material의 transparency는 항상 true으로 유지되어야 한다.\n var { alpha = 1, fontColor } = this.component.state\n\n applyAlpha(this.object3d.material, alpha, fontColor)\n ;(this.object3d.material as any).transparent = true\n }\n}\n"]}
|