@combeenation/3d-viewer 7.1.3 → 8.1.0-alpha1

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 (111) hide show
  1. package/README.md +111 -111
  2. package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
  3. package/dist/lib-cjs/api/classes/animationInterface.js +2 -2
  4. package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
  5. package/dist/lib-cjs/api/classes/dottedPath.js +166 -166
  6. package/dist/lib-cjs/api/classes/element.d.ts +153 -153
  7. package/dist/lib-cjs/api/classes/element.js +672 -672
  8. package/dist/lib-cjs/api/classes/event.d.ts +401 -401
  9. package/dist/lib-cjs/api/classes/event.js +424 -424
  10. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  11. package/dist/lib-cjs/api/classes/eventBroadcaster.js +49 -49
  12. package/dist/lib-cjs/api/classes/fuzzyMap.d.ts +7 -7
  13. package/dist/lib-cjs/api/classes/fuzzyMap.js +21 -21
  14. package/dist/lib-cjs/api/classes/parameter.d.ts +378 -351
  15. package/dist/lib-cjs/api/classes/parameter.js +551 -524
  16. package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
  17. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  18. package/dist/lib-cjs/api/classes/parameterObservable.js +72 -72
  19. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  20. package/dist/lib-cjs/api/classes/parameterizable.js +102 -102
  21. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +45 -45
  22. package/dist/lib-cjs/api/classes/placementAnimation.js +176 -176
  23. package/dist/lib-cjs/api/classes/variant.d.ts +261 -253
  24. package/dist/lib-cjs/api/classes/variant.js +870 -858
  25. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  26. package/dist/lib-cjs/api/classes/variantInstance.d.ts +53 -53
  27. package/dist/lib-cjs/api/classes/variantInstance.js +125 -125
  28. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  29. package/dist/lib-cjs/api/classes/variantParameterizable.js +86 -86
  30. package/dist/lib-cjs/api/classes/viewer.d.ts +213 -213
  31. package/dist/lib-cjs/api/classes/viewer.js +717 -716
  32. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  33. package/dist/lib-cjs/api/classes/viewerError.d.ts +43 -43
  34. package/dist/lib-cjs/api/classes/viewerError.js +55 -55
  35. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
  36. package/dist/lib-cjs/api/classes/viewerLight.js +348 -348
  37. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  38. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  39. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -13
  40. package/dist/lib-cjs/api/internal/sceneSetup.js +226 -226
  41. package/dist/lib-cjs/api/manager/animationManager.d.ts +30 -30
  42. package/dist/lib-cjs/api/manager/animationManager.js +126 -126
  43. package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +103 -79
  44. package/dist/lib-cjs/api/manager/gltfExportManager.js +325 -242
  45. package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
  46. package/dist/lib-cjs/api/manager/sceneManager.d.ts +33 -33
  47. package/dist/lib-cjs/api/manager/sceneManager.js +128 -128
  48. package/dist/lib-cjs/api/manager/tagManager.d.ts +118 -116
  49. package/dist/lib-cjs/api/manager/tagManager.js +508 -444
  50. package/dist/lib-cjs/api/manager/tagManager.js.map +1 -1
  51. package/dist/lib-cjs/api/manager/textureLoadManager.d.ts +22 -22
  52. package/dist/lib-cjs/api/manager/textureLoadManager.js +97 -97
  53. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +106 -106
  54. package/dist/lib-cjs/api/manager/variantInstanceManager.js +290 -292
  55. package/dist/lib-cjs/api/manager/variantInstanceManager.js.map +1 -1
  56. package/dist/lib-cjs/api/store/specStorage.d.ts +32 -32
  57. package/dist/lib-cjs/api/store/specStorage.js +65 -65
  58. package/dist/lib-cjs/api/util/babylonHelper.d.ts +235 -235
  59. package/dist/lib-cjs/api/util/babylonHelper.js +753 -753
  60. package/dist/lib-cjs/api/util/globalTypes.d.ts +469 -455
  61. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  62. package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -58
  63. package/dist/lib-cjs/api/util/resourceHelper.js +203 -203
  64. package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +44 -44
  65. package/dist/lib-cjs/api/util/sceneLoaderHelper.js +175 -175
  66. package/dist/lib-cjs/api/util/stringHelper.d.ts +13 -13
  67. package/dist/lib-cjs/api/util/stringHelper.js +32 -32
  68. package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
  69. package/dist/lib-cjs/api/util/structureHelper.js +60 -57
  70. package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
  71. package/dist/lib-cjs/buildinfo.json +3 -3
  72. package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
  73. package/dist/lib-cjs/index.d.ts +54 -54
  74. package/dist/lib-cjs/index.js +117 -117
  75. package/package.json +81 -81
  76. package/src/api/classes/animationInterface.ts +10 -10
  77. package/src/api/classes/dottedPath.ts +181 -181
  78. package/src/api/classes/element.ts +733 -733
  79. package/src/api/classes/event.ts +457 -457
  80. package/src/api/classes/eventBroadcaster.ts +52 -52
  81. package/src/api/classes/fuzzyMap.ts +21 -21
  82. package/src/api/classes/parameter.ts +591 -561
  83. package/src/api/classes/parameterObservable.ts +73 -73
  84. package/src/api/classes/parameterizable.ts +87 -87
  85. package/src/api/classes/placementAnimation.ts +162 -162
  86. package/src/api/classes/variant.ts +963 -949
  87. package/src/api/classes/variantInstance.ts +123 -123
  88. package/src/api/classes/variantParameterizable.ts +83 -83
  89. package/src/api/classes/viewer.ts +770 -772
  90. package/src/api/classes/viewerError.ts +63 -63
  91. package/src/api/classes/viewerLight.ts +339 -339
  92. package/src/api/internal/debugViewer.ts +90 -90
  93. package/src/api/internal/lensRendering.ts +9 -9
  94. package/src/api/internal/sceneSetup.ts +205 -205
  95. package/src/api/manager/animationManager.ts +143 -143
  96. package/src/api/manager/gltfExportManager.ts +302 -237
  97. package/src/api/manager/sceneManager.ts +134 -134
  98. package/src/api/manager/tagManager.ts +536 -477
  99. package/src/api/manager/textureLoadManager.ts +95 -95
  100. package/src/api/manager/variantInstanceManager.ts +306 -309
  101. package/src/api/store/specStorage.ts +68 -68
  102. package/src/api/util/babylonHelper.ts +823 -823
  103. package/src/api/util/globalTypes.ts +543 -525
  104. package/src/api/util/resourceHelper.ts +191 -191
  105. package/src/api/util/sceneLoaderHelper.ts +170 -170
  106. package/src/api/util/stringHelper.ts +30 -30
  107. package/src/api/util/structureHelper.ts +60 -58
  108. package/src/buildinfo.json +3 -3
  109. package/src/dev.ts +62 -62
  110. package/src/index.ts +103 -103
  111. package/src/types.d.ts +38 -38
