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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/animation/AnimatableObject.d.ts +8 -8
  5. package/dist/animation/AnimatableObject.js +3 -3
  6. package/dist/animation/animator/Animator.d.ts +33 -33
  7. package/dist/animation/animator/Animator.js +58 -58
  8. package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
  9. package/dist/animation/animator/AnimatorEasing.js +31 -31
  10. package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
  11. package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
  12. package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
  13. package/dist/animation/animator/AnimatorHighlight.js +32 -32
  14. package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
  15. package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
  16. package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
  17. package/dist/animation/animator/AnimatorQueue.js +57 -57
  18. package/dist/animation/animator/AnimatorScale.d.ts +8 -8
  19. package/dist/animation/animator/AnimatorScale.js +13 -13
  20. package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
  21. package/dist/animation/animator/AnimatorSpin.js +13 -13
  22. package/dist/animation/animator/EasingFunctions.d.ts +35 -35
  23. package/dist/animation/animator/EasingFunctions.js +137 -137
  24. package/dist/animation/coordinator/Coordinator.d.ts +28 -28
  25. package/dist/animation/coordinator/Coordinator.js +53 -53
  26. package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
  27. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +138 -138
  28. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
  29. package/dist/animation/coordinator/CoordinatorIdentity.js +14 -14
  30. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
  31. package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
  32. package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
  33. package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
  34. package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
  35. package/dist/animation/coordinator/CoordinatorPulseBounce.js +35 -35
  36. package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
  37. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +29 -29
  38. package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
  39. package/dist/animation/coordinator/CoordinatorPulseInflate.js +23 -23
  40. package/dist/camera/CameraCreator.d.ts +5 -5
  41. package/dist/camera/CameraCreator.js +4 -4
  42. package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
  43. package/dist/camera/CfgArcRotateCameraPointersInput.js +266 -266
  44. package/dist/camera/CfgOrbitalCamera.d.ts +76 -76
  45. package/dist/camera/CfgOrbitalCamera.js +281 -281
  46. package/dist/camera/CfgOrbitalCameraControlProps.d.ts +14 -14
  47. package/dist/camera/CfgOrbitalCameraControlProps.js +7 -7
  48. package/dist/camera/GradingApplier.d.ts +3 -3
  49. package/dist/camera/GradingApplier.js +48 -48
  50. package/dist/engine/EngineCreator.d.ts +3 -3
  51. package/dist/engine/EngineCreator.js +10 -10
  52. package/dist/geometry/CfgGeometry.d.ts +29 -29
  53. package/dist/geometry/CfgGeometry.js +146 -146
  54. package/dist/geometry/CfgMesh.d.ts +10 -10
  55. package/dist/geometry/CfgMesh.js +38 -38
  56. package/dist/geometry/geoSplitter.d.ts +8 -8
  57. package/dist/geometry/geoSplitter.js +192 -192
  58. package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
  59. package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
  60. package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
  61. package/dist/geometry/stretch/CfgStretchData.js +347 -350
  62. package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
  63. package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
  64. package/dist/index.d.ts +16 -16
  65. package/dist/index.js +16 -16
  66. package/dist/io/CfgHistoryToCameraConfConnector.d.ts +31 -31
  67. package/dist/io/CfgHistoryToCameraConfConnector.js +90 -90
  68. package/dist/io/CfgIOCameraConfConnector.d.ts +35 -35
  69. package/dist/io/CfgIOCameraConfConnector.js +81 -81
  70. package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +10 -10
  71. package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -11
  72. package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +10 -10
  73. package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -11
  74. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  75. package/dist/light/CfgDirectionalLight.js +18 -18
  76. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  77. package/dist/light/CfgHemisphericLight.js +17 -17
  78. package/dist/light/CfgPointLight.d.ts +8 -8
  79. package/dist/light/CfgPointLight.js +18 -18
  80. package/dist/light/DefaultLightRig.d.ts +19 -19
  81. package/dist/light/DefaultLightRig.js +77 -77
  82. package/dist/light/LightRigCreator.d.ts +9 -9
  83. package/dist/light/LightRigCreator.js +3 -3
  84. package/dist/material/CfgMaterial.d.ts +68 -68
  85. package/dist/material/CfgMaterial.js +482 -482
  86. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  87. package/dist/material/DummyMaterialCreator.js +15 -15
  88. package/dist/material/material.d.ts +18 -18
  89. package/dist/material/material.js +128 -128
  90. package/dist/material/texture.d.ts +14 -14
  91. package/dist/material/texture.js +306 -306
  92. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  93. package/dist/nodes/CfgContentRootNode.js +75 -75
  94. package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
  95. package/dist/nodes/CfgDeferredMeshNode.js +378 -378
  96. package/dist/nodes/CfgProductNode.d.ts +127 -127
  97. package/dist/nodes/CfgProductNode.js +598 -598
  98. package/dist/nodes/CfgSymNode.d.ts +50 -50
  99. package/dist/nodes/CfgSymNode.js +249 -249
  100. package/dist/nodes/CfgSymRootNode.d.ts +45 -45
  101. package/dist/nodes/CfgSymRootNode.js +239 -229
  102. package/dist/nodes/CfgTransformNode.d.ts +33 -33
  103. package/dist/nodes/CfgTransformNode.js +83 -83
  104. package/dist/scene/SceneCreator.d.ts +6 -6
  105. package/dist/scene/SceneCreator.js +22 -22
  106. package/dist/utilities/CfgBoundingBox.d.ts +21 -21
  107. package/dist/utilities/CfgBoundingBox.js +81 -81
  108. package/dist/utilities/anchor/anchor.d.ts +50 -50
  109. package/dist/utilities/anchor/anchor.js +133 -133
  110. package/dist/utilities/anchor/anchorMap.d.ts +20 -20
  111. package/dist/utilities/anchor/anchorMap.js +111 -111
  112. package/dist/utilities/utilities3D.d.ts +70 -70
  113. package/dist/utilities/utilities3D.js +265 -265
  114. package/dist/utilities/utilitiesColor.d.ts +18 -18
  115. package/dist/utilities/utilitiesColor.js +50 -50
  116. package/dist/utilities/utilitiesImage.d.ts +6 -6
  117. package/dist/utilities/utilitiesImage.js +107 -107
  118. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
  119. package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
  120. package/dist/view/BaseView.d.ts +78 -78
  121. package/dist/view/BaseView.js +303 -303
  122. package/dist/view/BaseViewConfiguration.d.ts +32 -32
  123. package/dist/view/BaseViewConfiguration.js +10 -10
  124. package/dist/view/RenderEnv.d.ts +43 -43
  125. package/dist/view/RenderEnv.js +7 -7
  126. package/dist/view/SingleProductDefaultCameraView.d.ts +38 -38
  127. package/dist/view/SingleProductDefaultCameraView.js +149 -149
  128. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +44 -44
  129. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  130. package/dist/view/SingleProductView.d.ts +44 -44
  131. package/dist/view/SingleProductView.js +212 -212
  132. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  133. package/dist/view/SingleProductViewConfiguration.js +19 -19
  134. package/package.json +5 -5
