@babylonjs/viewer 5.0.0 → 5.0.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 (127) hide show
  1. package/configuration/configuration.d.ts +107 -107
  2. package/configuration/configuration.js +15 -15
  3. package/configuration/configurationCompatibility.d.ts +8 -8
  4. package/configuration/configurationCompatibility.js +65 -65
  5. package/configuration/configurationContainer.d.ts +10 -10
  6. package/configuration/configurationContainer.js +9 -9
  7. package/configuration/globals.d.ts +6 -6
  8. package/configuration/globals.js +17 -17
  9. package/configuration/index.d.ts +2 -2
  10. package/configuration/index.js +3 -3
  11. package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
  12. package/configuration/interfaces/cameraConfiguration.js +1 -1
  13. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
  14. package/configuration/interfaces/colorGradingConfiguration.js +1 -1
  15. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
  16. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
  17. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
  18. package/configuration/interfaces/environmentMapConfiguration.js +1 -1
  19. package/configuration/interfaces/groundConfiguration.d.ts +24 -24
  20. package/configuration/interfaces/groundConfiguration.js +1 -1
  21. package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
  22. package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
  23. package/configuration/interfaces/index.d.ts +15 -15
  24. package/configuration/interfaces/index.js +15 -15
  25. package/configuration/interfaces/lightConfiguration.d.ts +60 -60
  26. package/configuration/interfaces/lightConfiguration.js +1 -1
  27. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
  28. package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
  29. package/configuration/interfaces/modelConfiguration.d.ts +65 -65
  30. package/configuration/interfaces/modelConfiguration.js +1 -1
  31. package/configuration/interfaces/observersConfiguration.d.ts +5 -5
  32. package/configuration/interfaces/observersConfiguration.js +1 -1
  33. package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
  34. package/configuration/interfaces/sceneConfiguration.js +1 -1
  35. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
  36. package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
  37. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
  38. package/configuration/interfaces/skyboxConfiguration.js +1 -1
  39. package/configuration/interfaces/templateConfiguration.d.ts +67 -67
  40. package/configuration/interfaces/templateConfiguration.js +1 -1
  41. package/configuration/interfaces/vrConfiguration.d.ts +16 -16
  42. package/configuration/interfaces/vrConfiguration.js +1 -1
  43. package/configuration/loader.d.ts +4 -4
  44. package/configuration/loader.js +16 -16
  45. package/configuration/mappers.d.ts +42 -42
  46. package/configuration/mappers.js +190 -190
  47. package/configuration/renderOnlyLoader.d.ts +33 -33
  48. package/configuration/renderOnlyLoader.js +161 -161
  49. package/configuration/types/default.d.ts +6 -6
  50. package/configuration/types/default.js +120 -120
  51. package/configuration/types/environmentMap.d.ts +5 -5
  52. package/configuration/types/environmentMap.js +13 -13
  53. package/configuration/types/extended.d.ts +6 -6
  54. package/configuration/types/extended.js +316 -316
  55. package/configuration/types/index.d.ts +13 -13
  56. package/configuration/types/index.js +49 -49
  57. package/configuration/types/minimal.d.ts +6 -6
  58. package/configuration/types/minimal.js +42 -42
  59. package/configuration/types/renderOnlyDefault.d.ts +30 -30
  60. package/configuration/types/renderOnlyDefault.js +30 -30
  61. package/configuration/types/shadowLight.d.ts +9 -9
  62. package/configuration/types/shadowLight.js +63 -63
  63. package/helper/index.d.ts +26 -26
  64. package/helper/index.js +62 -62
  65. package/index.d.ts +30 -30
  66. package/index.js +45 -45
  67. package/initializer.d.ts +11 -11
  68. package/initializer.js +34 -34
  69. package/interfaces.d.ts +5 -5
  70. package/interfaces.js +1 -1
  71. package/labs/environmentSerializer.d.ts +126 -126
  72. package/labs/environmentSerializer.js +190 -190
  73. package/labs/texture.d.ts +183 -183
  74. package/labs/texture.js +300 -300
  75. package/labs/viewerLabs.d.ts +51 -51
  76. package/labs/viewerLabs.js +133 -133
  77. package/loader/modelLoader.d.ts +47 -47
  78. package/loader/modelLoader.js +189 -189
  79. package/loader/plugins/applyMaterialConfig.d.ts +12 -12
  80. package/loader/plugins/applyMaterialConfig.js +15 -15
  81. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
  82. package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
  83. package/loader/plugins/index.d.ts +18 -18
  84. package/loader/plugins/index.js +42 -42
  85. package/loader/plugins/loaderPlugin.d.ts +24 -24
  86. package/loader/plugins/loaderPlugin.js +1 -1
  87. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
  88. package/loader/plugins/msftLodLoaderPlugin.js +20 -20
  89. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
  90. package/loader/plugins/telemetryLoaderPlugin.js +35 -35
  91. package/managers/observablesManager.d.ts +66 -66
  92. package/managers/observablesManager.js +34 -34
  93. package/managers/sceneManager.d.ts +243 -243
  94. package/managers/sceneManager.js +1388 -1388
  95. package/managers/telemetryManager.d.ts +57 -57
  96. package/managers/telemetryManager.js +113 -113
  97. package/model/modelAnimation.d.ts +215 -215
  98. package/model/modelAnimation.js +232 -232
  99. package/model/viewerModel.d.ts +228 -228
  100. package/model/viewerModel.js +669 -669
  101. package/optimizer/custom/extended.d.ts +11 -11
  102. package/optimizer/custom/extended.js +98 -98
  103. package/optimizer/custom/index.d.ts +8 -8
  104. package/optimizer/custom/index.js +24 -24
  105. package/package.json +5 -5
  106. package/renderOnlyIndex.d.ts +11 -11
  107. package/renderOnlyIndex.js +17 -17
  108. package/templating/eventManager.d.ts +35 -35
  109. package/templating/eventManager.js +65 -65
  110. package/templating/plugins/hdButtonPlugin.d.ts +9 -9
  111. package/templating/plugins/hdButtonPlugin.js +21 -21
  112. package/templating/plugins/printButton.d.ts +9 -9
  113. package/templating/plugins/printButton.js +40 -40
  114. package/templating/templateManager.d.ts +190 -190
  115. package/templating/templateManager.js +553 -553
  116. package/templating/viewerTemplatePlugin.d.ts +21 -21
  117. package/templating/viewerTemplatePlugin.js +68 -68
  118. package/viewer/defaultViewer.d.ts +122 -122
  119. package/viewer/defaultViewer.js +665 -665
  120. package/viewer/renderOnlyViewer.d.ts +8 -8
  121. package/viewer/renderOnlyViewer.js +43 -43
  122. package/viewer/viewer.d.ts +254 -254
  123. package/viewer/viewer.js +777 -777
  124. package/viewer/viewerManager.d.ts +55 -55
  125. package/viewer/viewerManager.js +87 -87
  126. package/viewer/viewerWithTemplate.d.ts +9 -9
  127. package/viewer/viewerWithTemplate.js +19 -19
