@shopware-ag/dive 1.12.1 → 1.14.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 +458 -405
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +314 -78
- package/build/dive.d.ts +314 -78
- package/build/dive.js +430 -377
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/__test__/DIVE.test.ts +33 -29
- package/src/axiscamera/AxisCamera.ts +1 -1
- package/src/axiscamera/__test__/AxisCamera.test.ts +1 -1
- package/src/com/Communication.ts +59 -14
- package/src/com/__test__/Communication.test.ts +111 -31
- package/src/com/actions/index.ts +2 -0
- package/src/com/actions/object/addobject.ts +1 -1
- package/src/com/actions/object/deleteobject.ts +1 -1
- package/src/com/actions/object/deselectobject.ts +1 -1
- package/src/com/actions/object/getallobjects.ts +1 -1
- package/src/com/actions/object/getobjects.ts +1 -1
- package/src/com/actions/object/selectobject.ts +1 -1
- package/src/com/actions/object/setparent.ts +9 -0
- package/src/com/actions/object/updateobject.ts +1 -1
- package/src/com/actions/scene/getallscenedata.ts +1 -1
- package/src/com/types/COMBaseEntity.ts +9 -0
- package/src/com/types/COMEntity.ts +7 -0
- package/src/com/types/COMEntityType.ts +1 -0
- package/src/com/types/COMGeometry.ts +6 -0
- package/src/com/types/COMGroup.ts +9 -0
- package/src/com/types/COMLight.ts +10 -0
- package/src/com/types/COMMaterial.ts +12 -0
- package/src/com/types/COMModel.ts +12 -0
- package/src/com/types/COMPov.ts +8 -0
- package/src/com/types/COMPrimitive.ts +12 -0
- package/src/com/types/index.ts +21 -0
- package/src/dive.ts +9 -16
- package/src/grid/Grid.ts +1 -1
- package/src/grid/__test__/Grid.test.ts +1 -1
- package/src/group/Group.ts +126 -0
- package/src/group/__test__/Group.test.ts +100 -0
- package/src/helper/findSceneRecursive/findSceneRecursive.ts +1 -1
- package/src/light/AmbientLight.ts +3 -0
- package/src/light/PointLight.ts +6 -3
- package/src/light/SceneLight.ts +2 -0
- package/src/light/__test__/PointLight.test.ts +8 -6
- package/src/light/__test__/SceneLight.test.ts +8 -6
- package/src/loadingmanager/LoadingManager.ts +1 -1
- package/src/loadingmanager/__test__/LoadingManager.test.ts +1 -1
- package/src/mediacreator/MediaCreator.ts +1 -1
- package/src/mediacreator/__test__/MediaCreator.test.ts +6 -4
- package/src/model/Model.ts +8 -7
- package/src/model/__test__/Model.test.ts +13 -10
- package/src/primitive/Primitive.ts +4 -3
- package/src/primitive/__test__/Primitive.test.ts +9 -7
- package/src/primitive/floor/Floor.ts +1 -1
- package/src/primitive/floor/__test__/Floor.test.ts +1 -1
- package/src/renderer/__test__/Renderer.test.ts +1 -1
- package/src/scene/Scene.ts +29 -9
- package/src/scene/__test__/Scene.test.ts +33 -19
- package/src/scene/root/Root.ts +239 -72
- package/src/scene/root/__test__/Root.test.ts +476 -114
- package/src/toolbox/BaseTool.ts +1 -1
- package/src/toolbox/Toolbox.ts +1 -1
- package/src/toolbox/__test__/BaseTool.test.ts +1 -1
- package/src/toolbox/__test__/Toolbox.test.ts +1 -1
- package/src/toolbox/select/SelectTool.ts +1 -1
- package/src/toolbox/select/__test__/SelectTool.test.ts +11 -9
- package/src/toolbox/transform/TransformTool.ts +1 -1
- package/src/toolbox/transform/__test__/TransformTool.test.ts +12 -10
- package/src/types/SceneObjects.ts +14 -0
- package/src/types/index.ts +5 -0
- package/src/com/index.ts +0 -3
- package/src/com/types.ts +0 -58
- package/src/scene/root/lightroot/LightRoot.ts +0 -99
- package/src/scene/root/lightroot/__test__/LightRoot.test.ts +0 -145
- package/src/scene/root/modelroot/ModelRoot.ts +0 -98
- package/src/scene/root/modelroot/__test__/ModelRoot.test.ts +0 -189
- package/src/scene/root/primitiveroot/PrimitiveRoot.ts +0 -88
- package/src/scene/root/primitiveroot/__test__/PrimitiveRoot.test.ts +0 -181
package/build/dive.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Mesh, ColorRepresentation,
|
|
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 } from 'three/examples/jsm/Addons';
|
|
4
|
+
import { TransformControls, GLTF } from 'three/examples/jsm/Addons.js';
|
|
5
|
+
import { TransformControls as TransformControls$1 } from 'three/examples/jsm/controls/TransformControls';
|
|
6
|
+
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons';
|
|
5
7
|
|
|
6
8
|
type DIVERendererSettings = {
|
|
7
9
|
antialias: boolean;
|
|
@@ -202,17 +204,24 @@ interface PLACE_ON_FLOOR {
|
|
|
202
204
|
'RETURN': boolean;
|
|
203
205
|
}
|
|
204
206
|
|
|
207
|
+
type COMEntityType = 'pov' | 'light' | 'model' | 'primitive' | 'group';
|
|
208
|
+
|
|
205
209
|
type COMBaseEntity = {
|
|
206
210
|
id: string;
|
|
207
211
|
name: string;
|
|
208
|
-
entityType:
|
|
212
|
+
entityType: COMEntityType;
|
|
209
213
|
visible: boolean;
|
|
214
|
+
parent?: Partial<COMBaseEntity> & {
|
|
215
|
+
id: string;
|
|
216
|
+
} | null;
|
|
210
217
|
};
|
|
218
|
+
|
|
211
219
|
type COMPov = COMBaseEntity & {
|
|
212
220
|
position: Vector3Like;
|
|
213
221
|
target: Vector3Like;
|
|
214
222
|
locked?: boolean;
|
|
215
223
|
};
|
|
224
|
+
|
|
216
225
|
type COMLight = COMBaseEntity & {
|
|
217
226
|
type: 'ambient' | 'point' | 'scene';
|
|
218
227
|
intensity: number;
|
|
@@ -220,6 +229,18 @@ type COMLight = COMBaseEntity & {
|
|
|
220
229
|
enabled: boolean;
|
|
221
230
|
position?: Vector3Like;
|
|
222
231
|
};
|
|
232
|
+
|
|
233
|
+
type COMMaterial = {
|
|
234
|
+
vertexColors: boolean;
|
|
235
|
+
color: string | number;
|
|
236
|
+
map: Texture | null;
|
|
237
|
+
normalMap: Texture | null;
|
|
238
|
+
roughness: number;
|
|
239
|
+
roughnessMap: Texture | null;
|
|
240
|
+
metalness: number;
|
|
241
|
+
metalnessMap: Texture | null;
|
|
242
|
+
};
|
|
243
|
+
|
|
223
244
|
type COMModel = COMBaseEntity & {
|
|
224
245
|
uri: string;
|
|
225
246
|
position: Vector3Like;
|
|
@@ -228,22 +249,14 @@ type COMModel = COMBaseEntity & {
|
|
|
228
249
|
loaded: boolean;
|
|
229
250
|
material?: Partial<COMMaterial>;
|
|
230
251
|
};
|
|
252
|
+
|
|
231
253
|
type COMGeometry = {
|
|
232
254
|
name: string;
|
|
233
255
|
width: number;
|
|
234
256
|
height: number;
|
|
235
257
|
depth: number;
|
|
236
258
|
};
|
|
237
|
-
|
|
238
|
-
vertexColors: boolean;
|
|
239
|
-
color: string | number;
|
|
240
|
-
map: Texture | null;
|
|
241
|
-
normalMap: Texture | null;
|
|
242
|
-
roughness: number;
|
|
243
|
-
roughnessMap: Texture | null;
|
|
244
|
-
metalness: number;
|
|
245
|
-
metalnessMap: Texture | null;
|
|
246
|
-
};
|
|
259
|
+
|
|
247
260
|
type COMPrimitive = COMBaseEntity & {
|
|
248
261
|
position: Vector3Like;
|
|
249
262
|
rotation: Vector3Like;
|
|
@@ -251,7 +264,15 @@ type COMPrimitive = COMBaseEntity & {
|
|
|
251
264
|
geometry: COMGeometry;
|
|
252
265
|
material?: Partial<COMMaterial>;
|
|
253
266
|
};
|
|
254
|
-
|
|
267
|
+
|
|
268
|
+
type COMGroup = COMBaseEntity & {
|
|
269
|
+
position: Vector3Like;
|
|
270
|
+
rotation: Vector3Like;
|
|
271
|
+
scale: Vector3Like;
|
|
272
|
+
bbVisible?: boolean;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
type COMEntity = COMPov | COMLight | COMModel | COMPrimitive | COMGroup;
|
|
255
276
|
|
|
256
277
|
interface GET_ALL_OBJECTS {
|
|
257
278
|
'PAYLOAD': Map<string, COMEntity>;
|
|
@@ -379,49 +400,250 @@ interface COMPUTE_ENCOMPASSING_VIEW {
|
|
|
379
400
|
}
|
|
380
401
|
|
|
381
402
|
/**
|
|
382
|
-
*
|
|
403
|
+
* Interface for objects that can be moved in the scene.
|
|
383
404
|
*
|
|
384
|
-
*
|
|
405
|
+
* @module
|
|
406
|
+
*/
|
|
407
|
+
interface DIVEMoveable {
|
|
408
|
+
isMoveable: true;
|
|
409
|
+
onMove?: () => void;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Interface for objects that can be selected in the scene.
|
|
385
414
|
*
|
|
386
415
|
* @module
|
|
387
416
|
*/
|
|
388
|
-
|
|
389
|
-
|
|
417
|
+
|
|
418
|
+
interface DIVESelectable {
|
|
419
|
+
isSelectable: true;
|
|
420
|
+
onSelect?: () => void;
|
|
421
|
+
onDeselect?: () => void;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare class DIVEGroup extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
425
|
+
readonly isDIVEGroup: true;
|
|
426
|
+
readonly isSelectable: true;
|
|
427
|
+
readonly isMoveable: true;
|
|
428
|
+
private _bb;
|
|
429
|
+
private _boxMesh;
|
|
390
430
|
constructor();
|
|
431
|
+
SetPosition(position: Vector3Like): void;
|
|
432
|
+
SetRotation(rotation: Vector3Like): void;
|
|
433
|
+
SetScale(scale: Vector3Like): void;
|
|
391
434
|
SetVisibility(visible: boolean): void;
|
|
392
|
-
|
|
435
|
+
SetBoundingBoxVisibility(visible: boolean): void;
|
|
436
|
+
attach(object: DIVESceneObject): this;
|
|
437
|
+
remove(object: DIVESceneObject): this;
|
|
438
|
+
/**
|
|
439
|
+
* Recalculates the position of the group based on it's bounding box.
|
|
440
|
+
* Children's world positions are kept.
|
|
441
|
+
*/
|
|
442
|
+
private recalculatePosition;
|
|
443
|
+
/**
|
|
444
|
+
* Updates the bounding box of the group.
|
|
445
|
+
* @returns {Vector3} The new center of the bounding box.
|
|
446
|
+
*/
|
|
447
|
+
private updateBB;
|
|
448
|
+
private updateBoxMesh;
|
|
449
|
+
onMove(): void;
|
|
450
|
+
onSelect(): void;
|
|
451
|
+
onDeselect(): void;
|
|
393
452
|
}
|
|
394
453
|
|
|
395
454
|
/**
|
|
396
|
-
* A basic
|
|
455
|
+
* A basic ambient light.
|
|
456
|
+
*
|
|
457
|
+
* Can change the color, intensity, and visibility of the light.
|
|
397
458
|
*
|
|
398
459
|
* @module
|
|
399
460
|
*/
|
|
400
|
-
declare class
|
|
461
|
+
declare class DIVEAmbientLight extends Object3D {
|
|
462
|
+
readonly isDIVELight: true;
|
|
463
|
+
readonly isDIVEAmbientLight: true;
|
|
464
|
+
private _light;
|
|
465
|
+
constructor();
|
|
466
|
+
SetColor(color: Color): void;
|
|
467
|
+
SetIntensity(intensity: number): void;
|
|
468
|
+
SetEnabled(enabled: boolean): void;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* A basic point light.
|
|
473
|
+
*
|
|
474
|
+
* Can change the color, intensity, and visibility of the light.
|
|
475
|
+
*
|
|
476
|
+
* Can be moved and selected.
|
|
477
|
+
*
|
|
478
|
+
* @module
|
|
479
|
+
*/
|
|
480
|
+
declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
481
|
+
readonly isDIVELight: true;
|
|
482
|
+
readonly isDIVEPointLight: true;
|
|
483
|
+
readonly isMoveable: true;
|
|
484
|
+
readonly isSelectable: true;
|
|
485
|
+
gizmo: TransformControls | null;
|
|
486
|
+
private light;
|
|
487
|
+
private mesh;
|
|
488
|
+
constructor();
|
|
489
|
+
SetColor(color: Color): void;
|
|
490
|
+
SetIntensity(intensity: number): void;
|
|
491
|
+
SetEnabled(enabled: boolean): void;
|
|
492
|
+
onMove(): void;
|
|
493
|
+
onSelect(): void;
|
|
494
|
+
onDeselect(): void;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* A complex scene light.
|
|
499
|
+
*
|
|
500
|
+
* Can change the color, intensity, and visibility of the light.
|
|
501
|
+
*
|
|
502
|
+
* @module
|
|
503
|
+
*/
|
|
504
|
+
declare class DIVESceneLight extends Object3D {
|
|
505
|
+
readonly isDIVELight: true;
|
|
506
|
+
readonly isDIVESceneLight: true;
|
|
507
|
+
private _hemiLight;
|
|
508
|
+
private _dirLight;
|
|
509
|
+
constructor();
|
|
510
|
+
SetColor(color: Color): void;
|
|
511
|
+
SetIntensity(intensity: number): void;
|
|
512
|
+
SetEnabled(enabled: boolean): void;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* A basic model class.
|
|
517
|
+
*
|
|
518
|
+
* It does calculate it's own bounding box which is used for positioning on the floor.
|
|
519
|
+
*
|
|
520
|
+
* Can be moved and selected.
|
|
521
|
+
*
|
|
522
|
+
* @module
|
|
523
|
+
*/
|
|
524
|
+
declare class DIVEModel extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
525
|
+
readonly isDIVEModel: true;
|
|
526
|
+
readonly isSelectable: true;
|
|
527
|
+
readonly isMoveable: true;
|
|
528
|
+
gizmo: TransformControls | null;
|
|
529
|
+
private boundingBox;
|
|
530
|
+
private _mesh;
|
|
531
|
+
private _material;
|
|
532
|
+
constructor();
|
|
533
|
+
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
|
+
SetMaterial(material: Partial<COMMaterial>): void;
|
|
539
|
+
SetToWorldOrigin(): void;
|
|
540
|
+
PlaceOnFloor(): void;
|
|
541
|
+
DropIt(): void;
|
|
542
|
+
onMove(): void;
|
|
543
|
+
onSelect(): void;
|
|
544
|
+
onDeselect(): void;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* A basic model class.
|
|
549
|
+
*
|
|
550
|
+
* It does calculate it's own bounding box which is used for positioning on the floor.
|
|
551
|
+
*
|
|
552
|
+
* Can be moved and selected.
|
|
553
|
+
*
|
|
554
|
+
* @module
|
|
555
|
+
*/
|
|
556
|
+
declare class DIVEPrimitive extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
557
|
+
readonly isDIVEPrimitive: true;
|
|
558
|
+
readonly isSelectable: true;
|
|
559
|
+
readonly isMoveable: true;
|
|
560
|
+
gizmo: TransformControls$1 | null;
|
|
561
|
+
private _mesh;
|
|
562
|
+
private _boundingBox;
|
|
401
563
|
constructor();
|
|
564
|
+
SetGeometry(geometry: COMGeometry): void;
|
|
565
|
+
SetPosition(position: Vector3Like): void;
|
|
566
|
+
SetRotation(rotation: Vector3Like): void;
|
|
567
|
+
SetScale(scale: Vector3Like): void;
|
|
402
568
|
SetVisibility(visible: boolean): void;
|
|
569
|
+
SetMaterial(material: Partial<COMMaterial>): void;
|
|
570
|
+
SetToWorldOrigin(): void;
|
|
571
|
+
PlaceOnFloor(): void;
|
|
572
|
+
DropIt(): void;
|
|
573
|
+
onMove(): void;
|
|
574
|
+
onSelect(): void;
|
|
575
|
+
onDeselect(): void;
|
|
576
|
+
private assembleGeometry;
|
|
577
|
+
private createCylinderGeometry;
|
|
578
|
+
private createSphereGeometry;
|
|
579
|
+
private createPyramidGeometry;
|
|
580
|
+
private createBoxGeometry;
|
|
581
|
+
private createConeGeometry;
|
|
582
|
+
private createWallGeometry;
|
|
583
|
+
private createPlaneGeometry;
|
|
403
584
|
}
|
|
404
585
|
|
|
586
|
+
type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
|
|
587
|
+
|
|
405
588
|
/**
|
|
406
589
|
* A basic scene node to hold grid, floor and all lower level roots.
|
|
407
590
|
*
|
|
408
591
|
* @module
|
|
409
592
|
*/
|
|
410
593
|
declare class DIVERoot extends Object3D {
|
|
411
|
-
|
|
412
|
-
private
|
|
413
|
-
private primitiveRoot;
|
|
414
|
-
private floor;
|
|
415
|
-
private grid;
|
|
416
|
-
get Floor(): DIVEFloor;
|
|
417
|
-
get Grid(): DIVEGrid;
|
|
594
|
+
readonly isDIVERoot: true;
|
|
595
|
+
private loadingManager;
|
|
418
596
|
constructor();
|
|
419
597
|
ComputeSceneBB(): Box3;
|
|
420
|
-
GetSceneObject(object: Partial<COMEntity>
|
|
598
|
+
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
599
|
+
id: string;
|
|
600
|
+
}): T | undefined;
|
|
421
601
|
AddSceneObject(object: COMEntity): void;
|
|
422
|
-
UpdateSceneObject(object: Partial<COMEntity>
|
|
423
|
-
|
|
424
|
-
|
|
602
|
+
UpdateSceneObject(object: Partial<COMEntity> & {
|
|
603
|
+
id: string;
|
|
604
|
+
}): void;
|
|
605
|
+
DeleteSceneObject(object: Partial<COMEntity> & {
|
|
606
|
+
id: string;
|
|
607
|
+
}): void;
|
|
608
|
+
PlaceOnFloor(object: Partial<COMEntity> & {
|
|
609
|
+
id: string;
|
|
610
|
+
}): void;
|
|
611
|
+
private updateLight;
|
|
612
|
+
private updateModel;
|
|
613
|
+
private updatePrimitive;
|
|
614
|
+
private updateGroup;
|
|
615
|
+
private deleteLight;
|
|
616
|
+
private deleteModel;
|
|
617
|
+
private deletePrimitive;
|
|
618
|
+
private deleteGroup;
|
|
619
|
+
private placeOnFloor;
|
|
620
|
+
private setParent;
|
|
621
|
+
private detachTransformControls;
|
|
622
|
+
private findScene;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* A basic grid for the scene.
|
|
627
|
+
*
|
|
628
|
+
* @module
|
|
629
|
+
*/
|
|
630
|
+
declare class DIVEGrid extends Object3D {
|
|
631
|
+
constructor();
|
|
632
|
+
SetVisibility(visible: boolean): void;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* A basic floor geometry.
|
|
637
|
+
*
|
|
638
|
+
* Can change the color and visibility of the floor.
|
|
639
|
+
*
|
|
640
|
+
* @module
|
|
641
|
+
*/
|
|
642
|
+
declare class DIVEFloor extends Mesh {
|
|
643
|
+
isFloor: true;
|
|
644
|
+
constructor();
|
|
645
|
+
SetVisibility(visible: boolean): void;
|
|
646
|
+
SetColor(color: ColorRepresentation): void;
|
|
425
647
|
}
|
|
426
648
|
|
|
427
649
|
/**
|
|
@@ -433,15 +655,27 @@ declare class DIVERoot extends Object3D {
|
|
|
433
655
|
*/
|
|
434
656
|
declare class DIVEScene extends Scene {
|
|
435
657
|
private root;
|
|
658
|
+
private floor;
|
|
659
|
+
private grid;
|
|
436
660
|
get Root(): DIVERoot;
|
|
661
|
+
get Floor(): DIVEFloor;
|
|
662
|
+
get Grid(): DIVEGrid;
|
|
437
663
|
constructor();
|
|
438
664
|
SetBackground(color: ColorRepresentation): void;
|
|
439
665
|
ComputeSceneBB(): Box3;
|
|
440
|
-
GetSceneObject(object: Partial<COMEntity>
|
|
666
|
+
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
667
|
+
id: string;
|
|
668
|
+
}): T | undefined;
|
|
441
669
|
AddSceneObject(object: COMEntity): void;
|
|
442
|
-
UpdateSceneObject(object: Partial<COMEntity>
|
|
443
|
-
|
|
444
|
-
|
|
670
|
+
UpdateSceneObject(object: Partial<COMEntity> & {
|
|
671
|
+
id: string;
|
|
672
|
+
}): void;
|
|
673
|
+
DeleteSceneObject(object: Partial<COMEntity> & {
|
|
674
|
+
id: string;
|
|
675
|
+
}): void;
|
|
676
|
+
PlaceOnFloor(object: Partial<COMModel> & {
|
|
677
|
+
id: string;
|
|
678
|
+
}): void;
|
|
445
679
|
}
|
|
446
680
|
|
|
447
681
|
interface DIVEDraggable {
|
|
@@ -511,25 +745,13 @@ declare abstract class DIVEBaseTool {
|
|
|
511
745
|
*/
|
|
512
746
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
513
747
|
readonly isTransformTool: boolean;
|
|
514
|
-
protected _gizmo: TransformControls;
|
|
748
|
+
protected _gizmo: TransformControls$2;
|
|
515
749
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
516
750
|
Activate(): void;
|
|
517
751
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
518
752
|
SetGizmoVisibility(active: boolean): void;
|
|
519
753
|
}
|
|
520
754
|
|
|
521
|
-
/**
|
|
522
|
-
* Interface for objects that can be selected in the scene.
|
|
523
|
-
*
|
|
524
|
-
* @module
|
|
525
|
-
*/
|
|
526
|
-
|
|
527
|
-
interface DIVESelectable {
|
|
528
|
-
isSelectable: true;
|
|
529
|
-
onSelect?: () => void;
|
|
530
|
-
onDeselect?: () => void;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
755
|
/**
|
|
534
756
|
* A Tool to select and move objects in the scene.
|
|
535
757
|
*
|
|
@@ -582,6 +804,18 @@ interface USE_TOOL {
|
|
|
582
804
|
'RETURN': boolean;
|
|
583
805
|
}
|
|
584
806
|
|
|
807
|
+
interface SET_PARENT {
|
|
808
|
+
'PAYLOAD': {
|
|
809
|
+
object: Partial<COMEntity> & {
|
|
810
|
+
id: string;
|
|
811
|
+
};
|
|
812
|
+
parent: Partial<COMEntity> & {
|
|
813
|
+
id: string;
|
|
814
|
+
} | null;
|
|
815
|
+
};
|
|
816
|
+
'RETURN': boolean;
|
|
817
|
+
}
|
|
818
|
+
|
|
585
819
|
type Actions = {
|
|
586
820
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
587
821
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
@@ -607,6 +841,7 @@ type Actions = {
|
|
|
607
841
|
MODEL_LOADED: MODEL_LOADED;
|
|
608
842
|
UPDATE_SCENE: UPDATE_SCENE;
|
|
609
843
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
844
|
+
SET_PARENT: SET_PARENT;
|
|
610
845
|
};
|
|
611
846
|
|
|
612
847
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
@@ -672,36 +907,9 @@ declare class DIVECommunication {
|
|
|
672
907
|
private modelLoaded;
|
|
673
908
|
private updateScene;
|
|
674
909
|
private generateMedia;
|
|
910
|
+
private setParent;
|
|
675
911
|
}
|
|
676
912
|
|
|
677
|
-
declare function ceilExp(number: number, decimals?: number): number;
|
|
678
|
-
|
|
679
|
-
declare function floorExp(number: number, decimals?: number): number;
|
|
680
|
-
|
|
681
|
-
declare function roundExponential(number: number, decimals?: number): number;
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Calculate the signed angle between two vectors. Only works when the vectors are on the same plane.
|
|
685
|
-
* @param vecB Start Vector
|
|
686
|
-
* @param vecA Target Vector
|
|
687
|
-
* @param planeNormal The vector's plane normal
|
|
688
|
-
* @returns Signed angle in radians
|
|
689
|
-
*/
|
|
690
|
-
declare function signedAngleTo(vecA: Vector3, vecB: Vector3, planeNormal: Vector3): number;
|
|
691
|
-
|
|
692
|
-
declare function toFixedExp(number: number, decimals?: number): string;
|
|
693
|
-
|
|
694
|
-
declare function truncateExp(number: number, decimals?: number): number;
|
|
695
|
-
|
|
696
|
-
declare const DIVEMath: {
|
|
697
|
-
ceilExp: typeof ceilExp;
|
|
698
|
-
floorExp: typeof floorExp;
|
|
699
|
-
roundExp: typeof roundExponential;
|
|
700
|
-
toFixedExp: typeof toFixedExp;
|
|
701
|
-
truncateExp: typeof truncateExp;
|
|
702
|
-
signedAngleTo: typeof signedAngleTo;
|
|
703
|
-
};
|
|
704
|
-
|
|
705
913
|
declare class DIVEInfo {
|
|
706
914
|
private static _supportsWebXR;
|
|
707
915
|
/**
|
|
@@ -731,6 +939,34 @@ declare class DIVEInfo {
|
|
|
731
939
|
static GetIsARCapable(): Promise<boolean>;
|
|
732
940
|
}
|
|
733
941
|
|
|
942
|
+
declare function ceilExp(number: number, decimals?: number): number;
|
|
943
|
+
|
|
944
|
+
declare function floorExp(number: number, decimals?: number): number;
|
|
945
|
+
|
|
946
|
+
declare function roundExponential(number: number, decimals?: number): number;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Calculate the signed angle between two vectors. Only works when the vectors are on the same plane.
|
|
950
|
+
* @param vecB Start Vector
|
|
951
|
+
* @param vecA Target Vector
|
|
952
|
+
* @param planeNormal The vector's plane normal
|
|
953
|
+
* @returns Signed angle in radians
|
|
954
|
+
*/
|
|
955
|
+
declare function signedAngleTo(vecA: Vector3, vecB: Vector3, planeNormal: Vector3): number;
|
|
956
|
+
|
|
957
|
+
declare function toFixedExp(number: number, decimals?: number): string;
|
|
958
|
+
|
|
959
|
+
declare function truncateExp(number: number, decimals?: number): number;
|
|
960
|
+
|
|
961
|
+
declare const DIVEMath: {
|
|
962
|
+
ceilExp: typeof ceilExp;
|
|
963
|
+
floorExp: typeof floorExp;
|
|
964
|
+
roundExp: typeof roundExponential;
|
|
965
|
+
toFixedExp: typeof toFixedExp;
|
|
966
|
+
truncateExp: typeof truncateExp;
|
|
967
|
+
signedAngleTo: typeof signedAngleTo;
|
|
968
|
+
};
|
|
969
|
+
|
|
734
970
|
type DIVESettings = {
|
|
735
971
|
autoResize: boolean;
|
|
736
972
|
displayAxes: boolean;
|
|
@@ -786,4 +1022,4 @@ declare class DIVE {
|
|
|
786
1022
|
private removeResizeObserver;
|
|
787
1023
|
}
|
|
788
1024
|
|
|
789
|
-
export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|
|
1025
|
+
export { type Actions, type COMEntity, type COMEntityType, type COMGeometry, type COMGroup, type COMLight, type COMMaterial, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|