@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
@@ -1,51 +1,51 @@
1
- import type { PBREnvironment } from "./environmentSerializer";
2
- import type { Scene } from "@babylonjs/core/scene.js";
3
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
- import type { ShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
5
- /**
6
- * The ViewerLabs class will hold functions that are not (!) backwards compatible.
7
- * The APIs in all labs-related classes and configuration might change.
8
- * Once stable, lab features will be moved to the publis API and configuration object.
9
- */
10
- export declare class ViewerLabs {
11
- private _scene;
12
- constructor(_scene: Scene);
13
- assetsRootURL: string;
14
- environment: PBREnvironment;
15
- /**
16
- * Loads an environment map from a given URL
17
- * @param url URL of environment map
18
- * @param onSuccess Callback fired after environment successfully applied to the scene
19
- * @param onProgress Callback fired at progress events while loading the environment map
20
- * @param onError Callback fired when the load fails
21
- */
22
- loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
23
- /**
24
- * Loads an environment map from a given URL
25
- * @param buffer ArrayBuffer containing environment map
26
- * @param onSuccess Callback fired after environment successfully applied to the scene
27
- * @param onProgress Callback fired at progress events while loading the environment map
28
- * @param onError Callback fired when the load fails
29
- */
30
- loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
31
- /**
32
- * Sets the environment to an already loaded environment
33
- * @param env PBREnvironment instance
34
- * @param onSuccess Callback fired after environment successfully applied to the scene
35
- * @param onProgress Callback fired at progress events while loading the environment map
36
- * @param onError Callback fired when the load fails
37
- */
38
- loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
39
- /**
40
- * Applies an `EnvironmentMapConfiguration` to the scene
41
- * @param rotationY
42
- */
43
- applyEnvironmentMapConfiguration(rotationY?: number): void;
44
- /**
45
- * Get an environment asset url by using the configuration if the path is not absolute.
46
- * @param url Asset url
47
- * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
48
- */
49
- getAssetUrl(url: string): string;
50
- rotateShadowLight(shadowLight: ShadowLight, amount: number, point?: Vector3, axis?: Vector3, target?: Vector3): void;
51
- }
1
+ import type { PBREnvironment } from "./environmentSerializer";
2
+ import type { Scene } from "@babylonjs/core/scene.js";
3
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
+ import type { ShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
5
+ /**
6
+ * The ViewerLabs class will hold functions that are not (!) backwards compatible.
7
+ * The APIs in all labs-related classes and configuration might change.
8
+ * Once stable, lab features will be moved to the publis API and configuration object.
9
+ */
10
+ export declare class ViewerLabs {
11
+ private _scene;
12
+ constructor(_scene: Scene);
13
+ assetsRootURL: string;
14
+ environment: PBREnvironment;
15
+ /**
16
+ * Loads an environment map from a given URL
17
+ * @param url URL of environment map
18
+ * @param onSuccess Callback fired after environment successfully applied to the scene
19
+ * @param onProgress Callback fired at progress events while loading the environment map
20
+ * @param onError Callback fired when the load fails
21
+ */
22
+ loadEnvironment(url: string, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
23
+ /**
24
+ * Loads an environment map from a given URL
25
+ * @param buffer ArrayBuffer containing environment map
26
+ * @param onSuccess Callback fired after environment successfully applied to the scene
27
+ * @param onProgress Callback fired at progress events while loading the environment map
28
+ * @param onError Callback fired when the load fails
29
+ */
30
+ loadEnvironment(buffer: ArrayBuffer, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
31
+ /**
32
+ * Sets the environment to an already loaded environment
33
+ * @param env PBREnvironment instance
34
+ * @param onSuccess Callback fired after environment successfully applied to the scene
35
+ * @param onProgress Callback fired at progress events while loading the environment map
36
+ * @param onError Callback fired when the load fails
37
+ */
38
+ loadEnvironment(env: PBREnvironment, onSuccess?: (env: PBREnvironment) => void, onProgress?: (bytesLoaded: number, bytesTotal: number) => void, onError?: (e: any) => void): void;
39
+ /**
40
+ * Applies an `EnvironmentMapConfiguration` to the scene
41
+ * @param rotationY
42
+ */
43
+ applyEnvironmentMapConfiguration(rotationY?: number): void;
44
+ /**
45
+ * Get an environment asset url by using the configuration if the path is not absolute.
46
+ * @param url Asset url
47
+ * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
48
+ */
49
+ getAssetUrl(url: string): string;
50
+ rotateShadowLight(shadowLight: ShadowLight, amount: number, point?: Vector3, axis?: Vector3, target?: Vector3): void;
51
+ }
@@ -1,134 +1,134 @@
1
- import { EnvironmentDeserializer } from "./environmentSerializer.js";
2
- import { Vector3, Quaternion, Matrix, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
3
- import { SphericalPolynomial } from "@babylonjs/core/Maths/sphericalPolynomial.js";
4
- import { TextureUtils } from "./texture.js";
5
- import { Axis } from "@babylonjs/core/Maths/math.axis.js";
6
- /**
7
- * The ViewerLabs class will hold functions that are not (!) backwards compatible.
8
- * The APIs in all labs-related classes and configuration might change.
9
- * Once stable, lab features will be moved to the publis API and configuration object.
10
- */
11
- var ViewerLabs = /** @class */ (function () {
12
- function ViewerLabs(_scene) {
13
- this._scene = _scene;
14
- this.environment = {
15
- //irradiance
16
- irradiancePolynomialCoefficients: {
17
- x: new Vector3(0, 0, 0),
18
- y: new Vector3(0, 0, 0),
19
- z: new Vector3(0, 0, 0),
20
- xx: new Vector3(0, 0, 0),
21
- yy: new Vector3(0, 0, 0),
22
- zz: new Vector3(0, 0, 0),
23
- yz: new Vector3(0, 0, 0),
24
- zx: new Vector3(0, 0, 0),
25
- xy: new Vector3(0, 0, 0),
26
- },
27
- textureIntensityScale: 1.0,
28
- };
29
- }
30
- ViewerLabs.prototype.loadEnvironment = function (data, onSuccess, onProgress, onError) {
31
- var _this = this;
32
- //@! todo: should loadEnvironment cancel any currently loading environments?
33
- if (data instanceof ArrayBuffer) {
34
- this.environment = EnvironmentDeserializer.Parse(data);
35
- if (onSuccess) {
36
- onSuccess(this.environment);
37
- }
38
- }
39
- else if (typeof data === "string") {
40
- var url = this.getAssetUrl(data);
41
- this._scene._loadFile(url, function (arrayBuffer) {
42
- _this.environment = EnvironmentDeserializer.Parse(arrayBuffer);
43
- if (onSuccess) {
44
- onSuccess(_this.environment);
45
- }
46
- }, function (progressEvent) {
47
- if (onProgress) {
48
- onProgress(progressEvent.loaded, progressEvent.total);
49
- }
50
- }, false, true, function (r, e) {
51
- if (onError) {
52
- onError(e);
53
- }
54
- });
55
- }
56
- else {
57
- //data assumed to be PBREnvironment object
58
- this.environment = data;
59
- if (onSuccess) {
60
- onSuccess(data);
61
- }
62
- }
63
- };
64
- /**
65
- * Applies an `EnvironmentMapConfiguration` to the scene
66
- * @param rotationY
67
- */
68
- ViewerLabs.prototype.applyEnvironmentMapConfiguration = function (rotationY) {
69
- if (!this.environment) {
70
- return;
71
- }
72
- //set orientation
73
- var rotatquatRotationionY = Quaternion.RotationAxis(Axis.Y, rotationY || 0);
74
- // Add env texture to the scene.
75
- if (this.environment.specularTexture) {
76
- // IE crashes when disposing the old texture and setting a new one
77
- if (!this._scene.environmentTexture) {
78
- this._scene.environmentTexture = TextureUtils.GetBabylonCubeTexture(this._scene, this.environment.specularTexture, false, true);
79
- }
80
- if (this._scene.environmentTexture) {
81
- this._scene.environmentTexture.level = this.environment.textureIntensityScale;
82
- this._scene.environmentTexture.invertZ = true;
83
- this._scene.environmentTexture.lodLevelInAlpha = true;
84
- var poly = this._scene.environmentTexture.sphericalPolynomial || new SphericalPolynomial();
85
- poly.x = this.environment.irradiancePolynomialCoefficients.x;
86
- poly.y = this.environment.irradiancePolynomialCoefficients.y;
87
- poly.z = this.environment.irradiancePolynomialCoefficients.z;
88
- poly.xx = this.environment.irradiancePolynomialCoefficients.xx;
89
- poly.xy = this.environment.irradiancePolynomialCoefficients.xy;
90
- poly.yy = this.environment.irradiancePolynomialCoefficients.yy;
91
- poly.yz = this.environment.irradiancePolynomialCoefficients.yz;
92
- poly.zx = this.environment.irradiancePolynomialCoefficients.zx;
93
- poly.zz = this.environment.irradiancePolynomialCoefficients.zz;
94
- this._scene.environmentTexture.sphericalPolynomial = poly;
95
- //set orientation
96
- Matrix.FromQuaternionToRef(rotatquatRotationionY, this._scene.environmentTexture.getReflectionTextureMatrix());
97
- }
98
- }
99
- };
100
- /**
101
- * Get an environment asset url by using the configuration if the path is not absolute.
102
- * @param url Asset url
103
- * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
104
- */
105
- ViewerLabs.prototype.getAssetUrl = function (url) {
106
- var returnUrl = url;
107
- if (url && url.toLowerCase().indexOf("//") === -1) {
108
- if (!this.assetsRootURL) {
109
- // Tools.Warn("Please, specify the root url of your assets before loading the configuration (labs.environmentAssetsRootURL) or disable the background through the viewer options.");
110
- return url;
111
- }
112
- returnUrl = this.assetsRootURL + returnUrl;
113
- }
114
- return returnUrl;
115
- };
116
- ViewerLabs.prototype.rotateShadowLight = function (shadowLight, amount, point, axis, target) {
117
- if (point === void 0) { point = Vector3.Zero(); }
118
- if (axis === void 0) { axis = Axis.Y; }
119
- if (target === void 0) { target = Vector3.Zero(); }
120
- axis.normalize();
121
- point.subtractToRef(shadowLight.position, TmpVectors.Vector3[0]);
122
- Matrix.TranslationToRef(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z, TmpVectors.Matrix[0]);
123
- TmpVectors.Matrix[0].invertToRef(TmpVectors.Matrix[2]);
124
- Matrix.RotationAxisToRef(axis, amount, TmpVectors.Matrix[1]);
125
- TmpVectors.Matrix[2].multiplyToRef(TmpVectors.Matrix[1], TmpVectors.Matrix[2]);
126
- TmpVectors.Matrix[2].multiplyToRef(TmpVectors.Matrix[0], TmpVectors.Matrix[2]);
127
- TmpVectors.Matrix[2].decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], TmpVectors.Vector3[1]);
128
- shadowLight.position.addInPlace(TmpVectors.Vector3[1]);
129
- shadowLight.setDirectionToTarget(target);
130
- };
131
- return ViewerLabs;
132
- }());
133
- export { ViewerLabs };
1
+ import { EnvironmentDeserializer } from "./environmentSerializer.js";
2
+ import { Vector3, Quaternion, Matrix, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
3
+ import { SphericalPolynomial } from "@babylonjs/core/Maths/sphericalPolynomial.js";
4
+ import { TextureUtils } from "./texture.js";
5
+ import { Axis } from "@babylonjs/core/Maths/math.axis.js";
6
+ /**
7
+ * The ViewerLabs class will hold functions that are not (!) backwards compatible.
8
+ * The APIs in all labs-related classes and configuration might change.
9
+ * Once stable, lab features will be moved to the publis API and configuration object.
10
+ */
11
+ var ViewerLabs = /** @class */ (function () {
12
+ function ViewerLabs(_scene) {
13
+ this._scene = _scene;
14
+ this.environment = {
15
+ //irradiance
16
+ irradiancePolynomialCoefficients: {
17
+ x: new Vector3(0, 0, 0),
18
+ y: new Vector3(0, 0, 0),
19
+ z: new Vector3(0, 0, 0),
20
+ xx: new Vector3(0, 0, 0),
21
+ yy: new Vector3(0, 0, 0),
22
+ zz: new Vector3(0, 0, 0),
23
+ yz: new Vector3(0, 0, 0),
24
+ zx: new Vector3(0, 0, 0),
25
+ xy: new Vector3(0, 0, 0),
26
+ },
27
+ textureIntensityScale: 1.0,
28
+ };
29
+ }
30
+ ViewerLabs.prototype.loadEnvironment = function (data, onSuccess, onProgress, onError) {
31
+ var _this = this;
32
+ //@! todo: should loadEnvironment cancel any currently loading environments?
33
+ if (data instanceof ArrayBuffer) {
34
+ this.environment = EnvironmentDeserializer.Parse(data);
35
+ if (onSuccess) {
36
+ onSuccess(this.environment);
37
+ }
38
+ }
39
+ else if (typeof data === "string") {
40
+ var url = this.getAssetUrl(data);
41
+ this._scene._loadFile(url, function (arrayBuffer) {
42
+ _this.environment = EnvironmentDeserializer.Parse(arrayBuffer);
43
+ if (onSuccess) {
44
+ onSuccess(_this.environment);
45
+ }
46
+ }, function (progressEvent) {
47
+ if (onProgress) {
48
+ onProgress(progressEvent.loaded, progressEvent.total);
49
+ }
50
+ }, false, true, function (r, e) {
51
+ if (onError) {
52
+ onError(e);
53
+ }
54
+ });
55
+ }
56
+ else {
57
+ //data assumed to be PBREnvironment object
58
+ this.environment = data;
59
+ if (onSuccess) {
60
+ onSuccess(data);
61
+ }
62
+ }
63
+ };
64
+ /**
65
+ * Applies an `EnvironmentMapConfiguration` to the scene
66
+ * @param rotationY
67
+ */
68
+ ViewerLabs.prototype.applyEnvironmentMapConfiguration = function (rotationY) {
69
+ if (!this.environment) {
70
+ return;
71
+ }
72
+ //set orientation
73
+ var rotatquatRotationionY = Quaternion.RotationAxis(Axis.Y, rotationY || 0);
74
+ // Add env texture to the scene.
75
+ if (this.environment.specularTexture) {
76
+ // IE crashes when disposing the old texture and setting a new one
77
+ if (!this._scene.environmentTexture) {
78
+ this._scene.environmentTexture = TextureUtils.GetBabylonCubeTexture(this._scene, this.environment.specularTexture, false, true);
79
+ }
80
+ if (this._scene.environmentTexture) {
81
+ this._scene.environmentTexture.level = this.environment.textureIntensityScale;
82
+ this._scene.environmentTexture.invertZ = true;
83
+ this._scene.environmentTexture.lodLevelInAlpha = true;
84
+ var poly = this._scene.environmentTexture.sphericalPolynomial || new SphericalPolynomial();
85
+ poly.x = this.environment.irradiancePolynomialCoefficients.x;
86
+ poly.y = this.environment.irradiancePolynomialCoefficients.y;
87
+ poly.z = this.environment.irradiancePolynomialCoefficients.z;
88
+ poly.xx = this.environment.irradiancePolynomialCoefficients.xx;
89
+ poly.xy = this.environment.irradiancePolynomialCoefficients.xy;
90
+ poly.yy = this.environment.irradiancePolynomialCoefficients.yy;
91
+ poly.yz = this.environment.irradiancePolynomialCoefficients.yz;
92
+ poly.zx = this.environment.irradiancePolynomialCoefficients.zx;
93
+ poly.zz = this.environment.irradiancePolynomialCoefficients.zz;
94
+ this._scene.environmentTexture.sphericalPolynomial = poly;
95
+ //set orientation
96
+ Matrix.FromQuaternionToRef(rotatquatRotationionY, this._scene.environmentTexture.getReflectionTextureMatrix());
97
+ }
98
+ }
99
+ };
100
+ /**
101
+ * Get an environment asset url by using the configuration if the path is not absolute.
102
+ * @param url Asset url
103
+ * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
104
+ */
105
+ ViewerLabs.prototype.getAssetUrl = function (url) {
106
+ var returnUrl = url;
107
+ if (url && url.toLowerCase().indexOf("//") === -1) {
108
+ if (!this.assetsRootURL) {
109
+ // Tools.Warn("Please, specify the root url of your assets before loading the configuration (labs.environmentAssetsRootURL) or disable the background through the viewer options.");
110
+ return url;
111
+ }
112
+ returnUrl = this.assetsRootURL + returnUrl;
113
+ }
114
+ return returnUrl;
115
+ };
116
+ ViewerLabs.prototype.rotateShadowLight = function (shadowLight, amount, point, axis, target) {
117
+ if (point === void 0) { point = Vector3.Zero(); }
118
+ if (axis === void 0) { axis = Axis.Y; }
119
+ if (target === void 0) { target = Vector3.Zero(); }
120
+ axis.normalize();
121
+ point.subtractToRef(shadowLight.position, TmpVectors.Vector3[0]);
122
+ Matrix.TranslationToRef(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z, TmpVectors.Matrix[0]);
123
+ TmpVectors.Matrix[0].invertToRef(TmpVectors.Matrix[2]);
124
+ Matrix.RotationAxisToRef(axis, amount, TmpVectors.Matrix[1]);
125
+ TmpVectors.Matrix[2].multiplyToRef(TmpVectors.Matrix[1], TmpVectors.Matrix[2]);
126
+ TmpVectors.Matrix[2].multiplyToRef(TmpVectors.Matrix[0], TmpVectors.Matrix[2]);
127
+ TmpVectors.Matrix[2].decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], TmpVectors.Vector3[1]);
128
+ shadowLight.position.addInPlace(TmpVectors.Vector3[1]);
129
+ shadowLight.setDirectionToTarget(target);
130
+ };
131
+ return ViewerLabs;
132
+ }());
133
+ export { ViewerLabs };
134
134
  //# sourceMappingURL=viewerLabs.js.map
@@ -1,47 +1,47 @@
1
- import type { ConfigurationContainer } from "../configuration/configurationContainer";
2
- import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
3
- import type { ObservablesManager } from "../managers/observablesManager";
4
- import { ViewerModel } from "../model/viewerModel";
5
- import type { ILoaderPlugin } from "./plugins/index";
6
- import "@babylonjs/loaders/glTF/index.js";
7
- import "@babylonjs/core/Loading/Plugins/babylonFileLoader.js";
8
- /**
9
- * An instance of the class is in charge of loading the model correctly.
10
- * This class will continuously be expended with tasks required from the specific loaders Babylon has.
11
- *
12
- * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
13
- */
14
- export declare class ModelLoader {
15
- private _observablesManager;
16
- private _configurationContainer?;
17
- private _loadId;
18
- private _disposed;
19
- private _loaders;
20
- private _plugins;
21
- private _baseUrl;
22
- get baseUrl(): string;
23
- /**
24
- * Create a new Model loader
25
- * @param _observablesManager
26
- * @param _configurationContainer
27
- */
28
- constructor(_observablesManager: ObservablesManager, _configurationContainer?: ConfigurationContainer | undefined);
29
- /**
30
- * Adds a new plugin to the loader process.
31
- *
32
- * @param plugin the plugin name or the plugin itself
33
- */
34
- addPlugin(plugin: ILoaderPlugin | string): void;
35
- /**
36
- * Load a model using predefined configuration
37
- * @param modelConfiguration the modelConfiguration to use to load the model
38
- */
39
- load(modelConfiguration: IModelConfiguration): ViewerModel;
40
- cancelLoad(model: ViewerModel): void;
41
- /**
42
- * dispose the model loader.
43
- * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
44
- */
45
- dispose(): void;
46
- private _checkAndRun;
47
- }
1
+ import type { ConfigurationContainer } from "../configuration/configurationContainer";
2
+ import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
3
+ import type { ObservablesManager } from "../managers/observablesManager";
4
+ import { ViewerModel } from "../model/viewerModel";
5
+ import type { ILoaderPlugin } from "./plugins/index";
6
+ import "@babylonjs/loaders/glTF/index.js";
7
+ import "@babylonjs/core/Loading/Plugins/babylonFileLoader.js";
8
+ /**
9
+ * An instance of the class is in charge of loading the model correctly.
10
+ * This class will continuously be expended with tasks required from the specific loaders Babylon has.
11
+ *
12
+ * A Model loader is unique per (Abstract)Viewer. It is being generated by the viewer
13
+ */
14
+ export declare class ModelLoader {
15
+ private _observablesManager;
16
+ private _configurationContainer?;
17
+ private _loadId;
18
+ private _disposed;
19
+ private _loaders;
20
+ private _plugins;
21
+ private _baseUrl;
22
+ get baseUrl(): string;
23
+ /**
24
+ * Create a new Model loader
25
+ * @param _observablesManager
26
+ * @param _configurationContainer
27
+ */
28
+ constructor(_observablesManager: ObservablesManager, _configurationContainer?: ConfigurationContainer | undefined);
29
+ /**
30
+ * Adds a new plugin to the loader process.
31
+ *
32
+ * @param plugin the plugin name or the plugin itself
33
+ */
34
+ addPlugin(plugin: ILoaderPlugin | string): void;
35
+ /**
36
+ * Load a model using predefined configuration
37
+ * @param modelConfiguration the modelConfiguration to use to load the model
38
+ */
39
+ load(modelConfiguration: IModelConfiguration): ViewerModel;
40
+ cancelLoad(model: ViewerModel): void;
41
+ /**
42
+ * dispose the model loader.
43
+ * If loaders are registered and are in the middle of loading, they will be disposed and the request(s) will be cancelled.
44
+ */
45
+ dispose(): void;
46
+ private _checkAndRun;
47
+ }