package/index.d.ts CHANGED
@@ -1,30 +1,30 @@
1
- import { mapperManager } from "./configuration/mappers";
2
- import { viewerGlobals } from "./configuration/globals";
3
- import { viewerManager } from "./viewer/viewerManager";
4
- import { DefaultViewer } from "./viewer/defaultViewer";
5
- import { AbstractViewer } from "./viewer/viewer";
6
- import { telemetryManager } from "./managers/telemetryManager";
7
- import { ModelLoader } from "./loader/modelLoader";
8
- import { ViewerModel, ModelState } from "./model/viewerModel";
9
- import { AnimationPlayMode, AnimationState } from "./model/modelAnimation";
10
- import { ILoaderPlugin } from "./loader/plugins/loaderPlugin";
11
- import { AbstractViewerNavbarButton } from "./templating/viewerTemplatePlugin";
12
- import { registerCustomOptimizer } from "./optimizer/custom/index";
13
- /**
14
- * BabylonJS Viewer
15
- *
16
- * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
17
- */
18
- import * as BABYLON from "@babylonjs/core/index.js";
19
- import "@babylonjs/loaders/.js";
20
- import "pepjs";
21
- import { InitTags } from "./initializer";
22
- declare const disableInit: boolean;
23
- /**
24
- * Dispose all viewers currently registered
25
- */
26
- declare function disposeAll(): void;
27
- declare const Version: string;
28
- export { BABYLON, Version, InitTags, DefaultViewer, AbstractViewer, viewerGlobals, telemetryManager, disableInit, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState, ILoaderPlugin, AbstractViewerNavbarButton, registerCustomOptimizer, };
29
- export { GLTF2 } from "@babylonjs/loaders/glTF/index.js";
30
- export * from "./configuration/index";
1
+ import { mapperManager } from "./configuration/mappers";
2
+ import { viewerGlobals } from "./configuration/globals";
3
+ import { viewerManager } from "./viewer/viewerManager";
4
+ import { DefaultViewer } from "./viewer/defaultViewer";
5
+ import { AbstractViewer } from "./viewer/viewer";
6
+ import { telemetryManager } from "./managers/telemetryManager";
7
+ import { ModelLoader } from "./loader/modelLoader";
8
+ import { ViewerModel, ModelState } from "./model/viewerModel";
9
+ import { AnimationPlayMode, AnimationState } from "./model/modelAnimation";
10
+ import { ILoaderPlugin } from "./loader/plugins/loaderPlugin";
11
+ import { AbstractViewerNavbarButton } from "./templating/viewerTemplatePlugin";
12
+ import { registerCustomOptimizer } from "./optimizer/custom/index";
13
+ /**
14
+ * BabylonJS Viewer
15
+ *
16
+ * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
17
+ */
18
+ import * as BABYLON from "@babylonjs/core/index.js";
19
+ import "@babylonjs/loaders/.js";
20
+ import "pepjs";
21
+ import { InitTags } from "./initializer";
22
+ declare const disableInit: boolean;
23
+ /**
24
+ * Dispose all viewers currently registered
25
+ */
26
+ declare function disposeAll(): void;
27
+ declare const Version: string;
28
+ export { BABYLON, Version, InitTags, DefaultViewer, AbstractViewer, viewerGlobals, telemetryManager, disableInit, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState, ILoaderPlugin, AbstractViewerNavbarButton, registerCustomOptimizer, };
29
+ export { GLTF2 } from "@babylonjs/loaders/glTF/index.js";
30
+ export * from "./configuration/index";
package/index.js CHANGED
@@ -1,46 +1,46 @@
1
- import { mapperManager } from "./configuration/mappers.js";
2
- import { viewerGlobals } from "./configuration/globals.js";
3
- import { viewerManager } from "./viewer/viewerManager.js";
4
- import { DefaultViewer } from "./viewer/defaultViewer.js";
5
- import { AbstractViewer } from "./viewer/viewer.js";
6
- import { telemetryManager } from "./managers/telemetryManager.js";
7
- import { ModelLoader } from "./loader/modelLoader.js";
8
- import { ViewerModel, ModelState } from "./model/viewerModel.js";
9
- import { AnimationPlayMode, AnimationState } from "./model/modelAnimation.js";
10
- import { AbstractViewerNavbarButton } from "./templating/viewerTemplatePlugin.js";
11
- // eslint-disable-next-line import/no-internal-modules
12
- import { registerCustomOptimizer } from "./optimizer/custom/index.js";
13
- /**
14
- * BabylonJS Viewer
15
- *
16
- * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
17
- */
18
- // eslint-disable-next-line import/no-internal-modules
19
- import * as BABYLON from "@babylonjs/core/index.js";
20
- // load needed modules.
21
- import "@babylonjs/loaders/.js";
22
- import "pepjs";
23
- import { initListeners, InitTags } from "./initializer.js";
24
- // promise polyfill, if needed!
25
- BABYLON.PromisePolyfill.Apply();
26
- initListeners();
27
- //deprectaed, here for backwards compatibility
28
- var disableInit = viewerGlobals.disableInit;
29
- /**
30
- * Dispose all viewers currently registered
31
- */
32
- function disposeAll() {
33
- viewerManager.dispose();
34
- mapperManager.dispose();
35
- telemetryManager.dispose();
36
- }
37
- var Version = viewerGlobals.version;
38
- console.log("Babylon.js viewer (v" + Version + ")");
39
- // public API for initialization
40
- export { BABYLON, Version, InitTags, DefaultViewer, AbstractViewer, viewerGlobals, telemetryManager, disableInit, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState, AbstractViewerNavbarButton, registerCustomOptimizer, };
41
- // eslint-disable-next-line import/no-internal-modules
42
- export { GLTF2 } from "@babylonjs/loaders/glTF/index.js";
43
- // export publicliy all configuration interfaces
44
- // eslint-disable-next-line import/no-internal-modules
45
- export * from "./configuration/index.js";
1
+ import { mapperManager } from "./configuration/mappers.js";
2
+ import { viewerGlobals } from "./configuration/globals.js";
3
+ import { viewerManager } from "./viewer/viewerManager.js";
4
+ import { DefaultViewer } from "./viewer/defaultViewer.js";
5
+ import { AbstractViewer } from "./viewer/viewer.js";
6
+ import { telemetryManager } from "./managers/telemetryManager.js";
7
+ import { ModelLoader } from "./loader/modelLoader.js";
8
+ import { ViewerModel, ModelState } from "./model/viewerModel.js";
9
+ import { AnimationPlayMode, AnimationState } from "./model/modelAnimation.js";
10
+ import { AbstractViewerNavbarButton } from "./templating/viewerTemplatePlugin.js";
11
+ // eslint-disable-next-line import/no-internal-modules
12
+ import { registerCustomOptimizer } from "./optimizer/custom/index.js";
13
+ /**
14
+ * BabylonJS Viewer
15
+ *
16
+ * An HTML-Based viewer for 3D models, based on BabylonJS and its extensions.
17
+ */
18
+ // eslint-disable-next-line import/no-internal-modules
19
+ import * as BABYLON from "@babylonjs/core/index.js";
20
+ // load needed modules.
21
+ import "@babylonjs/loaders/.js";
22
+ import "pepjs";
23
+ import { initListeners, InitTags } from "./initializer.js";
24
+ // promise polyfill, if needed!
25
+ BABYLON.PromisePolyfill.Apply();
26
+ initListeners();
27
+ //deprectaed, here for backwards compatibility
28
+ var disableInit = viewerGlobals.disableInit;
29
+ /**
30
+ * Dispose all viewers currently registered
31
+ */
32
+ function disposeAll() {
33
+ viewerManager.dispose();
34
+ mapperManager.dispose();
35
+ telemetryManager.dispose();
36
+ }
37
+ var Version = viewerGlobals.version;
38
+ console.log("Babylon.js viewer (v" + Version + ")");
39
+ // public API for initialization
40
+ export { BABYLON, Version, InitTags, DefaultViewer, AbstractViewer, viewerGlobals, telemetryManager, disableInit, viewerManager, mapperManager, disposeAll, ModelLoader, ViewerModel, AnimationPlayMode, AnimationState, ModelState, AbstractViewerNavbarButton, registerCustomOptimizer, };
41
+ // eslint-disable-next-line import/no-internal-modules
42
+ export { GLTF2 } from "@babylonjs/loaders/glTF/index.js";
43
+ // export publicliy all configuration interfaces
44
+ // eslint-disable-next-line import/no-internal-modules
45
+ export * from "./configuration/index.js";
46
46
  //# sourceMappingURL=index.js.map
