@configura/babylon-view 2.1.0-alpha.2 → 2.1.0-alpha.3

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.
Files changed (134) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/animation/AnimatableObject.d.ts +8 -8
  5. package/dist/animation/AnimatableObject.js +3 -3
  6. package/dist/animation/animator/Animator.d.ts +33 -33
  7. package/dist/animation/animator/Animator.js +58 -58
  8. package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
  9. package/dist/animation/animator/AnimatorEasing.js +31 -31
  10. package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
  11. package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
  12. package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
  13. package/dist/animation/animator/AnimatorHighlight.js +32 -32
  14. package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
  15. package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
  16. package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
  17. package/dist/animation/animator/AnimatorQueue.js +57 -57
  18. package/dist/animation/animator/AnimatorScale.d.ts +8 -8
  19. package/dist/animation/animator/AnimatorScale.js +13 -13
  20. package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
  21. package/dist/animation/animator/AnimatorSpin.js +13 -13
  22. package/dist/animation/animator/EasingFunctions.d.ts +35 -35
  23. package/dist/animation/animator/EasingFunctions.js +137 -137
  24. package/dist/animation/coordinator/Coordinator.d.ts +28 -28
  25. package/dist/animation/coordinator/Coordinator.js +53 -53
  26. package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
  27. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +138 -138
  28. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
  29. package/dist/animation/coordinator/CoordinatorIdentity.js +14 -14
  30. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
  31. package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
  32. package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
  33. package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
  34. package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
  35. package/dist/animation/coordinator/CoordinatorPulseBounce.js +35 -35
  36. package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
  37. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +29 -29
  38. package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
  39. package/dist/animation/coordinator/CoordinatorPulseInflate.js +23 -23
  40. package/dist/camera/CameraCreator.d.ts +5 -5
  41. package/dist/camera/CameraCreator.js +4 -4
  42. package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
  43. package/dist/camera/CfgArcRotateCameraPointersInput.js +266 -266
  44. package/dist/camera/CfgOrbitalCamera.d.ts +76 -76
  45. package/dist/camera/CfgOrbitalCamera.js +281 -281
  46. package/dist/camera/CfgOrbitalCameraControlProps.d.ts +14 -14
  47. package/dist/camera/CfgOrbitalCameraControlProps.js +7 -7
  48. package/dist/camera/GradingApplier.d.ts +3 -3
  49. package/dist/camera/GradingApplier.js +48 -48
  50. package/dist/engine/EngineCreator.d.ts +3 -3
  51. package/dist/engine/EngineCreator.js +10 -10
  52. package/dist/geometry/CfgGeometry.d.ts +29 -29
  53. package/dist/geometry/CfgGeometry.js +146 -146
  54. package/dist/geometry/CfgMesh.d.ts +10 -10
  55. package/dist/geometry/CfgMesh.js +38 -38
  56. package/dist/geometry/geoSplitter.d.ts +8 -8
  57. package/dist/geometry/geoSplitter.js +192 -192
  58. package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
  59. package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
  60. package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
  61. package/dist/geometry/stretch/CfgStretchData.js +350 -350
  62. package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
  63. package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
  64. package/dist/index.d.ts +16 -16
  65. package/dist/index.js +16 -16
  66. package/dist/io/CfgHistoryToCameraConfConnector.d.ts +31 -31
  67. package/dist/io/CfgHistoryToCameraConfConnector.js +90 -90
  68. package/dist/io/CfgIOCameraConfConnector.d.ts +35 -35
  69. package/dist/io/CfgIOCameraConfConnector.js +81 -81
  70. package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +10 -10
  71. package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -11
  72. package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +10 -10
  73. package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -11
  74. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  75. package/dist/light/CfgDirectionalLight.js +18 -18
  76. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  77. package/dist/light/CfgHemisphericLight.js +17 -17
  78. package/dist/light/CfgPointLight.d.ts +8 -8
  79. package/dist/light/CfgPointLight.js +18 -18
  80. package/dist/light/DefaultLightRig.d.ts +19 -19
  81. package/dist/light/DefaultLightRig.js +77 -77
  82. package/dist/light/LightRigCreator.d.ts +9 -9
  83. package/dist/light/LightRigCreator.js +3 -3
  84. package/dist/material/CfgMaterial.d.ts +68 -68
  85. package/dist/material/CfgMaterial.js +482 -482
  86. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  87. package/dist/material/DummyMaterialCreator.js +15 -15
  88. package/dist/material/material.d.ts +18 -18
  89. package/dist/material/material.js +128 -128
  90. package/dist/material/texture.d.ts +14 -14
  91. package/dist/material/texture.js +306 -306
  92. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  93. package/dist/nodes/CfgContentRootNode.js +75 -75
  94. package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
  95. package/dist/nodes/CfgDeferredMeshNode.js +378 -378
  96. package/dist/nodes/CfgProductNode.d.ts +127 -127
  97. package/dist/nodes/CfgProductNode.js +598 -598
  98. package/dist/nodes/CfgSymNode.d.ts +50 -50
  99. package/dist/nodes/CfgSymNode.js +249 -249
  100. package/dist/nodes/CfgSymRootNode.d.ts +45 -45
  101. package/dist/nodes/CfgSymRootNode.js +229 -229
  102. package/dist/nodes/CfgTransformNode.d.ts +33 -33
  103. package/dist/nodes/CfgTransformNode.js +83 -83
  104. package/dist/scene/SceneCreator.d.ts +6 -6
  105. package/dist/scene/SceneCreator.js +22 -22
  106. package/dist/utilities/CfgBoundingBox.d.ts +21 -21
  107. package/dist/utilities/CfgBoundingBox.js +81 -81
  108. package/dist/utilities/anchor/anchor.d.ts +50 -50
  109. package/dist/utilities/anchor/anchor.js +133 -133
  110. package/dist/utilities/anchor/anchorMap.d.ts +20 -20
  111. package/dist/utilities/anchor/anchorMap.js +111 -111
  112. package/dist/utilities/utilities3D.d.ts +70 -70
  113. package/dist/utilities/utilities3D.js +265 -265
  114. package/dist/utilities/utilitiesColor.d.ts +18 -18
  115. package/dist/utilities/utilitiesColor.js +50 -50
  116. package/dist/utilities/utilitiesImage.d.ts +6 -6
  117. package/dist/utilities/utilitiesImage.js +107 -107
  118. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
  119. package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
  120. package/dist/view/BaseView.d.ts +78 -78
  121. package/dist/view/BaseView.js +303 -303
  122. package/dist/view/BaseViewConfiguration.d.ts +32 -32
  123. package/dist/view/BaseViewConfiguration.js +10 -10
  124. package/dist/view/RenderEnv.d.ts +43 -43
  125. package/dist/view/RenderEnv.js +7 -7
  126. package/dist/view/SingleProductDefaultCameraView.d.ts +38 -38
  127. package/dist/view/SingleProductDefaultCameraView.js +149 -149
  128. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +44 -44
  129. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  130. package/dist/view/SingleProductView.d.ts +44 -44
  131. package/dist/view/SingleProductView.js +212 -212
  132. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  133. package/dist/view/SingleProductViewConfiguration.js +19 -19
  134. package/package.json +5 -5
