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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/animation/AnimatableObject.d.ts +8 -8
  5. package/dist/animation/AnimatableObject.js +3 -3
  6. package/dist/animation/animator/Animator.d.ts +33 -33
  7. package/dist/animation/animator/Animator.js +58 -58
  8. package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
  9. package/dist/animation/animator/AnimatorEasing.js +31 -31
  10. package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
  11. package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
  12. package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
  13. package/dist/animation/animator/AnimatorHighlight.js +32 -32
  14. package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
  15. package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
  16. package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
  17. package/dist/animation/animator/AnimatorQueue.js +57 -57
  18. package/dist/animation/animator/AnimatorScale.d.ts +8 -8
  19. package/dist/animation/animator/AnimatorScale.js +13 -13
  20. package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
  21. package/dist/animation/animator/AnimatorSpin.js +13 -13
  22. package/dist/animation/animator/EasingFunctions.d.ts +35 -35
  23. package/dist/animation/animator/EasingFunctions.js +137 -137
  24. package/dist/animation/coordinator/Coordinator.d.ts +28 -28
  25. package/dist/animation/coordinator/Coordinator.js +53 -53
  26. package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
  27. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +138 -138
  28. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
  29. package/dist/animation/coordinator/CoordinatorIdentity.js +14 -14
  30. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
  31. package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
  32. package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
  33. package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
  34. package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
  35. package/dist/animation/coordinator/CoordinatorPulseBounce.js +35 -35
  36. package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
  37. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +29 -29
  38. package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
  39. package/dist/animation/coordinator/CoordinatorPulseInflate.js +23 -23
  40. package/dist/camera/CameraCreator.d.ts +5 -5
  41. package/dist/camera/CameraCreator.js +4 -4
  42. package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
  43. package/dist/camera/CfgArcRotateCameraPointersInput.js +266 -266
  44. package/dist/camera/CfgOrbitalCamera.d.ts +76 -76
  45. package/dist/camera/CfgOrbitalCamera.js +281 -281
  46. package/dist/camera/CfgOrbitalCameraControlProps.d.ts +14 -14
  47. package/dist/camera/CfgOrbitalCameraControlProps.js +7 -7
  48. package/dist/camera/GradingApplier.d.ts +3 -3
  49. package/dist/camera/GradingApplier.js +48 -48
  50. package/dist/engine/EngineCreator.d.ts +3 -3
  51. package/dist/engine/EngineCreator.js +10 -10
  52. package/dist/geometry/CfgGeometry.d.ts +29 -29
  53. package/dist/geometry/CfgGeometry.js +146 -146
  54. package/dist/geometry/CfgMesh.d.ts +10 -10
  55. package/dist/geometry/CfgMesh.js +38 -38
  56. package/dist/geometry/geoSplitter.d.ts +8 -8
  57. package/dist/geometry/geoSplitter.js +192 -192
  58. package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
  59. package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
  60. package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
  61. package/dist/geometry/stretch/CfgStretchData.js +350 -350
  62. package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
  63. package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
  64. package/dist/index.d.ts +16 -16
  65. package/dist/index.js +16 -16
  66. package/dist/io/CfgHistoryToCameraConfConnector.d.ts +31 -31
  67. package/dist/io/CfgHistoryToCameraConfConnector.js +90 -90
  68. package/dist/io/CfgIOCameraConfConnector.d.ts +35 -35
  69. package/dist/io/CfgIOCameraConfConnector.js +81 -81
  70. package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +10 -10
  71. package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -11
  72. package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +10 -10
  73. package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -11
  74. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  75. package/dist/light/CfgDirectionalLight.js +18 -18
  76. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  77. package/dist/light/CfgHemisphericLight.js +17 -17
  78. package/dist/light/CfgPointLight.d.ts +8 -8
  79. package/dist/light/CfgPointLight.js +18 -18
  80. package/dist/light/DefaultLightRig.d.ts +19 -19
  81. package/dist/light/DefaultLightRig.js +77 -77
  82. package/dist/light/LightRigCreator.d.ts +9 -9
  83. package/dist/light/LightRigCreator.js +3 -3
  84. package/dist/material/CfgMaterial.d.ts +68 -68
  85. package/dist/material/CfgMaterial.js +482 -482
  86. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  87. package/dist/material/DummyMaterialCreator.js +15 -15
  88. package/dist/material/material.d.ts +18 -18
  89. package/dist/material/material.js +128 -128
  90. package/dist/material/texture.d.ts +14 -14
  91. package/dist/material/texture.js +306 -306
  92. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  93. package/dist/nodes/CfgContentRootNode.js +75 -75
  94. package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
  95. package/dist/nodes/CfgDeferredMeshNode.js +378 -378
  96. package/dist/nodes/CfgProductNode.d.ts +127 -127
  97. package/dist/nodes/CfgProductNode.js +598 -598
  98. package/dist/nodes/CfgSymNode.d.ts +50 -50
  99. package/dist/nodes/CfgSymNode.js +249 -249
  100. package/dist/nodes/CfgSymRootNode.d.ts +45 -45
  101. package/dist/nodes/CfgSymRootNode.js +229 -229
  102. package/dist/nodes/CfgTransformNode.d.ts +33 -33
  103. package/dist/nodes/CfgTransformNode.js +83 -83
  104. package/dist/scene/SceneCreator.d.ts +6 -6
  105. package/dist/scene/SceneCreator.js +22 -22
  106. package/dist/utilities/CfgBoundingBox.d.ts +21 -21
  107. package/dist/utilities/CfgBoundingBox.js +81 -81
  108. package/dist/utilities/anchor/anchor.d.ts +50 -50
  109. package/dist/utilities/anchor/anchor.js +133 -133
  110. package/dist/utilities/anchor/anchorMap.d.ts +20 -20
  111. package/dist/utilities/anchor/anchorMap.js +111 -111
  112. package/dist/utilities/utilities3D.d.ts +70 -70
  113. package/dist/utilities/utilities3D.js +265 -265
  114. package/dist/utilities/utilitiesColor.d.ts +18 -18
  115. package/dist/utilities/utilitiesColor.js +50 -50
  116. package/dist/utilities/utilitiesImage.d.ts +6 -6
  117. package/dist/utilities/utilitiesImage.js +107 -107
  118. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
  119. package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
  120. package/dist/view/BaseView.d.ts +78 -78
  121. package/dist/view/BaseView.js +303 -303
  122. package/dist/view/BaseViewConfiguration.d.ts +32 -32
  123. package/dist/view/BaseViewConfiguration.js +10 -10
  124. package/dist/view/RenderEnv.d.ts +43 -43
  125. package/dist/view/RenderEnv.js +7 -7
  126. package/dist/view/SingleProductDefaultCameraView.d.ts +38 -38
  127. package/dist/view/SingleProductDefaultCameraView.js +149 -149
  128. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +44 -44
  129. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  130. package/dist/view/SingleProductView.d.ts +44 -44
  131. package/dist/view/SingleProductView.js +212 -212
  132. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  133. package/dist/view/SingleProductViewConfiguration.js +19 -19
  134. package/package.json +5 -5
