@configura/babylon-view 1.2.1 → 1.3.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 (115) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/animation/AnimatableObject.d.ts +8 -8
  4. package/dist/animation/AnimatableObject.js +3 -3
  5. package/dist/animation/animator/Animator.d.ts +33 -33
  6. package/dist/animation/animator/Animator.js +58 -58
  7. package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
  8. package/dist/animation/animator/AnimatorEasing.js +31 -31
  9. package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
  10. package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
  11. package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
  12. package/dist/animation/animator/AnimatorHighlight.js +32 -32
  13. package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
  14. package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
  15. package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
  16. package/dist/animation/animator/AnimatorQueue.js +57 -57
  17. package/dist/animation/animator/AnimatorScale.d.ts +8 -8
  18. package/dist/animation/animator/AnimatorScale.js +13 -13
  19. package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
  20. package/dist/animation/animator/AnimatorSpin.js +13 -13
  21. package/dist/animation/animator/EasingFunctions.d.ts +35 -35
  22. package/dist/animation/animator/EasingFunctions.js +137 -137
  23. package/dist/animation/coordinator/Coordinator.d.ts +28 -28
  24. package/dist/animation/coordinator/Coordinator.js +47 -47
  25. package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
  26. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +133 -133
  27. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
  28. package/dist/animation/coordinator/CoordinatorIdentity.js +12 -12
  29. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
  30. package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
  31. package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
  32. package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
  33. package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
  34. package/dist/animation/coordinator/CoordinatorPulseBounce.js +40 -40
  35. package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
  36. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +34 -34
  37. package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
  38. package/dist/animation/coordinator/CoordinatorPulseInflate.js +30 -30
  39. package/dist/camera/CameraCreator.d.ts +5 -5
  40. package/dist/camera/CameraCreator.js +4 -4
  41. package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +10 -10
  42. package/dist/camera/CfgArcRotateCameraPointersInput.js +262 -262
  43. package/dist/camera/CfgOrbitalCamera.d.ts +68 -64
  44. package/dist/camera/CfgOrbitalCamera.js +250 -233
  45. package/dist/camera/CfgOrbitalCameraControlProps.d.ts +6 -6
  46. package/dist/camera/CfgOrbitalCameraControlProps.js +3 -3
  47. package/dist/camera/GradingApplier.d.ts +3 -3
  48. package/dist/camera/GradingApplier.js +48 -48
  49. package/dist/engine/EngineCreator.d.ts +3 -3
  50. package/dist/engine/EngineCreator.js +10 -10
  51. package/dist/geometry/CfgGeometry.d.ts +12 -12
  52. package/dist/geometry/CfgGeometry.js +117 -117
  53. package/dist/geometry/CfgMesh.d.ts +7 -7
  54. package/dist/geometry/CfgMesh.js +8 -8
  55. package/dist/geometry/geoSplitter.d.ts +8 -8
  56. package/dist/geometry/geoSplitter.js +192 -192
  57. package/dist/index.d.ts +13 -13
  58. package/dist/index.js +13 -13
  59. package/dist/light/CfgDirectionalLight.d.ts +8 -8
  60. package/dist/light/CfgDirectionalLight.js +18 -18
  61. package/dist/light/CfgHemisphericLight.d.ts +7 -7
  62. package/dist/light/CfgHemisphericLight.js +17 -17
  63. package/dist/light/CfgPointLight.d.ts +8 -8
  64. package/dist/light/CfgPointLight.js +18 -18
  65. package/dist/light/DefaultLightRig.d.ts +19 -19
  66. package/dist/light/DefaultLightRig.js +77 -77
  67. package/dist/light/LightRigCreator.d.ts +9 -9
  68. package/dist/light/LightRigCreator.js +3 -3
  69. package/dist/material/CfgMaterial.d.ts +53 -53
  70. package/dist/material/CfgMaterial.js +454 -454
  71. package/dist/material/DummyMaterialCreator.d.ts +4 -4
  72. package/dist/material/DummyMaterialCreator.js +15 -15
  73. package/dist/material/material.d.ts +18 -18
  74. package/dist/material/material.js +128 -128
  75. package/dist/material/texture.d.ts +14 -14
  76. package/dist/material/texture.js +304 -304
  77. package/dist/nodes/CfgContentRootNode.d.ts +19 -19
  78. package/dist/nodes/CfgContentRootNode.js +75 -75
  79. package/dist/nodes/CfgDeferredMeshNode.d.ts +48 -48
  80. package/dist/nodes/CfgDeferredMeshNode.js +347 -347
  81. package/dist/nodes/CfgProductNode.d.ts +61 -61
  82. package/dist/nodes/CfgProductNode.js +486 -486
  83. package/dist/nodes/CfgSymNode.d.ts +42 -42
  84. package/dist/nodes/CfgSymNode.js +216 -216
  85. package/dist/nodes/CfgSymRootNode.d.ts +33 -33
  86. package/dist/nodes/CfgSymRootNode.js +175 -175
  87. package/dist/nodes/CfgTransformNode.d.ts +29 -29
  88. package/dist/nodes/CfgTransformNode.js +81 -81
  89. package/dist/scene/SceneCreator.d.ts +6 -6
  90. package/dist/scene/SceneCreator.js +22 -22
  91. package/dist/utilities/CfgBoundingBox.d.ts +16 -16
  92. package/dist/utilities/CfgBoundingBox.js +64 -64
  93. package/dist/utilities/utilities3D.d.ts +26 -26
  94. package/dist/utilities/utilities3D.js +187 -187
  95. package/dist/utilities/utilitiesColor.d.ts +18 -18
  96. package/dist/utilities/utilitiesColor.js +48 -48
  97. package/dist/utilities/utilitiesImage.d.ts +6 -6
  98. package/dist/utilities/utilitiesImage.js +107 -107
  99. package/dist/utilities/utilitiesSymRootIdentifier.d.ts +5 -5
  100. package/dist/utilities/utilitiesSymRootIdentifier.js +20 -20
  101. package/dist/view/BaseView.d.ts +70 -70
  102. package/dist/view/BaseView.js +291 -291
  103. package/dist/view/BaseViewConfiguration.d.ts +32 -32
  104. package/dist/view/BaseViewConfiguration.js +8 -8
  105. package/dist/view/RenderEnv.d.ts +38 -38
  106. package/dist/view/RenderEnv.js +7 -7
  107. package/dist/view/SingleProductDefaultCameraView.d.ts +33 -33
  108. package/dist/view/SingleProductDefaultCameraView.js +141 -140
  109. package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +46 -44
  110. package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
  111. package/dist/view/SingleProductView.d.ts +42 -42
  112. package/dist/view/SingleProductView.js +205 -205
  113. package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
  114. package/dist/view/SingleProductViewConfiguration.js +19 -19
  115. package/package.json +5 -5
