@shopware-ag/dive 1.14.0 → 1.15.0
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/build/dive.cjs +109 -160
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +19 -36
- package/build/dive.d.ts +19 -36
- package/build/dive.js +67 -118
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/group/Group.ts +13 -42
- package/src/group/__test__/Group.test.ts +9 -17
- package/src/model/Model.ts +8 -58
- package/src/model/__test__/Model.test.ts +1 -56
- package/src/node/Node.ts +58 -0
- package/src/node/__test__/Node.test.ts +229 -0
- package/src/primitive/Primitive.ts +3 -49
- package/src/primitive/__test__/Primitive.test.ts +0 -55
package/build/dive.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster, Vector3 } from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
|
-
import { TransformControls
|
|
5
|
-
import { TransformControls as TransformControls$1 } from 'three/examples/jsm/
|
|
4
|
+
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
5
|
+
import { TransformControls as TransformControls$1, GLTF } from 'three/examples/jsm/Addons.js';
|
|
6
6
|
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons';
|
|
7
7
|
|
|
8
8
|
type DIVERendererSettings = {
|
|
@@ -421,17 +421,27 @@ interface DIVESelectable {
|
|
|
421
421
|
onDeselect?: () => void;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
declare class
|
|
425
|
-
readonly
|
|
424
|
+
declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
425
|
+
readonly isDIVENode: true;
|
|
426
426
|
readonly isSelectable: true;
|
|
427
427
|
readonly isMoveable: true;
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
gizmo: TransformControls | null;
|
|
429
|
+
protected _boundingBox: Box3;
|
|
430
430
|
constructor();
|
|
431
431
|
SetPosition(position: Vector3Like): void;
|
|
432
432
|
SetRotation(rotation: Vector3Like): void;
|
|
433
433
|
SetScale(scale: Vector3Like): void;
|
|
434
434
|
SetVisibility(visible: boolean): void;
|
|
435
|
+
SetToWorldOrigin(): void;
|
|
436
|
+
onMove(): void;
|
|
437
|
+
onSelect(): void;
|
|
438
|
+
onDeselect(): void;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare class DIVEGroup extends DIVENode {
|
|
442
|
+
readonly isDIVEGroup: true;
|
|
443
|
+
private _boxMesh;
|
|
444
|
+
constructor();
|
|
435
445
|
SetBoundingBoxVisibility(visible: boolean): void;
|
|
436
446
|
attach(object: DIVESceneObject): this;
|
|
437
447
|
remove(object: DIVESceneObject): this;
|
|
@@ -447,8 +457,6 @@ declare class DIVEGroup extends Object3D implements DIVESelectable, DIVEMoveable
|
|
|
447
457
|
private updateBB;
|
|
448
458
|
private updateBoxMesh;
|
|
449
459
|
onMove(): void;
|
|
450
|
-
onSelect(): void;
|
|
451
|
-
onDeselect(): void;
|
|
452
460
|
}
|
|
453
461
|
|
|
454
462
|
/**
|
|
@@ -482,7 +490,7 @@ declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMov
|
|
|
482
490
|
readonly isDIVEPointLight: true;
|
|
483
491
|
readonly isMoveable: true;
|
|
484
492
|
readonly isSelectable: true;
|
|
485
|
-
gizmo: TransformControls | null;
|
|
493
|
+
gizmo: TransformControls$1 | null;
|
|
486
494
|
private light;
|
|
487
495
|
private mesh;
|
|
488
496
|
constructor();
|
|
@@ -521,27 +529,14 @@ declare class DIVESceneLight extends Object3D {
|
|
|
521
529
|
*
|
|
522
530
|
* @module
|
|
523
531
|
*/
|
|
524
|
-
declare class DIVEModel extends
|
|
532
|
+
declare class DIVEModel extends DIVENode {
|
|
525
533
|
readonly isDIVEModel: true;
|
|
526
|
-
readonly isSelectable: true;
|
|
527
|
-
readonly isMoveable: true;
|
|
528
|
-
gizmo: TransformControls | null;
|
|
529
|
-
private boundingBox;
|
|
530
534
|
private _mesh;
|
|
531
535
|
private _material;
|
|
532
|
-
constructor();
|
|
533
536
|
SetModel(gltf: GLTF): void;
|
|
534
|
-
SetPosition(position: Vector3Like): void;
|
|
535
|
-
SetRotation(rotation: Vector3Like): void;
|
|
536
|
-
SetScale(scale: Vector3Like): void;
|
|
537
|
-
SetVisibility(visible: boolean): void;
|
|
538
537
|
SetMaterial(material: Partial<COMMaterial>): void;
|
|
539
|
-
SetToWorldOrigin(): void;
|
|
540
538
|
PlaceOnFloor(): void;
|
|
541
539
|
DropIt(): void;
|
|
542
|
-
onMove(): void;
|
|
543
|
-
onSelect(): void;
|
|
544
|
-
onDeselect(): void;
|
|
545
540
|
}
|
|
546
541
|
|
|
547
542
|
/**
|
|
@@ -553,26 +548,14 @@ declare class DIVEModel extends Object3D implements DIVESelectable, DIVEMoveable
|
|
|
553
548
|
*
|
|
554
549
|
* @module
|
|
555
550
|
*/
|
|
556
|
-
declare class DIVEPrimitive extends
|
|
551
|
+
declare class DIVEPrimitive extends DIVENode {
|
|
557
552
|
readonly isDIVEPrimitive: true;
|
|
558
|
-
readonly isSelectable: true;
|
|
559
|
-
readonly isMoveable: true;
|
|
560
|
-
gizmo: TransformControls$1 | null;
|
|
561
553
|
private _mesh;
|
|
562
|
-
private _boundingBox;
|
|
563
554
|
constructor();
|
|
564
555
|
SetGeometry(geometry: COMGeometry): void;
|
|
565
|
-
SetPosition(position: Vector3Like): void;
|
|
566
|
-
SetRotation(rotation: Vector3Like): void;
|
|
567
|
-
SetScale(scale: Vector3Like): void;
|
|
568
|
-
SetVisibility(visible: boolean): void;
|
|
569
556
|
SetMaterial(material: Partial<COMMaterial>): void;
|
|
570
|
-
SetToWorldOrigin(): void;
|
|
571
557
|
PlaceOnFloor(): void;
|
|
572
558
|
DropIt(): void;
|
|
573
|
-
onMove(): void;
|
|
574
|
-
onSelect(): void;
|
|
575
|
-
onDeselect(): void;
|
|
576
559
|
private assembleGeometry;
|
|
577
560
|
private createCylinderGeometry;
|
|
578
561
|
private createSphereGeometry;
|
package/build/dive.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster, Vector3 } from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
|
-
import { TransformControls
|
|
5
|
-
import { TransformControls as TransformControls$1 } from 'three/examples/jsm/
|
|
4
|
+
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
5
|
+
import { TransformControls as TransformControls$1, GLTF } from 'three/examples/jsm/Addons.js';
|
|
6
6
|
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons';
|
|
7
7
|
|
|
8
8
|
type DIVERendererSettings = {
|
|
@@ -421,17 +421,27 @@ interface DIVESelectable {
|
|
|
421
421
|
onDeselect?: () => void;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
declare class
|
|
425
|
-
readonly
|
|
424
|
+
declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
425
|
+
readonly isDIVENode: true;
|
|
426
426
|
readonly isSelectable: true;
|
|
427
427
|
readonly isMoveable: true;
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
gizmo: TransformControls | null;
|
|
429
|
+
protected _boundingBox: Box3;
|
|
430
430
|
constructor();
|
|
431
431
|
SetPosition(position: Vector3Like): void;
|
|
432
432
|
SetRotation(rotation: Vector3Like): void;
|
|
433
433
|
SetScale(scale: Vector3Like): void;
|
|
434
434
|
SetVisibility(visible: boolean): void;
|
|
435
|
+
SetToWorldOrigin(): void;
|
|
436
|
+
onMove(): void;
|
|
437
|
+
onSelect(): void;
|
|
438
|
+
onDeselect(): void;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare class DIVEGroup extends DIVENode {
|
|
442
|
+
readonly isDIVEGroup: true;
|
|
443
|
+
private _boxMesh;
|
|
444
|
+
constructor();
|
|
435
445
|
SetBoundingBoxVisibility(visible: boolean): void;
|
|
436
446
|
attach(object: DIVESceneObject): this;
|
|
437
447
|
remove(object: DIVESceneObject): this;
|
|
@@ -447,8 +457,6 @@ declare class DIVEGroup extends Object3D implements DIVESelectable, DIVEMoveable
|
|
|
447
457
|
private updateBB;
|
|
448
458
|
private updateBoxMesh;
|
|
449
459
|
onMove(): void;
|
|
450
|
-
onSelect(): void;
|
|
451
|
-
onDeselect(): void;
|
|
452
460
|
}
|
|
453
461
|
|
|
454
462
|
/**
|
|
@@ -482,7 +490,7 @@ declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMov
|
|
|
482
490
|
readonly isDIVEPointLight: true;
|
|
483
491
|
readonly isMoveable: true;
|
|
484
492
|
readonly isSelectable: true;
|
|
485
|
-
gizmo: TransformControls | null;
|
|
493
|
+
gizmo: TransformControls$1 | null;
|
|
486
494
|
private light;
|
|
487
495
|
private mesh;
|
|
488
496
|
constructor();
|
|
@@ -521,27 +529,14 @@ declare class DIVESceneLight extends Object3D {
|
|
|
521
529
|
*
|
|
522
530
|
* @module
|
|
523
531
|
*/
|
|
524
|
-
declare class DIVEModel extends
|
|
532
|
+
declare class DIVEModel extends DIVENode {
|
|
525
533
|
readonly isDIVEModel: true;
|
|
526
|
-
readonly isSelectable: true;
|
|
527
|
-
readonly isMoveable: true;
|
|
528
|
-
gizmo: TransformControls | null;
|
|
529
|
-
private boundingBox;
|
|
530
534
|
private _mesh;
|
|
531
535
|
private _material;
|
|
532
|
-
constructor();
|
|
533
536
|
SetModel(gltf: GLTF): void;
|
|
534
|
-
SetPosition(position: Vector3Like): void;
|
|
535
|
-
SetRotation(rotation: Vector3Like): void;
|
|
536
|
-
SetScale(scale: Vector3Like): void;
|
|
537
|
-
SetVisibility(visible: boolean): void;
|
|
538
537
|
SetMaterial(material: Partial<COMMaterial>): void;
|
|
539
|
-
SetToWorldOrigin(): void;
|
|
540
538
|
PlaceOnFloor(): void;
|
|
541
539
|
DropIt(): void;
|
|
542
|
-
onMove(): void;
|
|
543
|
-
onSelect(): void;
|
|
544
|
-
onDeselect(): void;
|
|
545
540
|
}
|
|
546
541
|
|
|
547
542
|
/**
|
|
@@ -553,26 +548,14 @@ declare class DIVEModel extends Object3D implements DIVESelectable, DIVEMoveable
|
|
|
553
548
|
*
|
|
554
549
|
* @module
|
|
555
550
|
*/
|
|
556
|
-
declare class DIVEPrimitive extends
|
|
551
|
+
declare class DIVEPrimitive extends DIVENode {
|
|
557
552
|
readonly isDIVEPrimitive: true;
|
|
558
|
-
readonly isSelectable: true;
|
|
559
|
-
readonly isMoveable: true;
|
|
560
|
-
gizmo: TransformControls$1 | null;
|
|
561
553
|
private _mesh;
|
|
562
|
-
private _boundingBox;
|
|
563
554
|
constructor();
|
|
564
555
|
SetGeometry(geometry: COMGeometry): void;
|
|
565
|
-
SetPosition(position: Vector3Like): void;
|
|
566
|
-
SetRotation(rotation: Vector3Like): void;
|
|
567
|
-
SetScale(scale: Vector3Like): void;
|
|
568
|
-
SetVisibility(visible: boolean): void;
|
|
569
556
|
SetMaterial(material: Partial<COMMaterial>): void;
|
|
570
|
-
SetToWorldOrigin(): void;
|
|
571
557
|
PlaceOnFloor(): void;
|
|
572
558
|
DropIt(): void;
|
|
573
|
-
onMove(): void;
|
|
574
|
-
onSelect(): void;
|
|
575
|
-
onDeselect(): void;
|
|
576
559
|
private assembleGeometry;
|
|
577
560
|
private createCylinderGeometry;
|
|
578
561
|
private createSphereGeometry;
|
package/build/dive.js
CHANGED
|
@@ -652,7 +652,7 @@ var DIVERenderer = class extends WebGLRenderer {
|
|
|
652
652
|
import { Color as Color7, Scene as Scene2 } from "three";
|
|
653
653
|
|
|
654
654
|
// src/scene/root/Root.ts
|
|
655
|
-
import { Box3 as
|
|
655
|
+
import { Box3 as Box32, Color as Color5, Object3D as Object3D6 } from "three";
|
|
656
656
|
|
|
657
657
|
// src/light/AmbientLight.ts
|
|
658
658
|
init_VisibilityLayerMask();
|
|
@@ -1150,7 +1150,7 @@ var DIVESceneLight = class extends Object3D4 {
|
|
|
1150
1150
|
|
|
1151
1151
|
// src/model/Model.ts
|
|
1152
1152
|
init_VisibilityLayerMask();
|
|
1153
|
-
import {
|
|
1153
|
+
import { MeshStandardMaterial, Raycaster as Raycaster2, Vector3 as Vector32 } from "three";
|
|
1154
1154
|
|
|
1155
1155
|
// src/helper/findSceneRecursive/findSceneRecursive.ts
|
|
1156
1156
|
var findSceneRecursive = (object) => {
|
|
@@ -1160,18 +1160,57 @@ var findSceneRecursive = (object) => {
|
|
|
1160
1160
|
return object;
|
|
1161
1161
|
};
|
|
1162
1162
|
|
|
1163
|
-
// src/
|
|
1164
|
-
|
|
1163
|
+
// src/node/Node.ts
|
|
1164
|
+
init_VisibilityLayerMask();
|
|
1165
|
+
import { Box3, Object3D as Object3D5 } from "three";
|
|
1166
|
+
var DIVENode = class extends Object3D5 {
|
|
1165
1167
|
constructor() {
|
|
1166
1168
|
super();
|
|
1167
|
-
this.
|
|
1169
|
+
this.isDIVENode = true;
|
|
1168
1170
|
this.isSelectable = true;
|
|
1169
1171
|
this.isMoveable = true;
|
|
1170
1172
|
this.gizmo = null;
|
|
1173
|
+
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1174
|
+
this._boundingBox = new Box3();
|
|
1175
|
+
}
|
|
1176
|
+
SetPosition(position) {
|
|
1177
|
+
this.position.set(position.x, position.y, position.z);
|
|
1178
|
+
}
|
|
1179
|
+
SetRotation(rotation) {
|
|
1180
|
+
this.rotation.set(rotation.x, rotation.y, rotation.z);
|
|
1181
|
+
}
|
|
1182
|
+
SetScale(scale) {
|
|
1183
|
+
this.scale.set(scale.x, scale.y, scale.z);
|
|
1184
|
+
}
|
|
1185
|
+
SetVisibility(visible) {
|
|
1186
|
+
this.visible = visible;
|
|
1187
|
+
}
|
|
1188
|
+
SetToWorldOrigin() {
|
|
1189
|
+
var _a;
|
|
1190
|
+
this.position.set(0, 0, 0);
|
|
1191
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1192
|
+
}
|
|
1193
|
+
onMove() {
|
|
1194
|
+
var _a;
|
|
1195
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1196
|
+
}
|
|
1197
|
+
onSelect() {
|
|
1198
|
+
var _a;
|
|
1199
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
|
|
1200
|
+
}
|
|
1201
|
+
onDeselect() {
|
|
1202
|
+
var _a;
|
|
1203
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
// src/model/Model.ts
|
|
1208
|
+
var DIVEModel = class extends DIVENode {
|
|
1209
|
+
constructor() {
|
|
1210
|
+
super(...arguments);
|
|
1211
|
+
this.isDIVEModel = true;
|
|
1171
1212
|
this._mesh = null;
|
|
1172
1213
|
this._material = null;
|
|
1173
|
-
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1174
|
-
this.boundingBox = new Box3();
|
|
1175
1214
|
}
|
|
1176
1215
|
SetModel(gltf) {
|
|
1177
1216
|
this.clear();
|
|
@@ -1179,7 +1218,7 @@ var DIVEModel = class extends Object3D5 {
|
|
|
1179
1218
|
child.castShadow = true;
|
|
1180
1219
|
child.receiveShadow = true;
|
|
1181
1220
|
child.layers.mask = this.layers.mask;
|
|
1182
|
-
this.
|
|
1221
|
+
this._boundingBox.expandByObject(child);
|
|
1183
1222
|
if (!this._mesh && "isMesh" in child) {
|
|
1184
1223
|
this._mesh = child;
|
|
1185
1224
|
if (this._material) {
|
|
@@ -1191,20 +1230,6 @@ var DIVEModel = class extends Object3D5 {
|
|
|
1191
1230
|
});
|
|
1192
1231
|
this.add(gltf.scene);
|
|
1193
1232
|
}
|
|
1194
|
-
SetPosition(position) {
|
|
1195
|
-
this.position.set(position.x, position.y, position.z);
|
|
1196
|
-
}
|
|
1197
|
-
SetRotation(rotation) {
|
|
1198
|
-
this.rotation.setFromVector3(new Vector32(rotation.x, rotation.y, rotation.z));
|
|
1199
|
-
}
|
|
1200
|
-
SetScale(scale) {
|
|
1201
|
-
this.scale.set(scale.x, scale.y, scale.z);
|
|
1202
|
-
}
|
|
1203
|
-
SetVisibility(visible) {
|
|
1204
|
-
this.traverse((child) => {
|
|
1205
|
-
child.visible = visible;
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
1233
|
SetMaterial(material) {
|
|
1209
1234
|
if (!this._material) {
|
|
1210
1235
|
this._material = new MeshStandardMaterial();
|
|
@@ -1243,14 +1268,9 @@ var DIVEModel = class extends Object3D5 {
|
|
|
1243
1268
|
this._mesh.material = this._material;
|
|
1244
1269
|
}
|
|
1245
1270
|
}
|
|
1246
|
-
SetToWorldOrigin() {
|
|
1247
|
-
var _a;
|
|
1248
|
-
this.position.set(0, 0, 0);
|
|
1249
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1250
|
-
}
|
|
1251
1271
|
PlaceOnFloor() {
|
|
1252
1272
|
var _a;
|
|
1253
|
-
this.position.y = -this.
|
|
1273
|
+
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1254
1274
|
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1255
1275
|
}
|
|
1256
1276
|
DropIt() {
|
|
@@ -1259,8 +1279,8 @@ var DIVEModel = class extends Object3D5 {
|
|
|
1259
1279
|
console.warn("DIVEModel: DropIt() called on a model that is not in the scene.", this);
|
|
1260
1280
|
return;
|
|
1261
1281
|
}
|
|
1262
|
-
const bottomY = this.
|
|
1263
|
-
const bbBottomCenter = this.localToWorld(this.
|
|
1282
|
+
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1283
|
+
const bbBottomCenter = this.localToWorld(this._boundingBox.getCenter(new Vector32()).multiply(this.scale));
|
|
1264
1284
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1265
1285
|
const raycaster = new Raycaster2(bbBottomCenter, new Vector32(0, -1, 0));
|
|
1266
1286
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
@@ -1277,18 +1297,6 @@ var DIVEModel = class extends Object3D5 {
|
|
|
1277
1297
|
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1278
1298
|
}
|
|
1279
1299
|
}
|
|
1280
|
-
onMove() {
|
|
1281
|
-
var _a;
|
|
1282
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1283
|
-
}
|
|
1284
|
-
onSelect() {
|
|
1285
|
-
var _a;
|
|
1286
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
|
|
1287
|
-
}
|
|
1288
|
-
onDeselect() {
|
|
1289
|
-
var _a;
|
|
1290
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
|
|
1291
|
-
}
|
|
1292
1300
|
};
|
|
1293
1301
|
|
|
1294
1302
|
// src/loadingmanager/LoadingManager.ts
|
|
@@ -1324,42 +1332,23 @@ var DIVELoadingManager = class {
|
|
|
1324
1332
|
};
|
|
1325
1333
|
|
|
1326
1334
|
// src/primitive/Primitive.ts
|
|
1327
|
-
import {
|
|
1335
|
+
import { BoxGeometry, BufferGeometry, Color as Color4, ConeGeometry, CylinderGeometry, Mesh as Mesh3, MeshStandardMaterial as MeshStandardMaterial2, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Vector3 as Vector33 } from "three";
|
|
1328
1336
|
init_VisibilityLayerMask();
|
|
1329
|
-
var DIVEPrimitive = class extends
|
|
1337
|
+
var DIVEPrimitive = class extends DIVENode {
|
|
1330
1338
|
constructor() {
|
|
1331
1339
|
super();
|
|
1332
1340
|
this.isDIVEPrimitive = true;
|
|
1333
|
-
this.isSelectable = true;
|
|
1334
|
-
this.isMoveable = true;
|
|
1335
|
-
this.gizmo = null;
|
|
1336
|
-
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1337
1341
|
this._mesh = new Mesh3();
|
|
1338
1342
|
this._mesh.layers.mask = PRODUCT_LAYER_MASK;
|
|
1339
1343
|
this._mesh.castShadow = true;
|
|
1340
1344
|
this._mesh.receiveShadow = true;
|
|
1341
1345
|
this._mesh.material = new MeshStandardMaterial2();
|
|
1342
1346
|
this.add(this._mesh);
|
|
1343
|
-
this._boundingBox = new Box32();
|
|
1344
1347
|
}
|
|
1345
1348
|
SetGeometry(geometry) {
|
|
1346
1349
|
this._mesh.geometry = this.assembleGeometry(geometry);
|
|
1347
1350
|
this._boundingBox.setFromObject(this._mesh);
|
|
1348
1351
|
}
|
|
1349
|
-
SetPosition(position) {
|
|
1350
|
-
this.position.set(position.x, position.y, position.z);
|
|
1351
|
-
}
|
|
1352
|
-
SetRotation(rotation) {
|
|
1353
|
-
this.rotation.setFromVector3(new Vector33(rotation.x, rotation.y, rotation.z));
|
|
1354
|
-
}
|
|
1355
|
-
SetScale(scale) {
|
|
1356
|
-
this.scale.set(scale.x, scale.y, scale.z);
|
|
1357
|
-
}
|
|
1358
|
-
SetVisibility(visible) {
|
|
1359
|
-
this.traverse((child) => {
|
|
1360
|
-
child.visible = visible;
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
1352
|
SetMaterial(material) {
|
|
1364
1353
|
const primitiveMaterial = this._mesh.material;
|
|
1365
1354
|
if (material.vertexColors !== void 0) {
|
|
@@ -1394,11 +1383,6 @@ var DIVEPrimitive = class extends Object3D6 {
|
|
|
1394
1383
|
}
|
|
1395
1384
|
if (this._mesh) this._mesh.material = primitiveMaterial;
|
|
1396
1385
|
}
|
|
1397
|
-
SetToWorldOrigin() {
|
|
1398
|
-
var _a;
|
|
1399
|
-
this.position.set(0, 0, 0);
|
|
1400
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1401
|
-
}
|
|
1402
1386
|
PlaceOnFloor() {
|
|
1403
1387
|
var _a;
|
|
1404
1388
|
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
@@ -1428,18 +1412,6 @@ var DIVEPrimitive = class extends Object3D6 {
|
|
|
1428
1412
|
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1429
1413
|
}
|
|
1430
1414
|
}
|
|
1431
|
-
onMove() {
|
|
1432
|
-
var _a;
|
|
1433
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1434
|
-
}
|
|
1435
|
-
onSelect() {
|
|
1436
|
-
var _a;
|
|
1437
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
|
|
1438
|
-
}
|
|
1439
|
-
onDeselect() {
|
|
1440
|
-
var _a;
|
|
1441
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
|
|
1442
|
-
}
|
|
1443
1415
|
assembleGeometry(geometry) {
|
|
1444
1416
|
switch (geometry.name) {
|
|
1445
1417
|
case "cylinder":
|
|
@@ -1498,34 +1470,16 @@ var DIVEPrimitive = class extends Object3D6 {
|
|
|
1498
1470
|
};
|
|
1499
1471
|
|
|
1500
1472
|
// src/group/Group.ts
|
|
1501
|
-
import {
|
|
1502
|
-
var DIVEGroup = class extends
|
|
1473
|
+
import { BoxGeometry as BoxGeometry2, Mesh as Mesh4, MeshBasicMaterial as MeshBasicMaterial2, Vector3 as Vector34 } from "three";
|
|
1474
|
+
var DIVEGroup = class extends DIVENode {
|
|
1503
1475
|
constructor() {
|
|
1504
1476
|
super();
|
|
1505
1477
|
this.isDIVEGroup = true;
|
|
1506
|
-
this.isSelectable = true;
|
|
1507
|
-
this.isMoveable = true;
|
|
1508
1478
|
this.name = "DIVEGroup";
|
|
1509
|
-
this._bb = new Box33();
|
|
1510
1479
|
this._boxMesh = new Mesh4(new BoxGeometry2(0, 0, 0), new MeshBasicMaterial2({ color: 16711680, wireframe: true }));
|
|
1511
1480
|
this._boxMesh.visible = false;
|
|
1512
1481
|
this.add(this._boxMesh);
|
|
1513
1482
|
}
|
|
1514
|
-
SetPosition(position) {
|
|
1515
|
-
this.position.set(position.x, position.y, position.z);
|
|
1516
|
-
}
|
|
1517
|
-
SetRotation(rotation) {
|
|
1518
|
-
this.rotation.setFromVector3(new Vector34(rotation.x, rotation.y, rotation.z));
|
|
1519
|
-
}
|
|
1520
|
-
SetScale(scale) {
|
|
1521
|
-
this.scale.set(scale.x, scale.y, scale.z);
|
|
1522
|
-
}
|
|
1523
|
-
SetVisibility(visible) {
|
|
1524
|
-
this.traverse((child) => {
|
|
1525
|
-
if (child.uuid === this._boxMesh.uuid) return;
|
|
1526
|
-
child.visible = visible;
|
|
1527
|
-
});
|
|
1528
|
-
}
|
|
1529
1483
|
SetBoundingBoxVisibility(visible) {
|
|
1530
1484
|
this._boxMesh.visible = visible;
|
|
1531
1485
|
}
|
|
@@ -1561,32 +1515,27 @@ var DIVEGroup = class extends Object3D7 {
|
|
|
1561
1515
|
* @returns {Vector3} The new center of the bounding box.
|
|
1562
1516
|
*/
|
|
1563
1517
|
updateBB() {
|
|
1564
|
-
this.
|
|
1518
|
+
this._boundingBox.makeEmpty();
|
|
1565
1519
|
this.children.forEach((child) => {
|
|
1566
1520
|
if (child.uuid === this._boxMesh.uuid) return;
|
|
1567
|
-
this.
|
|
1521
|
+
this._boundingBox.expandByObject(child);
|
|
1568
1522
|
});
|
|
1569
|
-
return this.
|
|
1523
|
+
return this._boundingBox.getCenter(new Vector34());
|
|
1570
1524
|
}
|
|
1571
1525
|
updateBoxMesh() {
|
|
1572
|
-
this._boxMesh.
|
|
1526
|
+
this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
|
|
1527
|
+
this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
|
|
1528
|
+
this._boxMesh.geometry = new BoxGeometry2(this._boundingBox.max.x - this._boundingBox.min.x, this._boundingBox.max.y - this._boundingBox.min.y, this._boundingBox.max.z - this._boundingBox.min.z);
|
|
1573
1529
|
}
|
|
1574
1530
|
onMove() {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
onSelect() {
|
|
1579
|
-
var _a;
|
|
1580
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
|
|
1581
|
-
}
|
|
1582
|
-
onDeselect() {
|
|
1583
|
-
var _a;
|
|
1584
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
|
|
1531
|
+
super.onMove();
|
|
1532
|
+
this.updateBB();
|
|
1533
|
+
this.updateBoxMesh();
|
|
1585
1534
|
}
|
|
1586
1535
|
};
|
|
1587
1536
|
|
|
1588
1537
|
// src/scene/root/Root.ts
|
|
1589
|
-
var DIVERoot = class extends
|
|
1538
|
+
var DIVERoot = class extends Object3D6 {
|
|
1590
1539
|
constructor() {
|
|
1591
1540
|
super();
|
|
1592
1541
|
this.isDIVERoot = true;
|
|
@@ -1594,7 +1543,7 @@ var DIVERoot = class extends Object3D8 {
|
|
|
1594
1543
|
this.loadingManager = new DIVELoadingManager();
|
|
1595
1544
|
}
|
|
1596
1545
|
ComputeSceneBB() {
|
|
1597
|
-
const bb = new
|
|
1546
|
+
const bb = new Box32();
|
|
1598
1547
|
this.traverse((object) => {
|
|
1599
1548
|
if ("isObject3D" in object) {
|
|
1600
1549
|
bb.expandByObject(object);
|
|
@@ -1855,8 +1804,8 @@ var GRID_SIDE_LINE_COLOR = "#dddddd";
|
|
|
1855
1804
|
|
|
1856
1805
|
// src/grid/Grid.ts
|
|
1857
1806
|
init_VisibilityLayerMask();
|
|
1858
|
-
import { GridHelper, Object3D as
|
|
1859
|
-
var DIVEGrid = class extends
|
|
1807
|
+
import { GridHelper, Object3D as Object3D7 } from "three";
|
|
1808
|
+
var DIVEGrid = class extends Object3D7 {
|
|
1860
1809
|
constructor() {
|
|
1861
1810
|
super();
|
|
1862
1811
|
this.name = "Grid";
|