package/initializer.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * Will attach an init function the the DOMContentLoaded event.
3
- * The init function will be removed automatically after the event was triggered.
4
- */
5
- export declare function initListeners(): void;
6
- /**
7
- * Select all HTML tags on the page that match the selector and initialize a viewer
8
- *
9
- * @param selector the selector to initialize the viewer on (default is 'babylon')
10
- */
11
- export declare function InitTags(selector?: string): void;
1
+ /**
2
+ * Will attach an init function the the DOMContentLoaded event.
3
+ * The init function will be removed automatically after the event was triggered.
4
+ */
5
+ export declare function initListeners(): void;
6
+ /**
7
+ * Select all HTML tags on the page that match the selector and initialize a viewer
8
+ *
9
+ * @param selector the selector to initialize the viewer on (default is 'babylon')
10
+ */
11
+ export declare function InitTags(selector?: string): void;
package/initializer.js CHANGED
@@ -1,35 +1,35 @@
1
- import { DefaultViewer } from "./viewer/defaultViewer.js";
2
- import { mapperManager } from "./configuration/mappers.js";
3
- import { viewerGlobals } from "./configuration/globals.js";
4
- /**
5
- * Will attach an init function the the DOMContentLoaded event.
6
- * The init function will be removed automatically after the event was triggered.
7
- */
8
- export function initListeners() {
9
- document.addEventListener("DOMContentLoaded", init);
10
- function init() {
11
- document.removeEventListener("DOMContentLoaded", init);
12
- if (viewerGlobals.disableInit) {
13
- return;
14
- }
15
- InitTags();
16
- }
17
- }
18
- /**
19
- * Select all HTML tags on the page that match the selector and initialize a viewer
20
- *
21
- * @param selector the selector to initialize the viewer on (default is 'babylon')
22
- */
23
- export function InitTags(selector) {
24
- if (selector === void 0) { selector = "babylon"; }
25
- var elements = document.querySelectorAll(selector);
26
- for (var i = 0; i < elements.length; ++i) {
27
- var element = elements.item(i);
28
- // get the html configuration
29
- var configMapper = mapperManager.getMapper("dom");
30
- var config = configMapper.map(element);
31
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
- new DefaultViewer(element, config);
33
- }
34
- }
1
+ import { DefaultViewer } from "./viewer/defaultViewer.js";
2
+ import { mapperManager } from "./configuration/mappers.js";
3
+ import { viewerGlobals } from "./configuration/globals.js";
4
+ /**
5
+ * Will attach an init function the the DOMContentLoaded event.
6
+ * The init function will be removed automatically after the event was triggered.
7
+ */
8
+ export function initListeners() {
9
+ document.addEventListener("DOMContentLoaded", init);
10
+ function init() {
11
+ document.removeEventListener("DOMContentLoaded", init);
12
+ if (viewerGlobals.disableInit) {
13
+ return;
14
+ }
15
+ InitTags();
16
+ }
17
+ }
18
+ /**
19
+ * Select all HTML tags on the page that match the selector and initialize a viewer
20
+ *
21
+ * @param selector the selector to initialize the viewer on (default is 'babylon')
22
+ */
23
+ export function InitTags(selector) {
24
+ if (selector === void 0) { selector = "babylon"; }
25
+ var elements = document.querySelectorAll(selector);
26
+ for (var i = 0; i < elements.length; ++i) {
27
+ var element = elements.item(i);
28
+ // get the html configuration
29
+ var configMapper = mapperManager.getMapper("dom");
30
+ var config = configMapper.map(element);
31
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
+ new DefaultViewer(element, config);
33
+ }
34
+ }
35
35
  //# sourceMappingURL=initializer.js.map