@@ -1,50 +1,50 @@
1
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
- import { Color } from "@configura/web-core/dist/cm/basic/Color.js";
3
- import { ColorF } from "@configura/web-core/dist/cm/basic/ColorF.js";
4
- /**
5
- * Converts a number of different color formats into Color3 for use with Babylon.js
6
- * Returns White if object is undefined.
7
- */
8
- export function toColor3(object) {
9
- if (object === undefined) {
10
- return Color3.White();
11
- }
12
- if (typeof object === "number") {
13
- // Assume object is a 24 bit integer
14
- return Color3.FromInts((object >>> 16) & 0xff, (object >>> 8) & 0xff, object & 0xff);
15
- }
16
- if (typeof object === "string") {
17
- // Assume object is a hex-string
18
- return Color3.FromHexString(object);
19
- }
20
- if (object instanceof ColorF) {
21
- // Object is a DEX ColorF (floats, 0-1)
22
- return new Color3(object.r, object.g, object.b);
23
- }
24
- if (object instanceof Color) {
25
- // Object is a DEX Color (integers 0-255)
26
- return Color3.FromInts(object.r, object.g, object.b);
27
- }
28
- // Must be Color3 already
29
- return object;
30
- }
31
- /**
32
- * in: r,g,b in [0,1], out: h in [0,360) and s,l in [0,1]
33
- * Original source: https://stackoverflow.com/a/54071699/1488048
34
- */
35
- export function rgb2hsl(r, g, b) {
36
- const a = Math.max(r, g, b);
37
- const n = a - Math.min(r, g, b);
38
- const f = 1 - Math.abs(a + a - n - 1);
39
- const h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
40
- return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
41
- }
42
- /**
43
- * input: h in [0,360] and s,v in [0,1] - output: r,g,b in [0,1]
44
- * Original source: https://stackoverflow.com/a/54014428/1488048
45
- */
46
- export function hsl2rgb(h, s, l) {
47
- const a = s * Math.min(l, 1 - l);
48
- const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
49
- return [f(0), f(8), f(4)];
50
- }
1
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
+ import { Color } from "@configura/web-core/dist/cm/basic/Color.js";
3
+ import { ColorF } from "@configura/web-core/dist/cm/basic/ColorF.js";
4
+ /**
5
+ * Converts a number of different color formats into Color3 for use with Babylon.js
6
+ * Returns White if object is undefined.
7
+ */
8
+ export function toColor3(object) {
9
+ if (object === undefined) {
10
+ return Color3.White();
11
+ }
12
+ if (typeof object === "number") {
13
+ // Assume object is a 24 bit integer
14
+ return Color3.FromInts((object >>> 16) & 0xff, (object >>> 8) & 0xff, object & 0xff);
15
+ }
16
+ if (typeof object === "string") {
17
+ // Assume object is a hex-string
18
+ return Color3.FromHexString(object);
19
+ }
20
+ if (object instanceof ColorF) {
21
+ // Object is a DEX ColorF (floats, 0-1)
22
+ return new Color3(object.r, object.g, object.b);
23
+ }
24
+ if (object instanceof Color) {
25
+ // Object is a DEX Color (integers 0-255)
26
+ return Color3.FromInts(object.r, object.g, object.b);
27
+ }
28
+ // Must be Color3 already
29
+ return object;
30
+ }
31
+ /**
32
+ * in: r,g,b in [0,1], out: h in [0,360) and s,l in [0,1]
33
+ * Original source: https://stackoverflow.com/a/54071699/1488048
34
+ */
35
+ export function rgb2hsl(r, g, b) {
36
+ const a = Math.max(r, g, b);
37
+ const n = a - Math.min(r, g, b);
38
+ const f = 1 - Math.abs(a + a - n - 1);
39
+ const h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
40
+ return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
41
+ }
42
+ /**
43
+ * input: h in [0,360] and s,v in [0,1] - output: r,g,b in [0,1]
44
+ * Original source: https://stackoverflow.com/a/54014428/1488048
45
+ */
46
+ export function hsl2rgb(h, s, l) {
47
+ const a = s * Math.min(l, 1 - l);
48
+ const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
49
+ return [f(0), f(8), f(4)];
50
+ }
@@ -1,7 +1,7 @@
1
- import { Color } from "@configura/web-core/dist/cm/basic/Color.js";
2
- export declare function aggregateImage<T>(image: HTMLImageElement, aggregator: (imgData: ImageData) => T): T | undefined;
3
- export declare function calculateLightnessFromImage(image: HTMLImageElement): number | undefined;
4
- export declare function allPixelsAreColor(image: HTMLImageElement): false | Color;
5
- export declare function isLikelyBumpMap(image: HTMLImageElement, acceptableDeviationFromGray?: number): boolean;
6
- export declare function isLikelyNormalMap(image: HTMLImageElement): boolean;
1
+ import { Color } from "@configura/web-core/dist/cm/basic/Color.js";
2
+ export declare function aggregateImage<T>(image: HTMLImageElement, aggregator: (imgData: ImageData) => T): T | undefined;
3
+ export declare function calculateLightnessFromImage(image: HTMLImageElement): number | undefined;
4
+ export declare function allPixelsAreColor(image: HTMLImageElement): false | Color;
5
+ export declare function isLikelyBumpMap(image: HTMLImageElement, acceptableDeviationFromGray?: number): boolean;
6
+ export declare function isLikelyNormalMap(image: HTMLImageElement): boolean;
7
7
  //# sourceMappingURL=utilitiesImage.d.ts.map
