@shopware-ag/dive 1.16.7 → 1.16.8
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 +90 -20
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +76 -72
- package/build/dive.d.ts +76 -72
- package/build/dive.js +106 -34
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/actions/scene/getallscenedata.ts +2 -25
- package/src/com/types/COMLight.ts +1 -0
- package/src/dive.ts +1 -0
- package/src/model/Model.ts +21 -5
- package/src/model/__test__/Model.test.ts +34 -4
- package/src/node/Node.ts +18 -8
- package/src/node/__test__/Node.test.ts +35 -3
- package/src/primitive/Primitive.ts +56 -15
- package/src/primitive/__test__/Primitive.test.ts +39 -1
- package/src/scene/root/__test__/Root.test.ts +39 -0
- package/src/types/SceneData.ts +26 -0
- package/src/types/index.ts +2 -1
package/build/dive.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster
|
|
1
|
+
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Vector3, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster } from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
4
|
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
@@ -235,6 +235,7 @@ type COMLight = COMBaseEntity & {
|
|
|
235
235
|
color: string | number;
|
|
236
236
|
enabled: boolean;
|
|
237
237
|
position?: Vector3Like;
|
|
238
|
+
rotation?: Vector3Like;
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
type COMMaterial = {
|
|
@@ -354,76 +355,6 @@ interface GENERATE_MEDIA {
|
|
|
354
355
|
RETURN: boolean;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
|
-
type SceneData = {
|
|
358
|
-
name: string;
|
|
359
|
-
mediaItem: null;
|
|
360
|
-
backgroundColor: string;
|
|
361
|
-
floorEnabled: boolean;
|
|
362
|
-
floorColor: string;
|
|
363
|
-
userCamera: {
|
|
364
|
-
position: Vector3Like;
|
|
365
|
-
target: Vector3Like;
|
|
366
|
-
};
|
|
367
|
-
spotmarks: object[];
|
|
368
|
-
lights: COMLight[];
|
|
369
|
-
objects: COMModel[];
|
|
370
|
-
cameras: COMPov[];
|
|
371
|
-
primitives: COMPrimitive[];
|
|
372
|
-
};
|
|
373
|
-
interface GET_ALL_SCENE_DATA {
|
|
374
|
-
DESCRIPTION: 'Retrieves all current scene data.';
|
|
375
|
-
PAYLOAD: object;
|
|
376
|
-
RETURN: SceneData;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
interface SELECT_OBJECT {
|
|
380
|
-
DESCRIPTION: 'Selects an existing object.';
|
|
381
|
-
PAYLOAD: Partial<COMEntity> & {
|
|
382
|
-
id: string;
|
|
383
|
-
};
|
|
384
|
-
RETURN: boolean;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
interface DESELECT_OBJECT {
|
|
388
|
-
DESCRIPTION: 'Deselects an existing object.';
|
|
389
|
-
PAYLOAD: Partial<COMEntity> & {
|
|
390
|
-
id: string;
|
|
391
|
-
};
|
|
392
|
-
RETURN: boolean;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface GET_CAMERA_TRANSFORM {
|
|
396
|
-
DESCRIPTION: 'Returns the current camera position and target.';
|
|
397
|
-
PAYLOAD: object;
|
|
398
|
-
RETURN: {
|
|
399
|
-
position: Vector3Like;
|
|
400
|
-
target: Vector3Like;
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
interface DROP_IT {
|
|
405
|
-
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
406
|
-
PAYLOAD: {
|
|
407
|
-
id: string;
|
|
408
|
-
};
|
|
409
|
-
RETURN: boolean;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface SET_GIZMO_VISIBILITY {
|
|
413
|
-
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
414
|
-
PAYLOAD: boolean;
|
|
415
|
-
RETURN: boolean;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
419
|
-
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
420
|
-
PAYLOAD: object;
|
|
421
|
-
RETURN: {
|
|
422
|
-
position: Vector3Like;
|
|
423
|
-
target: Vector3Like;
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
358
|
/**
|
|
428
359
|
* Interface for objects that can be moved in the scene.
|
|
429
360
|
*
|
|
@@ -452,6 +383,7 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
|
|
|
452
383
|
readonly isSelectable: true;
|
|
453
384
|
readonly isMovable: true;
|
|
454
385
|
gizmo: TransformControls | null;
|
|
386
|
+
protected _positionWorldBuffer: Vector3;
|
|
455
387
|
protected _boundingBox: Box3;
|
|
456
388
|
constructor();
|
|
457
389
|
SetPosition(position: Vector3Like): void;
|
|
@@ -596,6 +528,78 @@ type DIVESceneFileType = {
|
|
|
596
528
|
glb: GLTF$1;
|
|
597
529
|
};
|
|
598
530
|
|
|
531
|
+
type DIVESceneData = {
|
|
532
|
+
name: string;
|
|
533
|
+
mediaItem: null;
|
|
534
|
+
backgroundColor: string;
|
|
535
|
+
floorEnabled: boolean;
|
|
536
|
+
floorColor: string;
|
|
537
|
+
userCamera: {
|
|
538
|
+
position: Vector3Like;
|
|
539
|
+
target: Vector3Like;
|
|
540
|
+
};
|
|
541
|
+
spotmarks: object[];
|
|
542
|
+
lights: COMLight[];
|
|
543
|
+
objects: COMModel[];
|
|
544
|
+
cameras: COMPov[];
|
|
545
|
+
primitives: COMPrimitive[];
|
|
546
|
+
groups: COMGroup[];
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
interface GET_ALL_SCENE_DATA {
|
|
550
|
+
DESCRIPTION: 'Retrieves all current scene data.';
|
|
551
|
+
PAYLOAD: object;
|
|
552
|
+
RETURN: DIVESceneData;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
interface SELECT_OBJECT {
|
|
556
|
+
DESCRIPTION: 'Selects an existing object.';
|
|
557
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
RETURN: boolean;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface DESELECT_OBJECT {
|
|
564
|
+
DESCRIPTION: 'Deselects an existing object.';
|
|
565
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
566
|
+
id: string;
|
|
567
|
+
};
|
|
568
|
+
RETURN: boolean;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
interface GET_CAMERA_TRANSFORM {
|
|
572
|
+
DESCRIPTION: 'Returns the current camera position and target.';
|
|
573
|
+
PAYLOAD: object;
|
|
574
|
+
RETURN: {
|
|
575
|
+
position: Vector3Like;
|
|
576
|
+
target: Vector3Like;
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
interface DROP_IT {
|
|
581
|
+
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
582
|
+
PAYLOAD: {
|
|
583
|
+
id: string;
|
|
584
|
+
};
|
|
585
|
+
RETURN: boolean;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface SET_GIZMO_VISIBILITY {
|
|
589
|
+
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
590
|
+
PAYLOAD: boolean;
|
|
591
|
+
RETURN: boolean;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
595
|
+
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
596
|
+
PAYLOAD: object;
|
|
597
|
+
RETURN: {
|
|
598
|
+
position: Vector3Like;
|
|
599
|
+
target: Vector3Like;
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
599
603
|
/**
|
|
600
604
|
* A basic scene node to hold grid, floor and all lower level roots.
|
|
601
605
|
*
|
|
@@ -1065,4 +1069,4 @@ declare class DIVE {
|
|
|
1065
1069
|
private removeResizeObserver;
|
|
1066
1070
|
}
|
|
1067
1071
|
|
|
1068
|
-
export { type Actions, type COMEntity, type COMEntityType, type COMGeometry, type COMGeometryType, type COMGroup, type COMLight, type COMMaterial, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|
|
1072
|
+
export { type Actions, type COMEntity, type COMEntityType, type COMGeometry, type COMGeometryType, type COMGroup, type COMLight, type COMMaterial, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESceneData, type DIVESceneFileType, type DIVESceneObject, type DIVESettings, DIVE as default };
|
package/build/dive.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster
|
|
1
|
+
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Vector3, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster } from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
4
|
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
@@ -235,6 +235,7 @@ type COMLight = COMBaseEntity & {
|
|
|
235
235
|
color: string | number;
|
|
236
236
|
enabled: boolean;
|
|
237
237
|
position?: Vector3Like;
|
|
238
|
+
rotation?: Vector3Like;
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
type COMMaterial = {
|
|
@@ -354,76 +355,6 @@ interface GENERATE_MEDIA {
|
|
|
354
355
|
RETURN: boolean;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
|
-
type SceneData = {
|
|
358
|
-
name: string;
|
|
359
|
-
mediaItem: null;
|
|
360
|
-
backgroundColor: string;
|
|
361
|
-
floorEnabled: boolean;
|
|
362
|
-
floorColor: string;
|
|
363
|
-
userCamera: {
|
|
364
|
-
position: Vector3Like;
|
|
365
|
-
target: Vector3Like;
|
|
366
|
-
};
|
|
367
|
-
spotmarks: object[];
|
|
368
|
-
lights: COMLight[];
|
|
369
|
-
objects: COMModel[];
|
|
370
|
-
cameras: COMPov[];
|
|
371
|
-
primitives: COMPrimitive[];
|
|
372
|
-
};
|
|
373
|
-
interface GET_ALL_SCENE_DATA {
|
|
374
|
-
DESCRIPTION: 'Retrieves all current scene data.';
|
|
375
|
-
PAYLOAD: object;
|
|
376
|
-
RETURN: SceneData;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
interface SELECT_OBJECT {
|
|
380
|
-
DESCRIPTION: 'Selects an existing object.';
|
|
381
|
-
PAYLOAD: Partial<COMEntity> & {
|
|
382
|
-
id: string;
|
|
383
|
-
};
|
|
384
|
-
RETURN: boolean;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
interface DESELECT_OBJECT {
|
|
388
|
-
DESCRIPTION: 'Deselects an existing object.';
|
|
389
|
-
PAYLOAD: Partial<COMEntity> & {
|
|
390
|
-
id: string;
|
|
391
|
-
};
|
|
392
|
-
RETURN: boolean;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface GET_CAMERA_TRANSFORM {
|
|
396
|
-
DESCRIPTION: 'Returns the current camera position and target.';
|
|
397
|
-
PAYLOAD: object;
|
|
398
|
-
RETURN: {
|
|
399
|
-
position: Vector3Like;
|
|
400
|
-
target: Vector3Like;
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
interface DROP_IT {
|
|
405
|
-
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
406
|
-
PAYLOAD: {
|
|
407
|
-
id: string;
|
|
408
|
-
};
|
|
409
|
-
RETURN: boolean;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface SET_GIZMO_VISIBILITY {
|
|
413
|
-
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
414
|
-
PAYLOAD: boolean;
|
|
415
|
-
RETURN: boolean;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
419
|
-
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
420
|
-
PAYLOAD: object;
|
|
421
|
-
RETURN: {
|
|
422
|
-
position: Vector3Like;
|
|
423
|
-
target: Vector3Like;
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
358
|
/**
|
|
428
359
|
* Interface for objects that can be moved in the scene.
|
|
429
360
|
*
|
|
@@ -452,6 +383,7 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
|
|
|
452
383
|
readonly isSelectable: true;
|
|
453
384
|
readonly isMovable: true;
|
|
454
385
|
gizmo: TransformControls | null;
|
|
386
|
+
protected _positionWorldBuffer: Vector3;
|
|
455
387
|
protected _boundingBox: Box3;
|
|
456
388
|
constructor();
|
|
457
389
|
SetPosition(position: Vector3Like): void;
|
|
@@ -596,6 +528,78 @@ type DIVESceneFileType = {
|
|
|
596
528
|
glb: GLTF$1;
|
|
597
529
|
};
|
|
598
530
|
|
|
531
|
+
type DIVESceneData = {
|
|
532
|
+
name: string;
|
|
533
|
+
mediaItem: null;
|
|
534
|
+
backgroundColor: string;
|
|
535
|
+
floorEnabled: boolean;
|
|
536
|
+
floorColor: string;
|
|
537
|
+
userCamera: {
|
|
538
|
+
position: Vector3Like;
|
|
539
|
+
target: Vector3Like;
|
|
540
|
+
};
|
|
541
|
+
spotmarks: object[];
|
|
542
|
+
lights: COMLight[];
|
|
543
|
+
objects: COMModel[];
|
|
544
|
+
cameras: COMPov[];
|
|
545
|
+
primitives: COMPrimitive[];
|
|
546
|
+
groups: COMGroup[];
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
interface GET_ALL_SCENE_DATA {
|
|
550
|
+
DESCRIPTION: 'Retrieves all current scene data.';
|
|
551
|
+
PAYLOAD: object;
|
|
552
|
+
RETURN: DIVESceneData;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
interface SELECT_OBJECT {
|
|
556
|
+
DESCRIPTION: 'Selects an existing object.';
|
|
557
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
RETURN: boolean;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface DESELECT_OBJECT {
|
|
564
|
+
DESCRIPTION: 'Deselects an existing object.';
|
|
565
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
566
|
+
id: string;
|
|
567
|
+
};
|
|
568
|
+
RETURN: boolean;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
interface GET_CAMERA_TRANSFORM {
|
|
572
|
+
DESCRIPTION: 'Returns the current camera position and target.';
|
|
573
|
+
PAYLOAD: object;
|
|
574
|
+
RETURN: {
|
|
575
|
+
position: Vector3Like;
|
|
576
|
+
target: Vector3Like;
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
interface DROP_IT {
|
|
581
|
+
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
582
|
+
PAYLOAD: {
|
|
583
|
+
id: string;
|
|
584
|
+
};
|
|
585
|
+
RETURN: boolean;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface SET_GIZMO_VISIBILITY {
|
|
589
|
+
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
590
|
+
PAYLOAD: boolean;
|
|
591
|
+
RETURN: boolean;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
595
|
+
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
596
|
+
PAYLOAD: object;
|
|
597
|
+
RETURN: {
|
|
598
|
+
position: Vector3Like;
|
|
599
|
+
target: Vector3Like;
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
599
603
|
/**
|
|
600
604
|
* A basic scene node to hold grid, floor and all lower level roots.
|
|
601
605
|
*
|
|
@@ -1065,4 +1069,4 @@ declare class DIVE {
|
|
|
1065
1069
|
private removeResizeObserver;
|
|
1066
1070
|
}
|
|
1067
1071
|
|
|
1068
|
-
export { type Actions, type COMEntity, type COMEntityType, type COMGeometry, type COMGeometryType, type COMGroup, type COMLight, type COMMaterial, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|
|
1072
|
+
export { type Actions, type COMEntity, type COMEntityType, type COMGeometry, type COMGeometryType, type COMGroup, type COMLight, type COMMaterial, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESceneData, type DIVESceneFileType, type DIVESceneObject, type DIVESettings, DIVE as default };
|
package/build/dive.js
CHANGED
|
@@ -1401,7 +1401,7 @@ var DIVESceneLight = class extends Object3D4 {
|
|
|
1401
1401
|
|
|
1402
1402
|
// src/model/Model.ts
|
|
1403
1403
|
init_VisibilityLayerMask();
|
|
1404
|
-
import { MeshStandardMaterial, Raycaster as Raycaster2, Vector3 as
|
|
1404
|
+
import { MeshStandardMaterial, Raycaster as Raycaster2, Vector3 as Vector33 } from "three";
|
|
1405
1405
|
|
|
1406
1406
|
// src/helper/findSceneRecursive/findSceneRecursive.ts
|
|
1407
1407
|
var findSceneRecursive = (object) => {
|
|
@@ -1413,7 +1413,7 @@ var findSceneRecursive = (object) => {
|
|
|
1413
1413
|
|
|
1414
1414
|
// src/node/Node.ts
|
|
1415
1415
|
init_VisibilityLayerMask();
|
|
1416
|
-
import { Box3, Object3D as Object3D5 } from "three";
|
|
1416
|
+
import { Box3, Object3D as Object3D5, Vector3 as Vector32 } from "three";
|
|
1417
1417
|
var DIVENode = class extends Object3D5 {
|
|
1418
1418
|
constructor() {
|
|
1419
1419
|
super();
|
|
@@ -1422,10 +1422,19 @@ var DIVENode = class extends Object3D5 {
|
|
|
1422
1422
|
this.isMovable = true;
|
|
1423
1423
|
this.gizmo = null;
|
|
1424
1424
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1425
|
+
this._positionWorldBuffer = new Vector32();
|
|
1425
1426
|
this._boundingBox = new Box3();
|
|
1426
1427
|
}
|
|
1427
1428
|
SetPosition(position) {
|
|
1428
|
-
this.
|
|
1429
|
+
if (!this.parent) {
|
|
1430
|
+
this.position.set(position.x, position.y, position.z);
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
const newPosition = new Vector32(position.x, position.y, position.z);
|
|
1434
|
+
this.position.copy(this.parent.worldToLocal(newPosition));
|
|
1435
|
+
if ("isDIVEGroup" in this.parent) {
|
|
1436
|
+
this.parent.UpdateLineTo(this);
|
|
1437
|
+
}
|
|
1429
1438
|
}
|
|
1430
1439
|
SetRotation(rotation) {
|
|
1431
1440
|
this.rotation.set(rotation.x, rotation.y, rotation.z);
|
|
@@ -1443,7 +1452,7 @@ var DIVENode = class extends Object3D5 {
|
|
|
1443
1452
|
"UPDATE_OBJECT",
|
|
1444
1453
|
{
|
|
1445
1454
|
id: this.userData.id,
|
|
1446
|
-
position: this.
|
|
1455
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
1447
1456
|
rotation: this.rotation,
|
|
1448
1457
|
scale: this.scale
|
|
1449
1458
|
}
|
|
@@ -1455,14 +1464,11 @@ var DIVENode = class extends Object3D5 {
|
|
|
1455
1464
|
"UPDATE_OBJECT",
|
|
1456
1465
|
{
|
|
1457
1466
|
id: this.userData.id,
|
|
1458
|
-
position: this.
|
|
1467
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
1459
1468
|
rotation: this.rotation,
|
|
1460
1469
|
scale: this.scale
|
|
1461
1470
|
}
|
|
1462
1471
|
);
|
|
1463
|
-
if (this.parent && "isDIVEGroup" in this.parent) {
|
|
1464
|
-
this.parent.UpdateLineTo(this);
|
|
1465
|
-
}
|
|
1466
1472
|
}
|
|
1467
1473
|
onSelect() {
|
|
1468
1474
|
var _a;
|
|
@@ -1490,6 +1496,7 @@ var DIVEModel = class extends DIVENode {
|
|
|
1490
1496
|
}
|
|
1491
1497
|
SetModel(gltf) {
|
|
1492
1498
|
this.clear();
|
|
1499
|
+
this._boundingBox.makeEmpty();
|
|
1493
1500
|
gltf.scene.traverse((child) => {
|
|
1494
1501
|
child.castShadow = true;
|
|
1495
1502
|
child.receiveShadow = true;
|
|
@@ -1545,10 +1552,20 @@ var DIVEModel = class extends DIVENode {
|
|
|
1545
1552
|
}
|
|
1546
1553
|
}
|
|
1547
1554
|
PlaceOnFloor() {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
this.
|
|
1555
|
+
var _a;
|
|
1556
|
+
const worldPos = this.getWorldPosition(this._positionWorldBuffer);
|
|
1557
|
+
const oldWorldPos = worldPos.clone();
|
|
1558
|
+
worldPos.y = -this._boundingBox.min.y * this.scale.y;
|
|
1559
|
+
if (worldPos.y === oldWorldPos.y) return;
|
|
1560
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1561
|
+
"UPDATE_OBJECT",
|
|
1562
|
+
{
|
|
1563
|
+
id: this.userData.id,
|
|
1564
|
+
position: worldPos,
|
|
1565
|
+
rotation: this.rotation,
|
|
1566
|
+
scale: this.scale
|
|
1567
|
+
}
|
|
1568
|
+
);
|
|
1552
1569
|
}
|
|
1553
1570
|
DropIt() {
|
|
1554
1571
|
if (!this.parent) {
|
|
@@ -1560,10 +1577,10 @@ var DIVEModel = class extends DIVENode {
|
|
|
1560
1577
|
}
|
|
1561
1578
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1562
1579
|
const bbBottomCenter = this.localToWorld(
|
|
1563
|
-
this._boundingBox.getCenter(new
|
|
1580
|
+
this._boundingBox.getCenter(new Vector33()).multiply(this.scale)
|
|
1564
1581
|
);
|
|
1565
1582
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1566
|
-
const raycaster = new Raycaster2(bbBottomCenter, new
|
|
1583
|
+
const raycaster = new Raycaster2(bbBottomCenter, new Vector33(0, -1, 0));
|
|
1567
1584
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1568
1585
|
const intersections = raycaster.intersectObjects(
|
|
1569
1586
|
findSceneRecursive(this).Root.children,
|
|
@@ -1575,7 +1592,7 @@ var DIVEModel = class extends DIVENode {
|
|
|
1575
1592
|
const meshBB = mesh.geometry.boundingBox;
|
|
1576
1593
|
const worldPos = mesh.localToWorld(meshBB.max.clone());
|
|
1577
1594
|
const oldPos = this.position.clone();
|
|
1578
|
-
const newPos = this.position.clone().setY(worldPos.y).sub(new
|
|
1595
|
+
const newPos = this.position.clone().setY(worldPos.y).sub(new Vector33(0, bottomY, 0));
|
|
1579
1596
|
this.position.copy(newPos);
|
|
1580
1597
|
if (this.position.y === oldPos.y) return;
|
|
1581
1598
|
this.onMove();
|
|
@@ -1621,6 +1638,8 @@ var DIVELoadingManager = class {
|
|
|
1621
1638
|
init_VisibilityLayerMask();
|
|
1622
1639
|
import {
|
|
1623
1640
|
BoxGeometry,
|
|
1641
|
+
BufferAttribute,
|
|
1642
|
+
BufferGeometry,
|
|
1624
1643
|
Color as Color4,
|
|
1625
1644
|
ConeGeometry,
|
|
1626
1645
|
CylinderGeometry,
|
|
@@ -1628,7 +1647,7 @@ import {
|
|
|
1628
1647
|
MeshStandardMaterial as MeshStandardMaterial2,
|
|
1629
1648
|
Raycaster as Raycaster3,
|
|
1630
1649
|
SphereGeometry as SphereGeometry2,
|
|
1631
|
-
Vector3 as
|
|
1650
|
+
Vector3 as Vector34
|
|
1632
1651
|
} from "three";
|
|
1633
1652
|
var DIVEPrimitive = class extends DIVENode {
|
|
1634
1653
|
constructor() {
|
|
@@ -1682,10 +1701,20 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1682
1701
|
if (this._mesh) this._mesh.material = primitiveMaterial;
|
|
1683
1702
|
}
|
|
1684
1703
|
PlaceOnFloor() {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
this.
|
|
1704
|
+
var _a;
|
|
1705
|
+
const worldPos = this.getWorldPosition(this._positionWorldBuffer);
|
|
1706
|
+
const oldWorldPos = worldPos.clone();
|
|
1707
|
+
worldPos.y = -this._boundingBox.min.y * this.scale.y;
|
|
1708
|
+
if (worldPos.y === oldWorldPos.y) return;
|
|
1709
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1710
|
+
"UPDATE_OBJECT",
|
|
1711
|
+
{
|
|
1712
|
+
id: this.userData.id,
|
|
1713
|
+
position: worldPos,
|
|
1714
|
+
rotation: this.rotation,
|
|
1715
|
+
scale: this.scale
|
|
1716
|
+
}
|
|
1717
|
+
);
|
|
1689
1718
|
}
|
|
1690
1719
|
DropIt() {
|
|
1691
1720
|
if (!this.parent) {
|
|
@@ -1697,10 +1726,10 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1697
1726
|
}
|
|
1698
1727
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1699
1728
|
const bbBottomCenter = this.localToWorld(
|
|
1700
|
-
this._boundingBox.getCenter(new
|
|
1729
|
+
this._boundingBox.getCenter(new Vector34()).multiply(this.scale)
|
|
1701
1730
|
);
|
|
1702
1731
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1703
|
-
const raycaster = new Raycaster3(bbBottomCenter, new
|
|
1732
|
+
const raycaster = new Raycaster3(bbBottomCenter, new Vector34(0, -1, 0));
|
|
1704
1733
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1705
1734
|
const intersections = raycaster.intersectObjects(
|
|
1706
1735
|
findSceneRecursive(this).Root.children,
|
|
@@ -1712,19 +1741,21 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1712
1741
|
const meshBB = mesh.geometry.boundingBox;
|
|
1713
1742
|
const worldPos = mesh.localToWorld(meshBB.max.clone());
|
|
1714
1743
|
const oldPos = this.position.clone();
|
|
1715
|
-
const newPos = this.position.clone().setY(worldPos.y).sub(new
|
|
1744
|
+
const newPos = this.position.clone().setY(worldPos.y).sub(new Vector34(0, bottomY, 0));
|
|
1716
1745
|
this.position.copy(newPos);
|
|
1717
1746
|
if (this.position.y === oldPos.y) return;
|
|
1718
1747
|
this.onMove();
|
|
1719
1748
|
}
|
|
1720
1749
|
}
|
|
1721
1750
|
assembleGeometry(geometry) {
|
|
1751
|
+
this._mesh.material.flatShading = false;
|
|
1722
1752
|
switch (geometry.name.toLowerCase()) {
|
|
1723
1753
|
case "cylinder":
|
|
1724
1754
|
return this.createCylinderGeometry(geometry);
|
|
1725
1755
|
case "sphere":
|
|
1726
1756
|
return this.createSphereGeometry(geometry);
|
|
1727
1757
|
case "pyramid":
|
|
1758
|
+
this._mesh.material.flatShading = true;
|
|
1728
1759
|
return this.createPyramidGeometry(geometry);
|
|
1729
1760
|
case "cube":
|
|
1730
1761
|
case "box":
|
|
@@ -1759,16 +1790,57 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1759
1790
|
return geo;
|
|
1760
1791
|
}
|
|
1761
1792
|
createPyramidGeometry(geometry) {
|
|
1762
|
-
const
|
|
1793
|
+
const vertices = new Float32Array([
|
|
1794
|
+
-geometry.width / 2,
|
|
1795
|
+
0,
|
|
1796
|
+
-geometry.depth / 2,
|
|
1797
|
+
// 0
|
|
1798
|
+
geometry.width / 2,
|
|
1799
|
+
0,
|
|
1800
|
+
-geometry.depth / 2,
|
|
1801
|
+
// 1
|
|
1763
1802
|
geometry.width / 2,
|
|
1803
|
+
0,
|
|
1804
|
+
geometry.depth / 2,
|
|
1805
|
+
// 2
|
|
1806
|
+
-geometry.width / 2,
|
|
1807
|
+
0,
|
|
1808
|
+
geometry.depth / 2,
|
|
1809
|
+
// 3
|
|
1810
|
+
0,
|
|
1764
1811
|
geometry.height,
|
|
1812
|
+
0
|
|
1813
|
+
]);
|
|
1814
|
+
const indices = new Uint16Array([
|
|
1815
|
+
0,
|
|
1816
|
+
1,
|
|
1817
|
+
2,
|
|
1818
|
+
0,
|
|
1819
|
+
2,
|
|
1820
|
+
3,
|
|
1821
|
+
0,
|
|
1765
1822
|
4,
|
|
1766
1823
|
1,
|
|
1767
|
-
|
|
1824
|
+
1,
|
|
1825
|
+
4,
|
|
1826
|
+
2,
|
|
1827
|
+
2,
|
|
1828
|
+
4,
|
|
1829
|
+
3,
|
|
1830
|
+
3,
|
|
1831
|
+
4,
|
|
1832
|
+
0
|
|
1833
|
+
]);
|
|
1834
|
+
const geometryBuffer = new BufferGeometry();
|
|
1835
|
+
geometryBuffer.setAttribute(
|
|
1836
|
+
"position",
|
|
1837
|
+
new BufferAttribute(vertices, 3)
|
|
1768
1838
|
);
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1839
|
+
geometryBuffer.setIndex(new BufferAttribute(indices, 1));
|
|
1840
|
+
geometryBuffer.computeVertexNormals();
|
|
1841
|
+
geometryBuffer.computeBoundingBox();
|
|
1842
|
+
geometryBuffer.computeBoundingSphere();
|
|
1843
|
+
return geometryBuffer;
|
|
1772
1844
|
}
|
|
1773
1845
|
createBoxGeometry(geometry) {
|
|
1774
1846
|
const geo = new BoxGeometry(
|
|
@@ -1806,7 +1878,7 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1806
1878
|
};
|
|
1807
1879
|
|
|
1808
1880
|
// src/group/Group.ts
|
|
1809
|
-
import { BufferGeometry as BufferGeometry2, Line, LineDashedMaterial, Vector3 as
|
|
1881
|
+
import { BufferGeometry as BufferGeometry2, Line, LineDashedMaterial, Vector3 as Vector35 } from "three";
|
|
1810
1882
|
var DIVEGroup = class extends DIVENode {
|
|
1811
1883
|
// lines to children
|
|
1812
1884
|
constructor() {
|
|
@@ -1871,7 +1943,7 @@ var DIVEGroup = class extends DIVENode {
|
|
|
1871
1943
|
*/
|
|
1872
1944
|
updateLineTo(line, object) {
|
|
1873
1945
|
line.geometry.setFromPoints([
|
|
1874
|
-
new
|
|
1946
|
+
new Vector35(0, 0, 0),
|
|
1875
1947
|
object.position.clone()
|
|
1876
1948
|
]);
|
|
1877
1949
|
line.computeLineDistances();
|
|
@@ -2368,7 +2440,7 @@ init_PerspectiveCamera();
|
|
|
2368
2440
|
|
|
2369
2441
|
// src/controls/OrbitControls.ts
|
|
2370
2442
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
|
|
2371
|
-
import { MathUtils as MathUtils2, Vector3 as
|
|
2443
|
+
import { MathUtils as MathUtils2, Vector3 as Vector36 } from "three";
|
|
2372
2444
|
import { Easing } from "@tweenjs/tween.js";
|
|
2373
2445
|
var DIVEOrbitControlsDefaultSettings = {
|
|
2374
2446
|
enableDamping: true,
|
|
@@ -2410,8 +2482,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
|
|
|
2410
2482
|
this.dispose();
|
|
2411
2483
|
}
|
|
2412
2484
|
ComputeEncompassingView(bb) {
|
|
2413
|
-
const center = bb.getCenter(new
|
|
2414
|
-
const size = bb.getSize(new
|
|
2485
|
+
const center = bb.getCenter(new Vector36());
|
|
2486
|
+
const size = bb.getSize(new Vector36());
|
|
2415
2487
|
const distance = Math.max(size.x, size.y, size.z) * 1.25;
|
|
2416
2488
|
const direction = this.object.position.clone().normalize();
|
|
2417
2489
|
return {
|
|
@@ -2859,7 +2931,7 @@ DIVEInfo._supportsWebXR = null;
|
|
|
2859
2931
|
// package.json
|
|
2860
2932
|
var package_default = {
|
|
2861
2933
|
name: "@shopware-ag/dive",
|
|
2862
|
-
version: "1.16.
|
|
2934
|
+
version: "1.16.8",
|
|
2863
2935
|
description: "Shopware Spatial Framework",
|
|
2864
2936
|
type: "module",
|
|
2865
2937
|
main: "./build/dive.cjs",
|