@@ -1,33 +1,33 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
- import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
3
- import { EventListener } from "@configura/web-utilities";
4
- import { RenderEnv } from "./RenderEnv.js";
5
- export { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
6
- /**
7
- * @param allowedDetailLevels Optionally controls the detail level (LOD, level of detail) allowed
8
- * when loading the 3D models. Provide a single DetailLevel or an array of them if you want to
9
- * override the default selection and/or order. The order of the array defines the priority since
10
- * models are not guaranteed to have all DetailLevels available.
11
- */
12
- export interface BaseViewConfiguration {
13
- allowedDetailLevels?: DetailLevel | DetailLevel[];
14
- }
15
- export declare type BaseViewEventListener<K extends keyof BaseViewEventMap> = EventListener<BaseViewEventMap, K>;
16
- export declare type ScheduleRerender = (dumpNextFrameToImage?: ImageDumpCallback) => void;
17
- export declare type ImageDumpCallback = (imageDataUrl: string) => void;
18
- export interface BaseViewEventMap {
19
- renderEnv: RenderEnv;
20
- error: Error;
21
- loading: boolean;
22
- cameraConfiguration: CameraConfigurationProps;
23
- }
24
- export interface CameraConfigurationProps {
25
- nearClipping: number;
26
- farClipping: number;
27
- position: Vector3;
28
- contentPosition: Vector3;
29
- fov: number;
30
- aspect: number;
31
- }
32
- export declare function cameraConfigurationPropsEquals(left: CameraConfigurationProps, right: CameraConfigurationProps): boolean;
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
3
+ import { EventListener } from "@configura/web-utilities";
4
+ import { RenderEnv } from "./RenderEnv.js";
5
+ export { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
6
+ /**
7
+ * @param allowedDetailLevels Optionally controls the detail level (LOD, level of detail) allowed
8
+ * when loading the 3D models. Provide a single DetailLevel or an array of them if you want to
9
+ * override the default selection and/or order. The order of the array defines the priority since
10
+ * models are not guaranteed to have all DetailLevels available.
11
+ */
12
+ export interface BaseViewConfiguration {
13
+ allowedDetailLevels?: DetailLevel | DetailLevel[];
14
+ }
15
+ export declare type BaseViewEventListener<K extends keyof BaseViewEventMap> = EventListener<BaseViewEventMap, K>;
16
+ export declare type ScheduleRerender = (dumpNextFrameToImage?: ImageDumpCallback) => void;
17
+ export declare type ImageDumpCallback = (imageDataUrl: string) => void;
18
+ export interface BaseViewEventMap {
19
+ renderEnv: RenderEnv;
20
+ error: Error;
21
+ loading: boolean;
22
+ cameraConfiguration: CameraConfigurationProps;
23
+ }
24
+ export interface CameraConfigurationProps {
25
+ nearClipping: number;
26
+ farClipping: number;
27
+ position: Vector3;
28
+ contentPosition: Vector3;
29
+ fov: number;
30
+ aspect: number;
31
+ }
32
+ export declare function cameraConfigurationPropsEquals(left: CameraConfigurationProps, right: CameraConfigurationProps): boolean;
33
33
  //# sourceMappingURL=BaseViewConfiguration.d.ts.map
@@ -1,10 +1,10 @@
1
- import { vector3Equals } from "../utilities/utilities3D.js";
2
- export { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
3
- export function cameraConfigurationPropsEquals(left, right) {
4
- return (left.nearClipping === right.nearClipping &&
5
- left.farClipping === right.farClipping &&
6
- vector3Equals(left.position, right.position) &&
7
- vector3Equals(left.contentPosition, right.contentPosition) &&
8
- left.fov === right.fov &&
9
- left.aspect === right.aspect);
10
- }
1
+ import { vector3Equals } from "../utilities/utilities3D.js";
2
+ export { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
3
+ export function cameraConfigurationPropsEquals(left, right) {
4
+ return (left.nearClipping === right.nearClipping &&
5
+ left.farClipping === right.farClipping &&
6
+ vector3Equals(left.position, right.position) &&
7
+ vector3Equals(left.contentPosition, right.contentPosition) &&
8
+ left.fov === right.fov &&
9
+ left.aspect === right.aspect);
10
+ }
@@ -1,44 +1,44 @@
1
- import { AssetsManager } from "@babylonjs/core/Misc/assetsManager.js";
2
- import { Scene } from "@babylonjs/core/scene.js";
3
- import { GMaterial3D } from "@configura/web-core/dist/cm/core3D/GMaterial3D.js";
4
- import { SymComponent } from "@configura/web-core/dist/cm/format/cmsym/components/SymComponent.js";
5
- import { SymGetMeshEnv } from "@configura/web-core/dist/cm/format/cmsym/components/SymGetMeshEnv.js";
6
- import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
7
- import { DexManager } from "@configura/web-core/dist/cm/format/dex/DexManager.js";
8
- import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
9
- import { PromiseCache } from "@configura/web-utilities";
10
- import { CfgGeometry } from "../geometry/CfgGeometry.js";
11
- import { LightRig } from "../light/LightRigCreator.js";
12
- import { CfgMaterial } from "../material/CfgMaterial.js";
13
- import { MaterialWithMetaData } from "../material/material.js";
14
- import { TextureImageWithMetaData } from "../material/texture.js";
15
- import { ScheduleRerender } from "./BaseViewConfiguration.js";
16
- export declare type GeometryCacheIdentifierObject = {
17
- component: SymComponent;
18
- stretchDatasHash: number;
19
- uvMapperHash: number | undefined;
20
- };
21
- export interface RenderEnv {
22
- scene: Scene;
23
- assetsManager: AssetsManager;
24
- dummyMaterial: CfgMaterial;
25
- geometryCache: PromiseCache<GeometryCacheIdentifierObject, GeometryCacheEntry | undefined>;
26
- symNodeCache: PromiseCache<string, SymNode>;
27
- materialCache: PromiseCache<string | GMaterial3D, MaterialWithMetaData>;
28
- textureImageCache: PromiseCache<string, TextureImageWithMetaData>;
29
- derivedNormalMapCache: PromiseCache<string, HTMLImageElement | undefined>;
30
- lightRig: LightRig;
31
- scheduleRerender: ScheduleRerender;
32
- notifyError: (e: unknown) => void;
33
- symMeshEnv: SymGetMeshEnv;
34
- dexManager: DexManager;
35
- cullEmptyNodes: boolean;
36
- allowedDetailLevels: DetailLevel | DetailLevel[];
37
- }
38
- export declare class GeometryCacheEntry {
39
- readonly geometry: CfgGeometry;
40
- readonly doubleSided: boolean | undefined;
41
- readonly lowerLeftTextureOrigin: boolean | undefined;
42
- constructor(geometry: CfgGeometry, doubleSided: boolean | undefined, lowerLeftTextureOrigin: boolean | undefined);
43
- }
1
+ import { AssetsManager } from "@babylonjs/core/Misc/assetsManager.js";
2
+ import { Scene } from "@babylonjs/core/scene.js";
3
+ import { GMaterial3D } from "@configura/web-core/dist/cm/core3D/GMaterial3D.js";
4
+ import { SymComponent } from "@configura/web-core/dist/cm/format/cmsym/components/SymComponent.js";
5
+ import { SymGetMeshEnv } from "@configura/web-core/dist/cm/format/cmsym/components/SymGetMeshEnv.js";
6
+ import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
7
+ import { DexManager } from "@configura/web-core/dist/cm/format/dex/DexManager.js";
8
+ import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
9
+ import { PromiseCache } from "@configura/web-utilities";
10
+ import { CfgGeometry } from "../geometry/CfgGeometry.js";
11
+ import { LightRig } from "../light/LightRigCreator.js";
12
+ import { CfgMaterial } from "../material/CfgMaterial.js";
13
+ import { MaterialWithMetaData } from "../material/material.js";
14
+ import { TextureImageWithMetaData } from "../material/texture.js";
15
+ import { ScheduleRerender } from "./BaseViewConfiguration.js";
16
+ export declare type GeometryCacheIdentifierObject = {
17
+ component: SymComponent;
18
+ stretchDatasHash: number;
19
+ uvMapperHash: number | undefined;
20
+ };
21
+ export interface RenderEnv {
22
+ scene: Scene;
23
+ assetsManager: AssetsManager;
24
+ dummyMaterial: CfgMaterial;
25
+ geometryCache: PromiseCache<GeometryCacheIdentifierObject, GeometryCacheEntry | undefined>;
26
+ symNodeCache: PromiseCache<string, SymNode>;
27
+ materialCache: PromiseCache<string | GMaterial3D, MaterialWithMetaData>;
28
+ textureImageCache: PromiseCache<string, TextureImageWithMetaData>;
29
+ derivedNormalMapCache: PromiseCache<string, HTMLImageElement | undefined>;
30
+ lightRig: LightRig;
31
+ scheduleRerender: ScheduleRerender;
32
+ notifyError: (e: unknown) => void;
33
+ symMeshEnv: SymGetMeshEnv;
34
+ dexManager: DexManager;
35
+ cullEmptyNodes: boolean;
36
+ allowedDetailLevels: DetailLevel | DetailLevel[];
37
+ }
38
+ export declare class GeometryCacheEntry {
39
+ readonly geometry: CfgGeometry;
40
+ readonly doubleSided: boolean | undefined;
41
+ readonly lowerLeftTextureOrigin: boolean | undefined;
42
+ constructor(geometry: CfgGeometry, doubleSided: boolean | undefined, lowerLeftTextureOrigin: boolean | undefined);
43
+ }
44
44
  //# sourceMappingURL=RenderEnv.d.ts.map
@@ -1,7 +1,7 @@
1
- export class GeometryCacheEntry {
2
- constructor(geometry, doubleSided, lowerLeftTextureOrigin) {
3
- this.geometry = geometry;
4
- this.doubleSided = doubleSided;
5
- this.lowerLeftTextureOrigin = lowerLeftTextureOrigin;
6
- }
7
- }
1
+ export class GeometryCacheEntry {
2
+ constructor(geometry, doubleSided, lowerLeftTextureOrigin) {
3
+ this.geometry = geometry;
4
+ this.doubleSided = doubleSided;
5
+ this.lowerLeftTextureOrigin = lowerLeftTextureOrigin;
6
+ }
7
+ }
@@ -1,39 +1,39 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
- import { EventListener, Observable } from "@configura/web-utilities";
3
- import { CfgOrbitalCamera } from "../camera/CfgOrbitalCamera.js";
4
- import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
5
- import { EngineCreator } from "../engine/EngineCreator.js";
6
- import { LightRigCreator } from "../light/LightRigCreator.js";
7
- import { DummyMaterialCreator } from "../material/DummyMaterialCreator.js";
8
- import { SceneCreator } from "../scene/SceneCreator.js";
9
- import { OrbitalCameraConfigurationProps, SingleProductDefaultCameraViewConfiguration, SingleProductDefaultCameraViewEventMap } from "./SingleProductDefaultCameraViewConfiguration.js";
10
- import { SingleProductView } from "./SingleProductView.js";
11
- export declare type SingleProductDefaultCameraViewConstructorOptions = {
12
- canvas: HTMLCanvasElement;
13
- engineCreator?: EngineCreator;
14
- lightRigCreator?: LightRigCreator;
15
- sceneCreator?: SceneCreator;
16
- dummyMaterialCreator?: DummyMaterialCreator;
17
- };
18
- export declare class SingleProductDefaultCameraView<T extends SingleProductDefaultCameraViewEventMap = SingleProductDefaultCameraViewEventMap> extends SingleProductView<CfgOrbitalCamera, T> {
19
- private _orbitalCameraConfigurationObservable;
20
- private _previousOrbitalCameraConf;
21
- constructor(options: SingleProductDefaultCameraViewConstructorOptions);
22
- private _cameraDefaults;
23
- private initOrResetCamera;
24
- resetCamera(): void;
25
- setConfiguration(configuration: SingleProductDefaultCameraViewConfiguration): void;
26
- addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
27
- removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
28
- get orbitalCameraConfiguration(): OrbitalCameraConfigurationProps;
29
- protected notifyCameraListeners(): void;
30
- get cameraControlObservable(): Observable<CfgOrbitalCameraControlProps>;
31
- protected get contentCenter(): Vector3;
32
- /**
33
- * @param force true means force apply camera distance and camera bounds. false means force do not apply.
34
- */
35
- protected handleSizing(force: boolean): void;
36
- protected refreshCameraNearFar(): void;
37
- protected getNeededFrameRender(time: number): boolean;
38
- }
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { EventListener, Observable } from "@configura/web-utilities";
3
+ import { CfgOrbitalCamera } from "../camera/CfgOrbitalCamera.js";
4
+ import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
5
+ import { EngineCreator } from "../engine/EngineCreator.js";
6
+ import { LightRigCreator } from "../light/LightRigCreator.js";
7
+ import { DummyMaterialCreator } from "../material/DummyMaterialCreator.js";
8
+ import { SceneCreator } from "../scene/SceneCreator.js";
9
+ import { OrbitalCameraConfigurationProps, SingleProductDefaultCameraViewConfiguration, SingleProductDefaultCameraViewEventMap } from "./SingleProductDefaultCameraViewConfiguration.js";
10
+ import { SingleProductView } from "./SingleProductView.js";
11
+ export declare type SingleProductDefaultCameraViewConstructorOptions = {
12
+ canvas: HTMLCanvasElement;
13
+ engineCreator?: EngineCreator;
14
+ lightRigCreator?: LightRigCreator;
15
+ sceneCreator?: SceneCreator;
16
+ dummyMaterialCreator?: DummyMaterialCreator;
17
+ };
18
+ export declare class SingleProductDefaultCameraView<T extends SingleProductDefaultCameraViewEventMap = SingleProductDefaultCameraViewEventMap> extends SingleProductView<CfgOrbitalCamera, T> {
19
+ private _orbitalCameraConfigurationObservable;
20
+ private _previousOrbitalCameraConf;
21
+ constructor(options: SingleProductDefaultCameraViewConstructorOptions);
22
+ private _cameraDefaults;
23
+ private initOrResetCamera;
24
+ resetCamera(): void;
25
+ setConfiguration(configuration: SingleProductDefaultCameraViewConfiguration): void;
26
+ addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
27
+ removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
28
+ get orbitalCameraConfiguration(): OrbitalCameraConfigurationProps;
29
+ protected notifyCameraListeners(): void;
30
+ get cameraControlObservable(): Observable<CfgOrbitalCameraControlProps>;
31
+ protected get contentCenter(): Vector3;
32
+ /**
33
+ * @param force true means force apply camera distance and camera bounds. false means force do not apply.
34
+ */
35
+ protected handleSizing(force: boolean): void;
36
+ protected refreshCameraNearFar(): void;
37
+ protected getNeededFrameRender(time: number): boolean;
38
+ }
39
39
  //# sourceMappingURL=SingleProductDefaultCameraView.d.ts.map
@@ -1,149 +1,149 @@
1
- import { Observable } from "@configura/web-utilities";
2
- import { getDefaultCamera } from "../camera/CameraCreator.js";
3
- import { MAX_UPPER_BETA_LIMIT, MIN_LOWER_BETA_LIMIT, } from "../camera/CfgOrbitalCamera.js";
4
- import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
5
- import { measureLongestDistanceToCorner } from "../utilities/utilities3D.js";
6
- import { CET_TO_BABYLON_MATRIX } from "./BaseView.js";
7
- import { orbitalCameraConfigurationPropsEquals, } from "./SingleProductDefaultCameraViewConfiguration.js";
8
- import { SingleProductView } from "./SingleProductView.js";
9
- const CONTENT_TO_LIGHT_RIG_SCALE_FACTOR = 1;
10
- export class SingleProductDefaultCameraView extends SingleProductView {
11
- constructor(options) {
12
- super(Object.assign(Object.assign({}, options), { cameraCreator: getDefaultCamera }));
13
- this._cameraDefaults = {};
14
- }
15
- initOrResetCamera(props) {
16
- this.handleSizing(true);
17
- const { distance, pitch, yaw } = props;
18
- let change = false;
19
- if (distance !== undefined) {
20
- this._camera.forceRadius(distance);
21
- change = true;
22
- }
23
- if (pitch !== undefined) {
24
- this._camera.beta = pitch;
25
- change = true;
26
- }
27
- if (yaw !== undefined) {
28
- this._camera.alpha = yaw;
29
- change = true;
30
- }
31
- if (change) {
32
- // Force a recompute of the view matrix as if a target-change happens in
33
- // the same frame render alpha/beta will be reset.
34
- this._camera.getViewMatrix();
35
- }
36
- }
37
- resetCamera() {
38
- this.initOrResetCamera(this._cameraDefaults);
39
- }
40
- setConfiguration(configuration) {
41
- var _a;
42
- super.setConfiguration(configuration);
43
- const cameraConf = configuration.camera || {};
44
- this._camera.disableAutomaticSizing = cameraConf.disableAutomaticSizing === true;
45
- this._camera.disableZoom = cameraConf.disableZoom === true;
46
- this._camera.disableSubFloorCam = cameraConf.disableSubFloorCam === true;
47
- this._camera.lowestAllowedCameraHeight = cameraConf.lowestAllowedCameraHeight;
48
- this._cameraDefaults = cameraConf;
49
- this.initOrResetCamera((_a = cameraConf.initial) !== null && _a !== void 0 ? _a : cameraConf);
50
- const { autoRotate } = cameraConf;
51
- if (autoRotate !== undefined) {
52
- this._camera.useAutoRotationBehavior = true;
53
- const behavior = this._camera.autoRotationBehavior;
54
- if (behavior !== null) {
55
- if (autoRotate.idleRotationSpeed !== undefined) {
56
- behavior.idleRotationSpeed = autoRotate.idleRotationSpeed;
57
- }
58
- if (autoRotate.idleRotationSpinupTime !== undefined) {
59
- behavior.idleRotationSpinupTime = autoRotate.idleRotationSpinupTime;
60
- }
61
- if (autoRotate.idleRotationWaitTime !== undefined) {
62
- behavior.idleRotationWaitTime = autoRotate.idleRotationWaitTime;
63
- }
64
- if (autoRotate.zoomStopsAnimation !== undefined) {
65
- behavior.zoomStopsAnimation = autoRotate.zoomStopsAnimation;
66
- }
67
- }
68
- }
69
- else {
70
- this._camera.useAutoRotationBehavior = false;
71
- }
72
- }
73
- addEventListener(event, listener) {
74
- switch (event) {
75
- case "orbitalCameraConfiguration":
76
- if (this._orbitalCameraConfigurationObservable === undefined) {
77
- this._orbitalCameraConfigurationObservable =
78
- new Observable();
79
- }
80
- this._orbitalCameraConfigurationObservable.listen(listener);
81
- break;
82
- default:
83
- super.addEventListener(event, listener);
84
- }
85
- }
86
- removeEventListener(event, listener) {
87
- switch (event) {
88
- case "orbitalCameraConfiguration":
89
- if (this._orbitalCameraConfigurationObservable === undefined) {
90
- return;
91
- }
92
- this._orbitalCameraConfigurationObservable.stopListen(listener);
93
- break;
94
- default:
95
- super.removeEventListener(event, listener);
96
- }
97
- }
98
- get orbitalCameraConfiguration() {
99
- const camera = this._camera;
100
- return Object.assign({ disableZoom: camera.disableZoom, minDistance: camera.lowerRadiusLimit || 0, maxDistance: camera.upperRadiusLimit || Infinity, minYaw: camera.lowerAlphaLimit || -Math.PI, maxYaw: camera.upperAlphaLimit || Math.PI, minPitch: Math.max(camera.lowerBetaLimit || MIN_LOWER_BETA_LIMIT, MIN_LOWER_BETA_LIMIT), maxPitch: Math.min(camera.upperBetaLimit || MAX_UPPER_BETA_LIMIT, MAX_UPPER_BETA_LIMIT) }, this.cameraConfiguration);
101
- }
102
- notifyCameraListeners() {
103
- super.notifyCameraListeners();
104
- if (this._orbitalCameraConfigurationObservable === undefined) {
105
- return;
106
- }
107
- const cameraConf = this.orbitalCameraConfiguration;
108
- if (this._previousOrbitalCameraConf !== undefined &&
109
- orbitalCameraConfigurationPropsEquals(this._previousOrbitalCameraConf, cameraConf)) {
110
- return;
111
- }
112
- this._orbitalCameraConfigurationObservable.notifyAll(cameraConf, this._orbitalCameraConfigurationObservable);
113
- this._previousOrbitalCameraConf = cameraConf;
114
- }
115
- get cameraControlObservable() {
116
- return this._camera.cameraControlObservable;
117
- }
118
- get contentCenter() {
119
- return this._camera.target;
120
- }
121
- /**
122
- * @param force true means force apply camera distance and camera bounds. false means force do not apply.
123
- */
124
- handleSizing(force) {
125
- super.handleSizing(force);
126
- if (this._viewportSize === undefined) {
127
- return;
128
- }
129
- const currentProductNode = this.currentProductNode;
130
- const boundingBox = currentProductNode === undefined
131
- ? new CfgBoundingBox()
132
- : currentProductNode.boundingBox;
133
- boundingBox.applyMatrix(CET_TO_BABYLON_MATRIX);
134
- const initialCameraDistanceSetPreventsInitialAutoSizingSet = this.isFirstLoad && this._cameraDefaults.distance !== undefined;
135
- this._camera.setContentBoundingBox(boundingBox, initialCameraDistanceSetPreventsInitialAutoSizingSet ? false : force ? true : undefined);
136
- if (!boundingBox.isEmpty) {
137
- this._lightRig.scale =
138
- measureLongestDistanceToCorner(boundingBox, [0, 1, 2]) *
139
- CONTENT_TO_LIGHT_RIG_SCALE_FACTOR;
140
- }
141
- }
142
- refreshCameraNearFar() {
143
- super.refreshCameraNearFar();
144
- this._camera.refreshCameraNearFar();
145
- }
146
- getNeededFrameRender(time) {
147
- return super.getNeededFrameRender(time) || this._camera.frameRenderNeeded();
148
- }
149
- }
1
+ import { Observable } from "@configura/web-utilities";
2
+ import { getDefaultCamera } from "../camera/CameraCreator.js";
3
+ import { MAX_UPPER_BETA_LIMIT, MIN_LOWER_BETA_LIMIT, } from "../camera/CfgOrbitalCamera.js";
4
+ import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
5
+ import { measureLongestDistanceToCorner } from "../utilities/utilities3D.js";
6
+ import { CET_TO_BABYLON_MATRIX } from "./BaseView.js";
7
+ import { orbitalCameraConfigurationPropsEquals, } from "./SingleProductDefaultCameraViewConfiguration.js";
8
+ import { SingleProductView } from "./SingleProductView.js";
9
+ const CONTENT_TO_LIGHT_RIG_SCALE_FACTOR = 1;
10
+ export class SingleProductDefaultCameraView extends SingleProductView {
11
+ constructor(options) {
12
+ super(Object.assign(Object.assign({}, options), { cameraCreator: getDefaultCamera }));
13
+ this._cameraDefaults = {};
14
+ }
15
+ initOrResetCamera(props) {
16
+ this.handleSizing(true);
17
+ const { distance, pitch, yaw } = props;
18
+ let change = false;
19
+ if (distance !== undefined) {
20
+ this._camera.forceRadius(distance);
21
+ change = true;
22
+ }
23
+ if (pitch !== undefined) {
24
+ this._camera.beta = pitch;
25
+ change = true;
26
+ }
27
+ if (yaw !== undefined) {
28
+ this._camera.alpha = yaw;
29
+ change = true;
30
+ }
31
+ if (change) {
32
+ // Force a recompute of the view matrix as if a target-change happens in
33
+ // the same frame render alpha/beta will be reset.
34
+ this._camera.getViewMatrix();
35
+ }
36
+ }
37
+ resetCamera() {
38
+ this.initOrResetCamera(this._cameraDefaults);
39
+ }
40
+ setConfiguration(configuration) {
41
+ var _a;
42
+ super.setConfiguration(configuration);
43
+ const cameraConf = configuration.camera || {};
44
+ this._camera.disableAutomaticSizing = cameraConf.disableAutomaticSizing === true;
45
+ this._camera.disableZoom = cameraConf.disableZoom === true;
46
+ this._camera.disableSubFloorCam = cameraConf.disableSubFloorCam === true;
47
+ this._camera.lowestAllowedCameraHeight = cameraConf.lowestAllowedCameraHeight;
48
+ this._cameraDefaults = cameraConf;
49
+ this.initOrResetCamera((_a = cameraConf.initial) !== null && _a !== void 0 ? _a : cameraConf);
50
+ const { autoRotate } = cameraConf;
51
+ if (autoRotate !== undefined) {
52
+ this._camera.useAutoRotationBehavior = true;
53
+ const behavior = this._camera.autoRotationBehavior;
54
+ if (behavior !== null) {
55
+ if (autoRotate.idleRotationSpeed !== undefined) {
56
+ behavior.idleRotationSpeed = autoRotate.idleRotationSpeed;
57
+ }
58
+ if (autoRotate.idleRotationSpinupTime !== undefined) {
59
+ behavior.idleRotationSpinupTime = autoRotate.idleRotationSpinupTime;
60
+ }
61
+ if (autoRotate.idleRotationWaitTime !== undefined) {
62
+ behavior.idleRotationWaitTime = autoRotate.idleRotationWaitTime;
63
+ }
64
+ if (autoRotate.zoomStopsAnimation !== undefined) {
65
+ behavior.zoomStopsAnimation = autoRotate.zoomStopsAnimation;
66
+ }
67
+ }
68
+ }
69
+ else {
70
+ this._camera.useAutoRotationBehavior = false;
71
+ }
72
+ }
73
+ addEventListener(event, listener) {
74
+ switch (event) {
75
+ case "orbitalCameraConfiguration":
76
+ if (this._orbitalCameraConfigurationObservable === undefined) {
77
+ this._orbitalCameraConfigurationObservable =
78
+ new Observable();
79
+ }
80
+ this._orbitalCameraConfigurationObservable.listen(listener);
81
+ break;
82
+ default:
83
+ super.addEventListener(event, listener);
84
+ }
85
+ }
86
+ removeEventListener(event, listener) {
87
+ switch (event) {
88
+ case "orbitalCameraConfiguration":
89
+ if (this._orbitalCameraConfigurationObservable === undefined) {
90
+ return;
91
+ }
92
+ this._orbitalCameraConfigurationObservable.stopListen(listener);
93
+ break;
94
+ default:
95
+ super.removeEventListener(event, listener);
96
+ }
97
+ }
98
+ get orbitalCameraConfiguration() {
99
+ const camera = this._camera;
100
+ return Object.assign({ disableZoom: camera.disableZoom, minDistance: camera.lowerRadiusLimit || 0, maxDistance: camera.upperRadiusLimit || Infinity, minYaw: camera.lowerAlphaLimit || -Math.PI, maxYaw: camera.upperAlphaLimit || Math.PI, minPitch: Math.max(camera.lowerBetaLimit || MIN_LOWER_BETA_LIMIT, MIN_LOWER_BETA_LIMIT), maxPitch: Math.min(camera.upperBetaLimit || MAX_UPPER_BETA_LIMIT, MAX_UPPER_BETA_LIMIT) }, this.cameraConfiguration);
101
+ }
102
+ notifyCameraListeners() {
103
+ super.notifyCameraListeners();
104
+ if (this._orbitalCameraConfigurationObservable === undefined) {
105
+ return;
106
+ }
107
+ const cameraConf = this.orbitalCameraConfiguration;
108
+ if (this._previousOrbitalCameraConf !== undefined &&
109
+ orbitalCameraConfigurationPropsEquals(this._previousOrbitalCameraConf, cameraConf)) {
110
+ return;
111
+ }
112
+ this._orbitalCameraConfigurationObservable.notifyAll(cameraConf, this._orbitalCameraConfigurationObservable);
113
+ this._previousOrbitalCameraConf = cameraConf;
114
+ }
115
+ get cameraControlObservable() {
116
+ return this._camera.cameraControlObservable;
117
+ }
118
+ get contentCenter() {
119
+ return this._camera.target;
120
+ }
121
+ /**
122
+ * @param force true means force apply camera distance and camera bounds. false means force do not apply.
123
+ */
124
+ handleSizing(force) {
125
+ super.handleSizing(force);
126
+ if (this._viewportSize === undefined) {
127
+ return;
128
+ }
129
+ const currentProductNode = this.currentProductNode;
130
+ const boundingBox = currentProductNode === undefined
131
+ ? new CfgBoundingBox()
132
+ : currentProductNode.boundingBox;
133
+ boundingBox.applyMatrix(CET_TO_BABYLON_MATRIX);
134
+ const initialCameraDistanceSetPreventsInitialAutoSizingSet = this.isFirstLoad && this._cameraDefaults.distance !== undefined;
135
+ this._camera.setContentBoundingBox(boundingBox, initialCameraDistanceSetPreventsInitialAutoSizingSet ? false : force ? true : undefined);
136
+ if (!boundingBox.isEmpty) {
137
+ this._lightRig.scale =
138
+ measureLongestDistanceToCorner(boundingBox, [0, 1, 2]) *
139
+ CONTENT_TO_LIGHT_RIG_SCALE_FACTOR;
140
+ }
141
+ }
142
+ refreshCameraNearFar() {
143
+ super.refreshCameraNearFar();
144
+ this._camera.refreshCameraNearFar();
145
+ }
146
+ getNeededFrameRender(time) {
147
+ return super.getNeededFrameRender(time) || this._camera.frameRenderNeeded();
148
+ }
149
+ }