@@ -1,107 +1,107 @@
1
- import { Color, ColorType } from "@configura/web-core/dist/cm/basic/Color.js";
2
- export function aggregateImage(image, aggregator) {
3
- const canvas = document.createElement("canvas");
4
- canvas.width = image.width;
5
- canvas.height = image.height;
6
- const context = canvas.getContext("2d");
7
- if (context !== null) {
8
- context.drawImage(image, 0, 0);
9
- const imgData = context.getImageData(0, 0, image.width, image.height);
10
- return aggregator(imgData);
11
- }
12
- return;
13
- }
14
- const CC = 4; // All imageData will be 4 channel (RGBA)
15
- export function calculateLightnessFromImage(image) {
16
- return aggregateImage(image, (imgData) => {
17
- let t = 0;
18
- const data = imgData.data;
19
- const size = data.length;
20
- for (let i = 0; i < size; i += CC) {
21
- const r = data[i];
22
- const g = data[i + 1];
23
- const b = data[i + 2];
24
- t += Math.max(r, g, b) + Math.min(r, g, b);
25
- }
26
- const average = (2 * t) / (size * 255);
27
- return average;
28
- });
29
- }
30
- export function allPixelsAreColor(image) {
31
- return (aggregateImage(image, (imgData) => {
32
- const data = imgData.data;
33
- const size = data.length;
34
- if (size === 0) {
35
- return false;
36
- }
37
- for (let i = 0; i < size; i++) {
38
- if (i < CC) {
39
- continue;
40
- }
41
- if (data[i] !== data[i % CC]) {
42
- return false;
43
- }
44
- }
45
- return new Color(ColorType.rgbaColor, data[0], data[1], data[2], data[3]);
46
- }) || false);
47
- }
48
- export function isLikelyBumpMap(image, acceptableDeviationFromGray = 0) {
49
- const isAcceptableDeviation = (c1, c2) => {
50
- const pxAcceptableDeviation = acceptableDeviationFromGray * 255;
51
- return Math.abs(c1 - c2) < pxAcceptableDeviation;
52
- };
53
- return (aggregateImage(image, (imgData) => {
54
- const data = imgData.data;
55
- const size = data.length;
56
- const variationsInChannels = [false, false, false];
57
- for (let i = 0; i < size; i += CC) {
58
- const r = data[i];
59
- const g = data[i + 1];
60
- const b = data[i + 2];
61
- if (isAcceptableDeviation(r, g) &&
62
- isAcceptableDeviation(g, b) &&
63
- isAcceptableDeviation(b, r)) {
64
- continue;
65
- }
66
- if (i === 0) {
67
- continue;
68
- }
69
- let variedChannelsCount = 0;
70
- for (let j = 0; j < CC - 1; j++) {
71
- if (data[i + j] !== data[j]) {
72
- variationsInChannels[j] = true;
73
- }
74
- if (variationsInChannels[j]) {
75
- variedChannelsCount++;
76
- }
77
- }
78
- if (1 < variedChannelsCount) {
79
- return false;
80
- }
81
- }
82
- return true;
83
- }) || false);
84
- }
85
- export function isLikelyNormalMap(image) {
86
- // A normal map represents the local surface inclination (direction, slope) relative
87
- // to the texture. In every pixel the values RGB represent the three base vectors XYZ.
88
- // A complete flat surface will have all normals pointing straight out of the texture,
89
- // in the Z-direction. This is the blue component. Therefore a normal map will normally
90
- // look blueish. We here test that we have a certain amount more of blue than the other
91
- // components to see if the is likely a normal-map.
92
- const blueMoreThanRedAndGreenThreshold = 1.2;
93
- return (aggregateImage(image, (imgData) => {
94
- const data = imgData.data;
95
- const size = data.length;
96
- const channelSum = [0, 0, 0];
97
- for (let i = 0; i < size; i++) {
98
- const comp = i % CC;
99
- if (comp === 3) {
100
- continue;
101
- }
102
- channelSum[comp] += data[i];
103
- }
104
- const [r, g, b] = channelSum;
105
- return (blueMoreThanRedAndGreenThreshold < b / r && blueMoreThanRedAndGreenThreshold < b / g);
106
- }) || false);
107
- }
1
+ import { Color, ColorType } from "@configura/web-core/dist/cm/basic/Color.js";
2
+ export function aggregateImage(image, aggregator) {
3
+ const canvas = document.createElement("canvas");
4
+ canvas.width = image.width;
5
+ canvas.height = image.height;
6
+ const context = canvas.getContext("2d");
7
+ if (context !== null) {
8
+ context.drawImage(image, 0, 0);
9
+ const imgData = context.getImageData(0, 0, image.width, image.height);
10
+ return aggregator(imgData);
11
+ }
12
+ return;
13
+ }
14
+ const CC = 4; // All imageData will be 4 channel (RGBA)
15
+ export function calculateLightnessFromImage(image) {
16
+ return aggregateImage(image, (imgData) => {
17
+ let t = 0;
18
+ const data = imgData.data;
19
+ const size = data.length;
20
+ for (let i = 0; i < size; i += CC) {
21
+ const r = data[i];
22
+ const g = data[i + 1];
23
+ const b = data[i + 2];
24
+ t += Math.max(r, g, b) + Math.min(r, g, b);
25
+ }
26
+ const average = (2 * t) / (size * 255);
27
+ return average;
28
+ });
29
+ }
30
+ export function allPixelsAreColor(image) {
31
+ return (aggregateImage(image, (imgData) => {
32
+ const data = imgData.data;
33
+ const size = data.length;
34
+ if (size === 0) {
35
+ return false;
36
+ }
37
+ for (let i = 0; i < size; i++) {
38
+ if (i < CC) {
39
+ continue;
40
+ }
41
+ if (data[i] !== data[i % CC]) {
42
+ return false;
43
+ }
44
+ }
45
+ return new Color(ColorType.rgbaColor, data[0], data[1], data[2], data[3]);
46
+ }) || false);
47
+ }
48
+ export function isLikelyBumpMap(image, acceptableDeviationFromGray = 0) {
49
+ const isAcceptableDeviation = (c1, c2) => {
50
+ const pxAcceptableDeviation = acceptableDeviationFromGray * 255;
51
+ return Math.abs(c1 - c2) < pxAcceptableDeviation;
52
+ };
53
+ return (aggregateImage(image, (imgData) => {
54
+ const data = imgData.data;
55
+ const size = data.length;
56
+ const variationsInChannels = [false, false, false];
57
+ for (let i = 0; i < size; i += CC) {
58
+ const r = data[i];
59
+ const g = data[i + 1];
60
+ const b = data[i + 2];
61
+ if (isAcceptableDeviation(r, g) &&
62
+ isAcceptableDeviation(g, b) &&
63
+ isAcceptableDeviation(b, r)) {
64
+ continue;
65
+ }
66
+ if (i === 0) {
67
+ continue;
68
+ }
69
+ let variedChannelsCount = 0;
70
+ for (let j = 0; j < CC - 1; j++) {
71
+ if (data[i + j] !== data[j]) {
72
+ variationsInChannels[j] = true;
73
+ }
74
+ if (variationsInChannels[j]) {
75
+ variedChannelsCount++;
76
+ }
77
+ }
78
+ if (1 < variedChannelsCount) {
79
+ return false;
80
+ }
81
+ }
82
+ return true;
83
+ }) || false);
84
+ }
85
+ export function isLikelyNormalMap(image) {
86
+ // A normal map represents the local surface inclination (direction, slope) relative
87
+ // to the texture. In every pixel the values RGB represent the three base vectors XYZ.
88
+ // A complete flat surface will have all normals pointing straight out of the texture,
89
+ // in the Z-direction. This is the blue component. Therefore a normal map will normally
90
+ // look blueish. We here test that we have a certain amount more of blue than the other
91
+ // components to see if the is likely a normal-map.
92
+ const blueMoreThanRedAndGreenThreshold = 1.2;
93
+ return (aggregateImage(image, (imgData) => {
94
+ const data = imgData.data;
95
+ const size = data.length;
96
+ const channelSum = [0, 0, 0];
97
+ for (let i = 0; i < size; i++) {
98
+ const comp = i % CC;
99
+ if (comp === 3) {
100
+ continue;
101
+ }
102
+ channelSum[comp] += data[i];
103
+ }
104
+ const [r, g, b] = channelSum;
105
+ return (blueMoreThanRedAndGreenThreshold < b / r && blueMoreThanRedAndGreenThreshold < b / g);
106
+ }) || false);
107
+ }
@@ -1,8 +1,8 @@
1
- import { DtoTransform as ModelTransform, RootNodeSource } from "@configura/web-api";
2
- import { CfgAnchorRef } from "./anchor/anchor.js";
3
- export declare function makeIdentifier(type: "uri" | "file", v: string): string;
4
- export declare function identifierIsUri(identifier: string): boolean;
5
- export declare function makeIdentifierFromRootNodeSource(source: RootNodeSource): string;
6
- export declare function isSameIdentifierTransformAndAnchor(identifier1: string, transform1: ModelTransform | undefined, anchor1: CfgAnchorRef | undefined, identifier2: string, transform2: ModelTransform | undefined, anchor2: CfgAnchorRef | undefined): boolean;
7
- export declare function isSameRootNodeSource(source1: RootNodeSource, source2: RootNodeSource): boolean;
1
+ import { DtoTransform as ModelTransform, RootNodeSource } from "@configura/web-api";
2
+ import { CfgAnchorRef } from "./anchor/anchor.js";
3
+ export declare function makeIdentifier(type: "uri" | "file", v: string): string;
4
+ export declare function identifierIsUri(identifier: string): boolean;
5
+ export declare function makeIdentifierFromRootNodeSource(source: RootNodeSource): string;
6
+ export declare function isSameIdentifierTransformAndAnchor(identifier1: string, transform1: ModelTransform | undefined, anchor1: CfgAnchorRef | undefined, identifier2: string, transform2: ModelTransform | undefined, anchor2: CfgAnchorRef | undefined): boolean;
7
+ export declare function isSameRootNodeSource(source1: RootNodeSource, source2: RootNodeSource): boolean;
8
8
  //# sourceMappingURL=utilitiesSymRootIdentifier.d.ts.map