@@ -1,81 +1,81 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { orbitalCameraControlPropsEquals, } from "../camera/CfgOrbitalCameraControlProps.js";
11
- export const STAGE_CAMERA_CONF_MESSAGE_KEY = "stagecameraconf";
12
- export const STAGE_CAMERA_MESSAGE_VERSION = "1.0";
13
- /**
14
- * Base class for connecting the camera configuration to an IO channel
15
- */
16
- export class CfgIOCameraConfConnector {
17
- constructor(_ioManager, initial, cameraControl) {
18
- this._ioManager = _ioManager;
19
- this.destroy = () => {
20
- this._stopListenToMessage();
21
- this._stopListenToCameraConf();
22
- };
23
- this._sendWithoutDuplicates = (cameraConf, initial) => {
24
- const latestSentData = this._latestSentData;
25
- if (latestSentData !== undefined) {
26
- if (orbitalCameraControlPropsEquals(latestSentData.cameraConf, cameraConf) &&
27
- latestSentData.initial === initial) {
28
- return;
29
- }
30
- }
31
- this._latestSentData = { cameraConf, initial };
32
- this._send(this.makeSendData(cameraConf, initial));
33
- };
34
- this._send = (data) => this._ioManager.send(STAGE_CAMERA_CONF_MESSAGE_KEY, data);
35
- this._sendWithoutDuplicates(initial, true);
36
- this._stopListenToMessage = CfgIOCameraConfConnector.listenForMessage((message) => __awaiter(this, void 0, void 0, function* () {
37
- cameraControl.notifyAll(message.cameraConf, this);
38
- }), _ioManager);
39
- this._stopListenToCameraConf = CfgIOCameraConfConnector.listenForCamera((cameraConf) => __awaiter(this, void 0, void 0, function* () {
40
- if (!cameraConf.committed) {
41
- return;
42
- }
43
- this._sendWithoutDuplicates(cameraConf, false);
44
- }), cameraControl);
45
- }
46
- static makeMessage(cameraConf, initial) {
47
- return {
48
- version: STAGE_CAMERA_MESSAGE_VERSION,
49
- initial,
50
- cameraConf,
51
- };
52
- }
53
- static makeMessageListener(callback) {
54
- return (message) => __awaiter(this, void 0, void 0, function* () {
55
- const cameraConfMessage = message;
56
- const version = cameraConfMessage.version;
57
- if (version !== STAGE_CAMERA_MESSAGE_VERSION) {
58
- console.error(`The a message was passed with an unsupported version "${version}". Currently only ${STAGE_CAMERA_MESSAGE_VERSION} is supported.`);
59
- return;
60
- }
61
- yield callback(cameraConfMessage);
62
- });
63
- }
64
- /**
65
- * Register the callback to listen for Product Configuration messages
66
- * @returns A function which when called will cancel listening
67
- */
68
- static listenForMessage(callback, ioManager) {
69
- const listener = this.makeMessageListener(callback);
70
- ioManager.listenForMessage(listener, STAGE_CAMERA_CONF_MESSAGE_KEY);
71
- return () => {
72
- ioManager.stopListenForMessage(listener);
73
- };
74
- }
75
- static listenForCamera(callback, cameraControl) {
76
- cameraControl.listen(callback, this);
77
- return () => {
78
- cameraControl.stopListen(callback);
79
- };
80
- }
81
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { orbitalCameraControlPropsEquals, } from "../camera/CfgOrbitalCameraControlProps.js";
11
+ export const STAGE_CAMERA_CONF_MESSAGE_KEY = "stagecameraconf";
12
+ export const STAGE_CAMERA_MESSAGE_VERSION = "1.0";
13
+ /**
14
+ * Base class for connecting the camera configuration to an IO channel
15
+ */
16
+ export class CfgIOCameraConfConnector {
17
+ constructor(_ioManager, initial, cameraControl) {
18
+ this._ioManager = _ioManager;
19
+ this.destroy = () => {
20
+ this._stopListenToMessage();
21
+ this._stopListenToCameraConf();
22
+ };
23
+ this._sendWithoutDuplicates = (cameraConf, initial) => {
24
+ const latestSentData = this._latestSentData;
25
+ if (latestSentData !== undefined) {
26
+ if (orbitalCameraControlPropsEquals(latestSentData.cameraConf, cameraConf) &&
27
+ latestSentData.initial === initial) {
28
+ return;
29
+ }
30
+ }
31
+ this._latestSentData = { cameraConf, initial };
32
+ this._send(this.makeSendData(cameraConf, initial));
33
+ };
34
+ this._send = (data) => this._ioManager.send(STAGE_CAMERA_CONF_MESSAGE_KEY, data);
35
+ this._sendWithoutDuplicates(initial, true);
36
+ this._stopListenToMessage = CfgIOCameraConfConnector.listenForMessage((message) => __awaiter(this, void 0, void 0, function* () {
37
+ cameraControl.notifyAll(message.cameraConf, this);
38
+ }), _ioManager);
39
+ this._stopListenToCameraConf = CfgIOCameraConfConnector.listenForCamera((cameraConf) => __awaiter(this, void 0, void 0, function* () {
40
+ if (!cameraConf.committed) {
41
+ return;
42
+ }
43
+ this._sendWithoutDuplicates(cameraConf, false);
44
+ }), cameraControl);
45
+ }
46
+ static makeMessage(cameraConf, initial) {
47
+ return {
48
+ version: STAGE_CAMERA_MESSAGE_VERSION,
49
+ initial,
50
+ cameraConf,
51
+ };
52
+ }
53
+ static makeMessageListener(callback) {
54
+ return (message) => __awaiter(this, void 0, void 0, function* () {
55
+ const cameraConfMessage = message;
56
+ const version = cameraConfMessage.version;
57
+ if (version !== STAGE_CAMERA_MESSAGE_VERSION) {
58
+ console.error(`The a message was passed with an unsupported version "${version}". Currently only ${STAGE_CAMERA_MESSAGE_VERSION} is supported.`);
59
+ return;
60
+ }
61
+ yield callback(cameraConfMessage);
62
+ });
63
+ }
64
+ /**
65
+ * Register the callback to listen for Product Configuration messages
66
+ * @returns A function which when called will cancel listening
67
+ */
68
+ static listenForMessage(callback, ioManager) {
69
+ const listener = this.makeMessageListener(callback);
70
+ ioManager.listenForMessage(listener, STAGE_CAMERA_CONF_MESSAGE_KEY);
71
+ return () => {
72
+ ioManager.stopListenForMessage(listener);
73
+ };
74
+ }
75
+ static listenForCamera(callback, cameraControl) {
76
+ cameraControl.listen(callback, this);
77
+ return () => {
78
+ cameraControl.stopListen(callback);
79
+ };
80
+ }
81
+ }
@@ -1,11 +1,11 @@
1
- import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
2
- import { CfgCameraConfMessage, CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
3
- /**
4
- * Instantiating this will make Stage send camera orientation to the observable state.
5
- * It will also make Stage listen for incoming updates to the observable state.
6
-
7
- */
8
- export declare class CfgObservableStateToCameraConfConnector extends CfgIOCameraConfConnector<CfgCameraConfMessage> {
9
- protected makeSendData(cameraConf: CfgOrbitalCameraControlProps, initial: boolean): CfgCameraConfMessage;
10
- }
1
+ import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
2
+ import { CfgCameraConfMessage, CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
3
+ /**
4
+ * Instantiating this will make Stage send camera orientation to the observable state.
5
+ * It will also make Stage listen for incoming updates to the observable state.
6
+
7
+ */
8
+ export declare class CfgObservableStateToCameraConfConnector extends CfgIOCameraConfConnector<CfgCameraConfMessage> {
9
+ protected makeSendData(cameraConf: CfgOrbitalCameraControlProps, initial: boolean): CfgCameraConfMessage;
10
+ }
11
11
  //# sourceMappingURL=CfgObservableStateToCameraConfConnector.d.ts.map
@@ -1,11 +1,11 @@
1
- import { CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
- /**
3
- * Instantiating this will make Stage send camera orientation to the observable state.
4
- * It will also make Stage listen for incoming updates to the observable state.
5
-
6
- */
7
- export class CfgObservableStateToCameraConfConnector extends CfgIOCameraConfConnector {
8
- makeSendData(cameraConf, initial) {
9
- return CfgIOCameraConfConnector.makeMessage(cameraConf, initial);
10
- }
11
- }
1
+ import { CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
+ /**
3
+ * Instantiating this will make Stage send camera orientation to the observable state.
4
+ * It will also make Stage listen for incoming updates to the observable state.
5
+
6
+ */
7
+ export class CfgObservableStateToCameraConfConnector extends CfgIOCameraConfConnector {
8
+ makeSendData(cameraConf, initial) {
9
+ return CfgIOCameraConfConnector.makeMessage(cameraConf, initial);
10
+ }
11
+ }
@@ -1,11 +1,11 @@
1
- import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
2
- import { CfgCameraConfMessage, CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
3
- /**
4
- * Instantiating this will make Stage send camera orientation changes using the post message-API.
5
- * It will also make Stage listen for incoming camera orientation update messages.
6
- * This can be used to communicate in and out of an iframe for example.
7
- */
8
- export declare class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector<CfgCameraConfMessage> {
9
- protected makeSendData(cameraConf: CfgOrbitalCameraControlProps, initial: boolean): CfgCameraConfMessage;
10
- }
1
+ import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
2
+ import { CfgCameraConfMessage, CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
3
+ /**
4
+ * Instantiating this will make Stage send camera orientation changes using the post message-API.
5
+ * It will also make Stage listen for incoming camera orientation update messages.
6
+ * This can be used to communicate in and out of an iframe for example.
7
+ */
8
+ export declare class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector<CfgCameraConfMessage> {
9
+ protected makeSendData(cameraConf: CfgOrbitalCameraControlProps, initial: boolean): CfgCameraConfMessage;
10
+ }
11
11
  //# sourceMappingURL=CfgWindowMessageToCameraConfConnector.d.ts.map
@@ -1,11 +1,11 @@
1
- import { CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
- /**
3
- * Instantiating this will make Stage send camera orientation changes using the post message-API.
4
- * It will also make Stage listen for incoming camera orientation update messages.
5
- * This can be used to communicate in and out of an iframe for example.
6
- */
7
- export class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector {
8
- makeSendData(cameraConf, initial) {
9
- return CfgIOCameraConfConnector.makeMessage(cameraConf, initial);
10
- }
11
- }
1
+ import { CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
+ /**
3
+ * Instantiating this will make Stage send camera orientation changes using the post message-API.
4
+ * It will also make Stage listen for incoming camera orientation update messages.
5
+ * This can be used to communicate in and out of an iframe for example.
6
+ */
7
+ export class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector {
8
+ makeSendData(cameraConf, initial) {
9
+ return CfgIOCameraConfConnector.makeMessage(cameraConf, initial);
10
+ }
11
+ }
@@ -1,9 +1,9 @@
1
- import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
- import { Node } from "@babylonjs/core/node.js";
5
- import { Scene } from "@babylonjs/core/scene.js";
6
- export declare class CfgDirectionalLight extends DirectionalLight {
7
- constructor(name: string, scene: Scene, parent?: Node, direction?: Vector3, color?: Color3 | string | number, intensity?: number);
8
- }
1
+ import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
2
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
+ import { Node } from "@babylonjs/core/node.js";
5
+ import { Scene } from "@babylonjs/core/scene.js";
6
+ export declare class CfgDirectionalLight extends DirectionalLight {
7
+ constructor(name: string, scene: Scene, parent?: Node, direction?: Vector3, color?: Color3 | string | number, intensity?: number);
8
+ }
9
9
  //# sourceMappingURL=CfgDirectionalLight.d.ts.map
@@ -1,18 +1,18 @@
1
- import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
2
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
3
- import { toColor3 } from "../utilities/utilitiesColor.js";
4
- export class CfgDirectionalLight extends DirectionalLight {
5
- constructor(name, scene, parent, direction, color, intensity) {
6
- if (direction === undefined) {
7
- direction = Vector3.Down();
8
- }
9
- super(name, direction, scene);
10
- if (parent) {
11
- this.parent = parent;
12
- }
13
- this.specular = this.diffuse = toColor3(color);
14
- if (intensity !== undefined) {
15
- this.intensity = intensity;
16
- }
17
- }
18
- }
1
+ import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
2
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
3
+ import { toColor3 } from "../utilities/utilitiesColor.js";
4
+ export class CfgDirectionalLight extends DirectionalLight {
5
+ constructor(name, scene, parent, direction, color, intensity) {
6
+ if (direction === undefined) {
7
+ direction = Vector3.Down();
8
+ }
9
+ super(name, direction, scene);
10
+ if (parent) {
11
+ this.parent = parent;
12
+ }
13
+ this.specular = this.diffuse = toColor3(color);
14
+ if (intensity !== undefined) {
15
+ this.intensity = intensity;
16
+ }
17
+ }
18
+ }
@@ -1,8 +1,8 @@
1
- import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import { Node } from "@babylonjs/core/node.js";
4
- import { Scene } from "@babylonjs/core/scene.js";
5
- export declare class CfgHemisphericLight extends HemisphericLight {
6
- constructor(name: string, scene: Scene, parent?: Node, color?: Color3 | string | number, intensity?: number);
7
- }
1
+ import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
2
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
+ import { Node } from "@babylonjs/core/node.js";
4
+ import { Scene } from "@babylonjs/core/scene.js";
5
+ export declare class CfgHemisphericLight extends HemisphericLight {
6
+ constructor(name: string, scene: Scene, parent?: Node, color?: Color3 | string | number, intensity?: number);
7
+ }
8
8
  //# sourceMappingURL=CfgHemisphericLight.d.ts.map
@@ -1,17 +1,17 @@
1
- import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
- import { toColor3 } from "../utilities/utilitiesColor.js";
5
- export class CfgHemisphericLight extends HemisphericLight {
6
- constructor(name, scene, parent, color, intensity) {
7
- super(name, new Vector3(0, 0, 1), scene);
8
- if (parent) {
9
- this.parent = parent;
10
- }
11
- this.groundColor = Color3.Black();
12
- this.specular = this.diffuse = toColor3(color);
13
- if (intensity !== undefined) {
14
- this.intensity = intensity;
15
- }
16
- }
17
- }
1
+ import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
2
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
+ import { toColor3 } from "../utilities/utilitiesColor.js";
5
+ export class CfgHemisphericLight extends HemisphericLight {
6
+ constructor(name, scene, parent, color, intensity) {
7
+ super(name, new Vector3(0, 0, 1), scene);
8
+ if (parent) {
9
+ this.parent = parent;
10
+ }
11
+ this.groundColor = Color3.Black();
12
+ this.specular = this.diffuse = toColor3(color);
13
+ if (intensity !== undefined) {
14
+ this.intensity = intensity;
15
+ }
16
+ }
17
+ }
@@ -1,9 +1,9 @@
1
- import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
- import { Node } from "@babylonjs/core/node.js";
5
- import { Scene } from "@babylonjs/core/scene.js";
6
- export declare class CfgPointLight extends PointLight {
7
- constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
8
- }
1
+ import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
2
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
+ import { Node } from "@babylonjs/core/node.js";
5
+ import { Scene } from "@babylonjs/core/scene.js";
6
+ export declare class CfgPointLight extends PointLight {
7
+ constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
8
+ }
9
9
  //# sourceMappingURL=CfgPointLight.d.ts.map
@@ -1,18 +1,18 @@
1
- import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
2
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
3
- import { toColor3 } from "../utilities/utilitiesColor.js";
4
- export class CfgPointLight extends PointLight {
5
- constructor(name, scene, parent, position, color, intensity) {
6
- if (position === undefined) {
7
- position = Vector3.Zero();
8
- }
9
- super(name, position, scene);
10
- if (parent) {
11
- this.parent = parent;
12
- }
13
- this.specular = this.diffuse = toColor3(color);
14
- if (intensity !== undefined) {
15
- this.intensity = intensity;
16
- }
17
- }
18
- }
1
+ import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
2
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
3
+ import { toColor3 } from "../utilities/utilitiesColor.js";
4
+ export class CfgPointLight extends PointLight {
5
+ constructor(name, scene, parent, position, color, intensity) {
6
+ if (position === undefined) {
7
+ position = Vector3.Zero();
8
+ }
9
+ super(name, position, scene);
10
+ if (parent) {
11
+ this.parent = parent;
12
+ }
13
+ this.specular = this.diffuse = toColor3(color);
14
+ if (intensity !== undefined) {
15
+ this.intensity = intensity;
16
+ }
17
+ }
18
+ }
@@ -1,20 +1,20 @@
1
- import { Node } from "@babylonjs/core/node.js";
2
- import { Scene } from "@babylonjs/core/scene.js";
3
- import { LightRig, LightRigCreator } from "./LightRigCreator.js";
4
- export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
5
- export declare class DefaultLightRig extends LightRig {
6
- private _allLights;
7
- private _allPointLights;
8
- private _defaultIntensities;
9
- private _dimLevel;
10
- get dimLevel(): number;
11
- set dimLevel(v: number);
12
- private _scale;
13
- get scale(): number;
14
- set scale(v: number);
15
- private applyDimLevel;
16
- private applyScale;
17
- constructor(scene: Scene, target: Node | undefined);
18
- get lightCount(): number;
19
- }
1
+ import { Node } from "@babylonjs/core/node.js";
2
+ import { Scene } from "@babylonjs/core/scene.js";
3
+ import { LightRig, LightRigCreator } from "./LightRigCreator.js";
4
+ export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
5
+ export declare class DefaultLightRig extends LightRig {
6
+ private _allLights;
7
+ private _allPointLights;
8
+ private _defaultIntensities;
9
+ private _dimLevel;
10
+ get dimLevel(): number;
11
+ set dimLevel(v: number);
12
+ private _scale;
13
+ get scale(): number;
14
+ set scale(v: number);
15
+ private applyDimLevel;
16
+ private applyScale;
17
+ constructor(scene: Scene, target: Node | undefined);
18
+ get lightCount(): number;
19
+ }
20
20
  //# sourceMappingURL=DefaultLightRig.d.ts.map
@@ -1,77 +1,77 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
- import { CfgDirectionalLight } from "./CfgDirectionalLight.js";
3
- import { CfgPointLight } from "./CfgPointLight.js";
4
- import { LightRig } from "./LightRigCreator.js";
5
- const LIGHT_DECAY = 2;
6
- const BASE_LIGHT_SCALE = 1;
7
- const BASE_LIGHT_POWER = 7;
8
- const BASE_NO_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 0.5;
9
- const BASE_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 30 * Math.pow(BASE_LIGHT_SCALE, LIGHT_DECAY);
10
- function isDecayingLight(object) {
11
- return object instanceof CfgPointLight;
12
- }
13
- export const getDefaultLightRigCreator = (relativeToCamera) => (scene, target) => new DefaultLightRig(scene, relativeToCamera ? target : undefined);
14
- export class DefaultLightRig extends LightRig {
15
- constructor(scene, target) {
16
- super("Light Rig");
17
- this._allLights = [];
18
- this._allPointLights = [];
19
- this._defaultIntensities = [];
20
- this._dimLevel = 1;
21
- this._scale = 1;
22
- if (target === undefined) {
23
- scene.addTransformNode(this);
24
- }
25
- else {
26
- this.setParent(target);
27
- }
28
- this.position.setAll(0);
29
- this.scaling.setAll(1);
30
- this.rotation.setAll(0);
31
- const lightColor = 0xffffff;
32
- // The light rig is by default attached to a CfgOrbitalCamera and thus rotates around the
33
- // current product, as well being scaled to fit around the product. The names of the lights
34
- // below are relative to what the camera looks at in this default configuration. In other
35
- // words, "behind" means the light is on the far side of the product relative to the camera.
36
- this._allLights.push(new CfgDirectionalLight("directional", scene, this, new Vector3(-35, -25, -10), lightColor, 1.2 * BASE_NO_DECAY_LIGHT_POWER));
37
- this._allPointLights.push(new CfgPointLight("rightUpBehind", scene, this, new Vector3(10, 10, -5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
38
- this._allPointLights.push(new CfgPointLight("below", scene, this, new Vector3(0, -10, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.5 * BASE_DECAY_LIGHT_POWER));
39
- this._allPointLights.push(new CfgPointLight("leftFront", scene, this, new Vector3(-10, 0, 10).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.2 * BASE_DECAY_LIGHT_POWER));
40
- this._allPointLights.push(new CfgPointLight("rightUpFront", scene, this, new Vector3(10, 10, 5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
41
- this._allPointLights.push(new CfgPointLight("rightUp", scene, this, new Vector3(1, 15, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
42
- this._allLights.push(...this._allPointLights);
43
- this._allLights.forEach((light, index) => {
44
- this._defaultIntensities[index] = light.intensity;
45
- });
46
- }
47
- get dimLevel() {
48
- return this._dimLevel;
49
- }
50
- set dimLevel(v) {
51
- this._dimLevel = v;
52
- this.applyDimLevel();
53
- }
54
- get scale() {
55
- return this._scale;
56
- }
57
- set scale(v) {
58
- this._scale = v;
59
- this.applyDimLevel();
60
- this.applyScale();
61
- }
62
- applyDimLevel() {
63
- const decayCompensation = Math.pow(this.scale, LIGHT_DECAY);
64
- this._allPointLights.forEach((light, index) => {
65
- light.intensity =
66
- this._defaultIntensities[index] *
67
- this.dimLevel *
68
- (isDecayingLight(light) ? decayCompensation : 1);
69
- });
70
- }
71
- applyScale() {
72
- this.scaling = new Vector3(this.scale, this.scale, this.scale);
73
- }
74
- get lightCount() {
75
- return this._allLights.length;
76
- }
77
- }
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { CfgDirectionalLight } from "./CfgDirectionalLight.js";
3
+ import { CfgPointLight } from "./CfgPointLight.js";
4
+ import { LightRig } from "./LightRigCreator.js";
5
+ const LIGHT_DECAY = 2;
6
+ const BASE_LIGHT_SCALE = 1;
7
+ const BASE_LIGHT_POWER = 7;
8
+ const BASE_NO_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 0.5;
9
+ const BASE_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 30 * Math.pow(BASE_LIGHT_SCALE, LIGHT_DECAY);
10
+ function isDecayingLight(object) {
11
+ return object instanceof CfgPointLight;
12
+ }
13
+ export const getDefaultLightRigCreator = (relativeToCamera) => (scene, target) => new DefaultLightRig(scene, relativeToCamera ? target : undefined);
14
+ export class DefaultLightRig extends LightRig {
15
+ constructor(scene, target) {
16
+ super("Light Rig");
17
+ this._allLights = [];
18
+ this._allPointLights = [];
19
+ this._defaultIntensities = [];
20
+ this._dimLevel = 1;
21
+ this._scale = 1;
22
+ if (target === undefined) {
23
+ scene.addTransformNode(this);
24
+ }
25
+ else {
26
+ this.setParent(target);
27
+ }
28
+ this.position.setAll(0);
29
+ this.scaling.setAll(1);
30
+ this.rotation.setAll(0);
31
+ const lightColor = 0xffffff;
32
+ // The light rig is by default attached to a CfgOrbitalCamera and thus rotates around the
33
+ // current product, as well being scaled to fit around the product. The names of the lights
34
+ // below are relative to what the camera looks at in this default configuration. In other
35
+ // words, "behind" means the light is on the far side of the product relative to the camera.
36
+ this._allLights.push(new CfgDirectionalLight("directional", scene, this, new Vector3(-35, -25, -10), lightColor, 1.2 * BASE_NO_DECAY_LIGHT_POWER));
37
+ this._allPointLights.push(new CfgPointLight("rightUpBehind", scene, this, new Vector3(10, 10, -5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
38
+ this._allPointLights.push(new CfgPointLight("below", scene, this, new Vector3(0, -10, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.5 * BASE_DECAY_LIGHT_POWER));
39
+ this._allPointLights.push(new CfgPointLight("leftFront", scene, this, new Vector3(-10, 0, 10).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.2 * BASE_DECAY_LIGHT_POWER));
40
+ this._allPointLights.push(new CfgPointLight("rightUpFront", scene, this, new Vector3(10, 10, 5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
41
+ this._allPointLights.push(new CfgPointLight("rightUp", scene, this, new Vector3(1, 15, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
42
+ this._allLights.push(...this._allPointLights);
43
+ this._allLights.forEach((light, index) => {
44
+ this._defaultIntensities[index] = light.intensity;
45
+ });
46
+ }
47
+ get dimLevel() {
48
+ return this._dimLevel;
49
+ }
50
+ set dimLevel(v) {
51
+ this._dimLevel = v;
52
+ this.applyDimLevel();
53
+ }
54
+ get scale() {
55
+ return this._scale;
56
+ }
57
+ set scale(v) {
58
+ this._scale = v;
59
+ this.applyDimLevel();
60
+ this.applyScale();
61
+ }
62
+ applyDimLevel() {
63
+ const decayCompensation = Math.pow(this.scale, LIGHT_DECAY);
64
+ this._allPointLights.forEach((light, index) => {
65
+ light.intensity =
66
+ this._defaultIntensities[index] *
67
+ this.dimLevel *
68
+ (isDecayingLight(light) ? decayCompensation : 1);
69
+ });
70
+ }
71
+ applyScale() {
72
+ this.scaling = new Vector3(this.scale, this.scale, this.scale);
73
+ }
74
+ get lightCount() {
75
+ return this._allLights.length;
76
+ }
77
+ }
@@ -1,10 +1,10 @@
1
- import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
2
- import { Node } from "@babylonjs/core/node.js";
3
- import { Scene } from "@babylonjs/core/scene.js";
4
- export declare type LightRigCreator = (scene: Scene, target: Node | undefined) => LightRig;
5
- export declare abstract class LightRig extends TransformNode {
6
- abstract scale: number;
7
- abstract dimLevel: number;
8
- abstract lightCount: number;
9
- }
1
+ import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
2
+ import { Node } from "@babylonjs/core/node.js";
3
+ import { Scene } from "@babylonjs/core/scene.js";
4
+ export declare type LightRigCreator = (scene: Scene, target: Node | undefined) => LightRig;
5
+ export declare abstract class LightRig extends TransformNode {
6
+ abstract scale: number;
7
+ abstract dimLevel: number;
8
+ abstract lightCount: number;
9
+ }
10
10
  //# sourceMappingURL=LightRigCreator.d.ts.map