@shopware-ag/dive 1.12.0 → 1.13.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 +475 -452
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +311 -78
- package/build/dive.d.ts +311 -78
- package/build/dive.js +455 -432
- 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 -15
- package/src/grid/Grid.ts +1 -1
- package/src/grid/__test__/Grid.test.ts +1 -1
- package/src/group/Group.ts +111 -0
- package/src/group/__test__/Group.test.ts +67 -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 +50 -34
- package/src/primitive/__test__/Primitive.test.ts +39 -21
- 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,247 @@ 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;
|
|
393
449
|
}
|
|
394
450
|
|
|
395
451
|
/**
|
|
396
|
-
* A basic
|
|
452
|
+
* A basic ambient light.
|
|
453
|
+
*
|
|
454
|
+
* Can change the color, intensity, and visibility of the light.
|
|
397
455
|
*
|
|
398
456
|
* @module
|
|
399
457
|
*/
|
|
400
|
-
declare class
|
|
458
|
+
declare class DIVEAmbientLight extends Object3D {
|
|
459
|
+
readonly isDIVELight: true;
|
|
460
|
+
readonly isDIVEAmbientLight: true;
|
|
461
|
+
private _light;
|
|
462
|
+
constructor();
|
|
463
|
+
SetColor(color: Color): void;
|
|
464
|
+
SetIntensity(intensity: number): void;
|
|
465
|
+
SetEnabled(enabled: boolean): void;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* A basic point light.
|
|
470
|
+
*
|
|
471
|
+
* Can change the color, intensity, and visibility of the light.
|
|
472
|
+
*
|
|
473
|
+
* Can be moved and selected.
|
|
474
|
+
*
|
|
475
|
+
* @module
|
|
476
|
+
*/
|
|
477
|
+
declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
478
|
+
readonly isDIVELight: true;
|
|
479
|
+
readonly isDIVEPointLight: true;
|
|
480
|
+
readonly isMoveable: true;
|
|
481
|
+
readonly isSelectable: true;
|
|
482
|
+
gizmo: TransformControls | null;
|
|
483
|
+
private light;
|
|
484
|
+
private mesh;
|
|
485
|
+
constructor();
|
|
486
|
+
SetColor(color: Color): void;
|
|
487
|
+
SetIntensity(intensity: number): void;
|
|
488
|
+
SetEnabled(enabled: boolean): void;
|
|
489
|
+
onMove(): void;
|
|
490
|
+
onSelect(): void;
|
|
491
|
+
onDeselect(): void;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* A complex scene light.
|
|
496
|
+
*
|
|
497
|
+
* Can change the color, intensity, and visibility of the light.
|
|
498
|
+
*
|
|
499
|
+
* @module
|
|
500
|
+
*/
|
|
501
|
+
declare class DIVESceneLight extends Object3D {
|
|
502
|
+
readonly isDIVELight: true;
|
|
503
|
+
readonly isDIVESceneLight: true;
|
|
504
|
+
private _hemiLight;
|
|
505
|
+
private _dirLight;
|
|
506
|
+
constructor();
|
|
507
|
+
SetColor(color: Color): void;
|
|
508
|
+
SetIntensity(intensity: number): void;
|
|
509
|
+
SetEnabled(enabled: boolean): void;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* A basic model class.
|
|
514
|
+
*
|
|
515
|
+
* It does calculate it's own bounding box which is used for positioning on the floor.
|
|
516
|
+
*
|
|
517
|
+
* Can be moved and selected.
|
|
518
|
+
*
|
|
519
|
+
* @module
|
|
520
|
+
*/
|
|
521
|
+
declare class DIVEModel extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
522
|
+
readonly isDIVEModel: true;
|
|
523
|
+
readonly isSelectable: true;
|
|
524
|
+
readonly isMoveable: true;
|
|
525
|
+
gizmo: TransformControls | null;
|
|
526
|
+
private boundingBox;
|
|
527
|
+
private _mesh;
|
|
528
|
+
private _material;
|
|
401
529
|
constructor();
|
|
530
|
+
SetModel(gltf: GLTF): void;
|
|
531
|
+
SetPosition(position: Vector3Like): void;
|
|
532
|
+
SetRotation(rotation: Vector3Like): void;
|
|
533
|
+
SetScale(scale: Vector3Like): void;
|
|
402
534
|
SetVisibility(visible: boolean): void;
|
|
535
|
+
SetMaterial(material: Partial<COMMaterial>): void;
|
|
536
|
+
SetToWorldOrigin(): void;
|
|
537
|
+
PlaceOnFloor(): void;
|
|
538
|
+
DropIt(): void;
|
|
539
|
+
onMove(): void;
|
|
540
|
+
onSelect(): void;
|
|
541
|
+
onDeselect(): void;
|
|
403
542
|
}
|
|
404
543
|
|
|
544
|
+
/**
|
|
545
|
+
* A basic model class.
|
|
546
|
+
*
|
|
547
|
+
* It does calculate it's own bounding box which is used for positioning on the floor.
|
|
548
|
+
*
|
|
549
|
+
* Can be moved and selected.
|
|
550
|
+
*
|
|
551
|
+
* @module
|
|
552
|
+
*/
|
|
553
|
+
declare class DIVEPrimitive extends Object3D implements DIVESelectable, DIVEMoveable {
|
|
554
|
+
readonly isDIVEPrimitive: true;
|
|
555
|
+
readonly isSelectable: true;
|
|
556
|
+
readonly isMoveable: true;
|
|
557
|
+
gizmo: TransformControls$1 | null;
|
|
558
|
+
private _mesh;
|
|
559
|
+
private _boundingBox;
|
|
560
|
+
constructor();
|
|
561
|
+
SetGeometry(geometry: COMGeometry): void;
|
|
562
|
+
SetPosition(position: Vector3Like): void;
|
|
563
|
+
SetRotation(rotation: Vector3Like): void;
|
|
564
|
+
SetScale(scale: Vector3Like): void;
|
|
565
|
+
SetVisibility(visible: boolean): void;
|
|
566
|
+
SetMaterial(material: Partial<COMMaterial>): void;
|
|
567
|
+
SetToWorldOrigin(): void;
|
|
568
|
+
PlaceOnFloor(): void;
|
|
569
|
+
DropIt(): void;
|
|
570
|
+
onMove(): void;
|
|
571
|
+
onSelect(): void;
|
|
572
|
+
onDeselect(): void;
|
|
573
|
+
private assembleGeometry;
|
|
574
|
+
private createCylinderGeometry;
|
|
575
|
+
private createSphereGeometry;
|
|
576
|
+
private createPyramidGeometry;
|
|
577
|
+
private createBoxGeometry;
|
|
578
|
+
private createConeGeometry;
|
|
579
|
+
private createWallGeometry;
|
|
580
|
+
private createPlaneGeometry;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
|
|
584
|
+
|
|
405
585
|
/**
|
|
406
586
|
* A basic scene node to hold grid, floor and all lower level roots.
|
|
407
587
|
*
|
|
408
588
|
* @module
|
|
409
589
|
*/
|
|
410
590
|
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;
|
|
591
|
+
readonly isDIVERoot: true;
|
|
592
|
+
private loadingManager;
|
|
418
593
|
constructor();
|
|
419
594
|
ComputeSceneBB(): Box3;
|
|
420
|
-
GetSceneObject(object: Partial<COMEntity>
|
|
595
|
+
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
596
|
+
id: string;
|
|
597
|
+
}): T | undefined;
|
|
421
598
|
AddSceneObject(object: COMEntity): void;
|
|
422
|
-
UpdateSceneObject(object: Partial<COMEntity>
|
|
423
|
-
|
|
424
|
-
|
|
599
|
+
UpdateSceneObject(object: Partial<COMEntity> & {
|
|
600
|
+
id: string;
|
|
601
|
+
}): void;
|
|
602
|
+
DeleteSceneObject(object: Partial<COMEntity> & {
|
|
603
|
+
id: string;
|
|
604
|
+
}): void;
|
|
605
|
+
PlaceOnFloor(object: Partial<COMEntity> & {
|
|
606
|
+
id: string;
|
|
607
|
+
}): void;
|
|
608
|
+
private updateLight;
|
|
609
|
+
private updateModel;
|
|
610
|
+
private updatePrimitive;
|
|
611
|
+
private updateGroup;
|
|
612
|
+
private deleteLight;
|
|
613
|
+
private deleteModel;
|
|
614
|
+
private deletePrimitive;
|
|
615
|
+
private deleteGroup;
|
|
616
|
+
private placeOnFloor;
|
|
617
|
+
private setParent;
|
|
618
|
+
private detachTransformControls;
|
|
619
|
+
private findScene;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* A basic grid for the scene.
|
|
624
|
+
*
|
|
625
|
+
* @module
|
|
626
|
+
*/
|
|
627
|
+
declare class DIVEGrid extends Object3D {
|
|
628
|
+
constructor();
|
|
629
|
+
SetVisibility(visible: boolean): void;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* A basic floor geometry.
|
|
634
|
+
*
|
|
635
|
+
* Can change the color and visibility of the floor.
|
|
636
|
+
*
|
|
637
|
+
* @module
|
|
638
|
+
*/
|
|
639
|
+
declare class DIVEFloor extends Mesh {
|
|
640
|
+
isFloor: true;
|
|
641
|
+
constructor();
|
|
642
|
+
SetVisibility(visible: boolean): void;
|
|
643
|
+
SetColor(color: ColorRepresentation): void;
|
|
425
644
|
}
|
|
426
645
|
|
|
427
646
|
/**
|
|
@@ -433,15 +652,27 @@ declare class DIVERoot extends Object3D {
|
|
|
433
652
|
*/
|
|
434
653
|
declare class DIVEScene extends Scene {
|
|
435
654
|
private root;
|
|
655
|
+
private floor;
|
|
656
|
+
private grid;
|
|
436
657
|
get Root(): DIVERoot;
|
|
658
|
+
get Floor(): DIVEFloor;
|
|
659
|
+
get Grid(): DIVEGrid;
|
|
437
660
|
constructor();
|
|
438
661
|
SetBackground(color: ColorRepresentation): void;
|
|
439
662
|
ComputeSceneBB(): Box3;
|
|
440
|
-
GetSceneObject(object: Partial<COMEntity>
|
|
663
|
+
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
664
|
+
id: string;
|
|
665
|
+
}): T | undefined;
|
|
441
666
|
AddSceneObject(object: COMEntity): void;
|
|
442
|
-
UpdateSceneObject(object: Partial<COMEntity>
|
|
443
|
-
|
|
444
|
-
|
|
667
|
+
UpdateSceneObject(object: Partial<COMEntity> & {
|
|
668
|
+
id: string;
|
|
669
|
+
}): void;
|
|
670
|
+
DeleteSceneObject(object: Partial<COMEntity> & {
|
|
671
|
+
id: string;
|
|
672
|
+
}): void;
|
|
673
|
+
PlaceOnFloor(object: Partial<COMModel> & {
|
|
674
|
+
id: string;
|
|
675
|
+
}): void;
|
|
445
676
|
}
|
|
446
677
|
|
|
447
678
|
interface DIVEDraggable {
|
|
@@ -511,25 +742,13 @@ declare abstract class DIVEBaseTool {
|
|
|
511
742
|
*/
|
|
512
743
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
513
744
|
readonly isTransformTool: boolean;
|
|
514
|
-
protected _gizmo: TransformControls;
|
|
745
|
+
protected _gizmo: TransformControls$2;
|
|
515
746
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
516
747
|
Activate(): void;
|
|
517
748
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
518
749
|
SetGizmoVisibility(active: boolean): void;
|
|
519
750
|
}
|
|
520
751
|
|
|
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
752
|
/**
|
|
534
753
|
* A Tool to select and move objects in the scene.
|
|
535
754
|
*
|
|
@@ -582,6 +801,18 @@ interface USE_TOOL {
|
|
|
582
801
|
'RETURN': boolean;
|
|
583
802
|
}
|
|
584
803
|
|
|
804
|
+
interface SET_PARENT {
|
|
805
|
+
'PAYLOAD': {
|
|
806
|
+
object: Partial<COMEntity> & {
|
|
807
|
+
id: string;
|
|
808
|
+
};
|
|
809
|
+
parent: Partial<COMEntity> & {
|
|
810
|
+
id: string;
|
|
811
|
+
} | null;
|
|
812
|
+
};
|
|
813
|
+
'RETURN': boolean;
|
|
814
|
+
}
|
|
815
|
+
|
|
585
816
|
type Actions = {
|
|
586
817
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
587
818
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
@@ -607,6 +838,7 @@ type Actions = {
|
|
|
607
838
|
MODEL_LOADED: MODEL_LOADED;
|
|
608
839
|
UPDATE_SCENE: UPDATE_SCENE;
|
|
609
840
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
841
|
+
SET_PARENT: SET_PARENT;
|
|
610
842
|
};
|
|
611
843
|
|
|
612
844
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
@@ -672,36 +904,9 @@ declare class DIVECommunication {
|
|
|
672
904
|
private modelLoaded;
|
|
673
905
|
private updateScene;
|
|
674
906
|
private generateMedia;
|
|
907
|
+
private setParent;
|
|
675
908
|
}
|
|
676
909
|
|
|
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
910
|
declare class DIVEInfo {
|
|
706
911
|
private static _supportsWebXR;
|
|
707
912
|
/**
|
|
@@ -731,6 +936,34 @@ declare class DIVEInfo {
|
|
|
731
936
|
static GetIsARCapable(): Promise<boolean>;
|
|
732
937
|
}
|
|
733
938
|
|
|
939
|
+
declare function ceilExp(number: number, decimals?: number): number;
|
|
940
|
+
|
|
941
|
+
declare function floorExp(number: number, decimals?: number): number;
|
|
942
|
+
|
|
943
|
+
declare function roundExponential(number: number, decimals?: number): number;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Calculate the signed angle between two vectors. Only works when the vectors are on the same plane.
|
|
947
|
+
* @param vecB Start Vector
|
|
948
|
+
* @param vecA Target Vector
|
|
949
|
+
* @param planeNormal The vector's plane normal
|
|
950
|
+
* @returns Signed angle in radians
|
|
951
|
+
*/
|
|
952
|
+
declare function signedAngleTo(vecA: Vector3, vecB: Vector3, planeNormal: Vector3): number;
|
|
953
|
+
|
|
954
|
+
declare function toFixedExp(number: number, decimals?: number): string;
|
|
955
|
+
|
|
956
|
+
declare function truncateExp(number: number, decimals?: number): number;
|
|
957
|
+
|
|
958
|
+
declare const DIVEMath: {
|
|
959
|
+
ceilExp: typeof ceilExp;
|
|
960
|
+
floorExp: typeof floorExp;
|
|
961
|
+
roundExp: typeof roundExponential;
|
|
962
|
+
toFixedExp: typeof toFixedExp;
|
|
963
|
+
truncateExp: typeof truncateExp;
|
|
964
|
+
signedAngleTo: typeof signedAngleTo;
|
|
965
|
+
};
|
|
966
|
+
|
|
734
967
|
type DIVESettings = {
|
|
735
968
|
autoResize: boolean;
|
|
736
969
|
displayAxes: boolean;
|
|
@@ -786,4 +1019,4 @@ declare class DIVE {
|
|
|
786
1019
|
private removeResizeObserver;
|
|
787
1020
|
}
|
|
788
1021
|
|
|
789
|
-
export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
|
|
1022
|
+
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 };
|