@@ -1,48 +1,48 @@
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
- let a = Math.max(r, g, b), n = a - Math.min(r, g, b), f = 1 - Math.abs(a + a - n - 1);
37
- let h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
38
- return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
39
- }
40
- /**
41
- * input: h in [0,360] and s,v in [0,1] - output: r,g,b in [0,1]
42
- * Original source: https://stackoverflow.com/a/54014428/1488048
43
- */
44
- export function hsl2rgb(h, s, l) {
45
- let a = s * Math.min(l, 1 - l);
46
- let f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
47
- return [f(0), f(8), f(4)];
48
- }
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
+ let a = Math.max(r, g, b), n = a - Math.min(r, g, b), f = 1 - Math.abs(a + a - n - 1);
37
+ let h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
38
+ return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
39
+ }
40
+ /**
41
+ * input: h in [0,360] and s,v in [0,1] - output: r,g,b in [0,1]
42
+ * Original source: https://stackoverflow.com/a/54014428/1488048
43
+ */
44
+ export function hsl2rgb(h, s, l) {
45
+ let a = s * Math.min(l, 1 - l);
46
+ let f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
47
+ return [f(0), f(8), f(4)];
48
+ }
@@ -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,6 +1,6 @@
1
- import { RootNodeSource, Transform as ModelTransform } from "@configura/web-api";
2
- export declare function makeIdentifier(type: "uri" | "file", v: string): string;
3
- export declare function makeIdentifierFromRootNodeSource(source: RootNodeSource): string;
4
- export declare function isSameIdentifierAndTransform(identifier1: string, transform1: ModelTransform | undefined, identifier2: string, transform2: ModelTransform | undefined): boolean;
5
- export declare function isSameRootNodeSource(source1: RootNodeSource, source2: RootNodeSource): boolean;
1
+ import { RootNodeSource, Transform as ModelTransform } from "@configura/web-api";
2
+ export declare function makeIdentifier(type: "uri" | "file", v: string): string;
3
+ export declare function makeIdentifierFromRootNodeSource(source: RootNodeSource): string;
4
+ export declare function isSameIdentifierAndTransform(identifier1: string, transform1: ModelTransform | undefined, identifier2: string, transform2: ModelTransform | undefined): boolean;
5
+ export declare function isSameRootNodeSource(source1: RootNodeSource, source2: RootNodeSource): boolean;
6
6
  //# sourceMappingURL=utilitiesSymRootIdentifier.d.ts.map
