@operato/scene-visualizer 9.2.2 → 10.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/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 +1 -0
- package/dist/editors/index.js +5 -0
- package/dist/editors/index.js.map +1 -1
- package/dist/editors/property-editor-gltf-fill-targets.d.ts +17 -0
- package/dist/editors/property-editor-gltf-fill-targets.js +211 -0
- package/dist/editors/property-editor-gltf-fill-targets.js.map +1 -0
- package/dist/editors/property-editor-gltf-info.js +38 -29
- package/dist/editors/property-editor-gltf-info.js.map +1 -1
- package/dist/editors/property-editor-location-increase-pattern.js +91 -95
- package/dist/editors/property-editor-location-increase-pattern.js.map +1 -1
- package/dist/effects/outline.js +1 -1
- package/dist/effects/outline.js.map +1 -1
- package/dist/index.d.ts +5 -17
- package/dist/index.js +7 -17
- package/dist/index.js.map +1 -1
- package/dist/rack-table-3d.d.ts +16 -0
- package/dist/rack-table-3d.js +94 -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 +108 -380
- package/dist/rack-table.js.map +1 -1
- package/dist/rack.d.ts +3 -5
- package/dist/rack.js +7 -9
- 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.d.ts +22 -10
- package/dist/stock.js +87 -81
- package/dist/stock.js.map +1 -1
- 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 +1 -0
- package/dist/templates/index.js +9 -1
- package/dist/templates/index.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/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/vehicle.d.ts +248 -0
- package/dist/vehicle.js +133 -0
- package/dist/vehicle.js.map +1 -0
- package/dist/visualizer.d.ts +4 -5
- package/dist/visualizer.js +15 -28
- package/dist/visualizer.js.map +1 -1
- package/icons/carrier.png +0 -0
- package/icons/signal-tower.png +0 -0
- package/icons/tank.png +0 -0
- package/icons/vehicle.png +0 -0
- package/package.json +16 -18
- 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
package/dist/light.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
import { Ellipse, sceneComponent } from '@hatiolab/things-scene';
|
|
6
|
-
import * as THREE from 'three';
|
|
7
|
-
import { RealObject } from './threed/real-object.js';
|
|
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
|
-
export class LightObject extends RealObject {
|
|
74
|
-
updatePointLight() {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
var { lightType = 'point', distance = 0, // unlimited
|
|
77
|
-
intensity = 10, decay = 1, fillStyle: color = 'white', castShadow, near = 0.5, far = 1000, fov = 90, zoom = 1, showHelper } = this.component.state;
|
|
78
|
-
this.object3d.color = new THREE.Color(color);
|
|
79
|
-
if (lightType == 'point') {
|
|
80
|
-
;
|
|
81
|
-
this.object3d.distance = distance;
|
|
82
|
-
this.object3d.decay = decay;
|
|
83
|
-
}
|
|
84
|
-
this.object3d.intensity = intensity;
|
|
85
|
-
this.object3d.castShadow = castShadow;
|
|
86
|
-
if (castShadow) {
|
|
87
|
-
const camera = (_a = this.object3d.shadow) === null || _a === void 0 ? void 0 : _a.camera;
|
|
88
|
-
camera.far = far;
|
|
89
|
-
camera.near = near;
|
|
90
|
-
camera.fov = fov;
|
|
91
|
-
camera.zoom = zoom;
|
|
92
|
-
}
|
|
93
|
-
if (showHelper) {
|
|
94
|
-
const camera = (_b = this.object3d.shadow) === null || _b === void 0 ? void 0 : _b.camera;
|
|
95
|
-
if (!this.helper) {
|
|
96
|
-
this.helper = new THREE.CameraHelper(camera);
|
|
97
|
-
this.object3d.add(this.helper);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (this.helper) {
|
|
101
|
-
this.object3d.remove(this.helper);
|
|
102
|
-
delete this.helper;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
getObject3dInstance() {
|
|
106
|
-
var { lightType = 'point' } = this.component.state;
|
|
107
|
-
return lightType == 'point' ? new THREE.PointLight() : new THREE.DirectionalLight();
|
|
108
|
-
}
|
|
109
|
-
update() {
|
|
110
|
-
this.clear();
|
|
111
|
-
this.build();
|
|
112
|
-
this.updateDimension();
|
|
113
|
-
this.updateHidden();
|
|
114
|
-
this.updatePointLight();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
let PointLight = class PointLight extends Ellipse {
|
|
118
|
-
is3dish() {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
buildRealObject() {
|
|
122
|
-
return new LightObject(this);
|
|
123
|
-
}
|
|
124
|
-
get anchors() {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
get nature() {
|
|
128
|
-
return NATURE;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
PointLight = __decorate([
|
|
132
|
-
sceneComponent('light')
|
|
133
|
-
], PointLight);
|
|
134
|
-
export { PointLight };
|
|
135
|
-
//# sourceMappingURL=light.js.map
|
package/dist/light.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"light.js","sourceRoot":"","s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ourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Anchor, Component, ComponentNature, Ellipse, sceneComponent } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObject } from './threed/real-object.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'light-type',\n name: 'lightType',\n property: {\n options: ['', 'point', 'directional']\n }\n },\n {\n type: 'number',\n label: 'intensity',\n name: 'intensity'\n },\n {\n type: 'number',\n label: 'distance',\n name: 'distance'\n },\n {\n type: 'number',\n label: 'decay',\n name: 'decay'\n },\n {\n type: 'checkbox',\n label: 'cast-shadow',\n name: 'castShadow'\n },\n {\n type: 'number',\n label: 'near',\n name: 'near',\n placeholder: '0.5'\n },\n {\n type: 'number',\n label: 'far',\n name: 'far',\n placeholder: '1000'\n },\n {\n type: 'number',\n label: 'fov',\n name: 'fov',\n placeholder: '90'\n },\n {\n type: 'number',\n label: 'zoom',\n name: 'zoom',\n placeholder: '1'\n },\n {\n type: 'checkbox',\n label: 'show-helper',\n name: 'showHelper'\n }\n ],\n help: 'scene/component/light'\n}\n\nexport class LightObject extends RealObject<THREE.Light> {\n helper?: THREE.CameraHelper\n\n updatePointLight() {\n var {\n lightType = 'point',\n distance = 0, // unlimited\n intensity = 10,\n decay = 1,\n fillStyle: color = 'white',\n castShadow,\n near = 0.5,\n far = 1000,\n fov = 90,\n zoom = 1,\n showHelper\n } = this.component.state\n\n this.object3d!.color = new THREE.Color(color)\n if (lightType == 'point') {\n ;(this.object3d as THREE.PointLight)!.distance = distance\n ;(this.object3d as THREE.PointLight)!.decay = decay\n }\n this.object3d!.intensity = intensity\n this.object3d!.castShadow = castShadow\n if (castShadow) {\n const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera\n camera.far = far\n camera.near = near\n camera.fov = fov\n camera.zoom = zoom\n }\n\n if (showHelper) {\n const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera\n\n if (!this.helper) {\n this.helper = new THREE.CameraHelper(camera!)\n this.object3d.add(this.helper)\n }\n } else if (this.helper) {\n this.object3d.remove(this.helper)\n delete this.helper\n }\n }\n\n protected getObject3dInstance(): THREE.Light {\n var { lightType = 'point' } = this.component.state\n\n return lightType == 'point' ? new THREE.PointLight() : new THREE.DirectionalLight()\n }\n\n update() {\n this.clear()\n this.build()\n\n this.updateDimension()\n this.updateHidden()\n\n this.updatePointLight()\n }\n}\n\n@sceneComponent('light')\nexport class PointLight extends Ellipse {\n is3dish() {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new LightObject(this)\n }\n\n get anchors(): Array<Anchor> {\n return []\n }\n\n get nature(): ComponentNature {\n return NATURE\n }\n}\n"]}
|
package/dist/polygon.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { RealObjectExtrude } from './threed/real-object-extrude.js';
|
|
3
|
-
export declare class PolygonExtrude extends RealObjectExtrude {
|
|
4
|
-
_minMax?: {
|
|
5
|
-
minX?: number;
|
|
6
|
-
minY?: number;
|
|
7
|
-
maxX?: number;
|
|
8
|
-
maxY?: number;
|
|
9
|
-
};
|
|
10
|
-
get shape(): THREE.Shape;
|
|
11
|
-
get minMax(): {
|
|
12
|
-
minX?: number;
|
|
13
|
-
minY?: number;
|
|
14
|
-
maxX?: number;
|
|
15
|
-
maxY?: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
package/dist/polygon.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Polygon } from '@hatiolab/things-scene';
|
|
5
|
-
import * as THREE from 'three';
|
|
6
|
-
import { RealObjectExtrude } from './threed/real-object-extrude.js';
|
|
7
|
-
export class PolygonExtrude extends RealObjectExtrude {
|
|
8
|
-
get shape() {
|
|
9
|
-
var { path = [], round = 0 } = this.component.state;
|
|
10
|
-
var shape = new THREE.Shape();
|
|
11
|
-
for (var i = 0; i < path.length; i++) {
|
|
12
|
-
const prev = path[(i - 1 + path.length) % path.length];
|
|
13
|
-
const cursor = path[(i + path.length) % path.length];
|
|
14
|
-
const next = path[(i + 1) % path.length];
|
|
15
|
-
if (prev.x === cursor.x && prev.y === cursor.y) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
var length = Math.sqrt((prev.x - cursor.x) * (prev.x - cursor.x) + (prev.y - cursor.y) * (prev.y - cursor.y));
|
|
19
|
-
var theta = length !== 0 ? Math.atan2(prev.x - cursor.x, prev.y - cursor.y) : 0;
|
|
20
|
-
var x = Math.sin(theta) * Math.min(round, length / 2) + cursor.x;
|
|
21
|
-
var y = Math.cos(theta) * Math.min(round, length / 2) + cursor.y;
|
|
22
|
-
const p1 = round > 0 || length !== 0 ? { x, y } : cursor;
|
|
23
|
-
var length = Math.sqrt((next.x - cursor.x) * (next.x - cursor.x) + (next.y - cursor.y) * (next.y - cursor.y));
|
|
24
|
-
theta = length !== 0 ? Math.atan2(next.x - cursor.x, next.y - cursor.y) : 0;
|
|
25
|
-
x = Math.sin(theta) * Math.min(round, length / 2) + cursor.x;
|
|
26
|
-
y = Math.cos(theta) * Math.min(round, length / 2) + cursor.y;
|
|
27
|
-
const p2 = round > 0 || length !== 0 ? { x, y } : cursor;
|
|
28
|
-
i == 0 ? shape.moveTo(p1.x, p1.y) : shape.lineTo(p1.x, p1.y);
|
|
29
|
-
round > 0 && shape.quadraticCurveTo(cursor.x, cursor.y, p2.x, p2.y);
|
|
30
|
-
}
|
|
31
|
-
return shape;
|
|
32
|
-
}
|
|
33
|
-
get minMax() {
|
|
34
|
-
if (!this._minMax) {
|
|
35
|
-
var { path } = this.component.state;
|
|
36
|
-
var minX;
|
|
37
|
-
var minY;
|
|
38
|
-
var maxX;
|
|
39
|
-
var maxY;
|
|
40
|
-
path.forEach((p, i) => {
|
|
41
|
-
if (i == 0) {
|
|
42
|
-
minX = maxX = p.x;
|
|
43
|
-
minY = maxY = p.y;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
minX = Math.min(minX, p.x);
|
|
47
|
-
maxX = Math.max(maxX, p.x);
|
|
48
|
-
minY = Math.min(minY, p.y);
|
|
49
|
-
maxY = Math.max(maxY, p.y);
|
|
50
|
-
});
|
|
51
|
-
this._minMax = {
|
|
52
|
-
minX,
|
|
53
|
-
minY,
|
|
54
|
-
maxX,
|
|
55
|
-
maxY
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return this._minMax;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
Polygon.prototype.buildRealObject = function () {
|
|
62
|
-
return new PolygonExtrude(this);
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=polygon.js.map
|
package/dist/polygon.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../src/polygon.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAS,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAQnD,IAAI,KAAK;QACP,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAEnD,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;YAC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F;AAED,OAAO,CAAC,SAAS,CAAC,eAAe,GAAG;IAClC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { POINT, Polygon } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObjectExtrude } from './threed/real-object-extrude.js'\n\nexport class PolygonExtrude extends RealObjectExtrude {\n _minMax?: {\n minX?: number\n minY?: number\n maxX?: number\n maxY?: number\n }\n\n get shape() {\n var { path = [], round = 0 } = this.component.state\n\n var shape = new THREE.Shape()\n\n for (var i = 0; i < path.length; i++) {\n const prev = path[(i - 1 + path.length) % path.length]\n const cursor = path[(i + path.length) % path.length]\n const next = path[(i + 1) % path.length]\n\n if (prev.x === cursor.x && prev.y === cursor.y) {\n continue\n }\n\n var length = Math.sqrt((prev.x - cursor.x) * (prev.x - cursor.x) + (prev.y - cursor.y) * (prev.y - cursor.y))\n var theta = length !== 0 ? Math.atan2(prev.x - cursor.x, prev.y - cursor.y) : 0\n var x = Math.sin(theta) * Math.min(round, length / 2) + cursor.x\n var y = Math.cos(theta) * Math.min(round, length / 2) + cursor.y\n\n const p1 = round > 0 || length !== 0 ? { x, y } : cursor\n\n var length = Math.sqrt((next.x - cursor.x) * (next.x - cursor.x) + (next.y - cursor.y) * (next.y - cursor.y))\n theta = length !== 0 ? Math.atan2(next.x - cursor.x, next.y - cursor.y) : 0\n x = Math.sin(theta) * Math.min(round, length / 2) + cursor.x\n y = Math.cos(theta) * Math.min(round, length / 2) + cursor.y\n\n const p2 = round > 0 || length !== 0 ? { x, y } : cursor\n\n i == 0 ? shape.moveTo(p1.x, p1.y) : shape.lineTo(p1.x, p1.y)\n round > 0 && shape.quadraticCurveTo(cursor.x, cursor.y, p2.x, p2.y)\n }\n\n return shape\n }\n\n get minMax() {\n if (!this._minMax) {\n var { path } = this.component.state\n\n var minX: number | undefined\n var minY: number | undefined\n var maxX: number | undefined\n var maxY: number | undefined\n\n path.forEach((p: POINT, i: number) => {\n if (i == 0) {\n minX = maxX = p.x\n minY = maxY = p.y\n return\n }\n\n minX = Math.min(minX!, p.x)\n maxX = Math.max(maxX!, p.x)\n minY = Math.min(minY!, p.y)\n maxY = Math.max(maxY!, p.y)\n })\n\n this._minMax = {\n minX,\n minY,\n maxX,\n maxY\n }\n }\n\n return this._minMax\n }\n}\n\nPolygon.prototype.buildRealObject = function () {\n return new PolygonExtrude(this)\n}\n"]}
|
package/dist/rect.d.ts
DELETED
package/dist/rect.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Rect } from '@hatiolab/things-scene';
|
|
5
|
-
import * as THREE from 'three';
|
|
6
|
-
import { RealObjectExtrude } from './threed/real-object-extrude.js';
|
|
7
|
-
export class RectExtrude extends RealObjectExtrude {
|
|
8
|
-
get shape() {
|
|
9
|
-
var { width, height, round } = this.component.state;
|
|
10
|
-
var shape = new THREE.Shape();
|
|
11
|
-
if (round > 0) {
|
|
12
|
-
var radius = (round / 100) * (width / 2);
|
|
13
|
-
shape.moveTo(radius, 0);
|
|
14
|
-
shape.lineTo(width - radius, 0);
|
|
15
|
-
shape.quadraticCurveTo(width, 0, width, radius);
|
|
16
|
-
shape.lineTo(width, height - radius);
|
|
17
|
-
shape.quadraticCurveTo(width, height, width - radius, height);
|
|
18
|
-
shape.lineTo(radius, height);
|
|
19
|
-
shape.quadraticCurveTo(0, height, 0, height - radius);
|
|
20
|
-
shape.lineTo(0, radius);
|
|
21
|
-
shape.quadraticCurveTo(0, 0, radius, 0);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
shape.moveTo(0, 0);
|
|
25
|
-
shape.lineTo(width, 0);
|
|
26
|
-
shape.lineTo(width, height);
|
|
27
|
-
shape.lineTo(0, height);
|
|
28
|
-
shape.lineTo(0, 0);
|
|
29
|
-
}
|
|
30
|
-
return shape;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
Rect.prototype.buildRealObject = function () {
|
|
34
|
-
return new RectExtrude(this);
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=rect.js.map
|
package/dist/rect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../src/rect.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAChD,IAAI,KAAK;QACP,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QACnD,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAE7B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,IAAI,MAAM,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;YAExC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;YACvB,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CAAA;YAC/B,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;YAC/C,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;YACpC,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,CAAC,CAAA;YAC7D,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YAC5B,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;YACrD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;YACvB,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;QACzC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAClB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;YACtB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YAC3B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;YACvB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG;IAC/B,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Rect } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObjectExtrude } from './threed/real-object-extrude.js'\n\nexport class RectExtrude extends RealObjectExtrude {\n get shape() {\n var { width, height, round } = this.component.state\n var shape = new THREE.Shape()\n\n if (round > 0) {\n var radius = (round / 100) * (width / 2)\n\n shape.moveTo(radius, 0)\n shape.lineTo(width - radius, 0)\n shape.quadraticCurveTo(width, 0, width, radius)\n shape.lineTo(width, height - radius)\n shape.quadraticCurveTo(width, height, width - radius, height)\n shape.lineTo(radius, height)\n shape.quadraticCurveTo(0, height, 0, height - radius)\n shape.lineTo(0, radius)\n shape.quadraticCurveTo(0, 0, radius, 0)\n } else {\n shape.moveTo(0, 0)\n shape.lineTo(width, 0)\n shape.lineTo(width, height)\n shape.lineTo(0, height)\n shape.lineTo(0, 0)\n }\n\n return shape\n }\n}\n\nRect.prototype.buildRealObject = function () {\n return new RectExtrude(this)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/scene/component.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Component } from '@hatiolab/things-scene';
|
|
2
|
-
import { RealObjectSprite2D } from '../threed/real-object-sprite-2d.js';
|
|
3
|
-
Component.prototype.buildRealObject = function () {
|
|
4
|
-
return new RealObjectSprite2D(this);
|
|
5
|
-
};
|
|
6
|
-
Component.prototype.is3dish = function () {
|
|
7
|
-
return true;
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(Component.prototype, 'realObject', {
|
|
10
|
-
get: function () {
|
|
11
|
-
if (!this.disposed && !this._realObject) {
|
|
12
|
-
this._realObject = this.buildRealObject();
|
|
13
|
-
if (!this._realObject) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
this._realObject.update();
|
|
17
|
-
this._realObject.updateTransform();
|
|
18
|
-
}
|
|
19
|
-
return this._realObject;
|
|
20
|
-
},
|
|
21
|
-
enumerable: false,
|
|
22
|
-
configurable: false
|
|
23
|
-
});
|
|
24
|
-
var oldDispose = Component.prototype.dispose;
|
|
25
|
-
Component.prototype.dispose = function () {
|
|
26
|
-
oldDispose.call(this);
|
|
27
|
-
this.realObject && this.realObject.dispose();
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/scene/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAEvE,SAAS,CAAC,SAAS,CAAC,eAAe,GAAG;IACpC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA;AAED,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG;IAC5B,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,SAAS,EAAE,YAAY,EAAE;IACvD,GAAG,EAAE;QACH,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;YAEzC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAM;YACR,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;YACzB,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAA;QACpC,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IACD,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,KAAK;CACpB,CAAC,CAAA;AAEF,IAAI,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAA;AAE5C,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG;IAC5B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAErB,IAAI,CAAC,UAAU,IAAK,IAAI,CAAC,UAAkB,CAAC,OAAO,EAAE,CAAA;AACvD,CAAC,CAAA","sourcesContent":["import { Component } from '@hatiolab/things-scene'\nimport { RealObject } from '../threed/real-object.js'\nimport { RealObjectSprite2D } from '../threed/real-object-sprite-2d.js'\n\nComponent.prototype.buildRealObject = function (this: Component): RealObject | undefined {\n return new RealObjectSprite2D(this)\n}\n\nComponent.prototype.is3dish = function (this: Component): boolean {\n return true\n}\n\nObject.defineProperty(Component.prototype, 'realObject', {\n get: function (this: Component): RealObject | undefined {\n if (!this.disposed && !this._realObject) {\n this._realObject = this.buildRealObject()\n\n if (!this._realObject) {\n return\n }\n\n this._realObject.update()\n this._realObject.updateTransform()\n }\n\n return this._realObject\n },\n enumerable: false,\n configurable: false\n})\n\nvar oldDispose = Component.prototype.dispose\n\nComponent.prototype.dispose = function () {\n oldDispose.call(this)\n\n this.realObject && (this.realObject as any).dispose()\n}\n"]}
|
package/dist/sphere.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentNature, Ellipse } from '@hatiolab/things-scene';
|
|
2
|
-
import { RealObject } from './threed/real-object.js';
|
|
3
|
-
import { RealObjectMesh } from './threed/real-object-mesh.js';
|
|
4
|
-
export declare class Sphere3D extends RealObjectMesh {
|
|
5
|
-
buildGeometry(): void;
|
|
6
|
-
}
|
|
7
|
-
export declare class Sphere extends Ellipse {
|
|
8
|
-
is3dish(): boolean;
|
|
9
|
-
buildRealObject(): RealObject | undefined;
|
|
10
|
-
get nature(): ComponentNature;
|
|
11
|
-
}
|
package/dist/sphere.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
import { Ellipse, sceneComponent } from '@hatiolab/things-scene';
|
|
6
|
-
import * as THREE from 'three';
|
|
7
|
-
import { RealObjectMesh } from './threed/real-object-mesh.js';
|
|
8
|
-
const NATURE = {
|
|
9
|
-
mutable: false,
|
|
10
|
-
resizable: true,
|
|
11
|
-
rotatable: true,
|
|
12
|
-
properties: [],
|
|
13
|
-
help: 'scene/component/sphere'
|
|
14
|
-
};
|
|
15
|
-
export class Sphere3D extends RealObjectMesh {
|
|
16
|
-
buildGeometry() {
|
|
17
|
-
var { depth = 0, rx = 0, ry = 0 } = this.component.state;
|
|
18
|
-
let geometry = new THREE.SphereGeometry(1, 32, 16);
|
|
19
|
-
geometry.scale(rx, depth, ry);
|
|
20
|
-
this.object3d.geometry = geometry;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
let Sphere = class Sphere extends Ellipse {
|
|
24
|
-
is3dish() {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
buildRealObject() {
|
|
28
|
-
return new Sphere3D(this);
|
|
29
|
-
}
|
|
30
|
-
get nature() {
|
|
31
|
-
return NATURE;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
Sphere = __decorate([
|
|
35
|
-
sceneComponent('sphere')
|
|
36
|
-
], Sphere);
|
|
37
|
-
export { Sphere };
|
|
38
|
-
//# sourceMappingURL=sphere.js.map
|
package/dist/sphere.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sphere.js","sourceRoot":"","sources":["../src/sphere.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAA8B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,wBAAwB;CAC/B,CAAA;AAED,MAAM,OAAO,QAAS,SAAQ,cAAc;IAC1C,aAAa;QACX,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAExD,IAAI,QAAQ,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;QAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QAE7B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACnC,CAAC;CACF;AAGM,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,OAAO;IACjC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAZY,MAAM;IADlB,cAAc,CAAC,QAAQ,CAAC;GACZ,MAAM,CAYlB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, ComponentNature, Ellipse, sceneComponent } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObject } from './threed/real-object.js'\nimport { RealObjectMesh } from './threed/real-object-mesh.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [],\n help: 'scene/component/sphere'\n}\n\nexport class Sphere3D extends RealObjectMesh {\n buildGeometry() {\n var { depth = 0, rx = 0, ry = 0 } = this.component.state\n\n let geometry = new THREE.SphereGeometry(1, 32, 16)\n geometry.scale(rx, depth, ry)\n\n this.object3d.geometry = geometry\n }\n}\n\n@sceneComponent('sphere')\nexport class Sphere extends Ellipse {\n is3dish() {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new Sphere3D(this)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/sprite.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
|
-
import { RealObject } from './threed/real-object.js';
|
|
3
|
-
declare const Sprite_base: typeof Shape;
|
|
4
|
-
export declare class Sprite extends Sprite_base {
|
|
5
|
-
is3dish(): boolean;
|
|
6
|
-
buildRealObject(): RealObject | undefined;
|
|
7
|
-
get nature(): ComponentNature;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
package/dist/sprite.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { __decorate } from "tslib";
|
|
5
|
-
import { RectPath, Shape, sceneComponent } from '@hatiolab/things-scene';
|
|
6
|
-
import { RealObjectSprite2D } from './threed/real-object-sprite-2d.js';
|
|
7
|
-
const NATURE = {
|
|
8
|
-
mutable: false,
|
|
9
|
-
resizable: true,
|
|
10
|
-
rotatable: true,
|
|
11
|
-
properties: []
|
|
12
|
-
};
|
|
13
|
-
let Sprite = class Sprite extends RectPath(Shape) {
|
|
14
|
-
is3dish() {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
buildRealObject() {
|
|
18
|
-
return new RealObjectSprite2D(this);
|
|
19
|
-
}
|
|
20
|
-
get nature() {
|
|
21
|
-
return NATURE;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
Sprite = __decorate([
|
|
25
|
-
sceneComponent('sprite')
|
|
26
|
-
], Sprite);
|
|
27
|
-
export { Sprite };
|
|
28
|
-
//# sourceMappingURL=sprite.js.map
|
package/dist/sprite.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sprite.js","sourceRoot":"","sources":["../src/sprite.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAEtE,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,EAAE;CACf,CAAA;AAGM,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACzC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAZY,MAAM;IADlB,cAAc,CAAC,QAAQ,CAAC;GACZ,MAAM,CAYlB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\nimport { RealObject } from './threed/real-object.js'\nimport { RealObjectSprite2D } from './threed/real-object-sprite-2d.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: []\n}\n\n@sceneComponent('sprite')\nexport class Sprite extends RectPath(Shape) {\n is3dish(): boolean {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new RealObjectSprite2D(this)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/text.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/text.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { Text } from '@hatiolab/things-scene';
|
|
5
|
-
import { RealObjectText } from './threed/real-object-text.js';
|
|
6
|
-
Text.prototype.buildRealObject = function () {
|
|
7
|
-
return new RealObjectText(this);
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG;IAC/B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Text } from '@hatiolab/things-scene'\nimport { RealObjectText } from './threed/real-object-text.js'\n\nText.prototype.buildRealObject = function () {\n return new RealObjectText(this)\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
3
|
-
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
|
|
4
|
-
export declare class ThreeContainerEditor {
|
|
5
|
-
private ortho;
|
|
6
|
-
private persp;
|
|
7
|
-
private scene;
|
|
8
|
-
private camera;
|
|
9
|
-
private renderer;
|
|
10
|
-
private orbit?;
|
|
11
|
-
private transform?;
|
|
12
|
-
constructor(scene: THREE.Scene, ortho: THREE.OrthographicCamera, persp: THREE.PerspectiveCamera, camera: THREE.Camera, renderer: THREE.Renderer);
|
|
13
|
-
dispose(): void;
|
|
14
|
-
get orbitControls(): OrbitControls;
|
|
15
|
-
get transformControls(): TransformControls;
|
|
16
|
-
attach(target: THREE.Object3D): void;
|
|
17
|
-
detach(): void;
|
|
18
|
-
onKeyDown(e: KeyboardEvent): void;
|
|
19
|
-
onKeyUp(e: KeyboardEvent): void;
|
|
20
|
-
onWindowResize(): void;
|
|
21
|
-
render(): void;
|
|
22
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
3
|
-
import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js';
|
|
4
|
-
export class ThreeContainerEditor {
|
|
5
|
-
constructor(scene, ortho, persp, camera, renderer) {
|
|
6
|
-
this.ortho = ortho;
|
|
7
|
-
this.persp = persp;
|
|
8
|
-
this.scene = scene;
|
|
9
|
-
this.camera = camera;
|
|
10
|
-
this.renderer = renderer;
|
|
11
|
-
}
|
|
12
|
-
dispose() {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
(_a = this.orbit) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
15
|
-
(_b = this.transform) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
16
|
-
}
|
|
17
|
-
get orbitControls() {
|
|
18
|
-
if (!this.orbit) {
|
|
19
|
-
this.orbit = new OrbitControls(this.camera, this.renderer.domElement);
|
|
20
|
-
this.orbit.update();
|
|
21
|
-
this.orbit.addEventListener('change', this.render);
|
|
22
|
-
}
|
|
23
|
-
return this.orbit;
|
|
24
|
-
}
|
|
25
|
-
get transformControls() {
|
|
26
|
-
if (!this.transform) {
|
|
27
|
-
this.transform = new TransformControls(this.camera, this.renderer.domElement);
|
|
28
|
-
this.transform.addEventListener('change', this.render);
|
|
29
|
-
this.transform.addEventListener('dragging-changed', event => {
|
|
30
|
-
this.orbitControls.enabled = !event.value;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return this.transform;
|
|
34
|
-
}
|
|
35
|
-
attach(target) {
|
|
36
|
-
var _a;
|
|
37
|
-
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.attach(target);
|
|
38
|
-
this.scene.add(this.transformControls);
|
|
39
|
-
}
|
|
40
|
-
detach() {
|
|
41
|
-
this.scene.remove(this.transformControls);
|
|
42
|
-
}
|
|
43
|
-
onKeyDown(e) {
|
|
44
|
-
switch (e.code) {
|
|
45
|
-
case 'KeyQ':
|
|
46
|
-
this.transformControls.setSpace(this.transformControls.space === 'local' ? 'world' : 'local');
|
|
47
|
-
break;
|
|
48
|
-
case 'ShiftLeft':
|
|
49
|
-
case 'ShiftRight':
|
|
50
|
-
this.transformControls.setTranslationSnap(100);
|
|
51
|
-
this.transformControls.setRotationSnap(THREE.MathUtils.degToRad(15));
|
|
52
|
-
this.transformControls.setScaleSnap(0.25);
|
|
53
|
-
break;
|
|
54
|
-
case 'KeyW':
|
|
55
|
-
this.transformControls.setMode('translate');
|
|
56
|
-
break;
|
|
57
|
-
case 'KeyE':
|
|
58
|
-
this.transformControls.setMode('rotate');
|
|
59
|
-
break;
|
|
60
|
-
case 'KeyR':
|
|
61
|
-
this.transformControls.setMode('scale');
|
|
62
|
-
break;
|
|
63
|
-
case 'KeyC':
|
|
64
|
-
const position = this.camera.position.clone();
|
|
65
|
-
this.camera = this.camera.isPerspectiveCamera ? this.ortho : this.persp;
|
|
66
|
-
this.camera.position.copy(position);
|
|
67
|
-
this.orbitControls.object = this.camera;
|
|
68
|
-
this.transformControls.camera = this.camera;
|
|
69
|
-
this.camera.lookAt(this.orbitControls.target.x, this.orbitControls.target.y, this.orbitControls.target.z);
|
|
70
|
-
this.onWindowResize();
|
|
71
|
-
break;
|
|
72
|
-
case 'KeyV':
|
|
73
|
-
const randomFoV = Math.random() + 0.1;
|
|
74
|
-
const randomZoom = Math.random() + 0.1;
|
|
75
|
-
this.persp.fov = randomFoV * 160;
|
|
76
|
-
this.ortho.bottom = -randomFoV * 500;
|
|
77
|
-
this.ortho.top = randomFoV * 500;
|
|
78
|
-
this.persp.zoom = randomZoom * 5;
|
|
79
|
-
this.ortho.zoom = randomZoom * 5;
|
|
80
|
-
this.onWindowResize();
|
|
81
|
-
break;
|
|
82
|
-
case 'Equal':
|
|
83
|
-
case 'NumpadAdd':
|
|
84
|
-
case 'NumpadEqual':
|
|
85
|
-
this.transformControls.setSize(this.transformControls.size + 0.1);
|
|
86
|
-
break;
|
|
87
|
-
case 'Minus': // -
|
|
88
|
-
case 'IntlRo': // _
|
|
89
|
-
case 'NumpadSubtract': // num-
|
|
90
|
-
this.transformControls.setSize(Math.max(this.transformControls.size - 0.1, 0.1));
|
|
91
|
-
break;
|
|
92
|
-
case 'KeyX':
|
|
93
|
-
this.transformControls.showX = !this.transformControls.showX;
|
|
94
|
-
break;
|
|
95
|
-
case 'KeyY':
|
|
96
|
-
this.transformControls.showY = !this.transformControls.showY;
|
|
97
|
-
break;
|
|
98
|
-
case 'KeyZ':
|
|
99
|
-
this.transformControls.showZ = !this.transformControls.showZ;
|
|
100
|
-
break;
|
|
101
|
-
case 'Space':
|
|
102
|
-
this.transformControls.enabled = !this.transformControls.enabled;
|
|
103
|
-
break;
|
|
104
|
-
case 'Esc':
|
|
105
|
-
this.transformControls.reset();
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
onKeyUp(e) {
|
|
110
|
-
switch (e.code) {
|
|
111
|
-
case 'Shift':
|
|
112
|
-
this.transformControls.setTranslationSnap(null);
|
|
113
|
-
this.transformControls.setRotationSnap(null);
|
|
114
|
-
this.transformControls.setScaleSnap(null);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
onWindowResize() {
|
|
119
|
-
const aspect = window.innerWidth / window.innerHeight;
|
|
120
|
-
this.persp.aspect = aspect;
|
|
121
|
-
this.persp.updateProjectionMatrix();
|
|
122
|
-
this.ortho.left = this.ortho.bottom * aspect;
|
|
123
|
-
this.ortho.right = this.ortho.top * aspect;
|
|
124
|
-
this.ortho.updateProjectionMatrix();
|
|
125
|
-
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
|
126
|
-
this.render();
|
|
127
|
-
}
|
|
128
|
-
render() {
|
|
129
|
-
this.renderer.render(this.scene, this.camera);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=three-container-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"three-container-editor.js","sourceRoot":"","sources":["../src/three-container-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAA;AAEpF,MAAM,OAAO,oBAAoB;IAW/B,YACE,KAAkB,EAClB,KAA+B,EAC/B,KAA8B,EAC9B,MAAoB,EACpB,QAAwB;QAExB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,IAAI,CAAC,KAAK,GAAG,KAAK,CAA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AC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;QAC1B,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAA;QAEnC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;QAC5C,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAA;QAC1C,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAA;QAEnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;QAE5D,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;CACF","sourcesContent":["import * as THREE from 'three'\n\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'\nimport { TransformControls } from 'three/examples/jsm/controls/TransformControls.js'\n\nexport class ThreeContainerEditor {\n private ortho: THREE.OrthographicCamera\n private persp: THREE.PerspectiveCamera\n\n private scene: THREE.Scene\n private camera: THREE.Camera\n private renderer: THREE.Renderer\n\n private orbit?: OrbitControls\n private transform?: TransformControls\n\n constructor(\n scene: THREE.Scene,\n ortho: THREE.OrthographicCamera,\n persp: THREE.PerspectiveCamera,\n camera: THREE.Camera,\n renderer: THREE.Renderer\n ) {\n this.ortho = ortho\n this.persp = persp\n\n this.scene = scene\n this.camera = camera\n this.renderer = renderer\n }\n\n dispose() {\n this.orbit?.dispose()\n this.transform?.dispose()\n }\n\n get orbitControls(): OrbitControls {\n if (!this.orbit) {\n this.orbit = new OrbitControls(this.camera!, this.renderer.domElement)\n this.orbit.update()\n\n this.orbit.addEventListener('change', this.render)\n }\n\n return this.orbit\n }\n\n get transformControls(): TransformControls {\n if (!this.transform) {\n this.transform = new TransformControls(this.camera!, this.renderer.domElement)\n this.transform.addEventListener('change', this.render)\n\n this.transform.addEventListener('dragging-changed', event => {\n this.orbitControls.enabled = !event.value\n })\n }\n\n return this.transform\n }\n\n attach(target: THREE.Object3D) {\n this.transform?.attach(target)\n this.scene.add(this.transformControls)\n }\n\n detach() {\n this.scene.remove(this.transformControls)\n }\n\n onKeyDown(e: KeyboardEvent) {\n switch (e.code) {\n case 'KeyQ':\n this.transformControls.setSpace(this.transformControls.space === 'local' ? 'world' : 'local')\n break\n\n case 'ShiftLeft':\n case 'ShiftRight':\n this.transformControls.setTranslationSnap(100)\n this.transformControls.setRotationSnap(THREE.MathUtils.degToRad(15))\n this.transformControls.setScaleSnap(0.25)\n break\n\n case 'KeyW':\n this.transformControls.setMode('translate')\n break\n\n case 'KeyE':\n this.transformControls.setMode('rotate')\n break\n\n case 'KeyR':\n this.transformControls.setMode('scale')\n break\n\n case 'KeyC':\n const position = this.camera.position.clone()\n\n this.camera = (this.camera as THREE.PerspectiveCamera).isPerspectiveCamera ? this.ortho : this.persp\n this.camera.position.copy(position)\n\n this.orbitControls.object = this.camera\n this.transformControls.camera = this.camera\n\n this.camera.lookAt(this.orbitControls.target.x, this.orbitControls.target.y, this.orbitControls.target.z)\n\n this.onWindowResize()\n\n break\n\n case 'KeyV':\n const randomFoV = Math.random() + 0.1\n const randomZoom = Math.random() + 0.1\n\n this.persp.fov = randomFoV * 160\n this.ortho.bottom = -randomFoV * 500\n this.ortho.top = randomFoV * 500\n\n this.persp.zoom = randomZoom * 5\n this.ortho.zoom = randomZoom * 5\n\n this.onWindowResize()\n\n break\n\n case 'Equal':\n case 'NumpadAdd':\n case 'NumpadEqual':\n this.transformControls.setSize(this.transformControls.size + 0.1)\n break\n\n case 'Minus': // -\n case 'IntlRo': // _\n case 'NumpadSubtract': // num-\n this.transformControls.setSize(Math.max(this.transformControls.size - 0.1, 0.1))\n break\n\n case 'KeyX':\n this.transformControls.showX = !this.transformControls.showX\n break\n\n case 'KeyY':\n this.transformControls.showY = !this.transformControls.showY\n break\n\n case 'KeyZ':\n this.transformControls.showZ = !this.transformControls.showZ\n break\n\n case 'Space':\n this.transformControls.enabled = !this.transformControls.enabled\n break\n\n case 'Esc':\n this.transformControls.reset()\n break\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n switch (e.code) {\n case 'Shift':\n this.transformControls.setTranslationSnap(null)\n this.transformControls.setRotationSnap(null)\n this.transformControls.setScaleSnap(null)\n break\n }\n }\n\n onWindowResize() {\n const aspect = window.innerWidth / window.innerHeight\n\n this.persp.aspect = aspect\n this.persp.updateProjectionMatrix()\n\n this.ortho.left = this.ortho.bottom * aspect\n this.ortho.right = this.ortho.top * aspect\n this.ortho.updateProjectionMatrix()\n\n this.renderer.setSize(window.innerWidth, window.innerHeight)\n\n this.render()\n }\n\n render() {\n this.renderer.render(this.scene, this.camera)\n }\n}\n"]}
|