@operato/scene-visualizer 1.2.36 → 1.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/db.sqlite +0 -0
- package/dist/camera copy.d.ts +20 -0
- package/dist/camera copy.js +103 -0
- package/dist/camera copy.js.map +1 -0
- package/dist/camera.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/light.d.ts +15 -0
- package/dist/light.js +131 -0
- package/dist/light.js.map +1 -0
- package/dist/point-light.d.ts +14 -0
- package/dist/point-light.js +77 -0
- package/dist/point-light.js.map +1 -0
- package/dist/rack.d.ts +2 -2
- package/dist/stock.d.ts +1 -1
- package/dist/templates/index.d.ts +20 -0
- package/dist/templates/index.js +2 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/light.d.ts +22 -0
- package/dist/templates/light.js +23 -0
- package/dist/templates/light.js.map +1 -0
- package/dist/templates/point-light.d.ts +22 -0
- package/dist/templates/point-light.js +23 -0
- package/dist/templates/point-light.js.map +1 -0
- package/dist/templates/sprite.js +1 -1
- package/dist/templates/sprite.js.map +1 -1
- package/dist/templates/wall copy.d.ts +19 -0
- package/dist/templates/wall copy.js +20 -0
- package/dist/templates/wall copy.js.map +1 -0
- package/dist/three-container.js +0 -18
- package/dist/three-container.js.map +1 -1
- package/dist/three-modeller.d.ts +0 -0
- package/dist/three-modeller.js +2 -0
- package/dist/three-modeller.js.map +1 -0
- package/dist/three-space.d.ts +86 -0
- package/dist/three-space.js +566 -0
- package/dist/three-space.js.map +1 -0
- package/dist/threed/real-object-camera-meshed.d.ts +1 -1
- package/dist/threed/real-object-dom-element.d.ts +1 -0
- package/dist/threed/real-object-dom-element.js +6 -0
- package/dist/threed/real-object-dom-element.js.map +1 -1
- package/dist/threed/real-object-extrude.d.ts +1 -1
- package/dist/threed/real-object-mesh.d.ts +2 -2
- package/dist/threed/real-object-sprite.d.ts +1 -0
- package/dist/threed/real-object-sprite.js +6 -0
- package/dist/threed/real-object-sprite.js.map +1 -1
- package/dist/threed/texture/canvas-texture.js +25 -7
- package/dist/threed/texture/canvas-texture.js.map +1 -1
- package/helps/scene/component/light.ko.md +12 -0
- package/helps/scene/component/light.md +12 -0
- package/helps/scene/component/light.zh.md +12 -0
- package/icons/light.png +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +9 -24
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +12 -42
- package/logs/application-2023-05-23-21.log +6 -0
- package/logs/application-2023-05-24-21.log +6 -0
- package/logs/application-2023-05-25-00.log +20 -0
- package/logs/connections-2023-05-20-07.log +41 -0
- package/logs/connections-2023-05-23-21.log +41 -0
- package/logs/connections-2023-05-24-21.log +41 -0
- package/logs/connections-2023-05-25-00.log +123 -0
- package/package.json +3 -3
- package/schema.gql +10 -0
- package/src/index.ts +1 -0
- package/src/light.ts +155 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/light.ts +23 -0
- package/src/templates/sprite.ts +1 -1
- package/src/three-container.ts +0 -21
- package/src/three-space.ts +732 -0
- package/src/threed/real-object-dom-element.ts +9 -4
- package/src/threed/real-object-sprite.ts +9 -0
- package/src/threed/texture/canvas-texture.ts +32 -6
- package/translations/en.json +6 -1
- package/translations/ko.json +6 -1
- package/translations/ms.json +6 -1
- package/translations/zh.json +6 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/logs/application-2023-04-30-10.log +0 -6
- package/logs/application-2023-04-30-12.log +0 -6
- package/logs/application-2023-04-30-14.log +0 -6
- package/logs/application-2023-04-30-16.log +0 -15
- package/logs/application-2023-04-30-20.log +0 -6
- package/logs/application-2023-04-30-22.log +0 -6
- package/logs/connections-2023-04-22-10.log +0 -82
- package/logs/connections-2023-04-22-11.log +0 -41
- package/logs/connections-2023-04-24-13.log +0 -82
- package/logs/connections-2023-04-24-14.log +0 -82
- package/logs/connections-2023-04-30-10.log +0 -41
- package/logs/connections-2023-04-30-12.log +0 -41
- package/logs/connections-2023-04-30-14.log +0 -41
- package/logs/connections-2023-04-30-16.log +0 -41
- package/logs/connections-2023-04-30-20.log +0 -41
- package/logs/connections-2023-04-30-22.log +0 -41
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Container, error, FPS, Layout } from '@hatiolab/things-scene';
|
|
5
|
+
import * as THREE from 'three';
|
|
6
|
+
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
7
|
+
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
|
|
8
|
+
import ThreeControls from './three-controls';
|
|
9
|
+
import './three-layout';
|
|
10
|
+
import { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer';
|
|
11
|
+
import { createFloor } from './threed/floor/floor';
|
|
12
|
+
const NATURE = {
|
|
13
|
+
mutable: false,
|
|
14
|
+
resizable: true,
|
|
15
|
+
rotatable: true,
|
|
16
|
+
properties: [
|
|
17
|
+
{
|
|
18
|
+
type: 'select',
|
|
19
|
+
label: 'precision',
|
|
20
|
+
name: 'precision',
|
|
21
|
+
property: {
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
display: 'High',
|
|
25
|
+
value: 'highp'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
display: 'Medium',
|
|
29
|
+
value: 'mediump'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
display: 'Low',
|
|
33
|
+
value: 'lowp'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'checkbox',
|
|
40
|
+
label: 'anti-alias',
|
|
41
|
+
name: 'antialias',
|
|
42
|
+
property: 'antialias'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'checkbox',
|
|
46
|
+
label: 'controller',
|
|
47
|
+
name: 'controller',
|
|
48
|
+
property: 'controller'
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
help: 'scene/component/three-space'
|
|
52
|
+
};
|
|
53
|
+
const WEBGL_NO_SUPPORT_TEXT = 'WebGL no support';
|
|
54
|
+
export class ThreeSpace extends Container {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
this._noSupportWebgl = false;
|
|
58
|
+
this._raycaster = new THREE.Raycaster();
|
|
59
|
+
}
|
|
60
|
+
containable(component) {
|
|
61
|
+
return component.is3dish();
|
|
62
|
+
}
|
|
63
|
+
is3dContainer() {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
/* THREE Object related .. */
|
|
67
|
+
createObjects(components) {
|
|
68
|
+
for (let component of components) {
|
|
69
|
+
try {
|
|
70
|
+
var item = component.realObject;
|
|
71
|
+
if (item) {
|
|
72
|
+
if (component.isHTMLElement()) {
|
|
73
|
+
this.css3DScene.add(item.object3d);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this._scene3d.add(item.object3d);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
error(err);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
destroy_scene3d() {
|
|
86
|
+
var _a;
|
|
87
|
+
this.stop();
|
|
88
|
+
window.removeEventListener('focus', this._onFocus);
|
|
89
|
+
window.removeEventListener('resize', this._onResize);
|
|
90
|
+
if (this._renderer3d)
|
|
91
|
+
this._renderer3d.clear();
|
|
92
|
+
if ((_a = this._controls) === null || _a === void 0 ? void 0 : _a.autoRotate) {
|
|
93
|
+
this._controls.doAutoRotate(false);
|
|
94
|
+
}
|
|
95
|
+
delete this._renderer3d;
|
|
96
|
+
delete this._camera;
|
|
97
|
+
delete this._controls;
|
|
98
|
+
if (this._scene3d) {
|
|
99
|
+
let children = this._scene3d.children.slice();
|
|
100
|
+
for (let i in children) {
|
|
101
|
+
let child = children[i];
|
|
102
|
+
if (child.dispose)
|
|
103
|
+
child.dispose();
|
|
104
|
+
if (child.geometry && child.geometry.dispose)
|
|
105
|
+
child.geometry.dispose();
|
|
106
|
+
if (child.material && child.material.dispose)
|
|
107
|
+
child.material.dispose();
|
|
108
|
+
if (child.texture && child.texture.dispose)
|
|
109
|
+
child.texture.dispose();
|
|
110
|
+
this._scene3d.remove(child);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
delete this._scene3d;
|
|
114
|
+
}
|
|
115
|
+
update() {
|
|
116
|
+
var { width, height } = this.bounds;
|
|
117
|
+
var { fov = 45, near = 0.1, far = 20000, antialias = true, precision = 'highp', cameraX, cameraY, cameraZ, exposure = 2.5 } = this.state;
|
|
118
|
+
var components = this.components || [];
|
|
119
|
+
// SCENE
|
|
120
|
+
this._scene3d = new THREE.Scene();
|
|
121
|
+
// CAMERA
|
|
122
|
+
var aspect = width / height;
|
|
123
|
+
this._camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
|
|
124
|
+
var cameraXPos = height * 0.8, cameraYPos = width * 0.8, cameraZPos = Math.min(500, Math.floor(Math.min(width, height)));
|
|
125
|
+
// cameraZPos = Math.floor(Math.min(width, height))
|
|
126
|
+
if (cameraX != undefined)
|
|
127
|
+
cameraXPos = cameraX * width;
|
|
128
|
+
if (cameraY != undefined)
|
|
129
|
+
cameraYPos = cameraY * height;
|
|
130
|
+
if (cameraZ != undefined)
|
|
131
|
+
cameraZPos = cameraZ * Math.floor(Math.min(width, height));
|
|
132
|
+
this._camera.position.set(cameraXPos, cameraZPos, cameraYPos);
|
|
133
|
+
this._scene3d.add(this._camera);
|
|
134
|
+
this._camera.lookAt(this._scene3d.position);
|
|
135
|
+
this._camera.zoom = this.getState('zoom') * 0.01;
|
|
136
|
+
try {
|
|
137
|
+
const canvas = document.createElement('canvas');
|
|
138
|
+
let context = canvas.getContext('webgl2');
|
|
139
|
+
var renderer3d = new THREE.WebGLRenderer({
|
|
140
|
+
canvas,
|
|
141
|
+
context,
|
|
142
|
+
precision,
|
|
143
|
+
alpha: true,
|
|
144
|
+
antialias
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
this._noSupportWebgl = true;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this._renderer3d = renderer3d;
|
|
152
|
+
renderer3d.autoClear = true;
|
|
153
|
+
// @ts-ignore for three@0.150.1
|
|
154
|
+
renderer3d.outputColorSpace = THREE.SRGBColorSpace;
|
|
155
|
+
renderer3d.useLegacyLights = false;
|
|
156
|
+
renderer3d.toneMappingExposure = Math.pow(exposure, 5.0);
|
|
157
|
+
renderer3d.toneMapping = THREE.LinearToneMapping;
|
|
158
|
+
renderer3d.shadowMap.enabled = true;
|
|
159
|
+
renderer3d.setClearColor(0xffffff, 0); // transparent
|
|
160
|
+
renderer3d.setSize(width, height);
|
|
161
|
+
// CONTROLS
|
|
162
|
+
this._controls = new ThreeControls(this._camera, this);
|
|
163
|
+
this._controls.cameraChanged = true;
|
|
164
|
+
// Lights
|
|
165
|
+
var _hemiLight = new THREE.HemisphereLight(0xdddddd, 0x333333, 0.035);
|
|
166
|
+
var _directionalLight = new THREE.DirectionalLight(0xd6e1ff, 0.01);
|
|
167
|
+
var _pointLight1 = new THREE.PointLight(0xd6e1ff, 1, undefined, 2);
|
|
168
|
+
_pointLight1.power = cameraZPos * 50;
|
|
169
|
+
_pointLight1.castShadow = true;
|
|
170
|
+
_pointLight1.position.set(0, cameraZPos, 0);
|
|
171
|
+
_pointLight1.shadow.camera.near = 0.1;
|
|
172
|
+
_pointLight1.shadow.camera.far = cameraZPos * 2;
|
|
173
|
+
// const helper = new THREE.CameraHelper(_pointLight1.shadow.camera)
|
|
174
|
+
// this._scene3d?.add(helper)
|
|
175
|
+
this.scene3d.add(_hemiLight);
|
|
176
|
+
this.scene3d.add(_pointLight1);
|
|
177
|
+
this._camera.add(_directionalLight);
|
|
178
|
+
this._mouse = new THREE.Vector2();
|
|
179
|
+
this._clock = new THREE.Clock(true);
|
|
180
|
+
this._mixer = new THREE.AnimationMixer(this.scene3d);
|
|
181
|
+
this.createObjects(components);
|
|
182
|
+
this._camera.updateProjectionMatrix();
|
|
183
|
+
const floor = createFloor(this);
|
|
184
|
+
// if (this._floor) {
|
|
185
|
+
// this.object3d.remove(this._floor)
|
|
186
|
+
// this._floor.clear()
|
|
187
|
+
// delete this._floor
|
|
188
|
+
// }
|
|
189
|
+
if (floor) {
|
|
190
|
+
// this._floor = floor
|
|
191
|
+
this._scene3d.add(floor);
|
|
192
|
+
}
|
|
193
|
+
// this.invalidate()
|
|
194
|
+
// postprocessing
|
|
195
|
+
var composer = (this.composer = new EffectComposer(renderer3d));
|
|
196
|
+
composer.setSize(width, height);
|
|
197
|
+
const renderPass = new RenderPass(this._scene3d, this._camera);
|
|
198
|
+
composer.addPass(renderPass);
|
|
199
|
+
this._onFocus = (e) => {
|
|
200
|
+
this.render_threed();
|
|
201
|
+
};
|
|
202
|
+
this._onResize = (e) => {
|
|
203
|
+
this.resize();
|
|
204
|
+
};
|
|
205
|
+
window.addEventListener('resize', this._onResize);
|
|
206
|
+
window.addEventListener('focus', this._onFocus);
|
|
207
|
+
this.buildOverlays();
|
|
208
|
+
this.resize();
|
|
209
|
+
}
|
|
210
|
+
resize() {
|
|
211
|
+
var _a;
|
|
212
|
+
const { width, height } = this.bounds;
|
|
213
|
+
this._camera.aspect = width / height;
|
|
214
|
+
this.renderer3d.setSize(width, height);
|
|
215
|
+
this.css3DRenderer.setSize(width, height);
|
|
216
|
+
(_a = this.composer) === null || _a === void 0 ? void 0 : _a.setSize(width, height);
|
|
217
|
+
this._camera.updateProjectionMatrix();
|
|
218
|
+
}
|
|
219
|
+
init_scene3d() {
|
|
220
|
+
this.root.on('redraw', this.onredraw, this);
|
|
221
|
+
if (this._scene3d) {
|
|
222
|
+
this.destroy_scene3d();
|
|
223
|
+
}
|
|
224
|
+
this.update();
|
|
225
|
+
this.onchangeData && this.onchangeData(this.data, this.data);
|
|
226
|
+
}
|
|
227
|
+
threed_animate() {
|
|
228
|
+
if (!this._controls) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (this._mixer) {
|
|
232
|
+
this._mixer.update(this._clock.getDelta());
|
|
233
|
+
}
|
|
234
|
+
this._controls.update();
|
|
235
|
+
if (this.state.autoRotate) {
|
|
236
|
+
this.invalidate();
|
|
237
|
+
}
|
|
238
|
+
this.render_threed();
|
|
239
|
+
}
|
|
240
|
+
stop() { }
|
|
241
|
+
get scene3d() {
|
|
242
|
+
if (!this._scene3d) {
|
|
243
|
+
this.init_scene3d();
|
|
244
|
+
}
|
|
245
|
+
return this._scene3d;
|
|
246
|
+
}
|
|
247
|
+
get renderer3d() {
|
|
248
|
+
return this._renderer3d;
|
|
249
|
+
}
|
|
250
|
+
get mixer() {
|
|
251
|
+
return this._mixer;
|
|
252
|
+
}
|
|
253
|
+
get zoom() {
|
|
254
|
+
var _a;
|
|
255
|
+
return (_a = this._camera) === null || _a === void 0 ? void 0 : _a.zoom;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* CSS3DRenderer용 THREE.Scene을 제공
|
|
259
|
+
*/
|
|
260
|
+
get css3DScene() {
|
|
261
|
+
if (!this._css3DScene) {
|
|
262
|
+
this._css3DScene = this.buildCSS3DScene();
|
|
263
|
+
}
|
|
264
|
+
return this._css3DScene;
|
|
265
|
+
}
|
|
266
|
+
buildCSS3DScene() {
|
|
267
|
+
return new THREE.Scene();
|
|
268
|
+
}
|
|
269
|
+
disposeCSS3DScene() {
|
|
270
|
+
var children = [...this.css3DScene.children];
|
|
271
|
+
children.forEach(child => this.css3DScene.remove(child));
|
|
272
|
+
}
|
|
273
|
+
/* css3d-renderer */
|
|
274
|
+
/**
|
|
275
|
+
* css3d-renderer getter
|
|
276
|
+
*/
|
|
277
|
+
get css3DRenderer() {
|
|
278
|
+
if (!this._css3DRenderer) {
|
|
279
|
+
this._css3DRenderer = this.createCSS3DRenderer();
|
|
280
|
+
}
|
|
281
|
+
return this._css3DRenderer;
|
|
282
|
+
}
|
|
283
|
+
createCSS3DRenderer() {
|
|
284
|
+
var renderer = new CSS3DRenderer();
|
|
285
|
+
var div = renderer.domElement;
|
|
286
|
+
div.style.position = 'absolute';
|
|
287
|
+
div.style.top = '0';
|
|
288
|
+
div.style.pointerEvents = 'none';
|
|
289
|
+
if (this.app.isViewMode) {
|
|
290
|
+
// disableAllUserEvents(div)
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
div.style.pointerEvents = 'none';
|
|
294
|
+
}
|
|
295
|
+
return renderer;
|
|
296
|
+
}
|
|
297
|
+
disposeCSS3DRenderer() {
|
|
298
|
+
// Nothing to do
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* element내부에 필요한 overlay들을 생성
|
|
302
|
+
* ViewRenderer에서는 CSS3DRenderer와 GLRendering을 위한 canvas를 오버레이로 만든다.
|
|
303
|
+
* Warn: this.element는 아직 만들어지지 않은 상태에 buildOverlays가 호출됨.
|
|
304
|
+
* @param into
|
|
305
|
+
*/
|
|
306
|
+
buildOverlays() {
|
|
307
|
+
this.element.appendChild(this.css3DRenderer.domElement);
|
|
308
|
+
}
|
|
309
|
+
render_threed() {
|
|
310
|
+
if (this.composer) {
|
|
311
|
+
this.composer.render();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/* Container Overides .. */
|
|
315
|
+
render(ctx) {
|
|
316
|
+
if (this.app.isViewMode) {
|
|
317
|
+
this.setState('threed', true);
|
|
318
|
+
}
|
|
319
|
+
if (this.state.threed && !this._noSupportWebgl && this._camera) {
|
|
320
|
+
this.css3DRenderer.render(this.css3DScene, this._camera);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
super.render(ctx);
|
|
324
|
+
}
|
|
325
|
+
postrender(ctx) {
|
|
326
|
+
var { left, top, debug, threed } = this.state;
|
|
327
|
+
var { width, height } = this.bounds;
|
|
328
|
+
// ios에서 width, height에 소수점이 있으면 3d를 표현하지 못하는 문제가 있어 정수화
|
|
329
|
+
width = Math.floor(width);
|
|
330
|
+
height = Math.floor(height);
|
|
331
|
+
if (threed) {
|
|
332
|
+
if (!this._scene3d) {
|
|
333
|
+
this.init_scene3d();
|
|
334
|
+
this.render_threed();
|
|
335
|
+
}
|
|
336
|
+
if (this._noSupportWebgl) {
|
|
337
|
+
this._showWebglNoSupportText(ctx);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!this._renderer3d) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
var { width: rendererWidth, height: rendererHeight } = this._renderer3d.getSize(new THREE.Vector2());
|
|
344
|
+
ctx.drawImage(this._renderer3d.domElement, 0, 0, rendererWidth, rendererHeight, left, top, width, height);
|
|
345
|
+
if (debug) {
|
|
346
|
+
ctx.font = 100 + 'px Arial';
|
|
347
|
+
ctx.textAlign = 'center';
|
|
348
|
+
ctx.fillStyle = 'black';
|
|
349
|
+
ctx.globalAlpha = 0.5;
|
|
350
|
+
ctx.fillText(String(FPS()), 100, 100);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
super.postrender(ctx);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
dispose() {
|
|
358
|
+
var _a;
|
|
359
|
+
this.root.off('redraw', this.onredraw, this);
|
|
360
|
+
this.disposeCSS3DScene();
|
|
361
|
+
(_a = this.composer) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
362
|
+
this.destroy_scene3d();
|
|
363
|
+
super.dispose();
|
|
364
|
+
}
|
|
365
|
+
get layout() {
|
|
366
|
+
return Layout.get('three');
|
|
367
|
+
}
|
|
368
|
+
get nature() {
|
|
369
|
+
return NATURE;
|
|
370
|
+
}
|
|
371
|
+
getObjectByRaycast() {
|
|
372
|
+
var intersects = this.getObjectsByRaycast();
|
|
373
|
+
if (intersects && intersects.length > 0) {
|
|
374
|
+
var object = intersects[0].object;
|
|
375
|
+
while (object) {
|
|
376
|
+
if (object.userData.context) {
|
|
377
|
+
return object;
|
|
378
|
+
}
|
|
379
|
+
object = object.parent;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
getObjectsByRaycast() {
|
|
384
|
+
var vector = this._mouse;
|
|
385
|
+
if (!this._camera) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
this._raycaster.setFromCamera(vector, this._camera);
|
|
389
|
+
var intersects = this._raycaster.intersectObjects(this._scene3d.children, true);
|
|
390
|
+
return intersects;
|
|
391
|
+
}
|
|
392
|
+
_showWebglNoSupportText(context) {
|
|
393
|
+
context.save();
|
|
394
|
+
var { width, height } = this.state;
|
|
395
|
+
context.font = width / 20 + 'px Arial';
|
|
396
|
+
context.textAlign = 'center';
|
|
397
|
+
context.fillText(WEBGL_NO_SUPPORT_TEXT, width / 2 - width / 40, height / 2);
|
|
398
|
+
context.restore();
|
|
399
|
+
}
|
|
400
|
+
/* Event Handlers */
|
|
401
|
+
onchange(after, before) {
|
|
402
|
+
if (after.hasOwnProperty('width') || after.hasOwnProperty('height') || after.hasOwnProperty('threed'))
|
|
403
|
+
this.destroy_scene3d();
|
|
404
|
+
if (after.hasOwnProperty('autoRotate')) {
|
|
405
|
+
if (this._controls) {
|
|
406
|
+
this._controls.doAutoRotate(after.autoRotate);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (after.hasOwnProperty('fov') ||
|
|
410
|
+
after.hasOwnProperty('near') ||
|
|
411
|
+
after.hasOwnProperty('far') ||
|
|
412
|
+
after.hasOwnProperty('zoom')) {
|
|
413
|
+
if (this._camera) {
|
|
414
|
+
const { near, far, zoom, fov } = this.state;
|
|
415
|
+
this._camera.near = near;
|
|
416
|
+
this._camera.far = far;
|
|
417
|
+
this._camera.zoom = zoom * 0.01;
|
|
418
|
+
this._camera.fov = fov;
|
|
419
|
+
this._camera.updateProjectionMatrix();
|
|
420
|
+
this._controls.cameraChanged = true;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
onmousedown(e) {
|
|
425
|
+
if (this._controls) {
|
|
426
|
+
this._controls.onMouseDown(e);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
onmouseup(e) {
|
|
430
|
+
var _a;
|
|
431
|
+
if (this._controls) {
|
|
432
|
+
if (this._lastFocused) {
|
|
433
|
+
;
|
|
434
|
+
this._lastFocused._focused = false;
|
|
435
|
+
}
|
|
436
|
+
const { left, top, width, height } = this.state;
|
|
437
|
+
var pointer = this.transcoordC2S(e.offsetX, e.offsetY);
|
|
438
|
+
this._mouse.x = ((pointer.x - left) / width) * 2 - 1;
|
|
439
|
+
this._mouse.y = -((pointer.y - top) / height) * 2 + 1;
|
|
440
|
+
var object = this.getObjectByRaycast();
|
|
441
|
+
var realObject = object === null || object === void 0 ? void 0 : object.userData.context;
|
|
442
|
+
if (realObject) {
|
|
443
|
+
;
|
|
444
|
+
realObject._focused = true;
|
|
445
|
+
realObject._focusedAt = performance.now();
|
|
446
|
+
this._lastFocused = realObject;
|
|
447
|
+
(_a = realObject.component) === null || _a === void 0 ? void 0 : _a.trigger('click', e);
|
|
448
|
+
}
|
|
449
|
+
e.stopPropagation();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
onmousemove(e) {
|
|
453
|
+
var _a, _b;
|
|
454
|
+
if (this._controls) {
|
|
455
|
+
const { left, top, width, height } = this.state;
|
|
456
|
+
var pointer = this.transcoordC2S(e.offsetX, e.offsetY);
|
|
457
|
+
this._mouse.x = ((pointer.x - left) / width) * 2 - 1;
|
|
458
|
+
this._mouse.y = -((pointer.y - top) / height) * 2 + 1;
|
|
459
|
+
var object = this.getObjectByRaycast();
|
|
460
|
+
var realObject = object === null || object === void 0 ? void 0 : object.userData.context;
|
|
461
|
+
if (realObject !== this._lastHovered) {
|
|
462
|
+
if (this._lastHovered) {
|
|
463
|
+
(_a = this._lastHovered.component) === null || _a === void 0 ? void 0 : _a.trigger('mouseleave', e);
|
|
464
|
+
delete this._lastHovered;
|
|
465
|
+
}
|
|
466
|
+
if (realObject) {
|
|
467
|
+
this._lastHovered = realObject;
|
|
468
|
+
(_b = this._lastHovered.component) === null || _b === void 0 ? void 0 : _b.trigger('mouseenter', e);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
this._controls.onMouseMove(e);
|
|
472
|
+
e.stopPropagation();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
onmouseleave(e) { }
|
|
476
|
+
onwheel(e) {
|
|
477
|
+
if (this._controls) {
|
|
478
|
+
this.handleMouseWheel(e);
|
|
479
|
+
e.stopPropagation();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
ondblclick(e) {
|
|
483
|
+
if (this._controls) {
|
|
484
|
+
this.setState('zoom', this.get('zoom'));
|
|
485
|
+
this._controls.reset();
|
|
486
|
+
e.stopPropagation();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
ondragstart(e) {
|
|
490
|
+
if (this._controls) {
|
|
491
|
+
var pointer = this.transcoordC2S(e.offsetX, e.offsetY);
|
|
492
|
+
var { left, top, width, height } = this.bounds;
|
|
493
|
+
this._mouse.x = ((pointer.x - left) / width) * 2 - 1;
|
|
494
|
+
this._mouse.y = -((pointer.y - top) / height) * 2 + 1;
|
|
495
|
+
this._controls.onDragStart(e);
|
|
496
|
+
e.stopPropagation();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
ondragmove(e) {
|
|
500
|
+
if (this._controls) {
|
|
501
|
+
this._controls.cameraChanged = true;
|
|
502
|
+
this._controls.onDragMove(e);
|
|
503
|
+
e.stopPropagation();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
ondragend(e) {
|
|
507
|
+
if (this._controls) {
|
|
508
|
+
this._controls.cameraChanged = true;
|
|
509
|
+
this._controls.onDragEnd(e);
|
|
510
|
+
e.stopPropagation();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
ontouchstart(e) {
|
|
514
|
+
if (this._controls) {
|
|
515
|
+
this._controls.onTouchStart(e);
|
|
516
|
+
e.stopPropagation();
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
onpan(e) {
|
|
520
|
+
if (this._controls) {
|
|
521
|
+
this._controls.cameraChanged = true;
|
|
522
|
+
this._controls.onTouchMove(e);
|
|
523
|
+
e.stopPropagation();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
ontouchend(e) {
|
|
527
|
+
if (this._controls) {
|
|
528
|
+
this._controls.onTouchEnd(e);
|
|
529
|
+
e.stopPropagation();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
onkeydown(e) {
|
|
533
|
+
if (this._controls) {
|
|
534
|
+
this._controls.onKeyDown(e);
|
|
535
|
+
e.stopPropagation();
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
onpinch(e) {
|
|
539
|
+
if (this._controls) {
|
|
540
|
+
var zoom = this.getState('zoom');
|
|
541
|
+
//@ts-ignore
|
|
542
|
+
zoom *= e.scale;
|
|
543
|
+
if (zoom < 100)
|
|
544
|
+
zoom = 100;
|
|
545
|
+
this.setState('zoom', zoom);
|
|
546
|
+
e.stopPropagation();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
ondoubletap() {
|
|
550
|
+
this._controls.reset();
|
|
551
|
+
}
|
|
552
|
+
handleMouseWheel(event) {
|
|
553
|
+
var delta = 0;
|
|
554
|
+
var zoom = this.getState('zoom');
|
|
555
|
+
delta = -event.deltaY;
|
|
556
|
+
zoom += delta * 0.1;
|
|
557
|
+
if (zoom < 100)
|
|
558
|
+
zoom = 100;
|
|
559
|
+
this.setState('zoom', zoom);
|
|
560
|
+
}
|
|
561
|
+
onredraw() {
|
|
562
|
+
this.threed_animate();
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
Component.register('3d-space', ThreeSpace);
|
|
566
|
+
//# sourceMappingURL=three-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three-space.js","sourceRoot":"","sources":["../src/three-space.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAmB,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAA;AAC9G,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAA;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAA;AAE5E,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAC5C,OAAO,gBAAgB,CAAA;AAGvB,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGlD,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP;wBACE,OAAO,EAAE,MAAM;wBACf,KAAK,EAAE,OAAO;qBACf;oBACD;wBACE,OAAO,EAAE,QAAQ;wBACjB,KAAK,EAAE,SAAS;qBACjB;oBACD;wBACE,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,MAAM;qBACd;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,WAAW;SACtB;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,YAAY;SACvB;KACF;IACD,IAAI,EAAE,6BAA6B;CACpC,CAAA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QACnB,IAAI,IAAI,GAAG,GAAG;YAAE,IAAI,GAAG,GAAG,CAAA;QAE1B,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, Container, error, FPS, Layout, Properties } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js'\nimport { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js'\n\nimport ThreeControls from './three-controls'\nimport './three-layout'\nimport { RealObject } from './threed/real-object'\nimport { ThreeDimensionalContainer } from './threed/three-dimensional-container'\nimport { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer'\nimport { createFloor } from './threed/floor/floor'\nimport { RealObjectDomElement } from './threed'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'precision',\n name: 'precision',\n property: {\n options: [\n {\n display: 'High',\n value: 'highp'\n },\n {\n display: 'Medium',\n value: 'mediump'\n },\n {\n display: 'Low',\n value: 'lowp'\n }\n ]\n }\n },\n {\n type: 'checkbox',\n label: 'anti-alias',\n name: 'antialias',\n property: 'antialias'\n },\n {\n type: 'checkbox',\n label: 'controller',\n name: 'controller',\n property: 'controller'\n }\n ],\n help: 'scene/component/three-space'\n}\n\nconst WEBGL_NO_SUPPORT_TEXT = 'WebGL no support'\n\nexport class ThreeSpace extends Container implements ThreeDimensionalContainer {\n _scene3d?: THREE.Scene\n _initalizeComplete?: Promise<void>\n\n _mixer?: THREE.AnimationMixer\n\n _camera?: THREE.PerspectiveCamera\n _renderer3d?: THREE.WebGLRenderer\n\n _mouse?: THREE.Vector2\n\n _clock?: THREE.Clock\n\n _controls?: any\n _onFocus?: (e: FocusEvent) => void\n _onResize?: (e: Event) => void\n _noSupportWebgl: boolean = false\n\n _raycaster = new THREE.Raycaster()\n\n _lastFocused?: RealObject\n _lastHovered?: RealObject\n\n private _css3DScene?: THREE.Scene\n private _css3DRenderer?: CSS3DRenderer\n\n composer?: EffectComposer\n\n containable(component: Component) {\n return component.is3dish()\n }\n\n is3dContainer() {\n return true\n }\n\n /* THREE Object related .. */\n\n createObjects(components: Component[]) {\n for (let component of components) {\n try {\n var item = component.realObject\n\n if (item) {\n if (component.isHTMLElement()) {\n this.css3DScene.add((item as RealObjectDomElement).object3d)\n } else {\n this._scene3d!.add(item.object3d)\n }\n }\n } catch (err) {\n error(err)\n }\n }\n }\n\n destroy_scene3d() {\n this.stop()\n\n window.removeEventListener('focus', this._onFocus!)\n window.removeEventListener('resize', this._onResize!)\n\n if (this._renderer3d) this._renderer3d.clear()\n\n if (this._controls?.autoRotate) {\n this._controls.doAutoRotate(false)\n }\n\n delete this._renderer3d\n delete this._camera\n delete this._controls\n\n if (this._scene3d) {\n let children = this._scene3d.children.slice()\n for (let i in children) {\n let child = children[i] as any\n if (child.dispose) child.dispose()\n if (child.geometry && child.geometry.dispose) child.geometry.dispose()\n if (child.material && child.material.dispose) child.material.dispose()\n if (child.texture && child.texture.dispose) child.texture.dispose()\n this._scene3d.remove(child)\n }\n }\n\n delete this._scene3d\n }\n\n update() {\n var { width, height } = this.bounds\n\n var {\n fov = 45,\n near = 0.1,\n far = 20000,\n antialias = true,\n precision = 'highp',\n cameraX,\n cameraY,\n cameraZ,\n exposure = 2.5\n } = this.state\n\n var components = this.components || []\n\n // SCENE\n this._scene3d = new THREE.Scene()\n\n // CAMERA\n var aspect = width / height\n\n this._camera = new THREE.PerspectiveCamera(fov, aspect, near, far)\n\n var cameraXPos = height * 0.8,\n cameraYPos = width * 0.8,\n cameraZPos = Math.min(500, Math.floor(Math.min(width, height)))\n // cameraZPos = Math.floor(Math.min(width, height))\n\n if (cameraX != undefined) cameraXPos = cameraX * width\n if (cameraY != undefined) cameraYPos = cameraY * height\n if (cameraZ != undefined) cameraZPos = cameraZ * Math.floor(Math.min(width, height))\n\n this._camera.position.set(cameraXPos, cameraZPos, cameraYPos)\n\n this._scene3d.add(this._camera)\n this._camera.lookAt(this._scene3d.position)\n this._camera.zoom = this.getState('zoom') * 0.01\n\n try {\n const canvas = document.createElement('canvas')\n let context = canvas!.getContext('webgl2')!\n\n var renderer3d = new THREE.WebGLRenderer({\n canvas,\n context,\n precision,\n alpha: true,\n antialias\n })\n } catch (e) {\n this._noSupportWebgl = true\n return\n }\n\n this._renderer3d = renderer3d\n\n renderer3d!.autoClear = true\n // @ts-ignore for three@0.150.1\n renderer3d!.outputColorSpace = THREE.SRGBColorSpace\n renderer3d!.useLegacyLights = false\n renderer3d!.toneMappingExposure = Math.pow(exposure, 5.0)\n renderer3d!.toneMapping = THREE.LinearToneMapping\n renderer3d!.shadowMap.enabled = true\n renderer3d!.setClearColor(0xffffff, 0) // transparent\n renderer3d!.setSize(width, height)\n\n // CONTROLS\n this._controls = new (ThreeControls as any)(this._camera, this)\n this._controls.cameraChanged = true\n\n // Lights\n var _hemiLight = new THREE.HemisphereLight(0xdddddd, 0x333333, 0.035)\n var _directionalLight = new THREE.DirectionalLight(0xd6e1ff, 0.01)\n var _pointLight1 = new THREE.PointLight(0xd6e1ff, 1, undefined, 2)\n\n _pointLight1.power = cameraZPos * 50\n _pointLight1.castShadow = true\n _pointLight1.position.set(0, cameraZPos, 0)\n _pointLight1.shadow.camera.near = 0.1\n _pointLight1.shadow.camera.far = cameraZPos * 2\n\n // const helper = new THREE.CameraHelper(_pointLight1.shadow.camera)\n // this._scene3d?.add(helper)\n\n this.scene3d!.add(_hemiLight)\n this.scene3d!.add(_pointLight1)\n this._camera.add(_directionalLight)\n\n this._mouse = new THREE.Vector2()\n\n this._clock = new THREE.Clock(true)\n this._mixer = new THREE.AnimationMixer(this.scene3d!)\n\n this.createObjects(components)\n\n this._camera.updateProjectionMatrix()\n\n const floor = createFloor(this)\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._scene3d.add(floor)\n }\n\n // this.invalidate()\n\n // postprocessing\n\n var composer = (this.composer = new EffectComposer(renderer3d!))\n composer.setSize(width, height)\n\n const renderPass = new RenderPass(this._scene3d, this._camera)\n composer.addPass(renderPass)\n\n this._onFocus = (e: FocusEvent) => {\n this.render_threed()\n }\n\n this._onResize = (e: Event) => {\n this.resize()\n }\n\n window.addEventListener('resize', this._onResize)\n window.addEventListener('focus', this._onFocus)\n\n this.buildOverlays()\n this.resize()\n }\n\n resize() {\n const { width, height } = this.bounds\n\n this._camera!.aspect = width / height\n\n this.renderer3d!.setSize(width, height)\n this.css3DRenderer.setSize(width, height)\n\n this.composer?.setSize(width, height)\n this._camera!.updateProjectionMatrix()\n }\n\n init_scene3d() {\n this.root.on('redraw', this.onredraw, this)\n\n if (this._scene3d) {\n this.destroy_scene3d()\n }\n\n this.update()\n\n this.onchangeData && this.onchangeData(this.data, this.data)\n }\n\n threed_animate() {\n if (!this._controls) {\n return\n }\n\n if (this._mixer) {\n this._mixer.update(this._clock!.getDelta())\n }\n\n this._controls.update()\n\n if (this.state.autoRotate) {\n this.invalidate()\n }\n\n this.render_threed()\n }\n\n stop() {}\n\n get scene3d() {\n if (!this._scene3d) {\n this.init_scene3d()\n }\n\n return this._scene3d\n }\n\n get renderer3d() {\n return this._renderer3d\n }\n\n get mixer() {\n return this._mixer\n }\n\n get zoom() {\n return this._camera?.zoom\n }\n\n /**\n * CSS3DRenderer용 THREE.Scene을 제공\n */\n get css3DScene() {\n if (!this._css3DScene) {\n this._css3DScene = this.buildCSS3DScene()\n }\n return this._css3DScene\n }\n\n protected buildCSS3DScene() {\n return new THREE.Scene()\n }\n\n protected disposeCSS3DScene() {\n var children = [...this.css3DScene.children]\n children.forEach(child => this.css3DScene.remove(child))\n }\n\n /* css3d-renderer */\n\n /**\n * css3d-renderer getter\n */\n get css3DRenderer() {\n if (!this._css3DRenderer) {\n this._css3DRenderer = this.createCSS3DRenderer()\n }\n\n return this._css3DRenderer\n }\n\n protected createCSS3DRenderer() {\n var renderer = new CSS3DRenderer()\n var div = renderer.domElement\n div.style.position = 'absolute'\n div.style.top = '0'\n div.style.pointerEvents = 'none'\n\n if (this.app.isViewMode) {\n // disableAllUserEvents(div)\n } else {\n div.style.pointerEvents = 'none'\n }\n\n return renderer\n }\n\n protected disposeCSS3DRenderer() {\n // Nothing to do\n }\n\n /**\n * element내부에 필요한 overlay들을 생성\n * ViewRenderer에서는 CSS3DRenderer와 GLRendering을 위한 canvas를 오버레이로 만든다.\n * Warn: this.element는 아직 만들어지지 않은 상태에 buildOverlays가 호출됨.\n * @param into\n */\n buildOverlays() {\n this.element.appendChild(this.css3DRenderer.domElement)\n }\n\n render_threed() {\n if (this.composer) {\n this.composer.render()\n }\n }\n\n /* Container Overides .. */\n render(ctx: CanvasRenderingContext2D) {\n if (this.app.isViewMode) {\n this.setState('threed', true)\n }\n\n if (this.state.threed && !this._noSupportWebgl && this._camera) {\n this.css3DRenderer.render(this.css3DScene, this._camera!)\n return\n }\n\n super.render(ctx)\n }\n\n postrender(ctx: CanvasRenderingContext2D) {\n var { left, top, debug, threed } = this.state\n\n var { width, height } = this.bounds\n\n // ios에서 width, height에 소수점이 있으면 3d를 표현하지 못하는 문제가 있어 정수화\n width = Math.floor(width)\n height = Math.floor(height)\n\n if (threed) {\n if (!this._scene3d) {\n this.init_scene3d()\n this.render_threed()\n }\n\n if (this._noSupportWebgl) {\n this._showWebglNoSupportText(ctx)\n return\n }\n\n if (!this._renderer3d) {\n return\n }\n\n var { width: rendererWidth, height: rendererHeight } = this._renderer3d.getSize(new THREE.Vector2())\n\n ctx.drawImage(this._renderer3d.domElement, 0, 0, rendererWidth, rendererHeight, left, top, width, height)\n\n if (debug) {\n ctx.font = 100 + 'px Arial'\n ctx.textAlign = 'center'\n ctx.fillStyle = 'black'\n ctx.globalAlpha = 0.5\n ctx.fillText(String(FPS()), 100, 100)\n }\n } else {\n super.postrender(ctx)\n }\n }\n\n dispose() {\n this.root.off('redraw', this.onredraw, this)\n\n this.disposeCSS3DScene()\n\n this.composer?.dispose()\n this.destroy_scene3d()\n\n super.dispose()\n }\n\n get layout() {\n return Layout.get('three')\n }\n\n get nature(): ComponentNature {\n return NATURE\n }\n\n getObjectByRaycast(): THREE.Object3D | undefined {\n var intersects = this.getObjectsByRaycast()\n\n if (intersects && intersects.length > 0) {\n var object: THREE.Object3D | null = intersects[0].object\n while (object) {\n if (object.userData.context) {\n return object\n }\n\n object = object.parent\n }\n }\n }\n\n getObjectsByRaycast() {\n var vector = this._mouse\n if (!this._camera) {\n return\n }\n\n this._raycaster.setFromCamera(vector!, this._camera)\n\n var intersects = this._raycaster.intersectObjects(this._scene3d!.children, true)\n\n return intersects\n }\n\n _showWebglNoSupportText(context: CanvasRenderingContext2D) {\n context.save()\n\n var { width, height } = this.state\n\n context.font = width / 20 + 'px Arial'\n context.textAlign = 'center'\n context.fillText(WEBGL_NO_SUPPORT_TEXT, width / 2 - width / 40, height / 2)\n\n context.restore()\n }\n\n /* Event Handlers */\n\n onchange(after: Properties, before: Properties) {\n if (after.hasOwnProperty('width') || after.hasOwnProperty('height') || after.hasOwnProperty('threed'))\n this.destroy_scene3d()\n\n if (after.hasOwnProperty('autoRotate')) {\n if (this._controls) {\n this._controls.doAutoRotate(after.autoRotate)\n }\n }\n\n if (\n after.hasOwnProperty('fov') ||\n after.hasOwnProperty('near') ||\n after.hasOwnProperty('far') ||\n after.hasOwnProperty('zoom')\n ) {\n if (this._camera) {\n const { near, far, zoom, fov } = this.state\n\n this._camera.near = near\n this._camera.far = far\n this._camera.zoom = zoom * 0.01\n this._camera.fov = fov\n this._camera.updateProjectionMatrix()\n\n this._controls.cameraChanged = true\n }\n }\n }\n\n onmousedown(e: MouseEvent) {\n if (this._controls) {\n this._controls.onMouseDown(e)\n }\n }\n\n onmouseup(e: MouseEvent) {\n if (this._controls) {\n if (this._lastFocused) {\n ;(this._lastFocused as any)._focused = false\n }\n\n const { left, top, width, height } = this.state\n\n var pointer = this.transcoordC2S(e.offsetX, e.offsetY)\n\n this._mouse!.x = ((pointer.x - left) / width) * 2 - 1\n this._mouse!.y = -((pointer.y - top) / height) * 2 + 1\n\n var object = this.getObjectByRaycast()\n var realObject = object?.userData.context as RealObject\n\n if (realObject) {\n ;(realObject as any)._focused = true\n ;(realObject as any)._focusedAt = performance.now()\n this._lastFocused = realObject\n realObject.component?.trigger('click', e)\n }\n\n e.stopPropagation()\n }\n }\n\n onmousemove(e: MouseEvent) {\n if (this._controls) {\n const { left, top, width, height } = this.state\n\n var pointer = this.transcoordC2S(e.offsetX, e.offsetY)\n\n this._mouse!.x = ((pointer.x - left) / width) * 2 - 1\n this._mouse!.y = -((pointer.y - top) / height) * 2 + 1\n\n var object = this.getObjectByRaycast()\n var realObject = object?.userData.context as RealObject\n\n if (realObject !== this._lastHovered) {\n if (this._lastHovered) {\n this._lastHovered.component?.trigger('mouseleave', e)\n delete this._lastHovered\n }\n\n if (realObject) {\n this._lastHovered = realObject\n this._lastHovered.component?.trigger('mouseenter', e)\n }\n }\n\n this._controls.onMouseMove(e)\n\n e.stopPropagation()\n }\n }\n\n onmouseleave(e: MouseEvent) {}\n\n onwheel(e: WheelEvent) {\n if (this._controls) {\n this.handleMouseWheel(e)\n e.stopPropagation()\n }\n }\n\n ondblclick(e: MouseEvent) {\n if (this._controls) {\n this.setState('zoom', this.get('zoom'))\n this._controls.reset()\n e.stopPropagation()\n }\n }\n\n ondragstart(e: DragEvent) {\n if (this._controls) {\n var pointer = this.transcoordC2S(e.offsetX, e.offsetY)\n var { left, top, width, height } = this.bounds\n\n this._mouse!.x = ((pointer.x - left) / width) * 2 - 1\n this._mouse!.y = -((pointer.y - top) / height) * 2 + 1\n\n this._controls.onDragStart(e)\n e.stopPropagation()\n }\n }\n\n ondragmove(e: DragEvent) {\n if (this._controls) {\n this._controls.cameraChanged = true\n this._controls.onDragMove(e)\n e.stopPropagation()\n }\n }\n\n ondragend(e: DragEvent) {\n if (this._controls) {\n this._controls.cameraChanged = true\n this._controls.onDragEnd(e)\n e.stopPropagation()\n }\n }\n\n ontouchstart(e: TouchEvent) {\n if (this._controls) {\n this._controls.onTouchStart(e)\n e.stopPropagation()\n }\n }\n\n onpan(e: TouchEvent) {\n if (this._controls) {\n this._controls.cameraChanged = true\n this._controls.onTouchMove(e)\n e.stopPropagation()\n }\n }\n ontouchend(e: TouchEvent) {\n if (this._controls) {\n this._controls.onTouchEnd(e)\n e.stopPropagation()\n }\n }\n\n onkeydown(e: KeyboardEvent) {\n if (this._controls) {\n this._controls.onKeyDown(e)\n e.stopPropagation()\n }\n }\n\n onpinch(e: TouchEvent) {\n if (this._controls) {\n var zoom = this.getState('zoom')\n //@ts-ignore\n zoom *= e.scale\n\n if (zoom < 100) zoom = 100\n\n this.setState('zoom', zoom)\n e.stopPropagation()\n }\n }\n\n ondoubletap() {\n this._controls.reset()\n }\n\n handleMouseWheel(event: WheelEvent) {\n var delta = 0\n var zoom = this.getState('zoom')\n\n delta = -event.deltaY\n zoom += delta * 0.1\n if (zoom < 100) zoom = 100\n\n this.setState('zoom', zoom)\n }\n\n onredraw() {\n this.threed_animate()\n }\n}\n\nComponent.register('3d-space', ThreeSpace)\n"]}
|
|
@@ -7,6 +7,6 @@ export declare class RealObjectCamera extends RealObjectMesh {
|
|
|
7
7
|
createCamera(): THREE.PerspectiveCamera;
|
|
8
8
|
updateCamera(): void;
|
|
9
9
|
build(): void;
|
|
10
|
-
clear(): THREE.Mesh<THREE.BufferGeometry
|
|
10
|
+
clear(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>;
|
|
11
11
|
buildGeometry(): void;
|
|
12
12
|
}
|
|
@@ -2,6 +2,7 @@ import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer.js';
|
|
|
2
2
|
import { RealObject } from './real-object';
|
|
3
3
|
export declare class RealObjectDomElement extends RealObject<CSS3DObject> {
|
|
4
4
|
protected getObject3dInstance(): CSS3DObject;
|
|
5
|
+
get cz(): any;
|
|
5
6
|
build(): void;
|
|
6
7
|
updateDimension(): void;
|
|
7
8
|
updateAlpha(): void;
|
|
@@ -7,6 +7,12 @@ export class RealObjectDomElement extends RealObject {
|
|
|
7
7
|
getObject3dInstance() {
|
|
8
8
|
return new CSS3DObject(this.component.element);
|
|
9
9
|
}
|
|
10
|
+
get cz() {
|
|
11
|
+
var { zPos = 0 } = this.component.state;
|
|
12
|
+
var { height } = this.component.bounds;
|
|
13
|
+
var { tz = 0 } = this.component.delta();
|
|
14
|
+
return zPos + tz + height / 2;
|
|
15
|
+
}
|
|
10
16
|
build() {
|
|
11
17
|
super.build();
|
|
12
18
|
var element = this.component.element;
|