@@ -1,32 +1,32 @@
1
- export declare class SpecStorage {
2
- protected spec: StructureJson;
3
- static instance: SpecStorage | undefined;
4
- /**
5
- * Constructor.
6
- */
7
- protected constructor(spec: StructureJson);
8
- /**
9
- * Creates {@link SpecStorage} from spec.
10
- */
11
- static createFromSpec(structureJson: StructureJson): SpecStorage;
12
- /**
13
- * Gets the {@link SpecStorage} instance.
14
- */
15
- static getInstance(): SpecStorage;
16
- /**
17
- * Gets the spec from the {@link SpecStorage}.
18
- */
19
- static getSpec(): StructureJson;
20
- /**
21
- * Destroys the current instance to allow reinstantiating the SpecStorage.
22
- */
23
- static destroy(): void;
24
- /**
25
- * Gets spec from key.
26
- */
27
- static get<T>(key?: string): T;
28
- /**
29
- * Sets value for spec for given key.
30
- */
31
- static set<T>(key: string, value: T): typeof SpecStorage;
32
- }
1
+ export declare class SpecStorage {
2
+ protected spec: StructureJson;
3
+ static instance: SpecStorage | undefined;
4
+ /**
5
+ * Constructor.
6
+ */
7
+ protected constructor(spec: StructureJson);
8
+ /**
9
+ * Creates {@link SpecStorage} from spec.
10
+ */
11
+ static createFromSpec(structureJson: StructureJson): SpecStorage;
12
+ /**
13
+ * Gets the {@link SpecStorage} instance.
14
+ */
15
+ static getInstance(): SpecStorage;
16
+ /**
17
+ * Gets the spec from the {@link SpecStorage}.
18
+ */
19
+ static getSpec(): StructureJson;
20
+ /**
21
+ * Destroys the current instance to allow reinstantiating the SpecStorage.
22
+ */
23
+ static destroy(): void;
24
+ /**
25
+ * Gets spec from key.
26
+ */
27
+ static get<T>(key?: string): T;
28
+ /**
29
+ * Sets value for spec for given key.
30
+ */
31
+ static set<T>(key: string, value: T): typeof SpecStorage;
32
+ }
@@ -1,66 +1,66 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpecStorage = void 0;
4
- const lodash_es_1 = require("lodash-es");
5
- class SpecStorage {
6
- /**
7
- * Constructor.
8
- */
9
- constructor(spec) {
10
- this.spec = spec;
11
- }
12
- /**
13
- * Creates {@link SpecStorage} from spec.
14
- */
15
- static createFromSpec(structureJson) {
16
- if (this.instance) {
17
- throw new Error(`SpecStorage has already been created.`);
18
- }
19
- return (this.instance = new this(structureJson));
20
- }
21
- /**
22
- * Gets the {@link SpecStorage} instance.
23
- */
24
- static getInstance() {
25
- if (!this.instance || !this.instance.spec) {
26
- throw new Error(`SpecStore has not been properly created.`);
27
- }
28
- return this.instance;
29
- }
30
- /**
31
- * Gets the spec from the {@link SpecStorage}.
32
- */
33
- static getSpec() {
34
- return this.getInstance().spec;
35
- }
36
- /**
37
- * Destroys the current instance to allow reinstantiating the SpecStorage.
38
- */
39
- static destroy() {
40
- this.instance = undefined;
41
- }
42
- /**
43
- * Gets spec from key.
44
- */
45
- static get(key) {
46
- if (!this.instance || !this.instance.spec) {
47
- throw new Error(`SpecStore has not been properly created.`);
48
- }
49
- if (key) {
50
- return (0, lodash_es_1.get)(this.instance.spec, key);
51
- }
52
- return this.instance.spec;
53
- }
54
- /**
55
- * Sets value for spec for given key.
56
- */
57
- static set(key, value) {
58
- if (!this.instance || !this.instance.spec) {
59
- throw new Error(`SpecStore has not been properly created.`);
60
- }
61
- (0, lodash_es_1.set)(this.instance.spec, key, value);
62
- return SpecStorage;
63
- }
64
- }
65
- exports.SpecStorage = SpecStorage;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpecStorage = void 0;
4
+ const lodash_es_1 = require("lodash-es");
5
+ class SpecStorage {
6
+ /**
7
+ * Constructor.
8
+ */
9
+ constructor(spec) {
10
+ this.spec = spec;
11
+ }
12
+ /**
13
+ * Creates {@link SpecStorage} from spec.
14
+ */
15
+ static createFromSpec(structureJson) {
16
+ if (this.instance) {
17
+ throw new Error(`SpecStorage has already been created.`);
18
+ }
19
+ return (this.instance = new this(structureJson));
20
+ }
21
+ /**
22
+ * Gets the {@link SpecStorage} instance.
23
+ */
24
+ static getInstance() {
25
+ if (!this.instance || !this.instance.spec) {
26
+ throw new Error(`SpecStore has not been properly created.`);
27
+ }
28
+ return this.instance;
29
+ }
30
+ /**
31
+ * Gets the spec from the {@link SpecStorage}.
32
+ */
33
+ static getSpec() {
34
+ return this.getInstance().spec;
35
+ }
36
+ /**
37
+ * Destroys the current instance to allow reinstantiating the SpecStorage.
38
+ */
39
+ static destroy() {
40
+ this.instance = undefined;
41
+ }
42
+ /**
43
+ * Gets spec from key.
44
+ */
45
+ static get(key) {
46
+ if (!this.instance || !this.instance.spec) {
47
+ throw new Error(`SpecStore has not been properly created.`);
48
+ }
49
+ if (key) {
50
+ return (0, lodash_es_1.get)(this.instance.spec, key);
51
+ }
52
+ return this.instance.spec;
53
+ }
54
+ /**
55
+ * Sets value for spec for given key.
56
+ */
57
+ static set(key, value) {
58
+ if (!this.instance || !this.instance.spec) {
59
+ throw new Error(`SpecStore has not been properly created.`);
60
+ }
61
+ (0, lodash_es_1.set)(this.instance.spec, key, value);
62
+ return SpecStorage;
63
+ }
64
+ }
65
+ exports.SpecStorage = SpecStorage;
66
66
  //# sourceMappingURL=specStorage.js.map