package/interfaces.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare const enum CameraBehavior {
2
- AUTOROTATION = 0,
3
- BOUNCING = 1,
4
- FRAMING = 2
5
- }
1
+ export declare const enum CameraBehavior {
2
+ AUTOROTATION = 0,
3
+ BOUNCING = 1,
4
+ FRAMING = 2
5
+ }
package/interfaces.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=interfaces.js.map
@@ -1,126 +1,126 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.js";
2
- import { TextureCube } from "./texture";
3
- /**
4
- * Spherical polynomial coefficients (counter part to spherical harmonic coefficients used in shader irradiance calculation)
5
- * @ignoreChildren
6
- */
7
- export interface SphericalPolynomalCoefficients {
8
- x: Vector3;
9
- y: Vector3;
10
- z: Vector3;
11
- xx: Vector3;
12
- yy: Vector3;
13
- zz: Vector3;
14
- yz: Vector3;
15
- zx: Vector3;
16
- xy: Vector3;
17
- }
18
- /**
19
- * Wraps data and maps required for environments with physically based rendering
20
- */
21
- export interface PBREnvironment {
22
- /**
23
- * Spherical Polynomial Coefficients representing an irradiance map
24
- */
25
- irradiancePolynomialCoefficients: SphericalPolynomalCoefficients;
26
- /**
27
- * Specular cubemap
28
- */
29
- specularTexture?: TextureCube;
30
- /**
31
- * A scale factor applied to RGB values after reading from environment maps
32
- */
33
- textureIntensityScale: number;
34
- }
35
- /**
36
- * Environment map representations: layouts, projections and approximations
37
- */
38
- export declare type MapType = "irradiance_sh_coefficients_9" | "cubemap_faces";
39
- /**
40
- * Image type used for environment map
41
- */
42
- export declare type ImageType = "png";
43
- /**
44
- * A generic field in JSON that report's its type
45
- */
46
- export interface TypedObject<T> {
47
- type: T;
48
- }
49
- /**
50
- * Describes a range of bytes starting at byte pos (inclusive) and finishing at byte pos + length - 1
51
- */
52
- export interface ByteRange {
53
- pos: number;
54
- length: number;
55
- }
56
- /**
57
- * Complete Spectre Environment JSON Descriptor
58
- */
59
- export interface EnvJsonDescriptor {
60
- radiance: TypedObject<MapType>;
61
- irradiance: TypedObject<MapType>;
62
- specular: TypedObject<MapType>;
63
- }
64
- /**
65
- * Spherical harmonic coefficients to provide an irradiance map
66
- */
67
- export interface IrradianceSHCoefficients9 extends TypedObject<MapType> {
68
- l00: Array<number>;
69
- l1_1: Array<number>;
70
- l10: Array<number>;
71
- l11: Array<number>;
72
- l2_2: Array<number>;
73
- l2_1: Array<number>;
74
- l20: Array<number>;
75
- l21: Array<number>;
76
- l22: Array<number>;
77
- }
78
- /**
79
- * A generic set of images, where the image content is specified by byte ranges in the mipmaps field
80
- */
81
- export interface ImageSet<T> extends TypedObject<MapType> {
82
- imageType: ImageType;
83
- width: number;
84
- height: number;
85
- mipmaps: Array<T>;
86
- multiplier: number;
87
- }
88
- /**
89
- * A set of cubemap faces
90
- */
91
- export declare type CubemapFaces = ImageSet<Array<ByteRange>>;
92
- /**
93
- * A single image containing an atlas of equirectangular-projection maps across all mip levels
94
- */
95
- export declare type EquirectangularMipmapAtlas = ImageSet<ByteRange>;
96
- /**
97
- * A static class proving methods to aid parsing Spectre environment files
98
- */
99
- export declare class EnvironmentDeserializer {
100
- /**
101
- * Parses an arraybuffer into a new PBREnvironment object
102
- * @param arrayBuffer The arraybuffer of the Spectre environment file
103
- * @return a PBREnvironment object
104
- */
105
- static Parse(arrayBuffer: ArrayBuffer): PBREnvironment;
106
- /**
107
- * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.
108
- * L = (1/pi) * E * rho
109
- *
110
- * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.
111
- * @param harmonics Spherical harmonic coefficients (9)
112
- */
113
- private static _ConvertSHIrradianceToLambertianRadiance;
114
- /**
115
- * Convert spherical harmonics to spherical polynomial coefficients
116
- * @param harmonics Spherical harmonic coefficients (9)
117
- * @param outPolynomialCoefficents Polynomial coefficients (9) object to store result
118
- */
119
- private static _ConvertSHToSP;
120
- /**
121
- * Multiplies harmonic coefficients in place
122
- * @param harmonics Spherical harmonic coefficients (9)
123
- * @param scaleFactor Value to multiply by
124
- */
125
- private static _ScaleSH;
126
- }
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.js";
2
+ import { TextureCube } from "./texture";
3
+ /**
4
+ * Spherical polynomial coefficients (counter part to spherical harmonic coefficients used in shader irradiance calculation)
5
+ * @ignoreChildren
6
+ */
7
+ export interface SphericalPolynomalCoefficients {
8
+ x: Vector3;
9
+ y: Vector3;
10
+ z: Vector3;
11
+ xx: Vector3;
12
+ yy: Vector3;
13
+ zz: Vector3;
14
+ yz: Vector3;
15
+ zx: Vector3;
16
+ xy: Vector3;
17
+ }
18
+ /**
19
+ * Wraps data and maps required for environments with physically based rendering
20
+ */
21
+ export interface PBREnvironment {
22
+ /**
23
+ * Spherical Polynomial Coefficients representing an irradiance map
24
+ */
25
+ irradiancePolynomialCoefficients: SphericalPolynomalCoefficients;
26
+ /**
27
+ * Specular cubemap
28
+ */
29
+ specularTexture?: TextureCube;
30
+ /**
31
+ * A scale factor applied to RGB values after reading from environment maps
32
+ */
33
+ textureIntensityScale: number;
34
+ }
35
+ /**
36
+ * Environment map representations: layouts, projections and approximations
37
+ */
38
+ export declare type MapType = "irradiance_sh_coefficients_9" | "cubemap_faces";
39
+ /**
40
+ * Image type used for environment map
41
+ */
42
+ export declare type ImageType = "png";
43
+ /**
44
+ * A generic field in JSON that report's its type
45
+ */
46
+ export interface TypedObject<T> {
47
+ type: T;
48
+ }
49
+ /**
50
+ * Describes a range of bytes starting at byte pos (inclusive) and finishing at byte pos + length - 1
51
+ */
52
+ export interface ByteRange {
53
+ pos: number;
54
+ length: number;
55
+ }
56
+ /**
57
+ * Complete Spectre Environment JSON Descriptor
58
+ */
59
+ export interface EnvJsonDescriptor {
60
+ radiance: TypedObject<MapType>;
61
+ irradiance: TypedObject<MapType>;
62
+ specular: TypedObject<MapType>;
63
+ }
64
+ /**
65
+ * Spherical harmonic coefficients to provide an irradiance map
66
+ */
67
+ export interface IrradianceSHCoefficients9 extends TypedObject<MapType> {
68
+ l00: Array<number>;
69
+ l1_1: Array<number>;
70
+ l10: Array<number>;
71
+ l11: Array<number>;
72
+ l2_2: Array<number>;
73
+ l2_1: Array<number>;
74
+ l20: Array<number>;
75
+ l21: Array<number>;
76
+ l22: Array<number>;
77
+ }
78
+ /**
79
+ * A generic set of images, where the image content is specified by byte ranges in the mipmaps field
80
+ */
81
+ export interface ImageSet<T> extends TypedObject<MapType> {
82
+ imageType: ImageType;
83
+ width: number;
84
+ height: number;
85
+ mipmaps: Array<T>;
86
+ multiplier: number;
87
+ }
88
+ /**
89
+ * A set of cubemap faces
90
+ */
91
+ export declare type CubemapFaces = ImageSet<Array<ByteRange>>;
92
+ /**
93
+ * A single image containing an atlas of equirectangular-projection maps across all mip levels
94
+ */
95
+ export declare type EquirectangularMipmapAtlas = ImageSet<ByteRange>;
96
+ /**
97
+ * A static class proving methods to aid parsing Spectre environment files
98
+ */
99
+ export declare class EnvironmentDeserializer {
100
+ /**
101
+ * Parses an arraybuffer into a new PBREnvironment object
102
+ * @param arrayBuffer The arraybuffer of the Spectre environment file
103
+ * @return a PBREnvironment object
104
+ */
105
+ static Parse(arrayBuffer: ArrayBuffer): PBREnvironment;
106
+ /**
107
+ * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.
108
+ * L = (1/pi) * E * rho
109
+ *
110
+ * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.
111
+ * @param harmonics Spherical harmonic coefficients (9)
112
+ */
113
+ private static _ConvertSHIrradianceToLambertianRadiance;
114
+ /**
115
+ * Convert spherical harmonics to spherical polynomial coefficients
116
+ * @param harmonics Spherical harmonic coefficients (9)
117
+ * @param outPolynomialCoefficents Polynomial coefficients (9) object to store result
118
+ */
119
+ private static _ConvertSHToSP;
120
+ /**
121
+ * Multiplies harmonic coefficients in place
122
+ * @param harmonics Spherical harmonic coefficients (9)
123
+ * @param scaleFactor Value to multiply by
124
+ */
125
+ private static _ScaleSH;
126
+ }