@@ -1,26 +1,26 @@
1
- import { isModel } from "@configura/web-api";
2
- import { CfgAnchorRef } from "./anchor/anchor.js";
3
- import { modelTransformsEqual } from "./utilities3D.js";
4
- export function makeIdentifier(type, v) {
5
- return `${type}:${v}`;
6
- }
7
- export function identifierIsUri(identifier) {
8
- return identifier.startsWith("uri:");
9
- }
10
- export function makeIdentifierFromRootNodeSource(source) {
11
- return isModel(source)
12
- ? makeIdentifier("uri", source.uri)
13
- : makeIdentifier("file", source.name);
14
- }
15
- export function isSameIdentifierTransformAndAnchor(identifier1, transform1, anchor1, identifier2, transform2, anchor2) {
16
- return (identifier1 === identifier2 &&
17
- ((transform1 === undefined && transform2 === undefined) ||
18
- (transform1 !== undefined &&
19
- transform2 !== undefined &&
20
- modelTransformsEqual(transform1, transform2))) &&
21
- ((anchor1 === undefined && anchor2 === undefined) ||
22
- (anchor1 !== undefined && anchor2 !== undefined && anchor1.equal(anchor2))));
23
- }
24
- export function isSameRootNodeSource(source1, source2) {
25
- return isSameIdentifierTransformAndAnchor(makeIdentifierFromRootNodeSource(source1), isModel(source1) ? source1.t : undefined, isModel(source1) ? CfgAnchorRef.make(source1.anchor) : undefined, makeIdentifierFromRootNodeSource(source2), isModel(source2) ? source2.t : undefined, isModel(source2) ? CfgAnchorRef.make(source2.anchor) : undefined);
26
- }
1
+ import { isModel } from "@configura/web-api";
2
+ import { CfgAnchorRef } from "./anchor/anchor.js";
3
+ import { modelTransformsEqual } from "./utilities3D.js";
4
+ export function makeIdentifier(type, v) {
5
+ return `${type}:${v}`;
6
+ }
7
+ export function identifierIsUri(identifier) {
8
+ return identifier.startsWith("uri:");
9
+ }
10
+ export function makeIdentifierFromRootNodeSource(source) {
11
+ return isModel(source)
12
+ ? makeIdentifier("uri", source.uri)
13
+ : makeIdentifier("file", source.name);
14
+ }
15
+ export function isSameIdentifierTransformAndAnchor(identifier1, transform1, anchor1, identifier2, transform2, anchor2) {
16
+ return (identifier1 === identifier2 &&
17
+ ((transform1 === undefined && transform2 === undefined) ||
18
+ (transform1 !== undefined &&
19
+ transform2 !== undefined &&
20
+ modelTransformsEqual(transform1, transform2))) &&
21
+ ((anchor1 === undefined && anchor2 === undefined) ||
22
+ (anchor1 !== undefined && anchor2 !== undefined && anchor1.equal(anchor2))));
23
+ }
24
+ export function isSameRootNodeSource(source1, source2) {
25
+ return isSameIdentifierTransformAndAnchor(makeIdentifierFromRootNodeSource(source1), isModel(source1) ? source1.t : undefined, isModel(source1) ? CfgAnchorRef.make(source1.anchor) : undefined, makeIdentifierFromRootNodeSource(source2), isModel(source2) ? source2.t : undefined, isModel(source2) ? CfgAnchorRef.make(source2.anchor) : undefined);
26
+ }
@@ -1,79 +1,79 @@
1
- import { Camera } from "@babylonjs/core/Cameras/camera.js";
2
- import "@babylonjs/core/Debug/debugLayer.js";
3
- import { Engine } from "@babylonjs/core/Engines/engine.js";
4
- import { Matrix, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
5
- import { Scene } from "@babylonjs/core/scene.js";
6
- import { AggregatedLoadingObservable, EventListener, Observable } from "@configura/web-utilities";
7
- import { CameraCreator } from "../camera/CameraCreator.js";
8
- import { GradingApplier } from "../camera/GradingApplier.js";
9
- import { EngineCreator } from "../engine/EngineCreator.js";
10
- import { LightRig, LightRigCreator } from "../light/LightRigCreator.js";
11
- import { DummyMaterialCreator } from "../material/DummyMaterialCreator.js";
12
- import { CfgContentRootNode } from "../nodes/CfgContentRootNode.js";
13
- import { SceneCreator } from "../scene/SceneCreator.js";
14
- import { BaseViewConfiguration, BaseViewEventMap, CameraConfigurationProps, DetailLevel, ImageDumpCallback } from "./BaseViewConfiguration.js";
15
- import { RenderEnv } from "./RenderEnv";
16
- export declare const CET_TO_BABYLON_MATRIX: Matrix;
17
- export declare const BABYLON_TO_CET_MATRIX: Matrix;
18
- /**
19
- * Load the highest quality meshes by default.
20
- *
21
- * @remarks We only use "base" as a last fallback. The reason is that even though this LOD level
22
- * could theoretically include a better version than "super" it is not normally included in CmSym
23
- * files and never used by CET, which makes it unpredictable. See WRD-387 for a case where it
24
- * caused problems when it was the first choice.
25
- */
26
- export declare const DEFAULT_DETAIL_LEVELS: DetailLevel[];
27
- export declare type BaseViewConstructorOptions<C extends Camera> = {
28
- canvas: HTMLCanvasElement;
29
- cameraCreator: CameraCreator<C>;
30
- engineCreator?: EngineCreator;
31
- lightRigCreator?: LightRigCreator;
32
- sceneCreator?: SceneCreator;
33
- gradingApplier?: GradingApplier;
34
- dummyMaterialCreator?: DummyMaterialCreator;
35
- };
36
- export declare abstract class BaseView<C extends Camera, T extends BaseViewEventMap = BaseViewEventMap> {
37
- protected _destroyed: boolean;
38
- protected _viewportSize: [number, number] | undefined;
39
- protected _canvas: HTMLCanvasElement;
40
- protected _scene: Scene;
41
- protected _engine: Engine;
42
- protected _camera: C;
43
- protected _lightRig: LightRig;
44
- protected _inspectorActive: boolean;
45
- private _cameraConfigurationObservable;
46
- private _previousCameraConf;
47
- protected _contentRoot: CfgContentRootNode;
48
- private _needsRenderFrame;
49
- private _dumpNextFrameToImage;
50
- private _enginePauseSemaphore;
51
- protected _errorObservable: Observable<Error>;
52
- protected _loadingObservable: AggregatedLoadingObservable;
53
- private _renderEnvironmentObservable;
54
- protected _renderEnvironment: RenderEnv;
55
- private _dummyMaterialCreator;
56
- constructor(options: BaseViewConstructorOptions<C>);
57
- destroy(): void;
58
- pauseRendering(): void;
59
- resumeRendering(): void;
60
- private _hideInspector;
61
- showInspector(target: HTMLElement | undefined): void;
62
- setConfiguration(configuration: BaseViewConfiguration): void;
63
- get cameraConfiguration(): CameraConfigurationProps;
64
- protected get contentCenter(): Vector3;
65
- private _boundNotifyCameraListeners;
66
- protected notifyCameraListeners(): void;
67
- addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
68
- removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
69
- scheduleRerender(dumpNextFrameToImage?: ImageDumpCallback): void;
70
- protected isContinuousRender(): boolean;
71
- protected getNeededFrameRender(time: number): boolean;
72
- protected browserTick(time: number): void;
73
- protected renderFrame(time: number): void;
74
- resizeViewport(width: number, height: number): void;
75
- protected handleSizing(_force: boolean): void;
76
- protected refreshCameraNearFar(): void;
77
- protected notifyError: (e: unknown) => void;
78
- }
1
+ import { Camera } from "@babylonjs/core/Cameras/camera.js";
2
+ import "@babylonjs/core/Debug/debugLayer.js";
3
+ import { Engine } from "@babylonjs/core/Engines/engine.js";
4
+ import { Matrix, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
5
+ import { Scene } from "@babylonjs/core/scene.js";
6
+ import { AggregatedLoadingObservable, EventListener, Observable } from "@configura/web-utilities";
7
+ import { CameraCreator } from "../camera/CameraCreator.js";
8
+ import { GradingApplier } from "../camera/GradingApplier.js";
9
+ import { EngineCreator } from "../engine/EngineCreator.js";
10
+ import { LightRig, LightRigCreator } from "../light/LightRigCreator.js";
11
+ import { DummyMaterialCreator } from "../material/DummyMaterialCreator.js";
12
+ import { CfgContentRootNode } from "../nodes/CfgContentRootNode.js";
13
+ import { SceneCreator } from "../scene/SceneCreator.js";
14
+ import { BaseViewConfiguration, BaseViewEventMap, CameraConfigurationProps, DetailLevel, ImageDumpCallback } from "./BaseViewConfiguration.js";
15
+ import { RenderEnv } from "./RenderEnv";
16
+ export declare const CET_TO_BABYLON_MATRIX: Matrix;
17
+ export declare const BABYLON_TO_CET_MATRIX: Matrix;
18
+ /**
19
+ * Load the highest quality meshes by default.
20
+ *
21
+ * @remarks We only use "base" as a last fallback. The reason is that even though this LOD level
22
+ * could theoretically include a better version than "super" it is not normally included in CmSym
23
+ * files and never used by CET, which makes it unpredictable. See WRD-387 for a case where it
24
+ * caused problems when it was the first choice.
25
+ */
26
+ export declare const DEFAULT_DETAIL_LEVELS: DetailLevel[];
27
+ export declare type BaseViewConstructorOptions<C extends Camera> = {
28
+ canvas: HTMLCanvasElement;
29
+ cameraCreator: CameraCreator<C>;
30
+ engineCreator?: EngineCreator;
31
+ lightRigCreator?: LightRigCreator;
32
+ sceneCreator?: SceneCreator;
33
+ gradingApplier?: GradingApplier;
34
+ dummyMaterialCreator?: DummyMaterialCreator;
35
+ };
36
+ export declare abstract class BaseView<C extends Camera, T extends BaseViewEventMap = BaseViewEventMap> {
37
+ protected _destroyed: boolean;
38
+ protected _viewportSize: [number, number] | undefined;
39
+ protected _canvas: HTMLCanvasElement;
40
+ protected _scene: Scene;
41
+ protected _engine: Engine;
42
+ protected _camera: C;
43
+ protected _lightRig: LightRig;
44
+ protected _inspectorActive: boolean;
45
+ private _cameraConfigurationObservable;
46
+ private _previousCameraConf;
47
+ protected _contentRoot: CfgContentRootNode;
48
+ private _needsRenderFrame;
49
+ private _dumpNextFrameToImage;
50
+ private _enginePauseSemaphore;
51
+ protected _errorObservable: Observable<Error>;
52
+ protected _loadingObservable: AggregatedLoadingObservable;
53
+ private _renderEnvironmentObservable;
54
+ protected _renderEnvironment: RenderEnv;
55
+ private _dummyMaterialCreator;
56
+ constructor(options: BaseViewConstructorOptions<C>);
57
+ destroy(): void;
58
+ pauseRendering(): void;
59
+ resumeRendering(): void;
60
+ private _hideInspector;
61
+ showInspector(target: HTMLElement | undefined): void;
62
+ setConfiguration(configuration: BaseViewConfiguration): void;
63
+ get cameraConfiguration(): CameraConfigurationProps;
64
+ protected get contentCenter(): Vector3;
65
+ private _boundNotifyCameraListeners;
66
+ protected notifyCameraListeners(): void;
67
+ addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
68
+ removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
69
+ scheduleRerender(dumpNextFrameToImage?: ImageDumpCallback): void;
70
+ protected isContinuousRender(): boolean;
71
+ protected getNeededFrameRender(time: number): boolean;
72
+ protected browserTick(time: number): void;
73
+ protected renderFrame(time: number): void;
74
+ resizeViewport(width: number, height: number): void;
75
+ protected handleSizing(_force: boolean): void;
76
+ protected refreshCameraNearFar(): void;
77
+ protected notifyError: (e: unknown) => void;
78
+ }
79
79
  //# sourceMappingURL=BaseView.d.ts.map