@combeenation/3d-viewer 3.0.0-rc2 → 4.0.0-alpha6

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 (212) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +111 -111
  3. package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
  4. package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
  5. package/dist/lib-cjs/api/classes/animationInterface.js.map +0 -0
  6. package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
  7. package/dist/lib-cjs/api/classes/dottedPath.js +190 -190
  8. package/dist/lib-cjs/api/classes/dottedPath.js.map +0 -0
  9. package/dist/lib-cjs/api/classes/element.d.ts +130 -125
  10. package/dist/lib-cjs/api/classes/element.js +752 -638
  11. package/dist/lib-cjs/api/classes/element.js.map +1 -1
  12. package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -14
  13. package/dist/lib-cjs/api/classes/elementParameterizable.js +134 -134
  14. package/dist/lib-cjs/api/classes/elementParameterizable.js.map +0 -0
  15. package/dist/lib-cjs/api/classes/event.d.ts +326 -312
  16. package/dist/lib-cjs/api/classes/event.js +371 -357
  17. package/dist/lib-cjs/api/classes/event.js.map +1 -1
  18. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  19. package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
  20. package/dist/lib-cjs/api/classes/eventBroadcaster.js.map +0 -0
  21. package/dist/lib-cjs/api/classes/parameter.d.ts +259 -161
  22. package/dist/lib-cjs/api/classes/parameter.js +387 -261
  23. package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
  24. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  25. package/dist/lib-cjs/api/classes/parameterObservable.js +101 -126
  26. package/dist/lib-cjs/api/classes/parameterObservable.js.map +1 -1
  27. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -0
  28. package/dist/lib-cjs/api/classes/parameterizable.js +150 -0
  29. package/dist/lib-cjs/api/classes/parameterizable.js.map +1 -0
  30. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +38 -38
  31. package/dist/lib-cjs/api/classes/placementAnimation.js +138 -138
  32. package/dist/lib-cjs/api/classes/placementAnimation.js.map +0 -0
  33. package/dist/lib-cjs/api/classes/variant.d.ts +224 -176
  34. package/dist/lib-cjs/api/classes/variant.js +1126 -770
  35. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  36. package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -41
  37. package/dist/lib-cjs/api/classes/variantInstance.js +108 -98
  38. package/dist/lib-cjs/api/classes/variantInstance.js.map +1 -1
  39. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -0
  40. package/dist/lib-cjs/api/classes/variantParameterizable.js +93 -0
  41. package/dist/lib-cjs/api/classes/variantParameterizable.js.map +1 -0
  42. package/dist/lib-cjs/api/classes/viewer.d.ts +127 -128
  43. package/dist/lib-cjs/api/classes/viewer.js +486 -486
  44. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  45. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -0
  46. package/dist/lib-cjs/api/classes/viewerLight.js +350 -0
  47. package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -0
  48. package/dist/lib-cjs/api/emitter.d.ts +35 -0
  49. package/dist/lib-cjs/api/emitter.js +61 -0
  50. package/dist/lib-cjs/api/emitter.js.map +1 -0
  51. package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
  52. package/dist/lib-cjs/api/internal/debugViewer.js +87 -87
  53. package/dist/lib-cjs/api/internal/debugViewer.js.map +0 -0
  54. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  55. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  56. package/dist/lib-cjs/api/internal/lensRendering.js.map +0 -0
  57. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +10 -6
  58. package/dist/lib-cjs/api/internal/sceneSetup.js +231 -227
  59. package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
  60. package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
  61. package/dist/lib-cjs/api/manager/animationManager.js +121 -121
  62. package/dist/lib-cjs/api/manager/animationManager.js.map +0 -0
  63. package/dist/lib-cjs/api/manager/sceneManager.d.ts +32 -32
  64. package/dist/lib-cjs/api/manager/sceneManager.js +132 -132
  65. package/dist/lib-cjs/api/manager/sceneManager.js.map +0 -0
  66. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +90 -90
  67. package/dist/lib-cjs/api/manager/variantInstanceManager.js +321 -321
  68. package/dist/lib-cjs/api/manager/variantInstanceManager.js.map +0 -0
  69. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  70. package/dist/lib-cjs/api/store/specStorage.js +51 -51
  71. package/dist/lib-cjs/api/store/specStorage.js.map +0 -0
  72. package/dist/lib-cjs/api/util/babylonHelper.d.ts +160 -125
  73. package/dist/lib-cjs/api/util/babylonHelper.js +465 -368
  74. package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
  75. package/dist/lib-cjs/api/util/globalTypes.d.ts +321 -275
  76. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  77. package/dist/lib-cjs/api/util/globalTypes.js.map +0 -0
  78. package/dist/lib-cjs/api/util/resourceHelper.d.ts +26 -30
  79. package/dist/lib-cjs/api/util/resourceHelper.js +237 -247
  80. package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
  81. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -0
  82. package/dist/lib-cjs/api/util/stringHelper.js +26 -0
  83. package/dist/lib-cjs/api/util/stringHelper.js.map +1 -0
  84. package/dist/lib-cjs/buildinfo.json +3 -3
  85. package/dist/lib-cjs/index.d.ts +48 -46
  86. package/dist/lib-cjs/index.js +86 -82
  87. package/dist/lib-cjs/index.js.map +1 -1
  88. package/package.json +83 -83
  89. package/src/api/classes/animationInterface.ts +11 -11
  90. package/src/api/classes/dottedPath.ts +189 -189
  91. package/src/api/classes/element.ts +648 -606
  92. package/src/api/classes/event.ts +370 -355
  93. package/src/api/classes/eventBroadcaster.ts +54 -54
  94. package/src/api/classes/parameter.ts +408 -270
  95. package/src/api/classes/parameterObservable.ts +99 -121
  96. package/src/api/classes/{elementParameterizable.ts → parameterizable.ts} +89 -78
  97. package/src/api/classes/placementAnimation.ts +133 -133
  98. package/src/api/classes/variant.ts +799 -652
  99. package/src/api/classes/variantInstance.ts +88 -81
  100. package/src/api/classes/variantParameterizable.ts +73 -0
  101. package/src/api/classes/viewer.ts +420 -421
  102. package/src/api/classes/viewerLight.ts +295 -0
  103. package/src/api/internal/debugViewer.ts +81 -81
  104. package/src/api/internal/lensRendering.ts +10 -10
  105. package/src/api/internal/sceneSetup.ts +194 -204
  106. package/src/api/manager/animationManager.ts +116 -116
  107. package/src/api/manager/sceneManager.ts +105 -105
  108. package/src/api/manager/variantInstanceManager.ts +236 -236
  109. package/src/api/store/specStorage.ts +53 -53
  110. package/src/api/util/babylonHelper.ts +497 -392
  111. package/src/api/util/globalTypes.ts +369 -314
  112. package/src/api/util/resourceHelper.ts +157 -168
  113. package/src/api/util/stringHelper.ts +26 -0
  114. package/src/buildinfo.json +2 -2
  115. package/src/commonjs.tsconfig.json +13 -13
  116. package/src/declaration.tsconfig.json +10 -10
  117. package/src/dev.ts +45 -60
  118. package/src/es6.tsconfig.json +13 -13
  119. package/src/index.ts +91 -87
  120. package/src/pagesconfig.json +51 -47
  121. package/src/tsconfig.json +43 -43
  122. package/src/tsconfig.types.json +9 -9
  123. package/src/types.d.ts +4 -4
  124. package/src/assets/02_environment.env +0 -0
  125. package/src/assets/02_test_hdri_flipped.hdr +0 -0
  126. package/src/assets/07rDvxP2xTk.glb +0 -0
  127. package/src/assets/08L8DrdZt8y.glb +0 -0
  128. package/src/assets/CB-6250/main.js +0 -427
  129. package/src/assets/CB-6250/models/.gitkeep +0 -1
  130. package/src/assets/CB-6250/models/candle.glb +0 -0
  131. package/src/assets/CB-6250/models/lamp.glb +0 -0
  132. package/src/assets/CB-6250/models/molto-bido.glb +0 -0
  133. package/src/assets/CB-6250/models/mtron.glb +0 -0
  134. package/src/assets/CB-6250/models/mtron_split_geometry.glb +0 -0
  135. package/src/assets/CB-6250/models/mtron_split_material.glb +0 -0
  136. package/src/assets/KTM1290SA/AvatarAdv.glb +0 -0
  137. package/src/assets/KTM1290SA/ktm1290SA.ts +0 -77
  138. package/src/assets/KTM1290SA/scene.json +0 -16
  139. package/src/assets/_draft/main.js +0 -117
  140. package/src/assets/_draft/models/.gitkeep +0 -1
  141. package/src/assets/_draft/models/_demo.glb +0 -0
  142. package/src/assets/_draft/studio.env +0 -0
  143. package/src/assets/bike/CompleteBike_Optim_986K_01.glb +0 -0
  144. package/src/assets/bike/complete.json +0 -19
  145. package/src/assets/bike/index.json +0 -9
  146. package/src/assets/bike/setup.json +0 -11
  147. package/src/assets/ctrls-helper.ts +0 -89
  148. package/src/assets/cube/10 environment.env +0 -0
  149. package/src/assets/cube/bin_svg_logo_test.glb +0 -0
  150. package/src/assets/cube/cube.ts +0 -42
  151. package/src/assets/cube/cube_v2.glb +0 -0
  152. package/src/assets/cube/scene.ts +0 -83
  153. package/src/assets/cube/testCylinderUVs.glb +0 -0
  154. package/src/assets/environment.env +0 -0
  155. package/src/assets/hoferkerzen/hoferkerzen.glb +0 -0
  156. package/src/assets/hoferkerzen/index.json +0 -9
  157. package/src/assets/hoferkerzen/setup.json +0 -11
  158. package/src/assets/hoferkerzen/variant_kgl.json +0 -41
  159. package/src/assets/husqvarna-instanced-meshes/husqvarna.env +0 -0
  160. package/src/assets/husqvarna-instanced-meshes/husqvarna.glb +0 -0
  161. package/src/assets/husqvarna-instanced-meshes/main.ts +0 -108
  162. package/src/assets/index.html +0 -144
  163. package/src/assets/index.json +0 -9
  164. package/src/assets/linkeddups/example_2_instances.glb +0 -0
  165. package/src/assets/linkeddups/spec.ts +0 -32
  166. package/src/assets/molto-mova-multi-instance-shown-bug/main.ts +0 -106
  167. package/src/assets/molto-mova-multi-instance-shown-bug/molto-mova-rc82.glb +0 -0
  168. package/src/assets/molto-mova-multi-instance-shown-bug/molto-mova-volare.glb +0 -0
  169. package/src/assets/molto-mova-multi-instance-shown-bug/studio.env +0 -0
  170. package/src/assets/moltomova/10 environment.env +0 -0
  171. package/src/assets/moltomova/RC65.glb +0 -0
  172. package/src/assets/moltomova/RC82.glb +0 -0
  173. package/src/assets/moltomova/TPH67.glb +0 -0
  174. package/src/assets/moltomova/TPH82.glb +0 -0
  175. package/src/assets/moltomova/Volare.glb +0 -0
  176. package/src/assets/moltomova/moltomova-cl3d-spec-rc65.ts +0 -159
  177. package/src/assets/moltomova/moltomova-cl3d-spec-rc82.ts +0 -118
  178. package/src/assets/moltomova/moltomova-cl3d-spec-scene.ts +0 -57
  179. package/src/assets/moltomova/moltomova-cl3d-spec-tph67.ts +0 -199
  180. package/src/assets/moltomova/moltomova-cl3d-spec-tph82.ts +0 -173
  181. package/src/assets/moltomova/moltomova-cl3d-spec-volare65.ts +0 -173
  182. package/src/assets/moltomova/moltomova.ts +0 -175
  183. package/src/assets/mova.json +0 -18
  184. package/src/assets/mova_3_phase_rail.glb +0 -0
  185. package/src/assets/mova_3_phase_rail.json +0 -86
  186. package/src/assets/mova_recessed_luminaire.glb +0 -0
  187. package/src/assets/mova_recessed_luminaire.json +0 -81
  188. package/src/assets/nessie/gltf-test-no-material.gltf +0 -142
  189. package/src/assets/nessie/gltf-test-no-material_data.bin +0 -0
  190. package/src/assets/nessie/gltf-test-rotation.gltf +0 -142
  191. package/src/assets/nessie/gltf-test-rotation_data.bin +0 -0
  192. package/src/assets/nessie/gltf-test.gltf +0 -178
  193. package/src/assets/nessie/gltf-test_data.bin +0 -0
  194. package/src/assets/nessie/index.json +0 -9
  195. package/src/assets/nessie/nessie_basic.json +0 -24
  196. package/src/assets/nessie/setup.json +0 -12
  197. package/src/assets/scene.json +0 -64
  198. package/src/assets/setup.json +0 -25
  199. package/src/assets/small_cave_1k.hdr +0 -0
  200. package/src/assets/svgTo3D/09aJssVZrjk.env +0 -0
  201. package/src/assets/svgTo3D/09f0zfBQBWK.glb +0 -0
  202. package/src/assets/svgTo3D/9bae062709f8a7803769ba955cde3c4a.jpg +0 -0
  203. package/src/assets/svgTo3D/logo-cyledge.svg +0 -19
  204. package/src/assets/svgTo3D/spec.ts +0 -56
  205. package/src/assets/svgTo3D/svg_assets/09fmVjc59hQ.png +0 -0
  206. package/src/assets/svgTo3D/svg_assets/LDI2apCSOBg7S-QT7pb0EPOreec.woff2 +0 -0
  207. package/src/assets/svgTo3D/svg_assets/unineue_regular.woff2 +0 -0
  208. package/src/assets/svgTo3D/testCube.glb +0 -0
  209. package/src/assets/svgTo3D/testCube001.glb +0 -0
  210. package/src/assets/svgTo3D/testCubeSpec.ts +0 -49
  211. package/src/assets/textures/grass.png +0 -0
  212. package/src/assets/textures/seamless-grunge-scratched-texture.jpg +0 -0