@@ -1,20 +1,20 @@
1
- import { isModel } from "@configura/web-api";
2
- import { modelTransformsEqual } from "./utilities3D.js";
3
- export function makeIdentifier(type, v) {
4
- return `${type}${v}`;
5
- }
6
- export function makeIdentifierFromRootNodeSource(source) {
7
- return isModel(source)
8
- ? makeIdentifier("uri", source.uri)
9
- : makeIdentifier("file", source.name);
10
- }
11
- export function isSameIdentifierAndTransform(identifier1, transform1, identifier2, transform2) {
12
- return (identifier1 === identifier2 &&
13
- ((transform1 === undefined && transform2 === undefined) ||
14
- (transform1 !== undefined &&
15
- transform2 !== undefined &&
16
- modelTransformsEqual(transform1, transform2))));
17
- }
18
- export function isSameRootNodeSource(source1, source2) {
19
- return isSameIdentifierAndTransform(makeIdentifierFromRootNodeSource(source1), isModel(source1) ? source1.t : undefined, makeIdentifierFromRootNodeSource(source2), isModel(source2) ? source2.t : undefined);
20
- }
1
+ import { isModel } from "@configura/web-api";
2
+ import { modelTransformsEqual } from "./utilities3D.js";
3
+ export function makeIdentifier(type, v) {
4
+ return `${type}${v}`;
5
+ }
6
+ export function makeIdentifierFromRootNodeSource(source) {
7
+ return isModel(source)
8
+ ? makeIdentifier("uri", source.uri)
9
+ : makeIdentifier("file", source.name);
10
+ }
11
+ export function isSameIdentifierAndTransform(identifier1, transform1, identifier2, transform2) {
12
+ return (identifier1 === identifier2 &&
13
+ ((transform1 === undefined && transform2 === undefined) ||
14
+ (transform1 !== undefined &&
15
+ transform2 !== undefined &&
16
+ modelTransformsEqual(transform1, transform2))));
17
+ }
18
+ export function isSameRootNodeSource(source1, source2) {
19
+ return isSameIdentifierAndTransform(makeIdentifierFromRootNodeSource(source1), isModel(source1) ? source1.t : undefined, makeIdentifierFromRootNodeSource(source2), isModel(source2) ? source2.t : undefined);
20
+ }
@@ -1,71 +1,71 @@
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.js";
16
- export declare const CET_TO_BABYLON_MATRIX: Matrix;
17
- export declare const BABYLON_TO_CET_MATRIX: Matrix;
18
- export declare const DEFAULT_DETAIL_LEVELS: DetailLevel[];
19
- export declare type BaseViewConstructorOptions<C extends Camera> = {
20
- canvas: HTMLCanvasElement;
21
- cameraCreator: CameraCreator<C>;
22
- engineCreator?: EngineCreator;
23
- lightRigCreator?: LightRigCreator;
24
- sceneCreator?: SceneCreator;
25
- gradingApplier?: GradingApplier;
26
- dummyMaterialCreator?: DummyMaterialCreator;
27
- };
28
- export declare abstract class BaseView<C extends Camera, T extends BaseViewEventMap = BaseViewEventMap> {
29
- protected _destroyed: boolean;
30
- protected _viewportSize: [number, number] | undefined;
31
- protected _canvas: HTMLCanvasElement;
32
- protected _scene: Scene;
33
- protected _engine: Engine;
34
- protected _camera: C;
35
- protected _lightRig: LightRig;
36
- protected _inspectorActive: boolean;
37
- private _cameraConfigurationObservable;
38
- private _previousCameraConf;
39
- protected _contentRoot: CfgContentRootNode;
40
- private _needsRenderFrame;
41
- private _dumpNextFrameToImage;
42
- private _enginePauseSemaphore;
43
- protected _errorObservable: Observable<Error>;
44
- protected _loadingObservable: AggregatedLoadingObservable;
45
- private _renderEnvironmentObservable;
46
- protected _renderEnvironment: RenderEnv;
47
- private _dummyMaterialCreator;
48
- constructor(options: BaseViewConstructorOptions<C>);
49
- destroy(): void;
50
- pauseRendering(): void;
51
- resumeRendering(): void;
52
- private _hideInspector;
53
- showInspector(target: HTMLElement | undefined): void;
54
- setConfiguration(configuration: BaseViewConfiguration): void;
55
- get cameraConfiguration(): CameraConfigurationProps;
56
- protected get contentCenter(): Vector3;
57
- private _boundNotifyCameraListeners;
58
- protected notifyCameraListeners(): void;
59
- addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
60
- removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
61
- scheduleRerender(dumpNextFrameToImage?: ImageDumpCallback): void;
62
- protected isContinuousRender(): boolean;
63
- protected getNeededFrameRender(time: number): boolean;
64
- protected browserTick(time: number): void;
65
- protected renderFrame(time: number): void;
66
- resizeViewport(width: number, height: number): void;
67
- protected handleSizing(_force: boolean): void;
68
- protected refreshCameraNearFar(): void;
69
- protected notifyError: (e: any) => void;
70
- }
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.js";
16
+ export declare const CET_TO_BABYLON_MATRIX: Matrix;
17
+ export declare const BABYLON_TO_CET_MATRIX: Matrix;
18
+ export declare const DEFAULT_DETAIL_LEVELS: DetailLevel[];
19
+ export declare type BaseViewConstructorOptions<C extends Camera> = {
20
+ canvas: HTMLCanvasElement;
21
+ cameraCreator: CameraCreator<C>;
22
+ engineCreator?: EngineCreator;
23
+ lightRigCreator?: LightRigCreator;
24
+ sceneCreator?: SceneCreator;
25
+ gradingApplier?: GradingApplier;
26
+ dummyMaterialCreator?: DummyMaterialCreator;
27
+ };
28
+ export declare abstract class BaseView<C extends Camera, T extends BaseViewEventMap = BaseViewEventMap> {
29
+ protected _destroyed: boolean;
30
+ protected _viewportSize: [number, number] | undefined;
31
+ protected _canvas: HTMLCanvasElement;
32
+ protected _scene: Scene;
33
+ protected _engine: Engine;
34
+ protected _camera: C;
35
+ protected _lightRig: LightRig;
36
+ protected _inspectorActive: boolean;
37
+ private _cameraConfigurationObservable;
38
+ private _previousCameraConf;
39
+ protected _contentRoot: CfgContentRootNode;
40
+ private _needsRenderFrame;
41
+ private _dumpNextFrameToImage;
42
+ private _enginePauseSemaphore;
43
+ protected _errorObservable: Observable<Error>;
44
+ protected _loadingObservable: AggregatedLoadingObservable;
45
+ private _renderEnvironmentObservable;
46
+ protected _renderEnvironment: RenderEnv;
47
+ private _dummyMaterialCreator;
48
+ constructor(options: BaseViewConstructorOptions<C>);
49
+ destroy(): void;
50
+ pauseRendering(): void;
51
+ resumeRendering(): void;
52
+ private _hideInspector;
53
+ showInspector(target: HTMLElement | undefined): void;
54
+ setConfiguration(configuration: BaseViewConfiguration): void;
55
+ get cameraConfiguration(): CameraConfigurationProps;
56
+ protected get contentCenter(): Vector3;
57
+ private _boundNotifyCameraListeners;
58
+ protected notifyCameraListeners(): void;
59
+ addEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
60
+ removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
61
+ scheduleRerender(dumpNextFrameToImage?: ImageDumpCallback): void;
62
+ protected isContinuousRender(): boolean;
63
+ protected getNeededFrameRender(time: number): boolean;
64
+ protected browserTick(time: number): void;
65
+ protected renderFrame(time: number): void;
66
+ resizeViewport(width: number, height: number): void;
67
+ protected handleSizing(_force: boolean): void;
68
+ protected refreshCameraNearFar(): void;
69
+ protected notifyError: (e: any) => void;
70
+ }
71
71
  //# sourceMappingURL=BaseView.d.ts.map