@configura/babylon-view 2.2.0-alpha.1 → 2.2.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 (150) 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/animation/index.d.ts +5 -0
  41. package/dist/animation/index.js +4 -0
  42. package/dist/camera/CameraCreator.d.ts +5 -5
  43. package/dist/camera/CameraCreator.js +4 -4
  44. package/dist/camera/CfgOrbitalCamera.d.ts +76 -76
  45. package/dist/camera/CfgOrbitalCamera.js +277 -277
  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/camera/SSAO2PipelineCreator.d.ts +28 -0
  51. package/dist/camera/SSAO2PipelineCreator.js +23 -0
  52. package/dist/camera/index.d.ts +6 -0
  53. package/dist/camera/index.js +5 -0
  54. package/dist/engine/EngineCreator.d.ts +3 -3
  55. package/dist/engine/EngineCreator.js +10 -10
  56. package/dist/engine/index.d.ts +2 -0
  57. package/dist/engine/index.js +1 -0
  58. package/dist/geometry/CfgGeometry.d.ts +29 -29
  59. package/dist/geometry/CfgGeometry.js +146 -146
  60. package/dist/geometry/CfgMesh.d.ts +10 -10
  61. package/dist/geometry/CfgMesh.js +38 -38
  62. package/dist/geometry/geoSplitter.d.ts +8 -8
  63. package/dist/geometry/geoSplitter.js +192 -192
  64. package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
  65. package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
  66. package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
  67. package/dist/geometry/stretch/CfgStretchData.js +347 -347
  68. package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
  69. package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
  70. package/dist/index.d.ts +8 -16
  71. package/dist/index.js +8 -16
  72. package/dist/io/CfgHistoryToCameraConfConnector.d.ts +31 -31
  73. package/dist/io/CfgHistoryToCameraConfConnector.js +90 -90
  74. package/dist/io/CfgIOCameraConfConnector.d.ts +35 -35
  75. package/dist/io/CfgIOCameraConfConnector.js +81 -81
  76. package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +10 -10
  77. package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -11
  78. package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +10 -10
  79. package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -11
  80. package/dist/io/index.d.ts +4 -0
  81. package/dist/io/index.js +3 -0
  82. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  83. package/dist/light/CfgDirectionalLight.js +18 -18
  84. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  85. package/dist/light/CfgHemisphericLight.js +17 -17
  86. package/dist/light/CfgPointLight.d.ts +8 -8
  87. package/dist/light/CfgPointLight.js +18 -18
  88. package/dist/light/DefaultLightRig.d.ts +23 -19
  89. package/dist/light/DefaultLightRig.js +82 -77
  90. package/dist/light/LightRigCreator.d.ts +9 -9
  91. package/dist/light/LightRigCreator.js +3 -3
  92. package/dist/light/index.d.ts +6 -0
  93. package/dist/light/index.js +5 -0
  94. package/dist/material/CfgMaterial.d.ts +68 -68
  95. package/dist/material/CfgMaterial.js +497 -482
  96. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  97. package/dist/material/DummyMaterialCreator.js +15 -15
  98. package/dist/material/material.d.ts +18 -18
  99. package/dist/material/material.js +128 -128
  100. package/dist/material/texture.d.ts +14 -14
  101. package/dist/material/texture.js +316 -306
  102. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  103. package/dist/nodes/CfgContentRootNode.js +75 -75
  104. package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
  105. package/dist/nodes/CfgDeferredMeshNode.js +378 -378
  106. package/dist/nodes/CfgProductNode.d.ts +127 -127
  107. package/dist/nodes/CfgProductNode.js +598 -598
  108. package/dist/nodes/CfgSymNode.d.ts +50 -50
  109. package/dist/nodes/CfgSymNode.js +249 -249
  110. package/dist/nodes/CfgSymRootNode.d.ts +45 -45
  111. package/dist/nodes/CfgSymRootNode.js +240 -240
  112. package/dist/nodes/CfgTransformNode.d.ts +33 -33
  113. package/dist/nodes/CfgTransformNode.js +83 -83
  114. package/dist/scene/SceneCreator.d.ts +6 -6
  115. package/dist/scene/SceneCreator.js +22 -22
  116. package/dist/scene/index.d.ts +2 -0
  117. package/dist/scene/index.js +1 -0
  118. package/dist/utilities/CfgBoundingBox.d.ts +21 -21
  119. package/dist/utilities/CfgBoundingBox.js +81 -81
  120. package/dist/utilities/anchor/anchor.d.ts +50 -50
  121. package/dist/utilities/anchor/anchor.js +133 -133
  122. package/dist/utilities/anchor/anchorMap.d.ts +20 -20
  123. package/dist/utilities/anchor/anchorMap.js +111 -111
  124. package/dist/utilities/index.d.ts +4 -0
  125. package/dist/utilities/index.js +3 -0
  126. package/dist/utilities/utilities3D.d.ts +70 -70
  127. package/dist/utilities/utilities3D.js +259 -259
  128. package/dist/utilities/utilitiesColor.d.ts +18 -18
  129. package/dist/utilities/utilitiesColor.js +50 -50
  130. package/dist/utilities/utilitiesImage.d.ts +6 -6
  131. package/dist/utilities/utilitiesImage.js +107 -107
  132. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
  133. package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
  134. package/dist/view/BaseView.d.ts +80 -78
  135. package/dist/view/BaseView.js +321 -303
  136. package/dist/view/BaseViewConfiguration.d.ts +38 -32
  137. package/dist/view/BaseViewConfiguration.js +10 -10
  138. package/dist/view/RenderEnv.d.ts +45 -43
  139. package/dist/view/RenderEnv.js +7 -7
  140. package/dist/view/SingleProductDefaultCameraView.d.ts +38 -38
  141. package/dist/view/SingleProductDefaultCameraView.js +149 -149
  142. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +44 -44
  143. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  144. package/dist/view/SingleProductView.d.ts +44 -44
  145. package/dist/view/SingleProductView.js +212 -212
  146. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  147. package/dist/view/SingleProductViewConfiguration.js +19 -19
  148. package/dist/view/index.d.ts +8 -0
  149. package/dist/view/index.js +7 -0
  150. package/package.json +5 -5
