@shopware-ag/dive 1.16.7 → 1.16.9

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.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, Vector3 } from 'three';
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;
@@ -459,6 +391,9 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
459
391
  SetScale(scale: Vector3Like): void;
460
392
  SetVisibility(visible: boolean): void;
461
393
  SetToWorldOrigin(): void;
394
+ /**
395
+ * Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
396
+ */
462
397
  onMove(): void;
463
398
  onSelect(): void;
464
399
  onDeselect(): void;
@@ -469,6 +404,7 @@ declare class DIVEGroup extends DIVENode {
469
404
  private _members;
470
405
  private _lines;
471
406
  constructor();
407
+ SetPosition(position: Vector3Like): void;
472
408
  SetLinesVisibility(visible: boolean, object?: Object3D): void;
473
409
  attach(object: DIVESceneObject): this;
474
410
  remove(object: DIVESceneObject): this;
@@ -596,6 +532,78 @@ type DIVESceneFileType = {
596
532
  glb: GLTF$1;
597
533
  };
598
534
 
535
+ type DIVESceneData = {
536
+ name: string;
537
+ mediaItem: null;
538
+ backgroundColor: string;
539
+ floorEnabled: boolean;
540
+ floorColor: string;
541
+ userCamera: {
542
+ position: Vector3Like;
543
+ target: Vector3Like;
544
+ };
545
+ spotmarks: object[];
546
+ lights: COMLight[];
547
+ objects: COMModel[];
548
+ cameras: COMPov[];
549
+ primitives: COMPrimitive[];
550
+ groups: COMGroup[];
551
+ };
552
+
553
+ interface GET_ALL_SCENE_DATA {
554
+ DESCRIPTION: 'Retrieves all current scene data.';
555
+ PAYLOAD: object;
556
+ RETURN: DIVESceneData;
557
+ }
558
+
559
+ interface SELECT_OBJECT {
560
+ DESCRIPTION: 'Selects an existing object.';
561
+ PAYLOAD: Partial<COMEntity> & {
562
+ id: string;
563
+ };
564
+ RETURN: boolean;
565
+ }
566
+
567
+ interface DESELECT_OBJECT {
568
+ DESCRIPTION: 'Deselects an existing object.';
569
+ PAYLOAD: Partial<COMEntity> & {
570
+ id: string;
571
+ };
572
+ RETURN: boolean;
573
+ }
574
+
575
+ interface GET_CAMERA_TRANSFORM {
576
+ DESCRIPTION: 'Returns the current camera position and target.';
577
+ PAYLOAD: object;
578
+ RETURN: {
579
+ position: Vector3Like;
580
+ target: Vector3Like;
581
+ };
582
+ }
583
+
584
+ interface DROP_IT {
585
+ DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
586
+ PAYLOAD: {
587
+ id: string;
588
+ };
589
+ RETURN: boolean;
590
+ }
591
+
592
+ interface SET_GIZMO_VISIBILITY {
593
+ DESCRIPTION: "Sets the gizmo's visibility.";
594
+ PAYLOAD: boolean;
595
+ RETURN: boolean;
596
+ }
597
+
598
+ interface COMPUTE_ENCOMPASSING_VIEW {
599
+ DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
600
+ PAYLOAD: object;
601
+ RETURN: {
602
+ position: Vector3Like;
603
+ target: Vector3Like;
604
+ };
605
+ }
606
+
599
607
  /**
600
608
  * A basic scene node to hold grid, floor and all lower level roots.
601
609
  *
@@ -1001,6 +1009,10 @@ declare function toFixedExp(number: number, decimals?: number): string;
1001
1009
 
1002
1010
  declare function truncateExp(number: number, decimals?: number): number;
1003
1011
 
1012
+ declare function radToDeg(radians: number): number;
1013
+
1014
+ declare function degToRad(degrees: number): number;
1015
+
1004
1016
  declare const DIVEMath: {
1005
1017
  ceilExp: typeof ceilExp;
1006
1018
  floorExp: typeof floorExp;
@@ -1008,6 +1020,8 @@ declare const DIVEMath: {
1008
1020
  toFixedExp: typeof toFixedExp;
1009
1021
  truncateExp: typeof truncateExp;
1010
1022
  signedAngleTo: typeof signedAngleTo;
1023
+ radToDeg: typeof radToDeg;
1024
+ degToRad: typeof degToRad;
1011
1025
  };
1012
1026
 
1013
1027
  type DIVESettings = {
@@ -1065,4 +1079,4 @@ declare class DIVE {
1065
1079
  private removeResizeObserver;
1066
1080
  }
1067
1081
 
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 };
1082
+ 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, Vector3 } from 'three';
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;
@@ -459,6 +391,9 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
459
391
  SetScale(scale: Vector3Like): void;
460
392
  SetVisibility(visible: boolean): void;
461
393
  SetToWorldOrigin(): void;
394
+ /**
395
+ * Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
396
+ */
462
397
  onMove(): void;
463
398
  onSelect(): void;
464
399
  onDeselect(): void;
@@ -469,6 +404,7 @@ declare class DIVEGroup extends DIVENode {
469
404
  private _members;
470
405
  private _lines;
471
406
  constructor();
407
+ SetPosition(position: Vector3Like): void;
472
408
  SetLinesVisibility(visible: boolean, object?: Object3D): void;
473
409
  attach(object: DIVESceneObject): this;
474
410
  remove(object: DIVESceneObject): this;
@@ -596,6 +532,78 @@ type DIVESceneFileType = {
596
532
  glb: GLTF$1;
597
533
  };
598
534
 
535
+ type DIVESceneData = {
536
+ name: string;
537
+ mediaItem: null;
538
+ backgroundColor: string;
539
+ floorEnabled: boolean;
540
+ floorColor: string;
541
+ userCamera: {
542
+ position: Vector3Like;
543
+ target: Vector3Like;
544
+ };
545
+ spotmarks: object[];
546
+ lights: COMLight[];
547
+ objects: COMModel[];
548
+ cameras: COMPov[];
549
+ primitives: COMPrimitive[];
550
+ groups: COMGroup[];
551
+ };
552
+
553
+ interface GET_ALL_SCENE_DATA {
554
+ DESCRIPTION: 'Retrieves all current scene data.';
555
+ PAYLOAD: object;
556
+ RETURN: DIVESceneData;
557
+ }
558
+
559
+ interface SELECT_OBJECT {
560
+ DESCRIPTION: 'Selects an existing object.';
561
+ PAYLOAD: Partial<COMEntity> & {
562
+ id: string;
563
+ };
564
+ RETURN: boolean;
565
+ }
566
+
567
+ interface DESELECT_OBJECT {
568
+ DESCRIPTION: 'Deselects an existing object.';
569
+ PAYLOAD: Partial<COMEntity> & {
570
+ id: string;
571
+ };
572
+ RETURN: boolean;
573
+ }
574
+
575
+ interface GET_CAMERA_TRANSFORM {
576
+ DESCRIPTION: 'Returns the current camera position and target.';
577
+ PAYLOAD: object;
578
+ RETURN: {
579
+ position: Vector3Like;
580
+ target: Vector3Like;
581
+ };
582
+ }
583
+
584
+ interface DROP_IT {
585
+ DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
586
+ PAYLOAD: {
587
+ id: string;
588
+ };
589
+ RETURN: boolean;
590
+ }
591
+
592
+ interface SET_GIZMO_VISIBILITY {
593
+ DESCRIPTION: "Sets the gizmo's visibility.";
594
+ PAYLOAD: boolean;
595
+ RETURN: boolean;
596
+ }
597
+
598
+ interface COMPUTE_ENCOMPASSING_VIEW {
599
+ DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
600
+ PAYLOAD: object;
601
+ RETURN: {
602
+ position: Vector3Like;
603
+ target: Vector3Like;
604
+ };
605
+ }
606
+
599
607
  /**
600
608
  * A basic scene node to hold grid, floor and all lower level roots.
601
609
  *
@@ -1001,6 +1009,10 @@ declare function toFixedExp(number: number, decimals?: number): string;
1001
1009
 
1002
1010
  declare function truncateExp(number: number, decimals?: number): number;
1003
1011
 
1012
+ declare function radToDeg(radians: number): number;
1013
+
1014
+ declare function degToRad(degrees: number): number;
1015
+
1004
1016
  declare const DIVEMath: {
1005
1017
  ceilExp: typeof ceilExp;
1006
1018
  floorExp: typeof floorExp;
@@ -1008,6 +1020,8 @@ declare const DIVEMath: {
1008
1020
  toFixedExp: typeof toFixedExp;
1009
1021
  truncateExp: typeof truncateExp;
1010
1022
  signedAngleTo: typeof signedAngleTo;
1023
+ radToDeg: typeof radToDeg;
1024
+ degToRad: typeof degToRad;
1011
1025
  };
1012
1026
 
1013
1027
  type DIVESettings = {
@@ -1065,4 +1079,4 @@ declare class DIVE {
1065
1079
  private removeResizeObserver;
1066
1080
  }
1067
1081
 
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 };
1082
+ 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 };