@shopware-ag/dive 1.6.5 → 1.8.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/README.md +6 -8
- package/build/dive.cjs +130 -17
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +38 -7
- package/build/dive.d.ts +38 -7
- package/build/dive.js +129 -16
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/__test__/DIVE.test.ts +7 -1
- package/src/camera/PerspectiveCamera.ts +7 -2
- package/src/camera/__test__/PerspectiveCamera.test.ts +11 -2
- package/src/controls/OrbitControls.ts +9 -4
- package/src/controls/__test__/OrbitControls.test.ts +15 -5
- package/src/dive.ts +15 -8
- package/src/info/Info.ts +114 -0
- package/src/info/__test__/Info.test.ts +267 -0
- package/src/renderer/Renderer.ts +10 -7
- package/src/renderer/__test__/Renderer.test.ts +11 -0
package/build/dive.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Mesh, ColorRepresentation, Object3D, Intersection, Vector2, Raycaster, Vector3 } from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/
|
|
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/Addons';
|
|
5
5
|
|
|
@@ -10,6 +10,7 @@ type DIVERendererSettings = {
|
|
|
10
10
|
shadowMapEnabled: boolean;
|
|
11
11
|
shadowMapType: ShadowMapType;
|
|
12
12
|
toneMapping: ToneMapping;
|
|
13
|
+
canvas?: HTMLCanvasElement;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* A changed version of the WebGLRenderer.
|
|
@@ -24,7 +25,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
24
25
|
private force;
|
|
25
26
|
private preRenderCallbacks;
|
|
26
27
|
private postRenderCallbacks;
|
|
27
|
-
constructor(rendererSettings?: DIVERendererSettings);
|
|
28
|
+
constructor(rendererSettings?: Partial<DIVERendererSettings>);
|
|
28
29
|
Dispose(): void;
|
|
29
30
|
StartRenderer(scene: Scene, cam: Camera): void;
|
|
30
31
|
PauseRenderer(): void;
|
|
@@ -83,7 +84,7 @@ declare class DIVEPerspectiveCamera extends PerspectiveCamera {
|
|
|
83
84
|
static readonly EDITOR_VIEW_LAYER_MASK: number;
|
|
84
85
|
static readonly LIVE_VIEW_LAYER_MASK = 16;
|
|
85
86
|
onSetCameraLayer: (mask: number) => void;
|
|
86
|
-
constructor(settings?: DIVEPerspectiveCameraSettings);
|
|
87
|
+
constructor(settings?: Partial<DIVEPerspectiveCameraSettings>);
|
|
87
88
|
OnResize(width: number, height: number): void;
|
|
88
89
|
SetCameraLayer(layer: 'LIVE' | 'EDITOR'): void;
|
|
89
90
|
}
|
|
@@ -123,7 +124,7 @@ declare class DIVEOrbitControls extends OrbitControls {
|
|
|
123
124
|
object: DIVEPerspectiveCamera;
|
|
124
125
|
domElement: HTMLCanvasElement;
|
|
125
126
|
private _removePreRenderCallback;
|
|
126
|
-
constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: DIVEOrbitControlsSettings);
|
|
127
|
+
constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: Partial<DIVEOrbitControlsSettings>);
|
|
127
128
|
Dispose(): void;
|
|
128
129
|
ComputeEncompassingView(bb: Box3): {
|
|
129
130
|
position: Vector3Like;
|
|
@@ -676,12 +677,41 @@ declare const DIVEMath: {
|
|
|
676
677
|
signedAngleTo: typeof signedAngleTo;
|
|
677
678
|
};
|
|
678
679
|
|
|
680
|
+
declare class DIVEInfo {
|
|
681
|
+
private static _supportsWebXR;
|
|
682
|
+
/**
|
|
683
|
+
*
|
|
684
|
+
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
685
|
+
*/
|
|
686
|
+
static GetSystem(): string;
|
|
687
|
+
/**
|
|
688
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
689
|
+
*/
|
|
690
|
+
static GetSupportsWebXR(): Promise<boolean>;
|
|
691
|
+
/**
|
|
692
|
+
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
693
|
+
*/
|
|
694
|
+
static GetSupportsARQuickLook(): boolean;
|
|
695
|
+
/**
|
|
696
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
697
|
+
*/
|
|
698
|
+
static get isMobile(): boolean;
|
|
699
|
+
/**
|
|
700
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
701
|
+
*/
|
|
702
|
+
static get isDesktop(): boolean;
|
|
703
|
+
/**
|
|
704
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
705
|
+
*/
|
|
706
|
+
static GetIsARCapable(): Promise<boolean>;
|
|
707
|
+
}
|
|
708
|
+
|
|
679
709
|
type DIVESettings = {
|
|
680
710
|
autoResize: boolean;
|
|
681
711
|
displayAxes: boolean;
|
|
682
|
-
renderer: DIVERendererSettings
|
|
683
|
-
perspectiveCamera: DIVEPerspectiveCameraSettings
|
|
684
|
-
orbitControls: DIVEOrbitControlsSettings
|
|
712
|
+
renderer: Partial<DIVERendererSettings>;
|
|
713
|
+
perspectiveCamera: Partial<DIVEPerspectiveCameraSettings>;
|
|
714
|
+
orbitControls: Partial<DIVEOrbitControlsSettings>;
|
|
685
715
|
};
|
|
686
716
|
declare const DIVEDefaultSettings: DIVESettings;
|
|
687
717
|
/**
|
|
@@ -722,6 +752,7 @@ declare class DIVE {
|
|
|
722
752
|
private axisCamera;
|
|
723
753
|
get Communication(): DIVECommunication;
|
|
724
754
|
get Canvas(): HTMLCanvasElement;
|
|
755
|
+
get Info(): DIVEInfo;
|
|
725
756
|
set Settings(settings: Partial<DIVESettings>);
|
|
726
757
|
constructor(settings?: Partial<DIVESettings>);
|
|
727
758
|
Dispose(): void;
|
package/build/dive.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Mesh, ColorRepresentation, Object3D, Intersection, Vector2, Raycaster, Vector3 } from 'three';
|
|
2
|
-
import { OrbitControls } from 'three/examples/jsm/
|
|
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/Addons';
|
|
5
5
|
|
|
@@ -10,6 +10,7 @@ type DIVERendererSettings = {
|
|
|
10
10
|
shadowMapEnabled: boolean;
|
|
11
11
|
shadowMapType: ShadowMapType;
|
|
12
12
|
toneMapping: ToneMapping;
|
|
13
|
+
canvas?: HTMLCanvasElement;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* A changed version of the WebGLRenderer.
|
|
@@ -24,7 +25,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
24
25
|
private force;
|
|
25
26
|
private preRenderCallbacks;
|
|
26
27
|
private postRenderCallbacks;
|
|
27
|
-
constructor(rendererSettings?: DIVERendererSettings);
|
|
28
|
+
constructor(rendererSettings?: Partial<DIVERendererSettings>);
|
|
28
29
|
Dispose(): void;
|
|
29
30
|
StartRenderer(scene: Scene, cam: Camera): void;
|
|
30
31
|
PauseRenderer(): void;
|
|
@@ -83,7 +84,7 @@ declare class DIVEPerspectiveCamera extends PerspectiveCamera {
|
|
|
83
84
|
static readonly EDITOR_VIEW_LAYER_MASK: number;
|
|
84
85
|
static readonly LIVE_VIEW_LAYER_MASK = 16;
|
|
85
86
|
onSetCameraLayer: (mask: number) => void;
|
|
86
|
-
constructor(settings?: DIVEPerspectiveCameraSettings);
|
|
87
|
+
constructor(settings?: Partial<DIVEPerspectiveCameraSettings>);
|
|
87
88
|
OnResize(width: number, height: number): void;
|
|
88
89
|
SetCameraLayer(layer: 'LIVE' | 'EDITOR'): void;
|
|
89
90
|
}
|
|
@@ -123,7 +124,7 @@ declare class DIVEOrbitControls extends OrbitControls {
|
|
|
123
124
|
object: DIVEPerspectiveCamera;
|
|
124
125
|
domElement: HTMLCanvasElement;
|
|
125
126
|
private _removePreRenderCallback;
|
|
126
|
-
constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: DIVEOrbitControlsSettings);
|
|
127
|
+
constructor(camera: DIVEPerspectiveCamera, renderer: DIVERenderer, animationSystem: DIVEAnimationSystem, settings?: Partial<DIVEOrbitControlsSettings>);
|
|
127
128
|
Dispose(): void;
|
|
128
129
|
ComputeEncompassingView(bb: Box3): {
|
|
129
130
|
position: Vector3Like;
|
|
@@ -676,12 +677,41 @@ declare const DIVEMath: {
|
|
|
676
677
|
signedAngleTo: typeof signedAngleTo;
|
|
677
678
|
};
|
|
678
679
|
|
|
680
|
+
declare class DIVEInfo {
|
|
681
|
+
private static _supportsWebXR;
|
|
682
|
+
/**
|
|
683
|
+
*
|
|
684
|
+
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
685
|
+
*/
|
|
686
|
+
static GetSystem(): string;
|
|
687
|
+
/**
|
|
688
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
689
|
+
*/
|
|
690
|
+
static GetSupportsWebXR(): Promise<boolean>;
|
|
691
|
+
/**
|
|
692
|
+
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
693
|
+
*/
|
|
694
|
+
static GetSupportsARQuickLook(): boolean;
|
|
695
|
+
/**
|
|
696
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
697
|
+
*/
|
|
698
|
+
static get isMobile(): boolean;
|
|
699
|
+
/**
|
|
700
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
701
|
+
*/
|
|
702
|
+
static get isDesktop(): boolean;
|
|
703
|
+
/**
|
|
704
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
705
|
+
*/
|
|
706
|
+
static GetIsARCapable(): Promise<boolean>;
|
|
707
|
+
}
|
|
708
|
+
|
|
679
709
|
type DIVESettings = {
|
|
680
710
|
autoResize: boolean;
|
|
681
711
|
displayAxes: boolean;
|
|
682
|
-
renderer: DIVERendererSettings
|
|
683
|
-
perspectiveCamera: DIVEPerspectiveCameraSettings
|
|
684
|
-
orbitControls: DIVEOrbitControlsSettings
|
|
712
|
+
renderer: Partial<DIVERendererSettings>;
|
|
713
|
+
perspectiveCamera: Partial<DIVEPerspectiveCameraSettings>;
|
|
714
|
+
orbitControls: Partial<DIVEOrbitControlsSettings>;
|
|
685
715
|
};
|
|
686
716
|
declare const DIVEDefaultSettings: DIVESettings;
|
|
687
717
|
/**
|
|
@@ -722,6 +752,7 @@ declare class DIVE {
|
|
|
722
752
|
private axisCamera;
|
|
723
753
|
get Communication(): DIVECommunication;
|
|
724
754
|
get Canvas(): HTMLCanvasElement;
|
|
755
|
+
get Info(): DIVEInfo;
|
|
725
756
|
set Settings(settings: Partial<DIVESettings>);
|
|
726
757
|
constructor(settings?: Partial<DIVESettings>);
|
|
727
758
|
Dispose(): void;
|
package/build/dive.js
CHANGED
|
@@ -449,7 +449,12 @@ var init_PerspectiveCamera = __esm({
|
|
|
449
449
|
};
|
|
450
450
|
_DIVEPerspectiveCamera = class _DIVEPerspectiveCamera extends PerspectiveCamera {
|
|
451
451
|
constructor(settings = DIVEPerspectiveCameraDefaultSettings) {
|
|
452
|
-
super(
|
|
452
|
+
super(
|
|
453
|
+
settings.fov || DIVEPerspectiveCameraDefaultSettings.fov,
|
|
454
|
+
1,
|
|
455
|
+
settings.near || DIVEPerspectiveCameraDefaultSettings.near,
|
|
456
|
+
settings.far || DIVEPerspectiveCameraDefaultSettings.far
|
|
457
|
+
);
|
|
453
458
|
this.onSetCameraLayer = () => {
|
|
454
459
|
};
|
|
455
460
|
this.layers.mask = _DIVEPerspectiveCamera.EDITOR_VIEW_LAYER_MASK;
|
|
@@ -524,14 +529,16 @@ var DIVERendererDefaultSettings = {
|
|
|
524
529
|
stencil: false,
|
|
525
530
|
shadowMapEnabled: true,
|
|
526
531
|
shadowMapType: PCFSoftShadowMap,
|
|
527
|
-
toneMapping: NoToneMapping
|
|
532
|
+
toneMapping: NoToneMapping,
|
|
533
|
+
canvas: void 0
|
|
528
534
|
};
|
|
529
535
|
var DIVERenderer = class extends WebGLRenderer {
|
|
530
536
|
constructor(rendererSettings = DIVERendererDefaultSettings) {
|
|
531
537
|
super({
|
|
532
|
-
antialias: rendererSettings.antialias,
|
|
533
|
-
alpha: rendererSettings.alpha,
|
|
534
|
-
preserveDrawingBuffer: true
|
|
538
|
+
antialias: rendererSettings.antialias || DIVERendererDefaultSettings.antialias,
|
|
539
|
+
alpha: rendererSettings.alpha || DIVERendererDefaultSettings.alpha,
|
|
540
|
+
preserveDrawingBuffer: true,
|
|
541
|
+
canvas: rendererSettings.canvas
|
|
535
542
|
});
|
|
536
543
|
// basic functionality members
|
|
537
544
|
this.paused = false;
|
|
@@ -541,9 +548,9 @@ var DIVERenderer = class extends WebGLRenderer {
|
|
|
541
548
|
this.preRenderCallbacks = /* @__PURE__ */ new Map();
|
|
542
549
|
this.postRenderCallbacks = /* @__PURE__ */ new Map();
|
|
543
550
|
this.setPixelRatio(window.devicePixelRatio);
|
|
544
|
-
this.shadowMap.enabled = rendererSettings.shadowMapEnabled;
|
|
545
|
-
this.shadowMap.type = rendererSettings.shadowMapType;
|
|
546
|
-
this.toneMapping = rendererSettings.toneMapping;
|
|
551
|
+
this.shadowMap.enabled = rendererSettings.shadowMapEnabled || DIVERendererDefaultSettings.shadowMapEnabled;
|
|
552
|
+
this.shadowMap.type = rendererSettings.shadowMapType || DIVERendererDefaultSettings.shadowMapType;
|
|
553
|
+
this.toneMapping = rendererSettings.toneMapping || DIVERendererDefaultSettings.toneMapping;
|
|
547
554
|
this.debug.checkShaderErrors = false;
|
|
548
555
|
}
|
|
549
556
|
// Stops renderings and disposes the renderer.
|
|
@@ -1552,7 +1559,7 @@ var DIVEScene = class extends Scene2 {
|
|
|
1552
1559
|
init_PerspectiveCamera();
|
|
1553
1560
|
|
|
1554
1561
|
// src/controls/OrbitControls.ts
|
|
1555
|
-
import { OrbitControls } from "three/examples/jsm/
|
|
1562
|
+
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
|
|
1556
1563
|
import { MathUtils as MathUtils2, Vector3 as Vector33 } from "three";
|
|
1557
1564
|
import { Easing } from "@tweenjs/tween.js";
|
|
1558
1565
|
var DIVEOrbitControlsDefaultSettings = {
|
|
@@ -1584,8 +1591,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
|
|
|
1584
1591
|
this._removePreRenderCallback = () => {
|
|
1585
1592
|
renderer.RemovePreRenderCallback(id);
|
|
1586
1593
|
};
|
|
1587
|
-
this.enableDamping = settings.enableDamping;
|
|
1588
|
-
this.dampingFactor = settings.dampingFactor;
|
|
1594
|
+
this.enableDamping = settings.enableDamping || DIVEOrbitControlsDefaultSettings.enableDamping;
|
|
1595
|
+
this.dampingFactor = settings.dampingFactor || DIVEOrbitControlsDefaultSettings.dampingFactor;
|
|
1596
|
+
this.object.position.set(0, 2, 2);
|
|
1597
|
+
this.target.copy({ x: 0, y: 0.5, z: 0 });
|
|
1598
|
+
this.update();
|
|
1589
1599
|
}
|
|
1590
1600
|
Dispose() {
|
|
1591
1601
|
this._removePreRenderCallback();
|
|
@@ -1939,6 +1949,105 @@ var DIVEMath = {
|
|
|
1939
1949
|
|
|
1940
1950
|
// src/dive.ts
|
|
1941
1951
|
import { generateUUID as generateUUID2 } from "three/src/math/MathUtils";
|
|
1952
|
+
|
|
1953
|
+
// src/info/Info.ts
|
|
1954
|
+
var DIVEInfo = class {
|
|
1955
|
+
/**
|
|
1956
|
+
*
|
|
1957
|
+
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
1958
|
+
*/
|
|
1959
|
+
static GetSystem() {
|
|
1960
|
+
const platform = navigator.platform;
|
|
1961
|
+
if (/Android/.test(navigator.userAgent)) {
|
|
1962
|
+
return "Android";
|
|
1963
|
+
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent)) {
|
|
1964
|
+
return "iOS";
|
|
1965
|
+
} else if (platform.startsWith("Win")) {
|
|
1966
|
+
return "Windows";
|
|
1967
|
+
} else if (platform.startsWith("Mac")) {
|
|
1968
|
+
return "MacOS";
|
|
1969
|
+
} else if (platform.startsWith("Linux")) {
|
|
1970
|
+
return "Linux";
|
|
1971
|
+
} else {
|
|
1972
|
+
return "Unknown";
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
1977
|
+
*/
|
|
1978
|
+
static GetSupportsWebXR() {
|
|
1979
|
+
return __async(this, null, function* () {
|
|
1980
|
+
if (this._supportsWebXR !== null) {
|
|
1981
|
+
return this._supportsWebXR;
|
|
1982
|
+
}
|
|
1983
|
+
if (!navigator.xr) {
|
|
1984
|
+
this._supportsWebXR = false;
|
|
1985
|
+
return this._supportsWebXR;
|
|
1986
|
+
}
|
|
1987
|
+
try {
|
|
1988
|
+
const supported = yield navigator.xr.isSessionSupported("immersive-ar");
|
|
1989
|
+
this._supportsWebXR = supported;
|
|
1990
|
+
} catch (error) {
|
|
1991
|
+
this._supportsWebXR = false;
|
|
1992
|
+
}
|
|
1993
|
+
return this._supportsWebXR;
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
1998
|
+
*/
|
|
1999
|
+
static GetSupportsARQuickLook() {
|
|
2000
|
+
const a = document.createElement("a");
|
|
2001
|
+
if (a.relList.supports("ar")) {
|
|
2002
|
+
return true;
|
|
2003
|
+
}
|
|
2004
|
+
const userAgent = navigator.userAgent;
|
|
2005
|
+
const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
|
|
2006
|
+
if (!isIOS) {
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2009
|
+
const match = userAgent.match(/OS (\d+)_/);
|
|
2010
|
+
if (!match || match.length < 2) {
|
|
2011
|
+
return false;
|
|
2012
|
+
}
|
|
2013
|
+
const iOSVersion = parseInt(match[1], 10);
|
|
2014
|
+
const minQuickLookVersion = 12;
|
|
2015
|
+
if (iOSVersion < minQuickLookVersion) {
|
|
2016
|
+
return false;
|
|
2017
|
+
}
|
|
2018
|
+
const isSupportedBrowser = /^((?!chrome|android).)*safari|CriOS|FxiOS/i.test(userAgent);
|
|
2019
|
+
if (isSupportedBrowser) {
|
|
2020
|
+
return true;
|
|
2021
|
+
}
|
|
2022
|
+
return false;
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
2026
|
+
*/
|
|
2027
|
+
static get isMobile() {
|
|
2028
|
+
return this.GetSystem() === "Android" || this.GetSystem() === "iOS";
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
2032
|
+
*/
|
|
2033
|
+
static get isDesktop() {
|
|
2034
|
+
return !this.isMobile;
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
2038
|
+
*/
|
|
2039
|
+
static GetIsARCapable() {
|
|
2040
|
+
return __async(this, null, function* () {
|
|
2041
|
+
if (this.GetSupportsARQuickLook()) {
|
|
2042
|
+
return true;
|
|
2043
|
+
}
|
|
2044
|
+
return yield this.GetSupportsWebXR();
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
DIVEInfo._supportsWebXR = null;
|
|
2049
|
+
|
|
2050
|
+
// src/dive.ts
|
|
1942
2051
|
var DIVEDefaultSettings = {
|
|
1943
2052
|
autoResize: true,
|
|
1944
2053
|
displayAxes: false,
|
|
@@ -2002,20 +2111,23 @@ var DIVE = class _DIVE {
|
|
|
2002
2111
|
get Canvas() {
|
|
2003
2112
|
return this.renderer.domElement;
|
|
2004
2113
|
}
|
|
2114
|
+
get Info() {
|
|
2115
|
+
return DIVEInfo;
|
|
2116
|
+
}
|
|
2005
2117
|
// setters
|
|
2006
2118
|
set Settings(settings) {
|
|
2007
2119
|
var _a;
|
|
2008
2120
|
const settingsDelta = getObjectDelta(this._settings, settings);
|
|
2009
2121
|
if (settingsDelta.renderer) this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2010
2122
|
if (settingsDelta.perspectiveCamera) {
|
|
2011
|
-
this.perspectiveCamera.fov = settingsDelta.perspectiveCamera.fov;
|
|
2012
|
-
this.perspectiveCamera.near = settingsDelta.perspectiveCamera.near;
|
|
2013
|
-
this.perspectiveCamera.far = settingsDelta.perspectiveCamera.far;
|
|
2123
|
+
if (settingsDelta.perspectiveCamera.fov !== void 0) this.perspectiveCamera.fov = settingsDelta.perspectiveCamera.fov;
|
|
2124
|
+
if (settingsDelta.perspectiveCamera.near !== void 0) this.perspectiveCamera.near = settingsDelta.perspectiveCamera.near;
|
|
2125
|
+
if (settingsDelta.perspectiveCamera.far !== void 0) this.perspectiveCamera.far = settingsDelta.perspectiveCamera.far;
|
|
2014
2126
|
this.perspectiveCamera.OnResize(this.renderer.domElement.width, this.renderer.domElement.height);
|
|
2015
2127
|
}
|
|
2016
2128
|
if (settingsDelta.orbitControls) {
|
|
2017
|
-
this.orbitControls.enableDamping = settingsDelta.orbitControls.enableDamping;
|
|
2018
|
-
this.orbitControls.dampingFactor = settingsDelta.orbitControls.dampingFactor;
|
|
2129
|
+
if (settingsDelta.orbitControls.enableDamping !== void 0) this.orbitControls.enableDamping = settingsDelta.orbitControls.enableDamping;
|
|
2130
|
+
if (settingsDelta.orbitControls.dampingFactor !== void 0) this.orbitControls.dampingFactor = settingsDelta.orbitControls.dampingFactor;
|
|
2019
2131
|
}
|
|
2020
2132
|
if (settingsDelta.autoResize !== this._settings.autoResize) {
|
|
2021
2133
|
if (settingsDelta.autoResize) {
|
|
@@ -2058,6 +2170,7 @@ var DIVE = class _DIVE {
|
|
|
2058
2170
|
console.log(this.scene);
|
|
2059
2171
|
}
|
|
2060
2172
|
};
|
|
2173
|
+
console.log("DIVE initialized");
|
|
2061
2174
|
}
|
|
2062
2175
|
Dispose() {
|
|
2063
2176
|
var _a;
|