@@ -1,235 +1,235 @@
1
- import { DottedPath } from '../classes/dottedPath';
2
- import { HighlightLayer } from '@babylonjs/core/Layers/highlightLayer';
3
- import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator';
4
- import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';
5
- import { Material } from '@babylonjs/core/Materials/material';
6
- import { Color3 } from '@babylonjs/core/Maths/math.color';
7
- import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh';
8
- import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
9
- import { Observable } from '@babylonjs/core/Misc/observable';
10
- import { Node } from '@babylonjs/core/node';
11
- import { Scene } from '@babylonjs/core/scene';
12
- declare const backgroundDomeName = "BackgroundDome_ViewerGenerated";
13
- declare const envHelperMetadataName = "viewerEnvHelper";
14
- /**
15
- * @param node
16
- * @return Node
17
- */
18
- declare const getRootNode: (node: Node) => Node;
19
- /**
20
- * @param nodes
21
- * @param predicate
22
- * @return Map<DottedPath, T>
23
- */
24
- declare const mapToDottedNodes: <T>(nodes: Node[], predicate?: ((node: Node) => boolean) | undefined) => Map<DottedPath, T>;
25
- /**
26
- * @param node
27
- * @return DottedPath
28
- */
29
- declare const getDottedPathForNode: (node: Node) => DottedPath;
30
- /**
31
- * @param node
32
- * @param nodeNamingStrategy
33
- * @param predicate
34
- * @param deep
35
- * @return TransformNode | null
36
- */
37
- declare const cloneTransformNode: (node: TransformNode, nodeNamingStrategy: NodeNamingStrategy, predicate?: ((node: TransformNode) => boolean) | undefined, deep?: boolean) => TransformNode | null;
38
- /**
39
- * @param node
40
- */
41
- declare const cloneNodeWithParents: (node: Node | null) => Node | null;
42
- /**
43
- * @param node
44
- * @param deep
45
- * @param prefix
46
- * @return TransformNode
47
- */
48
- declare const cloneTransformNodeMaterial: (node: TransformNode, prefix?: DottedPathArgument, deep?: boolean) => TransformNode;
49
- /**
50
- * @param node
51
- * @param deep
52
- * @param metadata
53
- */
54
- declare const injectNodeMetadata: (node: Node, metadata: {}, deep?: boolean) => void;
55
- /**
56
- * @param node
57
- * @param assertCallable
58
- * @param callableParameters
59
- * @param deep
60
- */
61
- declare const assertTransformNode: (node: TransformNode, assertCallable: (node: TransformNode, ...args: any[]) => void, callableParameters?: any[], deep?: boolean) => void;
62
- /**
63
- * @param node
64
- * @param parameter
65
- */
66
- declare const assertMeshCapability: (node: TransformNode, parameter: string) => void;
67
- /**
68
- * @param node
69
- * @param deep
70
- */
71
- declare const activateTransformNode: (node: TransformNode, deep?: boolean) => void;
72
- /**
73
- * @param node
74
- * @param deep
75
- */
76
- declare const deactivateTransformNode: (node: TransformNode, deep?: boolean) => void;
77
- /**
78
- * @param node
79
- */
80
- declare const enableNodeWithParents: (node: Node) => void;
81
- /**
82
- * @param node
83
- */
84
- declare const disableNodeWithParents: (node: Node) => void;
85
- /**
86
- * Applies a {@link TransformationDefinition} consecutively to ensure dependencies in positioning etc.
87
- * @param node
88
- * @param transformation
89
- */
90
- declare const transformTransformNode: (node: TransformNode, transformation: TransformationDefinition) => void;
91
- /**
92
- * Apply changes of environment (background texture, etc.) consecutively in order to avoid dependency related issues.
93
- * @param scene
94
- * @param envDef
95
- */
96
- declare const changeEnvironment: (scene: Scene, envDef: EnvironmentDefinition) => void;
97
- /**
98
- * Sets a material by a given material id as material property on the given node.
99
- *
100
- * If the material is not already available in the scene, the viewer tries to create a material based on a Combeenation
101
- * [material asset](https://docs.combeenation.com/docs/howto-create-and-use-babylon-and-material-asset).
102
- * This of course only works if the viewer is used inside a Combeenation configurator.
103
- *
104
- * Furthermore this function also defers the material creation if the node is not visible yet to improve network &
105
- * viewer bootstrap performance as textures are automatically being lazy loaded only when they are actually visible in
106
- * the scene.
107
- *
108
- * Finally the material will not be applied before all its textures have been loaded. In this way "flickering" effects
109
- * will be avoided, since the material would be incomplete without its loaded textures.
110
- */
111
- declare const setMaterial: (node: TransformNode, materialId: string, deep?: boolean, variant?: Variant) => void;
112
- /**
113
- * Gets the Material either from the given {@link Variant}, the given scene or tries to create it from an Combeenation
114
- * material asset when inside a Combeenation configurator.
115
- */
116
- declare const getOrCreateMaterial: (scene: Scene, materialId: string, variant?: Variant) => Promise<Material>;
117
- /**
118
- * Waits until the materials textures are loaded and shaders are compiled.
119
- * Then sets the material on the node if there is no newer "set material" request
120
- */
121
- declare const applyMaterial: (material: Material, node: AbstractMesh) => Promise<void>;
122
- /**
123
- * !!! Warning !!!
124
- * This function is not public API. Whilst it can help solving certain problems, it only works reliably in well defined
125
- * situations and can cause unwanted side effects under some conditions. Use carefully at your own risk!
126
- *
127
- * See https://combeenation.myjetbrains.com/youtrack/issue/CB-5906 for further details regarding this warning.
128
- *
129
- * Set material of an instanced meshes source mesh.
130
- * Changes the material of all instanced meshes which have the same source mesh.
131
- *
132
- * @param node
133
- * @param material
134
- * @param deep
135
- *
136
- * @ignore
137
- */
138
- declare const setSourceNodeMaterial: (node: TransformNode, material: Material, deep?: boolean) => void;
139
- /**
140
- * @param node
141
- * @param color
142
- * @param deep
143
- */
144
- declare const setMaterialColor: (node: TransformNode, color: Color3, deep?: boolean) => void;
145
- /**
146
- * @param node
147
- * @param texture
148
- * @param deep
149
- */
150
- declare const setMaterialTexture: (node: TransformNode, texture: Texture, deep?: boolean) => void;
151
- /**
152
- * @param node
153
- * @param metallness
154
- * @param deep
155
- */
156
- declare const setMaterialMetallness: (node: TransformNode, metallness: number, deep?: boolean) => void;
157
- /**
158
- * @param node
159
- * @param roughness
160
- * @param deep
161
- */
162
- declare const setMaterialRoughness: (node: TransformNode, roughness: number, deep?: boolean) => void;
163
- /**
164
- * @param node
165
- * @param layer
166
- * @param color
167
- * @param deep
168
- */
169
- declare const addToHighlightLayer: (layer: HighlightLayer, color: Color3, node: TransformNode, deep?: boolean) => void;
170
- /**
171
- * @param node
172
- * @param layer
173
- * @param deep
174
- */
175
- declare const removeFromHighlightLayer: (layer: HighlightLayer, node: TransformNode, deep?: boolean) => void;
176
- /**
177
- * @param node
178
- * @param receiveShadows
179
- * @param deep
180
- */
181
- declare const setReceiveShadows: (node: TransformNode, receiveShadows: boolean, deep?: boolean) => void;
182
- /**
183
- * @param node
184
- * @param generator
185
- * @param deep
186
- */
187
- declare const addToShadowGenerator: (generator: ShadowGenerator, node: TransformNode, deep?: boolean) => void;
188
- /**
189
- * @param node
190
- * @param generator
191
- * @param deep
192
- */
193
- declare const removeFromShadowGenerator: (generator: ShadowGenerator, node: TransformNode, deep?: boolean) => void;
194
- /**
195
- * https://forum.babylonjs.com/t/get-mesh-bounding-box-position-and-size-in-2d-screen-coordinates/1058/3
196
- * @param mesh
197
- * @param scene
198
- * @param canvas
199
- */
200
- declare const getClientRectFromMesh: (mesh: AbstractMesh, scene: Scene, canvas: HTMLCanvasElement) => ClientRect;
201
- declare type BaseTextureWithOnLoadObservable = BaseTexture & {
202
- onLoadObservable: Observable<BaseTexture>;
203
- };
204
- /**
205
- * This type guard checks whether the given `BaseTextures` is any of its subtypes which comes with an
206
- * `onLoadObservable`.
207
- *
208
- * !!! Timing of when this function is called is important !!!
209
- * See the following for more details: https://forum.babylonjs.com/t/basetexture-whenallready-returns-too-early/34501/6
210
- */
211
- declare const isTextureWithOnLoadObservable: (texture: BaseTexture) => texture is BaseTextureWithOnLoadObservable;
212
- /**
213
- * @param objects
214
- * @param tagMapping
215
- */
216
- declare const mapTags: (objects: object[], tagMapping: TagMapping) => string[];
217
- /**
218
- * Gets an array of ids for nodeIds that exist in both TransformNode arrays.
219
- * @param nodes1
220
- * @param nodes2
221
- * @param predicate
222
- */
223
- declare const intersectingNodeNames: (nodes1: Node[], nodes2: Node[], predicate?: ((node: Node) => boolean) | undefined) => string[];
224
- /**
225
- * Gets an array of ids for duplicate nodeIds in given node array.
226
- * @param nodes
227
- * @param predicate
228
- */
229
- declare const duplicateNodeNames: (nodes: Node[], predicate?: ((node: Node) => boolean) | undefined) => string[];
230
- /**
231
- * Reports duplicate nodeIds.
232
- * @param nodeNames
233
- */
234
- declare const reportDuplicateNodeNames: (nodeNames: string[]) => void;
235
- export { getRootNode, isTextureWithOnLoadObservable, mapToDottedNodes, getDottedPathForNode, cloneTransformNode, cloneNodeWithParents, cloneTransformNodeMaterial, getOrCreateMaterial, applyMaterial, injectNodeMetadata, assertTransformNode, assertMeshCapability, activateTransformNode, deactivateTransformNode, enableNodeWithParents, disableNodeWithParents, transformTransformNode, setMaterial, setSourceNodeMaterial, setMaterialColor, setMaterialTexture, setMaterialMetallness, setMaterialRoughness, addToHighlightLayer, removeFromHighlightLayer, setReceiveShadows, addToShadowGenerator, removeFromShadowGenerator, getClientRectFromMesh, changeEnvironment, backgroundDomeName, envHelperMetadataName, mapTags, intersectingNodeNames, duplicateNodeNames, reportDuplicateNodeNames, };
1
+ import { DottedPath } from '../classes/dottedPath';
2
+ import { HighlightLayer } from '@babylonjs/core/Layers/highlightLayer';
3
+ import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator';
4
+ import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';
5
+ import { Material } from '@babylonjs/core/Materials/material';
6
+ import { Color3 } from '@babylonjs/core/Maths/math.color';
7
+ import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh';
8
+ import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
9
+ import { Observable } from '@babylonjs/core/Misc/observable';
10
+ import { Node } from '@babylonjs/core/node';
11
+ import { Scene } from '@babylonjs/core/scene';
12
+ declare const backgroundDomeName = "BackgroundDome_ViewerGenerated";
13
+ declare const envHelperMetadataName = "viewerEnvHelper";
14
+ /**
15
+ * @param node
16
+ * @return Node
17
+ */
18
+ declare const getRootNode: (node: Node) => Node;
19
+ /**
20
+ * @param nodes
21
+ * @param predicate
22
+ * @return Map<DottedPath, T>
23
+ */
24
+ declare const mapToDottedNodes: <T>(nodes: Node[], predicate?: ((node: Node) => boolean) | undefined) => Map<DottedPath, T>;
25
+ /**
26
+ * @param node
27
+ * @return DottedPath
28
+ */
29
+ declare const getDottedPathForNode: (node: Node) => DottedPath;
30
+ /**
31
+ * @param node
32
+ * @param nodeNamingStrategy
33
+ * @param predicate
34
+ * @param deep
35
+ * @return TransformNode | null
36
+ */
37
+ declare const cloneTransformNode: (node: TransformNode, nodeNamingStrategy: NodeNamingStrategy, predicate?: ((node: TransformNode) => boolean) | undefined, deep?: boolean) => TransformNode | null;
38
+ /**
39
+ * @param node
40
+ */
41
+ declare const cloneNodeWithParents: (node: Node | null) => Node | null;
42
+ /**
43
+ * @param node
44
+ * @param deep
45
+ * @param prefix
46
+ * @return TransformNode
47
+ */
48
+ declare const cloneTransformNodeMaterial: (node: TransformNode, prefix?: DottedPathArgument, deep?: boolean) => TransformNode;
49
+ /**
50
+ * @param node
51
+ * @param deep
52
+ * @param metadata
53
+ */
54
+ declare const injectNodeMetadata: (node: Node, metadata: {}, deep?: boolean) => void;
55
+ /**
56
+ * @param node
57
+ * @param assertCallable
58
+ * @param callableParameters
59
+ * @param deep
60
+ */
61
+ declare const assertTransformNode: (node: TransformNode, assertCallable: (node: TransformNode, ...args: any[]) => void, callableParameters?: any[], deep?: boolean) => void;
62
+ /**
63
+ * @param node
64
+ * @param parameter
65
+ */
66
+ declare const assertMeshCapability: (node: TransformNode, parameter: string) => void;
67
+ /**
68
+ * @param node
69
+ * @param deep
70
+ */
71
+ declare const activateTransformNode: (node: TransformNode, deep?: boolean) => void;
72
+ /**
73
+ * @param node
74
+ * @param deep
75
+ */
76
+ declare const deactivateTransformNode: (node: TransformNode, deep?: boolean) => void;
77
+ /**
78
+ * @param node
79
+ */
80
+ declare const enableNodeWithParents: (node: Node) => void;
81
+ /**
82
+ * @param node
83
+ */
84
+ declare const disableNodeWithParents: (node: Node) => void;
85
+ /**
86
+ * Applies a {@link TransformationDefinition} consecutively to ensure dependencies in positioning etc.
87
+ * @param node
88
+ * @param transformation
89
+ */
90
+ declare const transformTransformNode: (node: TransformNode, transformation: TransformationDefinition) => void;
91
+ /**
92
+ * Apply changes of environment (background texture, etc.) consecutively in order to avoid dependency related issues.
93
+ * @param scene
94
+ * @param envDef
95
+ */
96
+ declare const changeEnvironment: (scene: Scene, envDef: EnvironmentDefinition) => void;
97
+ /**
98
+ * Sets a material by a given material id as material property on the given node.
99
+ *
100
+ * If the material is not already available in the scene, the viewer tries to create a material based on a Combeenation
101
+ * [material asset](https://docs.combeenation.com/docs/howto-create-and-use-babylon-and-material-asset).
102
+ * This of course only works if the viewer is used inside a Combeenation configurator.
103
+ *
104
+ * Furthermore this function also defers the material creation if the node is not visible yet to improve network &
105
+ * viewer bootstrap performance as textures are automatically being lazy loaded only when they are actually visible in
106
+ * the scene.
107
+ *
108
+ * Finally the material will not be applied before all its textures have been loaded. In this way "flickering" effects
109
+ * will be avoided, since the material would be incomplete without its loaded textures.
110
+ */
111
+ declare const setMaterial: (node: TransformNode, materialId: string, deep?: boolean, variant?: Variant) => void;
112
+ /**
113
+ * Gets the Material either from the given {@link Variant}, the given scene or tries to create it from an Combeenation
114
+ * material asset when inside a Combeenation configurator.
115
+ */
116
+ declare const getOrCreateMaterial: (scene: Scene, materialId: string, variant?: Variant) => Promise<Material>;
117
+ /**
118
+ * Waits until the materials textures are loaded and shaders are compiled.
119
+ * Then sets the material on the node if there is no newer "set material" request
120
+ */
121
+ declare const applyMaterial: (material: Material, node: AbstractMesh) => Promise<void>;
122
+ /**
123
+ * !!! Warning !!!
124
+ * This function is not public API. Whilst it can help solving certain problems, it only works reliably in well defined
125
+ * situations and can cause unwanted side effects under some conditions. Use carefully at your own risk!
126
+ *
127
+ * See https://combeenation.myjetbrains.com/youtrack/issue/CB-5906 for further details regarding this warning.
128
+ *
129
+ * Set material of an instanced meshes source mesh.
130
+ * Changes the material of all instanced meshes which have the same source mesh.
131
+ *
132
+ * @param node
133
+ * @param material
134
+ * @param deep
135
+ *
136
+ * @ignore
137
+ */
138
+ declare const setSourceNodeMaterial: (node: TransformNode, material: Material, deep?: boolean) => void;
139
+ /**
140
+ * @param node
141
+ * @param color
142
+ * @param deep
143
+ */
144
+ declare const setMaterialColor: (node: TransformNode, color: Color3, deep?: boolean) => void;
145
+ /**
146
+ * @param node
147
+ * @param texture
148
+ * @param deep
149
+ */
150
+ declare const setMaterialTexture: (node: TransformNode, texture: Texture, deep?: boolean) => void;
151
+ /**
152
+ * @param node
153
+ * @param metallness
154
+ * @param deep
155
+ */
156
+ declare const setMaterialMetallness: (node: TransformNode, metallness: number, deep?: boolean) => void;
157
+ /**
158
+ * @param node
159
+ * @param roughness
160
+ * @param deep
161
+ */
162
+ declare const setMaterialRoughness: (node: TransformNode, roughness: number, deep?: boolean) => void;
163
+ /**
164
+ * @param node
165
+ * @param layer
166
+ * @param color
167
+ * @param deep
168
+ */
169
+ declare const addToHighlightLayer: (layer: HighlightLayer, color: Color3, node: TransformNode, deep?: boolean) => void;
170
+ /**
171
+ * @param node
172
+ * @param layer
173
+ * @param deep
174
+ */
175
+ declare const removeFromHighlightLayer: (layer: HighlightLayer, node: TransformNode, deep?: boolean) => void;
176
+ /**
177
+ * @param node
178
+ * @param receiveShadows
179
+ * @param deep
180
+ */
181
+ declare const setReceiveShadows: (node: TransformNode, receiveShadows: boolean, deep?: boolean) => void;
182
+ /**
183
+ * @param node
184
+ * @param generator
185
+ * @param deep
186
+ */
187
+ declare const addToShadowGenerator: (generator: ShadowGenerator, node: TransformNode, deep?: boolean) => void;
188
+ /**
189
+ * @param node
190
+ * @param generator
191
+ * @param deep
192
+ */
193
+ declare const removeFromShadowGenerator: (generator: ShadowGenerator, node: TransformNode, deep?: boolean) => void;
194
+ /**
195
+ * https://forum.babylonjs.com/t/get-mesh-bounding-box-position-and-size-in-2d-screen-coordinates/1058/3
196
+ * @param mesh
197
+ * @param scene
198
+ * @param canvas
199
+ */
200
+ declare const getClientRectFromMesh: (mesh: AbstractMesh, scene: Scene, canvas: HTMLCanvasElement) => ClientRect;
201
+ declare type BaseTextureWithOnLoadObservable = BaseTexture & {
202
+ onLoadObservable: Observable<BaseTexture>;
203
+ };
204
+ /**
205
+ * This type guard checks whether the given `BaseTextures` is any of its subtypes which comes with an
206
+ * `onLoadObservable`.
207
+ *
208
+ * !!! Timing of when this function is called is important !!!
209
+ * See the following for more details: https://forum.babylonjs.com/t/basetexture-whenallready-returns-too-early/34501/6
210
+ */
211
+ declare const isTextureWithOnLoadObservable: (texture: BaseTexture) => texture is BaseTextureWithOnLoadObservable;
212
+ /**
213
+ * @param objects
214
+ * @param tagMapping
215
+ */
216
+ declare const mapTags: (objects: object[], tagMapping: TagMapping) => string[];
217
+ /**
218
+ * Gets an array of ids for nodeIds that exist in both TransformNode arrays.
219
+ * @param nodes1
220
+ * @param nodes2
221
+ * @param predicate
222
+ */
223
+ declare const intersectingNodeNames: (nodes1: Node[], nodes2: Node[], predicate?: ((node: Node) => boolean) | undefined) => string[];
224
+ /**
225
+ * Gets an array of ids for duplicate nodeIds in given node array.
226
+ * @param nodes
227
+ * @param predicate
228
+ */
229
+ declare const duplicateNodeNames: (nodes: Node[], predicate?: ((node: Node) => boolean) | undefined) => string[];
230
+ /**
231
+ * Reports duplicate nodeIds.
232
+ * @param nodeNames
233
+ */
234
+ declare const reportDuplicateNodeNames: (nodeNames: string[]) => void;
235
+ export { getRootNode, isTextureWithOnLoadObservable, mapToDottedNodes, getDottedPathForNode, cloneTransformNode, cloneNodeWithParents, cloneTransformNodeMaterial, getOrCreateMaterial, applyMaterial, injectNodeMetadata, assertTransformNode, assertMeshCapability, activateTransformNode, deactivateTransformNode, enableNodeWithParents, disableNodeWithParents, transformTransformNode, setMaterial, setSourceNodeMaterial, setMaterialColor, setMaterialTexture, setMaterialMetallness, setMaterialRoughness, addToHighlightLayer, removeFromHighlightLayer, setReceiveShadows, addToShadowGenerator, removeFromShadowGenerator, getClientRectFromMesh, changeEnvironment, backgroundDomeName, envHelperMetadataName, mapTags, intersectingNodeNames, duplicateNodeNames, reportDuplicateNodeNames, };