@@ -1,176 +1,224 @@
1
- import { AssetContainer } from '@babylonjs/core/assetContainer';
2
- import '@babylonjs/core/Loading/Plugins/babylonFileLoader';
3
- import { Material } from '@babylonjs/core/Materials/material';
4
- import { Mesh } from '@babylonjs/core/Meshes/mesh';
5
- import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
6
- import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression';
7
- import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform';
8
- import '@babylonjs/loaders/glTF/2.0/glTFLoader';
9
- import { DottedPath } from './dottedPath';
10
- import { Element } from './element';
11
- import { ElementParameterizable } from './elementParameterizable';
12
- import { Viewer } from './viewer';
13
- /**
14
- * A concrete "Variant". Most of these are handled by either the {@link Viewer} or {@link VariantInstance}.
15
- */
16
- export declare class Variant extends ElementParameterizable {
17
- readonly name: string;
18
- protected readonly _structureJson: StructureJson;
19
- readonly viewer: Viewer;
20
- readonly parent?: Variant | undefined;
21
- assetContainer: AssetContainer;
22
- readonly elements: Element[];
23
- structureJson: StructureJson;
24
- protected _dottedNodes: Map<DottedPath, TransformNode> | undefined;
25
- protected readonly _children: Map<string, Variant>;
26
- protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
27
- /**
28
- * @internal
29
- */
30
- private parametersInitialized;
31
- /**
32
- * Constructor.
33
- */
34
- protected constructor(name: string, _structureJson: StructureJson, viewer: Viewer, parent?: Variant | undefined);
35
- /**
36
- * Creates a {@link Variant} based on given parameters.
37
- *
38
- * @throws Error if "gltf" property is provided without a filename
39
- */
40
- static create(name: string, structureJson: StructureJson, viewer: Viewer, parent?: Variant): Promise<Variant>;
41
- /**
42
- * The ancestor {@link Variant}s ordered from top to bottom in the built tree.
43
- */
44
- get ancestors(): Variant[];
45
- /**
46
- * The root {@link Variant}.
47
- */
48
- get root(): Variant;
49
- /**
50
- * The {@link DottedPath} in the built tree of {@link Variant}s.
51
- * E.g. "_.top-1.sub-2.sub-sub-3"
52
- */
53
- get dottedPath(): DottedPath;
54
- /**
55
- * The id representing a {@link DottedPath}.
56
- */
57
- get id(): string;
58
- /**
59
- * The defined glTF Asset.
60
- */
61
- get glTF(): Asset | undefined;
62
- /**
63
- * The defined glTF URI.
64
- */
65
- get glTFUri(): string | undefined;
66
- /**
67
- * The inherited defined glTF URI.
68
- */
69
- get inheritedGlTFUri(): string | undefined;
70
- /**
71
- * The TransformNodes of the {@link Variant}.
72
- */
73
- get nodes(): TransformNode[];
74
- /**
75
- * All TransformNodes of the {@link Variant} mapped flat with a {@link DottedPath}.
76
- */
77
- get dottedNodes(): Map<DottedPath, TransformNode>;
78
- /**
79
- * The Materials of the {@link Variant}.
80
- */
81
- get materials(): Material[];
82
- /**
83
- * All {@link Element}s from this {@link Variant}'s parents.
84
- */
85
- get inheritedElements(): Element[];
86
- /**
87
- * All TransformNodes inherited from this {@link Variant}'s parents.
88
- */
89
- get inheritedNodes(): TransformNode[];
90
- /**
91
- * All TransformNodes inherited from this {@link Variant}'s parents mapped flat with a {@link DottedPath}.
92
- */
93
- get inheritedDottedNodes(): Map<DottedPath, TransformNode>;
94
- /**
95
- * The {@link ParameterDeclarations} inherited from this {@link Variant}'s parents.
96
- */
97
- get inheritedParameterDeclaration(): ParameterDeclarations;
98
- /**
99
- * The {@link ParameterBag} inherited from this {@link Variant}'s parents.
100
- */
101
- get inheritedParameters(): ParameterBag;
102
- /**
103
- * All Materials from this {@link Variant}'s parents.
104
- */
105
- get inheritedMaterials(): Material[];
106
- /**
107
- * Gets the direct children of the current {@link Variant}.
108
- */
109
- getChildren(): Promise<Variant[]>;
110
- /**
111
- * Gets a descendant {@link Variant} of the current {@link Variant} relative to its {@link DottedPath}.
112
- * If you have the dotted path `_.product_x.variant_blue.with_yellow_highlight` in a tree and you operate on the
113
- * `product_x`, you can call `this.getDescendant('variant_blue.with_yellow_highlight')` to get the lowermost
114
- * {@link Variant}.
115
- */
116
- getDescendant(dottedPath: DottedPathArgument): Promise<Variant>;
117
- /**
118
- * Gets the desired {@link Element} of the current {@link Variant} relative to its {@link DottedPath}.
119
- * Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
120
- */
121
- getElement(dottedPath: DottedPathArgument): Promise<Element>;
122
- /**
123
- * A proxy for directly getting a Node from an {@link Element} by its {@link DottedPath}s.
124
- */
125
- getNode(elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
126
- /**
127
- * A proxy for directly getting a Mesh from an {@link Element} by its {@link DottedPath}s.
128
- */
129
- getMesh(elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
130
- /**
131
- * Gets the Material defined in one of the variants glTFs by its id.
132
- */
133
- getMaterial(id: string): Material;
134
- /**
135
- * Creates a living clone of this {@link Variant}. Will clone all parent {@link Variant}s in tree.
136
- *
137
- * @emit {@link Event.VARIANT_CREATED}
138
- * @ignore
139
- */
140
- createLiving(parameters?: ParameterBag): Promise<Variant>;
141
- /**
142
- * Destroys this {@link Variant}, all parents and destroy the {@link Element}s.
143
- */
144
- destroy(): Variant;
145
- /**
146
- * Places the given {@link ParameterBag} in the {@link Variant}'s parameters, replaces all patterns in the
147
- * {@link StructureJson}, broadcasts all {@link ParameterObserver}s and delegates them to its {@link Element}s.
148
- *
149
- * @emit {@link Event.VARIANT_PARAMETER_COMMITTED}
150
- */
151
- commitParameters(parameters?: ParameterBag): Promise<Variant>;
152
- /**
153
- * Adds an observer function for camera matrix changes for given `dottedPath` representing the {@link Element}
154
- * and the `traceable`. The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
155
- */
156
- addTraceableObserver(dottedPath: DottedPathArgument, observer: CallableFunction, payload?: any): Promise<Element>;
157
- /**
158
- * Loads {@link glTFUri} with assets, adds them to the {@link Variant}'s `assetContainer` and deactivates the meshes.
159
- * (for further processing).
160
- * @emits {@link Event.ASSET_LOADING_START}
161
- * @emits {@link Event.ASSET_LOADING_END}
162
- */
163
- protected loadAssets(): Promise<Variant>;
164
- /**
165
- * Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
166
- */
167
- protected addParameterObservers(): Variant;
168
- /**
169
- * Creates {@link Element}s and clones nodes into them.
170
- */
171
- protected createElements(): Variant;
172
- /**
173
- * Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
174
- */
175
- protected bootstrapParameters(parameters?: ParameterBag): Promise<Variant>;
176
- }
1
+ import { AssetContainer } from '@babylonjs/core/assetContainer';
2
+ import { Light } from '@babylonjs/core/Lights/light';
3
+ import '@babylonjs/core/Loading/Plugins/babylonFileLoader';
4
+ import { Material } from '@babylonjs/core/Materials/material';
5
+ import { Mesh } from '@babylonjs/core/Meshes/mesh';
6
+ import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
7
+ import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression';
8
+ import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform';
9
+ import '@babylonjs/loaders/glTF/2.0/glTFLoader';
10
+ import { DottedPath } from './dottedPath';
11
+ import { Element } from './element';
12
+ import { Parameterizable } from './parameterizable';
13
+ import { ParameterObservable } from './parameterObservable';
14
+ import { VariantParameterizable } from './variantParameterizable';
15
+ import { Viewer } from './viewer';
16
+ import { ViewerLight } from './viewerLight';
17
+ /**
18
+ * A concrete "Variant". Most of these are handled by either the {@link Viewer} or {@link VariantInstance}.
19
+ */
20
+ export declare class Variant extends Parameterizable {
21
+ readonly name: string;
22
+ protected readonly _structureJson: StructureJson;
23
+ readonly viewer: Viewer;
24
+ readonly parent?: Variant | undefined;
25
+ assetContainer: AssetContainer;
26
+ readonly elements: Element[];
27
+ readonly viewerLights: ViewerLight[];
28
+ structureJson: StructureJson;
29
+ protected _dottedNodes: Map<DottedPath, TransformNode> | undefined;
30
+ protected readonly _children: Map<string, Variant>;
31
+ protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
32
+ /**
33
+ * @internal
34
+ */
35
+ private parametersInitialized;
36
+ /**
37
+ * Constructor.
38
+ */
39
+ protected constructor(name: string, _structureJson: StructureJson, viewer: Viewer, parent?: Variant | undefined);
40
+ /**
41
+ * Creates a {@link Variant} based on given parameters.
42
+ *
43
+ * @throws Error if "gltf" property is provided without a filename
44
+ */
45
+ static create(name: string, structureJson: StructureJson, viewer: Viewer, parent?: Variant): Promise<Variant>;
46
+ /**
47
+ * The ancestor {@link Variant}s ordered from top to bottom in the built tree.
48
+ */
49
+ get ancestors(): Variant[];
50
+ /**
51
+ * The root {@link Variant}.
52
+ */
53
+ get root(): Variant;
54
+ /**
55
+ * The {@link DottedPath} in the built tree of {@link Variant}s.
56
+ * E.g. "_.top-1.sub-2.sub-sub-3"
57
+ */
58
+ get dottedPath(): DottedPath;
59
+ /**
60
+ * The id representing a {@link DottedPath}.
61
+ */
62
+ get id(): string;
63
+ /**
64
+ * The defined glTF Asset.
65
+ */
66
+ get glTF(): Asset | undefined;
67
+ /**
68
+ * The defined glTF URI.
69
+ */
70
+ get glTFUri(): string | undefined;
71
+ /**
72
+ * The inherited defined glTF URI.
73
+ */
74
+ get inheritedGlTFUri(): string | undefined;
75
+ /**
76
+ * The TransformNodes of the {@link Variant}.
77
+ */
78
+ get nodes(): TransformNode[];
79
+ /**
80
+ * The {@link ViewerLight}s of the {@link Variant}.
81
+ */
82
+ get lights(): Light[];
83
+ /**
84
+ * All TransformNodes of the {@link Variant} mapped flat with a {@link DottedPath}.
85
+ */
86
+ get dottedNodes(): Map<DottedPath, TransformNode>;
87
+ /**
88
+ * The Materials of the {@link Variant}.
89
+ */
90
+ get materials(): Material[];
91
+ /**
92
+ * All {@link Element}s from this {@link Variant}'s parents.
93
+ */
94
+ get inheritedElements(): Element[];
95
+ /**
96
+ * All {@link ViewerLight}s inherited from this {@link Variant}'s parents.
97
+ */
98
+ get inheritedViewerLights(): ViewerLight[];
99
+ /**
100
+ * All TransformNodes inherited from this {@link Variant}'s parents.
101
+ */
102
+ get inheritedNodes(): TransformNode[];
103
+ /**
104
+ * All TransformNodes inherited from this {@link Variant}'s parents mapped flat with a {@link DottedPath}.
105
+ */
106
+ get inheritedDottedNodes(): Map<DottedPath, TransformNode>;
107
+ /**
108
+ * All Lights inherited from this {@link Variant}'s parents.
109
+ */
110
+ get inheritedLights(): Light[];
111
+ /**
112
+ * The {@link ParameterDeclarations} inherited from this {@link Variant}'s parents.
113
+ */
114
+ get inheritedParameterDeclaration(): ParameterDeclarations;
115
+ /**
116
+ * The {@link ParameterBag} inherited from this {@link Variant}'s parents.
117
+ */
118
+ get inheritedParameters(): ParameterBag;
119
+ /**
120
+ * All Materials from this {@link Variant}'s parents.
121
+ */
122
+ get inheritedMaterials(): Material[];
123
+ /**
124
+ * Gets the direct children of the current {@link Variant}.
125
+ */
126
+ getChildren(): Promise<Variant[]>;
127
+ /**
128
+ * Gets a descendant {@link Variant} of the current {@link Variant} relative to its {@link DottedPath}.
129
+ * If you have the dotted path `_.product_x.variant_blue.with_yellow_highlight` in a tree and you operate on the
130
+ * `product_x`, you can call `this.getDescendant('variant_blue.with_yellow_highlight')` to get the lowermost
131
+ * {@link Variant}.
132
+ */
133
+ getDescendant(dottedPath: DottedPathArgument): Promise<Variant>;
134
+ /**
135
+ * Gets the desired {@link Element} of the current {@link Variant} relative to its {@link DottedPath}.
136
+ * Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
137
+ */
138
+ getElement(dottedPath: DottedPathArgument): Promise<Element>;
139
+ /**
140
+ * Gets the desired {@link ViewerLight} of the current {@link Variant} relative to its {@link DottedPath}.
141
+ * Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
142
+ */
143
+ getViewerLight(dottedPath: DottedPathArgument): Promise<ViewerLight>;
144
+ /**
145
+ * A proxy for directly getting a Node from an {@link Element} by its {@link DottedPath}s.
146
+ */
147
+ getNode(elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
148
+ /**
149
+ * A proxy for directly getting a Mesh from an {@link Element} by its {@link DottedPath}s.
150
+ */
151
+ getMesh(elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
152
+ /**
153
+ * Gets the Material defined in one of the variants glTFs by its id.
154
+ */
155
+ getMaterial(id: string): Material;
156
+ /**
157
+ * Creates a living clone of this {@link Variant}. Will clone all parent {@link Variant}s in tree.
158
+ *
159
+ * @emit {@link Event.VARIANT_CREATED}
160
+ * @ignore
161
+ */
162
+ createLiving(parameters?: ParameterBag): Promise<Variant>;
163
+ /**
164
+ * Destroys this {@link Variant}, all parents and destroy the {@link Element}s.
165
+ */
166
+ destroy(): Variant;
167
+ /**
168
+ * Places the given {@link ParameterBag} in the {@link Variant}'s parameters, replaces all patterns in the
169
+ * {@link StructureJson}, broadcasts all {@link ParameterObserver}s and delegates them to its {@link Element}s.
170
+ *
171
+ * @emit {@link Event.VARIANT_PARAMETER_COMMITTED}
172
+ */
173
+ commitParameters(parameters?: ParameterBag): Promise<Variant>;
174
+ /**
175
+ * Adds an observer function for camera matrix changes for given `dottedPath` representing the {@link Element}
176
+ * and the `traceable`. The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
177
+ */
178
+ addTraceableObserver(dottedPath: DottedPathArgument, observer: CallableFunction, payload?: any): Promise<Element>;
179
+ /**
180
+ * Loads {@link glTFUri} with assets, adds them to the {@link Variant}'s `assetContainer` and deactivates the meshes.
181
+ * (for further processing).
182
+ * @emits {@link Event.ASSET_LOADING_START}
183
+ * @emits {@link Event.ASSET_LOADING_END}
184
+ */
185
+ protected loadAssets(): Promise<Variant>;
186
+ /**
187
+ * Commits given parameters to all {@link Element}s.
188
+ */
189
+ protected commitParametersToElements(parameters: ParameterBag): Promise<void>;
190
+ /**
191
+ * Commits given parameters to all {@link ViewerLight}s.
192
+ */
193
+ protected commitParametersToViewerLights(parameters: ParameterBag): Promise<void>;
194
+ /**
195
+ * Commits given parameters to a {@link VariantParameterizable} and updates the according definition with given
196
+ * key in the {@link StructureJson}. The `definitionKey` "elements" for example will update the definition in
197
+ * `this.structureJson.elements`.
198
+ */
199
+ protected commitParametersToVariantParameterizable(parameters: ParameterBag, parameterizable: VariantParameterizable, definitionKey: string): Promise<ParameterObservable>;
200
+ /**
201
+ * Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
202
+ */
203
+ protected commitParameterToElements(parameter: string, value: ParameterValue): Promise<void>;
204
+ /**
205
+ * Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
206
+ */
207
+ protected commitParameterToViewerLights(parameter: string, value: ParameterValue): Promise<void>;
208
+ /**
209
+ * Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
210
+ */
211
+ protected addParameterObservers(): Variant;
212
+ /**
213
+ * Creates {@link Element}s and clones nodes into them.
214
+ */
215
+ protected createElements(): Promise<Variant>;
216
+ /**
217
+ * Creates {@link ViewerLight}s.
218
+ */
219
+ protected createViewerLights(): Promise<Variant>;
220
+ /**
221
+ * Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
222
+ */
223
+ protected bootstrapParameters(parameters?: ParameterBag): Promise<Variant>;
224
+ }