@@ -1,33 +1,39 @@
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 { MIPS_TEXTURE_LEVEL } from "@configura/web-core/dist/cm/core3D/GMaterialPBR.js";
3
+ import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
4
+ import { EventListener } from "@configura/web-utilities";
5
+ import { RenderEnv } from "./RenderEnv.js";
6
+ export { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
7
+ /**
8
+ * @param allowedDetailLevels Optionally controls the detail level (LOD, level of detail) allowed
9
+ * when loading the 3D models. Provide a single DetailLevel or an array of them if you want to
10
+ * override the default selection and/or order. The order of the array defines the priority since
11
+ * models are not guaranteed to have all DetailLevels available.
12
+ *
13
+ * @param orderIndependentTransparency This controls the rendering technique for transparent
14
+ * materials. Note: Enabling this causes conflicts with post processing render pipelines.
15
+ */
16
+ export interface BaseViewConfiguration {
17
+ allowedDetailLevels?: DetailLevel | DetailLevel[];
18
+ textureResolutionLevel?: MIPS_TEXTURE_LEVEL;
19
+ orderIndependentTransparency?: boolean;
20
+ }
21
+ export declare type BaseViewEventListener<K extends keyof BaseViewEventMap> = EventListener<BaseViewEventMap, K>;
22
+ export declare type ScheduleRerender = (dumpNextFrameToImage?: ImageDumpCallback) => void;
23
+ export declare type ImageDumpCallback = (imageDataUrl: string) => void;
24
+ export interface BaseViewEventMap {
25
+ renderEnv: RenderEnv;
26
+ error: Error;
27
+ loading: boolean;
28
+ cameraConfiguration: CameraConfigurationProps;
29
+ }
30
+ export interface CameraConfigurationProps {
31
+ nearClipping: number;
32
+ farClipping: number;
33
+ position: Vector3;
34
+ contentPosition: Vector3;
35
+ fov: number;
36
+ aspect: number;
37
+ }
38
+ export declare function cameraConfigurationPropsEquals(left: CameraConfigurationProps, right: CameraConfigurationProps): boolean;
33
39
  //# 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,46 @@
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 { MIPS_TEXTURE_LEVEL } from "@configura/web-core/dist/cm/core3D/GMaterialPBR.js";
5
+ import { SymComponent } from "@configura/web-core/dist/cm/format/cmsym/components/SymComponent.js";
6
+ import { SymGetMeshEnv } from "@configura/web-core/dist/cm/format/cmsym/components/SymGetMeshEnv.js";
7
+ import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
8
+ import { DexManager } from "@configura/web-core/dist/cm/format/dex/DexManager.js";
9
+ import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
10
+ import { PromiseCache } from "@configura/web-utilities";
11
+ import { CfgGeometry } from "../geometry/CfgGeometry.js";
12
+ import { LightRig } from "../light/LightRigCreator.js";
13
+ import { CfgMaterial } from "../material/CfgMaterial.js";
14
+ import { MaterialWithMetaData } from "../material/material.js";
15
+ import { TextureImageWithMetaData } from "../material/texture.js";
16
+ import { ScheduleRerender } from "./BaseViewConfiguration.js";
17
+ export declare type GeometryCacheIdentifierObject = {
18
+ component: SymComponent;
19
+ stretchDatasHash: number;
20
+ uvMapperHash: number | undefined;
21
+ };
22
+ export interface RenderEnv {
23
+ scene: Scene;
24
+ assetsManager: AssetsManager;
25
+ dummyMaterial: CfgMaterial;
26
+ geometryCache: PromiseCache<GeometryCacheIdentifierObject, GeometryCacheEntry | undefined>;
27
+ symNodeCache: PromiseCache<string, SymNode>;
28
+ materialCache: PromiseCache<string | GMaterial3D, MaterialWithMetaData>;
29
+ textureImageCache: PromiseCache<string, TextureImageWithMetaData>;
30
+ derivedNormalMapCache: PromiseCache<string, HTMLImageElement | undefined>;
31
+ lightRig: LightRig;
32
+ scheduleRerender: ScheduleRerender;
33
+ notifyError: (e: unknown) => void;
34
+ symMeshEnv: SymGetMeshEnv;
35
+ dexManager: DexManager;
36
+ cullEmptyNodes: boolean;
37
+ allowedDetailLevels: DetailLevel | DetailLevel[];
38
+ textureResolutionLevel: MIPS_TEXTURE_LEVEL;
39
+ }
40
+ export declare class GeometryCacheEntry {
41
+ readonly geometry: CfgGeometry;
42
+ readonly doubleSided: boolean | undefined;
43
+ readonly lowerLeftTextureOrigin: boolean | undefined;
44
+ constructor(geometry: CfgGeometry, doubleSided: boolean | undefined, lowerLeftTextureOrigin: boolean | undefined);
45
+ }
44
46
  //# 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
+ }