@combeenation/3d-viewer 7.1.1 → 7.1.2
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.
- package/README.md +111 -111
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +2 -2
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +166 -166
- package/dist/lib-cjs/api/classes/element.d.ts +153 -153
- package/dist/lib-cjs/api/classes/element.js +672 -670
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/event.d.ts +401 -396
- package/dist/lib-cjs/api/classes/event.js +424 -419
- package/dist/lib-cjs/api/classes/event.js.map +1 -1
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +49 -49
- package/dist/lib-cjs/api/classes/fuzzyMap.d.ts +7 -7
- package/dist/lib-cjs/api/classes/fuzzyMap.js +21 -21
- package/dist/lib-cjs/api/classes/parameter.d.ts +351 -351
- package/dist/lib-cjs/api/classes/parameter.js +524 -517
- package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
- package/dist/lib-cjs/api/classes/parameterObservable.js +72 -72
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +102 -102
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +45 -45
- package/dist/lib-cjs/api/classes/placementAnimation.js +176 -176
- package/dist/lib-cjs/api/classes/variant.d.ts +253 -253
- package/dist/lib-cjs/api/classes/variant.js +858 -843
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +53 -53
- package/dist/lib-cjs/api/classes/variantInstance.js +125 -125
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +86 -88
- package/dist/lib-cjs/api/classes/variantParameterizable.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewer.d.ts +204 -200
- package/dist/lib-cjs/api/classes/viewer.js +682 -670
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerError.d.ts +43 -0
- package/dist/lib-cjs/api/classes/viewerError.js +56 -0
- package/dist/lib-cjs/api/classes/viewerError.js.map +1 -0
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +348 -348
- package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
- package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
- package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -13
- package/dist/lib-cjs/api/internal/sceneSetup.js +226 -226
- package/dist/lib-cjs/api/manager/animationManager.d.ts +30 -30
- package/dist/lib-cjs/api/manager/animationManager.js +126 -126
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +79 -79
- package/dist/lib-cjs/api/manager/gltfExportManager.js +242 -242
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +33 -33
- package/dist/lib-cjs/api/manager/sceneManager.js +128 -130
- package/dist/lib-cjs/api/manager/sceneManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/tagManager.d.ts +116 -109
- package/dist/lib-cjs/api/manager/tagManager.js +444 -425
- package/dist/lib-cjs/api/manager/tagManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/textureLoadManager.d.ts +22 -22
- package/dist/lib-cjs/api/manager/textureLoadManager.js +97 -97
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +106 -106
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +292 -292
- package/dist/lib-cjs/api/store/specStorage.d.ts +32 -32
- package/dist/lib-cjs/api/store/specStorage.js +65 -65
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +235 -235
- package/dist/lib-cjs/api/util/babylonHelper.js +753 -753
- package/dist/lib-cjs/api/util/globalTypes.d.ts +441 -437
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -58
- package/dist/lib-cjs/api/util/resourceHelper.js +203 -203
- package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +44 -44
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js +175 -175
- package/dist/lib-cjs/api/util/stringHelper.d.ts +13 -13
- package/dist/lib-cjs/api/util/stringHelper.js +32 -32
- package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/structureHelper.js +57 -48
- package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/index.d.ts +54 -53
- package/dist/lib-cjs/index.js +117 -114
- package/dist/lib-cjs/index.js.map +1 -1
- package/package.json +81 -81
- package/src/api/classes/animationInterface.ts +10 -10
- package/src/api/classes/dottedPath.ts +181 -181
- package/src/api/classes/element.ts +733 -731
- package/src/api/classes/event.ts +457 -452
- package/src/api/classes/eventBroadcaster.ts +52 -52
- package/src/api/classes/fuzzyMap.ts +21 -21
- package/src/api/classes/parameter.ts +561 -554
- package/src/api/classes/parameterObservable.ts +73 -73
- package/src/api/classes/parameterizable.ts +87 -87
- package/src/api/classes/placementAnimation.ts +162 -162
- package/src/api/classes/variant.ts +949 -933
- package/src/api/classes/variantInstance.ts +123 -123
- package/src/api/classes/variantParameterizable.ts +83 -85
- package/src/api/classes/viewer.ts +760 -744
- package/src/api/classes/viewerError.ts +63 -0
- package/src/api/classes/viewerLight.ts +339 -339
- package/src/api/internal/debugViewer.ts +90 -90
- package/src/api/internal/lensRendering.ts +9 -9
- package/src/api/internal/sceneSetup.ts +205 -205
- package/src/api/manager/animationManager.ts +143 -143
- package/src/api/manager/gltfExportManager.ts +237 -237
- package/src/api/manager/sceneManager.ts +134 -136
- package/src/api/manager/tagManager.ts +477 -457
- package/src/api/manager/textureLoadManager.ts +95 -95
- package/src/api/manager/variantInstanceManager.ts +309 -309
- package/src/api/store/specStorage.ts +68 -68
- package/src/api/util/babylonHelper.ts +823 -823
- package/src/api/util/globalTypes.ts +508 -504
- package/src/api/util/resourceHelper.ts +191 -191
- package/src/api/util/sceneLoaderHelper.ts +170 -170
- package/src/api/util/stringHelper.ts +30 -30
- package/src/api/util/structureHelper.ts +58 -49
- package/src/buildinfo.json +3 -3
- package/src/dev.ts +62 -62
- package/src/index.ts +103 -100
- package/src/types.d.ts +38 -38
|
@@ -1,504 +1,508 @@
|
|
|
1
|
-
// global accessible types imported from 3d-viewer
|
|
2
|
-
type Viewer = import('../classes/viewer').Viewer;
|
|
3
|
-
type Variant = import('../classes/variant').Variant;
|
|
4
|
-
type VariantInstance = import('../classes/variantInstance').VariantInstance;
|
|
5
|
-
type VariantParameterizable = import('../classes/variantParameterizable').VariantParameterizable;
|
|
6
|
-
/**
|
|
7
|
-
* Alias for {@link Element} which can be used to prevent name clashes with the web APIs
|
|
8
|
-
* [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
|
|
9
|
-
*/
|
|
10
|
-
type VariantElement = import('../classes/element').Element;
|
|
11
|
-
type DottedPath = import('../classes/dottedPath').DottedPath;
|
|
12
|
-
type ViewerLight = import('../classes/viewerLight').ViewerLight;
|
|
13
|
-
type SceneManager = import('../manager/sceneManager').SceneManager;
|
|
14
|
-
|
|
15
|
-
type FuzzyMap<K, V> = import('../classes/fuzzyMap').FuzzyMap<K, V>;
|
|
16
|
-
|
|
17
|
-
// global accessible types imported from BabylonJS
|
|
18
|
-
type Scene = import('@babylonjs/core/scene').Scene;
|
|
19
|
-
type Vector3 = import('@babylonjs/core/Maths/math.vector').Vector3;
|
|
20
|
-
type Color3 = import('@babylonjs/core/Maths/math.color').Color3;
|
|
21
|
-
type Color4 = import('@babylonjs/core/Maths/math.color').Color4;
|
|
22
|
-
type Material = import('@babylonjs/core/Materials/material').Material;
|
|
23
|
-
type PBRMaterial = import('@babylonjs/core/Materials/PBR/pbrMaterial').PBRMaterial;
|
|
24
|
-
type StandardMaterial = import('@babylonjs/core/Materials/standardMaterial').StandardMaterial;
|
|
25
|
-
type DynamicTexture = import('@babylonjs/core/Materials/Textures/dynamicTexture').DynamicTexture;
|
|
26
|
-
type Mesh = import('@babylonjs/core/Meshes/mesh').Mesh;
|
|
27
|
-
type AbstractMesh = import('@babylonjs/core/Meshes/abstractMesh').AbstractMesh;
|
|
28
|
-
type InstancedMesh = import('@babylonjs/core/Meshes/instancedMesh').InstancedMesh;
|
|
29
|
-
type TransformNode = import('@babylonjs/core/Meshes/transformNode').TransformNode;
|
|
30
|
-
type Engine = import('@babylonjs/core/Engines/engine').Engine;
|
|
31
|
-
type EngineOptions = import('@babylonjs/core/Engines/thinEngine').EngineOptions;
|
|
32
|
-
type ArcRotateCamera = import('@babylonjs/core/Cameras/arcRotateCamera').ArcRotateCamera;
|
|
33
|
-
type IScreenshotSize = import('@babylonjs/core/Misc/interfaces/screenshotSize').IScreenshotSize;
|
|
34
|
-
type BabylonAnimation = import('@babylonjs/core/Animations/animation').Animation;
|
|
35
|
-
type CubeTexture = import('@babylonjs/core/Materials/Textures/cubeTexture').CubeTexture;
|
|
36
|
-
type MeshBuilder = typeof import('@babylonjs/core/Meshes/meshBuilder').MeshBuilder;
|
|
37
|
-
type Texture = import('@babylonjs/core/Materials/Textures/texture').Texture;
|
|
38
|
-
type HemisphericLight = import('@babylonjs/core/Lights/hemisphericLight').HemisphericLight;
|
|
39
|
-
type DirectionalLight = import('@babylonjs/core/Lights/directionalLight').DirectionalLight;
|
|
40
|
-
type IInspectorOptions = import('@babylonjs/core/Debug').IInspectorOptions;
|
|
41
|
-
// Node is already defined in lib.dom.d.ts, so it can't be declared that way
|
|
42
|
-
// type Node = import("@babylonjs/core/node").Node;
|
|
43
|
-
|
|
44
|
-
type IExportOptions = import('@babylonjs/serializers/glTF/2.0').IExportOptions;
|
|
45
|
-
|
|
46
|
-
type EventEmitter = import('eventemitter3');
|
|
47
|
-
|
|
48
|
-
type Undefinable<T> = T | undefined;
|
|
49
|
-
|
|
50
|
-
type Nullable<T> = T | null;
|
|
51
|
-
|
|
52
|
-
// some more global accessible types
|
|
53
|
-
type PathDefinitions = {
|
|
54
|
-
include: string[];
|
|
55
|
-
exclude?: string[];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
type TraceableDefinition = {
|
|
59
|
-
path: string;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
type TraceableDefinitions = {
|
|
63
|
-
[name: string]: TraceableDefinition;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
type PaintableDefinition = {
|
|
67
|
-
path: string;
|
|
68
|
-
textureOptions:
|
|
69
|
-
| {
|
|
70
|
-
width: number;
|
|
71
|
-
height: number;
|
|
72
|
-
}
|
|
73
|
-
| number;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
type PaintableDefinitions = {
|
|
77
|
-
[name: string]: PaintableDefinition;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
type Asset = {
|
|
81
|
-
rootUrl: string;
|
|
82
|
-
fileName: string | undefined;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
type ElementDefinitions = {
|
|
86
|
-
[name: string]: ElementDefinition | string[];
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
type ElementDefinition = {
|
|
90
|
-
paths: PathDefinitions;
|
|
91
|
-
traceables?: TraceableDefinitions;
|
|
92
|
-
paintables?: PaintableDefinitions;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type TransformationDefinition = {
|
|
96
|
-
scaling: Vector3;
|
|
97
|
-
position: Vector3;
|
|
98
|
-
rotation: Vector3;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
type EnvironmentDefinition = {
|
|
102
|
-
environmentColor?: Color3;
|
|
103
|
-
environmentIntensity?: number;
|
|
104
|
-
environment?: string;
|
|
105
|
-
environmentBackground?: string;
|
|
106
|
-
environmentRotation?: number;
|
|
107
|
-
environmentUseDefault?: boolean;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
type StructureJson = {
|
|
111
|
-
/**
|
|
112
|
-
* `scene` describes the visualisation of the babylon `scene` such as the incidence of light and camera position. If a
|
|
113
|
-
* string is given, the {@link Viewer} will resolve the URL or path and pass the parsed JSON to this property.
|
|
114
|
-
*/
|
|
115
|
-
scene?: string | SceneJson;
|
|
116
|
-
/**
|
|
117
|
-
* `setup` is a kind of construction plan for the {@link Viewer}. You can pass a {@link SetupJson} or a string, which
|
|
118
|
-
* must represent a valid URL or path. If a string is given, the {@link Viewer} will resolve the URL or path and pass
|
|
119
|
-
* the parsed JSON to this property. The {@link SetupJson} is responsible for managing a list of
|
|
120
|
-
* {@link VariantInstanceDefinition}s. These definitions define the instances that should be instantiated during the
|
|
121
|
-
* bootstrapping process. Each instance has a name and a reference to it's {@link Variant}.
|
|
122
|
-
*/
|
|
123
|
-
setup?: string | SetupJson;
|
|
124
|
-
file?: string;
|
|
125
|
-
glTF?: Asset | string;
|
|
126
|
-
parameterDeclaration?: ParameterDeclarations;
|
|
127
|
-
parameters?: ParameterBag;
|
|
128
|
-
elements?: ElementDefinitions;
|
|
129
|
-
lights?: LightDefinitions;
|
|
130
|
-
grounds?: GroundDefinitions;
|
|
131
|
-
/**
|
|
132
|
-
* `variants` is a declarative description of 3D-model variations in the configurator. Each variant itself is a
|
|
133
|
-
* {@link StructureJson} which must at least define a `name` in the key of the list and the properties `glTF` and
|
|
134
|
-
* `elements` in the value. FYI: Babylon.js's sandbox can show you the path of the 3D-model to properly define the
|
|
135
|
-
* `paths`.
|
|
136
|
-
*
|
|
137
|
-
* Example Code
|
|
138
|
-
* ```js
|
|
139
|
-
* variants: {
|
|
140
|
-
* 'My Pretty Variant' {
|
|
141
|
-
* glTF: {
|
|
142
|
-
* rootUrl: 'https:/my.awesome.domain/path/to/my/project/',
|
|
143
|
-
* fileName: 'my_3d_model_file.glb',
|
|
144
|
-
* },
|
|
145
|
-
* elements: {
|
|
146
|
-
* 'My Little Element': {
|
|
147
|
-
* paths: {
|
|
148
|
-
* includes: ['__root__.MeshName']
|
|
149
|
-
* }
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
* }
|
|
153
|
-
* }
|
|
154
|
-
* ```
|
|
155
|
-
* `MeshName` has to be identical to the path in the glb-file of the 3D-model.
|
|
156
|
-
*/
|
|
157
|
-
variants?: {
|
|
158
|
-
[id: string]: StructureJson;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
type AutoSpecStructureJson = StructureJson & {
|
|
163
|
-
scene: SceneJson;
|
|
164
|
-
setup: SetupJson;
|
|
165
|
-
variants: { [id: string]: StructureJson };
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
type SceneJson = {
|
|
169
|
-
parameterDeclaration?: ParameterDeclarations;
|
|
170
|
-
parameters?: ParameterBag;
|
|
171
|
-
meshPicking?: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Information about [EngineOptions](https://doc.babylonjs.com/typedoc/interfaces/babylon.engineoptions).
|
|
174
|
-
*/
|
|
175
|
-
engine?: {
|
|
176
|
-
antialiasing?: boolean;
|
|
177
|
-
options?: EngineOptions;
|
|
178
|
-
};
|
|
179
|
-
scene: SceneDefinition;
|
|
180
|
-
animations?: AnimationDefinitions;
|
|
181
|
-
placements?: PlacementDefinitions;
|
|
182
|
-
/**
|
|
183
|
-
* Information about [material cloning](pages/Release%20Notes/releases/4-3-0.html#material-cloning-on-mutation).
|
|
184
|
-
* Default value is `false`.
|
|
185
|
-
*/
|
|
186
|
-
cloneMaterialsOnMutation?: boolean;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
type SceneDefinition = {
|
|
190
|
-
globals: SceneGlobals;
|
|
191
|
-
cameras?: CameraDefinitions;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
type SceneGlobals = {
|
|
195
|
-
'shadows'?: {
|
|
196
|
-
enabled: boolean;
|
|
197
|
-
type: 'contact';
|
|
198
|
-
settings: [];
|
|
199
|
-
generator: [];
|
|
200
|
-
receiver: [];
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* `aa` or anti aliasing is not needed if hard edges are desired.\
|
|
204
|
-
* FYI: aa smooths edges and avoids stairs-effects.
|
|
205
|
-
*/
|
|
206
|
-
'aa'?: 'fxaa';
|
|
207
|
-
'tone-mapping'?: boolean;
|
|
208
|
-
/**
|
|
209
|
-
* @bloom is widely known as glow. There you can define it’s size (Specifies the size of the bloom blur kernel,
|
|
210
|
-
* relative to the final output size) and threshold (The luminance threshold to find bright areas of the image to
|
|
211
|
-
* bloom).
|
|
212
|
-
* Further Information under [BloomEffect](https://doc.babylonjs.com/typedoc/classes/babylon.bloomeffect).
|
|
213
|
-
*
|
|
214
|
-
* @dof short for "depth-of-field" defines the focus in the view. Parameters in settings are listed in [Depth of Field and Other Lens Effects link](https://doc.babylonjs.com/divingDeeper/postProcesses/dofLenseEffects).
|
|
215
|
-
* @exposure specifies the intensity of the lightning of the view (not 3D-Model).
|
|
216
|
-
* @sharpen´s parameter `settings` are listed in [Default Rendering Pipeline Sharpening link](https://doc.babylonjs.com/divingDeeper/postProcesses/defaultRenderingPipeline#sharpening).
|
|
217
|
-
*/
|
|
218
|
-
'camera-settings'?: {
|
|
219
|
-
contrast: number;
|
|
220
|
-
exposure: number;
|
|
221
|
-
bloom?: {
|
|
222
|
-
enabled: boolean;
|
|
223
|
-
size?: number;
|
|
224
|
-
threshold?: number;
|
|
225
|
-
};
|
|
226
|
-
dof?: {
|
|
227
|
-
enabled: boolean;
|
|
228
|
-
settings: {};
|
|
229
|
-
};
|
|
230
|
-
sharpen?: {
|
|
231
|
-
enabled: boolean;
|
|
232
|
-
settings: {};
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* {@link Viewer.screenshot} internally uses Babylon.js [ScreenshotTools.CreateScreenshotUsingRenderTarget](https://doc.babylonjs.com/typedoc/classes/babylon.screenshottools#createscreenshotusingrendertarget). \
|
|
239
|
-
* See this link for additional info about the properties.
|
|
240
|
-
*/
|
|
241
|
-
type ScreenshotSettings = {
|
|
242
|
-
/** Defaults to canvas width & height */
|
|
243
|
-
size?: IScreenshotSize;
|
|
244
|
-
/**
|
|
245
|
-
* Default `image/png`
|
|
246
|
-
*
|
|
247
|
-
* **Info regarding JPEG:** \
|
|
248
|
-
* Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
|
|
249
|
-
* Also ensure that {@link Scene.clearColor | viewer.scene.clearColor} has an alpha value of `1` as jpeg's don't
|
|
250
|
-
* support transparency. Otherwise background will always be black for jpeg's.
|
|
251
|
-
*/
|
|
252
|
-
mimeType?: string;
|
|
253
|
-
/** Default `1` */
|
|
254
|
-
samples?: number;
|
|
255
|
-
/** Default `false` */
|
|
256
|
-
antialiasing?: boolean;
|
|
257
|
-
/** Default `screenshot.png` */
|
|
258
|
-
fileName?: string;
|
|
259
|
-
/** Default `false` */
|
|
260
|
-
renderSprites?: boolean;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Use this to define geometry to be excluded from autofocus, GLB export, etc.
|
|
265
|
-
*/
|
|
266
|
-
type ExcludedGeometry = Mesh | AbstractMesh | VariantInstance | Variant | VariantElement | Node;
|
|
267
|
-
type ExcludedGeometryList = ExcludedGeometry[];
|
|
268
|
-
|
|
269
|
-
type AutofocusSettings = {
|
|
270
|
-
/**
|
|
271
|
-
* Can be used to customize the margins shown around the 3d model when calling {@link Viewer.autofocusActiveCamera}.\
|
|
272
|
-
* Defaults to 1.5 when not set explicitly.
|
|
273
|
-
*/
|
|
274
|
-
radiusFactor?: number;
|
|
275
|
-
adjustWheelPrecision?: boolean;
|
|
276
|
-
adjustPanningSensibility?: boolean;
|
|
277
|
-
adjustPinchPrecision?: boolean;
|
|
278
|
-
/** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
|
|
279
|
-
alpha?: number;
|
|
280
|
-
/** Desired vertical camera angle, this won't be overwritten by the autofocus function */
|
|
281
|
-
beta?: number;
|
|
282
|
-
/** Optional animation for the focusing camera movement */
|
|
283
|
-
animation?: string | AnimationDefinition;
|
|
284
|
-
/** Optional list of geometry to be excluded from consideration */
|
|
285
|
-
exclude?: ExcludedGeometryList;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
type LightDefinitions = {
|
|
289
|
-
[name: string]: LightDefinition | string;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
type LightDefinition = {
|
|
293
|
-
type: 'baked' | 'hemispheric' | 'point' | 'directional' | 'spot';
|
|
294
|
-
path?: string;
|
|
295
|
-
shadowGenerator?: ShadowGeneratorDefinition;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
type ShadowGeneratorDefinition = {
|
|
299
|
-
mapSize: number;
|
|
300
|
-
[others: string]: any;
|
|
301
|
-
/**
|
|
302
|
-
* Further properties like `usePoissonSampling` are set directly on the ShadowGenerator object.
|
|
303
|
-
* [Shadows](https://doc.babylonjs.com/divingDeeper/lights/shadows)
|
|
304
|
-
*/
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
type GroundDefinitions = {
|
|
308
|
-
[ground: string]: GroundDefinition;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
type GroundDefinition = {
|
|
312
|
-
type: 'baked' | 'ground' | 'heightmap';
|
|
313
|
-
meshId?: string;
|
|
314
|
-
url?: string;
|
|
315
|
-
width?: number;
|
|
316
|
-
height?: number;
|
|
317
|
-
subdivisions?: number;
|
|
318
|
-
receiveShadows?: boolean;
|
|
319
|
-
minHeight?: number;
|
|
320
|
-
maxHeight?: number;
|
|
321
|
-
alphaFilter?: number;
|
|
322
|
-
onReady?: any;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
type CameraDefinitions = {
|
|
326
|
-
[camera: string]: CameraDefinition;
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
type CameraDefinition = {
|
|
330
|
-
/**
|
|
331
|
-
* `fov` or "Field Of View" defines as it says the view of the scene. Further information about its [theory](https://en.wikipedia.org/wiki/Field_of_view) and [implementation](https://doc.babylonjs.com/typedoc/classes/babylon.camera#fov).
|
|
332
|
-
*/
|
|
333
|
-
fov?: number;
|
|
334
|
-
active?: boolean;
|
|
335
|
-
/**
|
|
336
|
-
* `arc` is a default camera position where the 3D-model is the center and the camera rotates around the 3D-model.
|
|
337
|
-
* More Information about `arc` in [ArcRotateCamera](https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera).
|
|
338
|
-
*
|
|
339
|
-
* NOTE: While "baked" camera definitions from a GLB or babylon file can currently not be instatiated within the
|
|
340
|
-
* `Specification`, it's still possible to use them in the viewer.\
|
|
341
|
-
* For the moment all camera definitions inside these files are automatically added to the scene and can be actived
|
|
342
|
-
* using the {@link Viewer.switchCamera} function.\
|
|
343
|
-
* The `newCamera` input has to match the name of the camera node inside the GLB/babylon file.
|
|
344
|
-
*/
|
|
345
|
-
type: 'arc';
|
|
346
|
-
/**
|
|
347
|
-
* `target` overrides `arc`´s position and repositions the camera. The string has the syntax (x?: number, y?: number, z?: number) like [Vector3](https://doc.babylonjs.com/typedoc/classes/babylon.vector3).
|
|
348
|
-
*/
|
|
349
|
-
target?: string;
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
type VariantInstanceDefinition = {
|
|
353
|
-
name?: string;
|
|
354
|
-
variant: DottedPathArgument;
|
|
355
|
-
parameters?: ParameterBag;
|
|
356
|
-
tagManagerParameterValues?: TagManagerParameterValue[];
|
|
357
|
-
lazy?: boolean;
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
type SetupJson = {
|
|
361
|
-
instances: VariantInstanceDefinition[];
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
type ParameterDeclarations = {
|
|
365
|
-
[name: string]: ParameterDeclaration;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
type ParameterDeclaration = {
|
|
369
|
-
type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector' | 'csl';
|
|
370
|
-
parser?: any;
|
|
371
|
-
options?: ParameterValue[];
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
type ParameterValue = string | number | boolean;
|
|
375
|
-
|
|
376
|
-
type ParameterBag = {
|
|
377
|
-
[name: string]: ParameterValue;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
type ParsedParameterBag = {
|
|
381
|
-
[name: string]: any;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
type DottedPathArgument = string | string[] | DottedPath;
|
|
385
|
-
|
|
386
|
-
type ParameterObserverResult =
|
|
387
|
-
|
|
388
|
-
type ParameterObserver = (
|
|
389
|
-
payload: any,
|
|
390
|
-
oldValue: Undefinable<ParameterValue>,
|
|
391
|
-
newValue: ParameterValue
|
|
392
|
-
) => ParameterObserverResult
|
|
393
|
-
|
|
394
|
-
type PlacementDefinitions = {
|
|
395
|
-
[name: string]: PlacementDefinition;
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
type PlacementDefinition = {
|
|
399
|
-
position?: string | Vector3;
|
|
400
|
-
alpha?: number;
|
|
401
|
-
beta?: number;
|
|
402
|
-
radius?: number;
|
|
403
|
-
target?: string | Vector3;
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
type AnimationDefinitions = {
|
|
407
|
-
[name: string]: AnimationDefinition;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* See [GSAP API Docs](https://greensock.com/docs/v3/GSAP/Tween/vars) for description of `GSAPTWeenVars`.
|
|
412
|
-
*
|
|
413
|
-
* You can use the [GreenSock Ease Visualizer](https://greensock.com/ease-visualizer/) to create an animation of your
|
|
414
|
-
* liking and simply copy the `ease` function shown at the bottom of the visualizer into the `ease` property of your
|
|
415
|
-
* {@link AnimationDefinition}.
|
|
416
|
-
*
|
|
417
|
-
* The `GSAPTWeenVars` are extended by the `shortestWay` property.\
|
|
418
|
-
* This property defines if the camera should move to the target position within the shortest possible distance.\
|
|
419
|
-
* If `shortestWay` is `false`, the camera moves the whole difference between the current camera position and the target
|
|
420
|
-
* position and that could be > 360, which can appear very unconvenient to the operator.\
|
|
421
|
-
* The default value of this flag is `true`.
|
|
422
|
-
*
|
|
423
|
-
* Example usage in {@link SceneJson | SceneJson.animations}:
|
|
424
|
-
*
|
|
425
|
-
* ```js
|
|
426
|
-
* // ...
|
|
427
|
-
* scene: {
|
|
428
|
-
* // ...
|
|
429
|
-
* animations: {
|
|
430
|
-
* DefaultCameraAnimation: {
|
|
431
|
-
* ease: 'Power3.easeInOut',
|
|
432
|
-
* duration: 0.8,
|
|
433
|
-
* },
|
|
434
|
-
* },
|
|
435
|
-
* // ...
|
|
436
|
-
* }
|
|
437
|
-
* // ...
|
|
438
|
-
* ```
|
|
439
|
-
*/
|
|
440
|
-
type AnimationDefinition = GSAPTweenVars & { shortestWay?: boolean };
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Extends Babylon.js's {@link IExportOptions} by some viewer specific settings
|
|
444
|
-
*/
|
|
445
|
-
interface IExportOptionsExtended extends IExportOptions {
|
|
446
|
-
/**
|
|
447
|
-
* In certain situations multiple meshes in the viewer scene have the same name (e.g. when cloning instances).\
|
|
448
|
-
* If this option is set, the exporter adjusts all mesh names before export to have a unique name.\
|
|
449
|
-
* This is required e.g. if the exported file is used to show an AR scene with the model viewer which requires all
|
|
450
|
-
* meshes to have unique names.
|
|
451
|
-
*/
|
|
452
|
-
createUniqueMeshNames?: boolean;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
type SpecGenerationData = {
|
|
456
|
-
name: string;
|
|
457
|
-
url: string;
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Key = Old tag name\
|
|
462
|
-
* Value = New tag name
|
|
463
|
-
*/
|
|
464
|
-
type TagMapping = {
|
|
465
|
-
[tagName: string]: string;
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
type TagManagerSubject = {
|
|
469
|
-
tagName?: string;
|
|
470
|
-
nodeName?: string;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
type
|
|
478
|
-
|
|
479
|
-
type
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
1
|
+
// global accessible types imported from 3d-viewer
|
|
2
|
+
type Viewer = import('../classes/viewer').Viewer;
|
|
3
|
+
type Variant = import('../classes/variant').Variant;
|
|
4
|
+
type VariantInstance = import('../classes/variantInstance').VariantInstance;
|
|
5
|
+
type VariantParameterizable = import('../classes/variantParameterizable').VariantParameterizable;
|
|
6
|
+
/**
|
|
7
|
+
* Alias for {@link Element} which can be used to prevent name clashes with the web APIs
|
|
8
|
+
* [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
|
|
9
|
+
*/
|
|
10
|
+
type VariantElement = import('../classes/element').Element;
|
|
11
|
+
type DottedPath = import('../classes/dottedPath').DottedPath;
|
|
12
|
+
type ViewerLight = import('../classes/viewerLight').ViewerLight;
|
|
13
|
+
type SceneManager = import('../manager/sceneManager').SceneManager;
|
|
14
|
+
|
|
15
|
+
type FuzzyMap<K, V> = import('../classes/fuzzyMap').FuzzyMap<K, V>;
|
|
16
|
+
|
|
17
|
+
// global accessible types imported from BabylonJS
|
|
18
|
+
type Scene = import('@babylonjs/core/scene').Scene;
|
|
19
|
+
type Vector3 = import('@babylonjs/core/Maths/math.vector').Vector3;
|
|
20
|
+
type Color3 = import('@babylonjs/core/Maths/math.color').Color3;
|
|
21
|
+
type Color4 = import('@babylonjs/core/Maths/math.color').Color4;
|
|
22
|
+
type Material = import('@babylonjs/core/Materials/material').Material;
|
|
23
|
+
type PBRMaterial = import('@babylonjs/core/Materials/PBR/pbrMaterial').PBRMaterial;
|
|
24
|
+
type StandardMaterial = import('@babylonjs/core/Materials/standardMaterial').StandardMaterial;
|
|
25
|
+
type DynamicTexture = import('@babylonjs/core/Materials/Textures/dynamicTexture').DynamicTexture;
|
|
26
|
+
type Mesh = import('@babylonjs/core/Meshes/mesh').Mesh;
|
|
27
|
+
type AbstractMesh = import('@babylonjs/core/Meshes/abstractMesh').AbstractMesh;
|
|
28
|
+
type InstancedMesh = import('@babylonjs/core/Meshes/instancedMesh').InstancedMesh;
|
|
29
|
+
type TransformNode = import('@babylonjs/core/Meshes/transformNode').TransformNode;
|
|
30
|
+
type Engine = import('@babylonjs/core/Engines/engine').Engine;
|
|
31
|
+
type EngineOptions = import('@babylonjs/core/Engines/thinEngine').EngineOptions;
|
|
32
|
+
type ArcRotateCamera = import('@babylonjs/core/Cameras/arcRotateCamera').ArcRotateCamera;
|
|
33
|
+
type IScreenshotSize = import('@babylonjs/core/Misc/interfaces/screenshotSize').IScreenshotSize;
|
|
34
|
+
type BabylonAnimation = import('@babylonjs/core/Animations/animation').Animation;
|
|
35
|
+
type CubeTexture = import('@babylonjs/core/Materials/Textures/cubeTexture').CubeTexture;
|
|
36
|
+
type MeshBuilder = typeof import('@babylonjs/core/Meshes/meshBuilder').MeshBuilder;
|
|
37
|
+
type Texture = import('@babylonjs/core/Materials/Textures/texture').Texture;
|
|
38
|
+
type HemisphericLight = import('@babylonjs/core/Lights/hemisphericLight').HemisphericLight;
|
|
39
|
+
type DirectionalLight = import('@babylonjs/core/Lights/directionalLight').DirectionalLight;
|
|
40
|
+
type IInspectorOptions = import('@babylonjs/core/Debug').IInspectorOptions;
|
|
41
|
+
// Node is already defined in lib.dom.d.ts, so it can't be declared that way
|
|
42
|
+
// type Node = import("@babylonjs/core/node").Node;
|
|
43
|
+
|
|
44
|
+
type IExportOptions = import('@babylonjs/serializers/glTF/2.0').IExportOptions;
|
|
45
|
+
|
|
46
|
+
type EventEmitter = import('eventemitter3');
|
|
47
|
+
|
|
48
|
+
type Undefinable<T> = T | undefined;
|
|
49
|
+
|
|
50
|
+
type Nullable<T> = T | null;
|
|
51
|
+
|
|
52
|
+
// some more global accessible types
|
|
53
|
+
type PathDefinitions = {
|
|
54
|
+
include: string[];
|
|
55
|
+
exclude?: string[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type TraceableDefinition = {
|
|
59
|
+
path: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type TraceableDefinitions = {
|
|
63
|
+
[name: string]: TraceableDefinition;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type PaintableDefinition = {
|
|
67
|
+
path: string;
|
|
68
|
+
textureOptions:
|
|
69
|
+
| {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
| number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
type PaintableDefinitions = {
|
|
77
|
+
[name: string]: PaintableDefinition;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type Asset = {
|
|
81
|
+
rootUrl: string;
|
|
82
|
+
fileName: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type ElementDefinitions = {
|
|
86
|
+
[name: string]: ElementDefinition | string[];
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type ElementDefinition = {
|
|
90
|
+
paths: PathDefinitions;
|
|
91
|
+
traceables?: TraceableDefinitions;
|
|
92
|
+
paintables?: PaintableDefinitions;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type TransformationDefinition = {
|
|
96
|
+
scaling: Vector3;
|
|
97
|
+
position: Vector3;
|
|
98
|
+
rotation: Vector3;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
type EnvironmentDefinition = {
|
|
102
|
+
environmentColor?: Color3;
|
|
103
|
+
environmentIntensity?: number;
|
|
104
|
+
environment?: string;
|
|
105
|
+
environmentBackground?: string;
|
|
106
|
+
environmentRotation?: number;
|
|
107
|
+
environmentUseDefault?: boolean;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
type StructureJson = {
|
|
111
|
+
/**
|
|
112
|
+
* `scene` describes the visualisation of the babylon `scene` such as the incidence of light and camera position. If a
|
|
113
|
+
* string is given, the {@link Viewer} will resolve the URL or path and pass the parsed JSON to this property.
|
|
114
|
+
*/
|
|
115
|
+
scene?: string | SceneJson;
|
|
116
|
+
/**
|
|
117
|
+
* `setup` is a kind of construction plan for the {@link Viewer}. You can pass a {@link SetupJson} or a string, which
|
|
118
|
+
* must represent a valid URL or path. If a string is given, the {@link Viewer} will resolve the URL or path and pass
|
|
119
|
+
* the parsed JSON to this property. The {@link SetupJson} is responsible for managing a list of
|
|
120
|
+
* {@link VariantInstanceDefinition}s. These definitions define the instances that should be instantiated during the
|
|
121
|
+
* bootstrapping process. Each instance has a name and a reference to it's {@link Variant}.
|
|
122
|
+
*/
|
|
123
|
+
setup?: string | SetupJson;
|
|
124
|
+
file?: string;
|
|
125
|
+
glTF?: Asset | string;
|
|
126
|
+
parameterDeclaration?: ParameterDeclarations;
|
|
127
|
+
parameters?: ParameterBag;
|
|
128
|
+
elements?: ElementDefinitions;
|
|
129
|
+
lights?: LightDefinitions;
|
|
130
|
+
grounds?: GroundDefinitions;
|
|
131
|
+
/**
|
|
132
|
+
* `variants` is a declarative description of 3D-model variations in the configurator. Each variant itself is a
|
|
133
|
+
* {@link StructureJson} which must at least define a `name` in the key of the list and the properties `glTF` and
|
|
134
|
+
* `elements` in the value. FYI: Babylon.js's sandbox can show you the path of the 3D-model to properly define the
|
|
135
|
+
* `paths`.
|
|
136
|
+
*
|
|
137
|
+
* Example Code
|
|
138
|
+
* ```js
|
|
139
|
+
* variants: {
|
|
140
|
+
* 'My Pretty Variant' {
|
|
141
|
+
* glTF: {
|
|
142
|
+
* rootUrl: 'https:/my.awesome.domain/path/to/my/project/',
|
|
143
|
+
* fileName: 'my_3d_model_file.glb',
|
|
144
|
+
* },
|
|
145
|
+
* elements: {
|
|
146
|
+
* 'My Little Element': {
|
|
147
|
+
* paths: {
|
|
148
|
+
* includes: ['__root__.MeshName']
|
|
149
|
+
* }
|
|
150
|
+
* }
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
* `MeshName` has to be identical to the path in the glb-file of the 3D-model.
|
|
156
|
+
*/
|
|
157
|
+
variants?: {
|
|
158
|
+
[id: string]: StructureJson;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type AutoSpecStructureJson = StructureJson & {
|
|
163
|
+
scene: SceneJson;
|
|
164
|
+
setup: SetupJson;
|
|
165
|
+
variants: { [id: string]: StructureJson };
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
type SceneJson = {
|
|
169
|
+
parameterDeclaration?: ParameterDeclarations;
|
|
170
|
+
parameters?: ParameterBag;
|
|
171
|
+
meshPicking?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Information about [EngineOptions](https://doc.babylonjs.com/typedoc/interfaces/babylon.engineoptions).
|
|
174
|
+
*/
|
|
175
|
+
engine?: {
|
|
176
|
+
antialiasing?: boolean;
|
|
177
|
+
options?: EngineOptions;
|
|
178
|
+
};
|
|
179
|
+
scene: SceneDefinition;
|
|
180
|
+
animations?: AnimationDefinitions;
|
|
181
|
+
placements?: PlacementDefinitions;
|
|
182
|
+
/**
|
|
183
|
+
* Information about [material cloning](pages/Release%20Notes/releases/4-3-0.html#material-cloning-on-mutation).
|
|
184
|
+
* Default value is `false`.
|
|
185
|
+
*/
|
|
186
|
+
cloneMaterialsOnMutation?: boolean;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
type SceneDefinition = {
|
|
190
|
+
globals: SceneGlobals;
|
|
191
|
+
cameras?: CameraDefinitions;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
type SceneGlobals = {
|
|
195
|
+
'shadows'?: {
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
type: 'contact';
|
|
198
|
+
settings: [];
|
|
199
|
+
generator: [];
|
|
200
|
+
receiver: [];
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* `aa` or anti aliasing is not needed if hard edges are desired.\
|
|
204
|
+
* FYI: aa smooths edges and avoids stairs-effects.
|
|
205
|
+
*/
|
|
206
|
+
'aa'?: 'fxaa';
|
|
207
|
+
'tone-mapping'?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* @bloom is widely known as glow. There you can define it’s size (Specifies the size of the bloom blur kernel,
|
|
210
|
+
* relative to the final output size) and threshold (The luminance threshold to find bright areas of the image to
|
|
211
|
+
* bloom).
|
|
212
|
+
* Further Information under [BloomEffect](https://doc.babylonjs.com/typedoc/classes/babylon.bloomeffect).
|
|
213
|
+
*
|
|
214
|
+
* @dof short for "depth-of-field" defines the focus in the view. Parameters in settings are listed in [Depth of Field and Other Lens Effects link](https://doc.babylonjs.com/divingDeeper/postProcesses/dofLenseEffects).
|
|
215
|
+
* @exposure specifies the intensity of the lightning of the view (not 3D-Model).
|
|
216
|
+
* @sharpen´s parameter `settings` are listed in [Default Rendering Pipeline Sharpening link](https://doc.babylonjs.com/divingDeeper/postProcesses/defaultRenderingPipeline#sharpening).
|
|
217
|
+
*/
|
|
218
|
+
'camera-settings'?: {
|
|
219
|
+
contrast: number;
|
|
220
|
+
exposure: number;
|
|
221
|
+
bloom?: {
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
size?: number;
|
|
224
|
+
threshold?: number;
|
|
225
|
+
};
|
|
226
|
+
dof?: {
|
|
227
|
+
enabled: boolean;
|
|
228
|
+
settings: {};
|
|
229
|
+
};
|
|
230
|
+
sharpen?: {
|
|
231
|
+
enabled: boolean;
|
|
232
|
+
settings: {};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* {@link Viewer.screenshot} internally uses Babylon.js [ScreenshotTools.CreateScreenshotUsingRenderTarget](https://doc.babylonjs.com/typedoc/classes/babylon.screenshottools#createscreenshotusingrendertarget). \
|
|
239
|
+
* See this link for additional info about the properties.
|
|
240
|
+
*/
|
|
241
|
+
type ScreenshotSettings = {
|
|
242
|
+
/** Defaults to canvas width & height */
|
|
243
|
+
size?: IScreenshotSize;
|
|
244
|
+
/**
|
|
245
|
+
* Default `image/png`
|
|
246
|
+
*
|
|
247
|
+
* **Info regarding JPEG:** \
|
|
248
|
+
* Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
|
|
249
|
+
* Also ensure that {@link Scene.clearColor | viewer.scene.clearColor} has an alpha value of `1` as jpeg's don't
|
|
250
|
+
* support transparency. Otherwise background will always be black for jpeg's.
|
|
251
|
+
*/
|
|
252
|
+
mimeType?: string;
|
|
253
|
+
/** Default `1` */
|
|
254
|
+
samples?: number;
|
|
255
|
+
/** Default `false` */
|
|
256
|
+
antialiasing?: boolean;
|
|
257
|
+
/** Default `screenshot.png` */
|
|
258
|
+
fileName?: string;
|
|
259
|
+
/** Default `false` */
|
|
260
|
+
renderSprites?: boolean;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Use this to define geometry to be excluded from autofocus, GLB export, etc.
|
|
265
|
+
*/
|
|
266
|
+
type ExcludedGeometry = Mesh | AbstractMesh | VariantInstance | Variant | VariantElement | Node | TagManagerSubject;
|
|
267
|
+
type ExcludedGeometryList = ExcludedGeometry[];
|
|
268
|
+
|
|
269
|
+
type AutofocusSettings = {
|
|
270
|
+
/**
|
|
271
|
+
* Can be used to customize the margins shown around the 3d model when calling {@link Viewer.autofocusActiveCamera}.\
|
|
272
|
+
* Defaults to 1.5 when not set explicitly.
|
|
273
|
+
*/
|
|
274
|
+
radiusFactor?: number;
|
|
275
|
+
adjustWheelPrecision?: boolean;
|
|
276
|
+
adjustPanningSensibility?: boolean;
|
|
277
|
+
adjustPinchPrecision?: boolean;
|
|
278
|
+
/** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
|
|
279
|
+
alpha?: number;
|
|
280
|
+
/** Desired vertical camera angle, this won't be overwritten by the autofocus function */
|
|
281
|
+
beta?: number;
|
|
282
|
+
/** Optional animation for the focusing camera movement */
|
|
283
|
+
animation?: string | AnimationDefinition;
|
|
284
|
+
/** Optional list of geometry to be excluded from consideration */
|
|
285
|
+
exclude?: ExcludedGeometryList;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
type LightDefinitions = {
|
|
289
|
+
[name: string]: LightDefinition | string;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
type LightDefinition = {
|
|
293
|
+
type: 'baked' | 'hemispheric' | 'point' | 'directional' | 'spot';
|
|
294
|
+
path?: string;
|
|
295
|
+
shadowGenerator?: ShadowGeneratorDefinition;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
type ShadowGeneratorDefinition = {
|
|
299
|
+
mapSize: number;
|
|
300
|
+
[others: string]: any;
|
|
301
|
+
/**
|
|
302
|
+
* Further properties like `usePoissonSampling` are set directly on the ShadowGenerator object.
|
|
303
|
+
* [Shadows](https://doc.babylonjs.com/divingDeeper/lights/shadows)
|
|
304
|
+
*/
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
type GroundDefinitions = {
|
|
308
|
+
[ground: string]: GroundDefinition;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
type GroundDefinition = {
|
|
312
|
+
type: 'baked' | 'ground' | 'heightmap';
|
|
313
|
+
meshId?: string;
|
|
314
|
+
url?: string;
|
|
315
|
+
width?: number;
|
|
316
|
+
height?: number;
|
|
317
|
+
subdivisions?: number;
|
|
318
|
+
receiveShadows?: boolean;
|
|
319
|
+
minHeight?: number;
|
|
320
|
+
maxHeight?: number;
|
|
321
|
+
alphaFilter?: number;
|
|
322
|
+
onReady?: any;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
type CameraDefinitions = {
|
|
326
|
+
[camera: string]: CameraDefinition;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
type CameraDefinition = {
|
|
330
|
+
/**
|
|
331
|
+
* `fov` or "Field Of View" defines as it says the view of the scene. Further information about its [theory](https://en.wikipedia.org/wiki/Field_of_view) and [implementation](https://doc.babylonjs.com/typedoc/classes/babylon.camera#fov).
|
|
332
|
+
*/
|
|
333
|
+
fov?: number;
|
|
334
|
+
active?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* `arc` is a default camera position where the 3D-model is the center and the camera rotates around the 3D-model.
|
|
337
|
+
* More Information about `arc` in [ArcRotateCamera](https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera).
|
|
338
|
+
*
|
|
339
|
+
* NOTE: While "baked" camera definitions from a GLB or babylon file can currently not be instatiated within the
|
|
340
|
+
* `Specification`, it's still possible to use them in the viewer.\
|
|
341
|
+
* For the moment all camera definitions inside these files are automatically added to the scene and can be actived
|
|
342
|
+
* using the {@link Viewer.switchCamera} function.\
|
|
343
|
+
* The `newCamera` input has to match the name of the camera node inside the GLB/babylon file.
|
|
344
|
+
*/
|
|
345
|
+
type: 'arc';
|
|
346
|
+
/**
|
|
347
|
+
* `target` overrides `arc`´s position and repositions the camera. The string has the syntax (x?: number, y?: number, z?: number) like [Vector3](https://doc.babylonjs.com/typedoc/classes/babylon.vector3).
|
|
348
|
+
*/
|
|
349
|
+
target?: string;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
type VariantInstanceDefinition = {
|
|
353
|
+
name?: string;
|
|
354
|
+
variant: DottedPathArgument;
|
|
355
|
+
parameters?: ParameterBag;
|
|
356
|
+
tagManagerParameterValues?: TagManagerParameterValue[];
|
|
357
|
+
lazy?: boolean;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
type SetupJson = {
|
|
361
|
+
instances: VariantInstanceDefinition[];
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
type ParameterDeclarations = {
|
|
365
|
+
[name: string]: ParameterDeclaration;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
type ParameterDeclaration = {
|
|
369
|
+
type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector' | 'csl';
|
|
370
|
+
parser?: any;
|
|
371
|
+
options?: ParameterValue[];
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
type ParameterValue = string | number | boolean;
|
|
375
|
+
|
|
376
|
+
type ParameterBag = {
|
|
377
|
+
[name: string]: ParameterValue;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type ParsedParameterBag = {
|
|
381
|
+
[name: string]: any;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
type DottedPathArgument = string | string[] | DottedPath;
|
|
385
|
+
|
|
386
|
+
type ParameterObserverResult = boolean | void;
|
|
387
|
+
|
|
388
|
+
type ParameterObserver = (
|
|
389
|
+
payload: any,
|
|
390
|
+
oldValue: Undefinable<ParameterValue>,
|
|
391
|
+
newValue: ParameterValue
|
|
392
|
+
) => Promise<ParameterObserverResult>;
|
|
393
|
+
|
|
394
|
+
type PlacementDefinitions = {
|
|
395
|
+
[name: string]: PlacementDefinition;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
type PlacementDefinition = {
|
|
399
|
+
position?: string | Vector3;
|
|
400
|
+
alpha?: number;
|
|
401
|
+
beta?: number;
|
|
402
|
+
radius?: number;
|
|
403
|
+
target?: string | Vector3;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
type AnimationDefinitions = {
|
|
407
|
+
[name: string]: AnimationDefinition;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* See [GSAP API Docs](https://greensock.com/docs/v3/GSAP/Tween/vars) for description of `GSAPTWeenVars`.
|
|
412
|
+
*
|
|
413
|
+
* You can use the [GreenSock Ease Visualizer](https://greensock.com/ease-visualizer/) to create an animation of your
|
|
414
|
+
* liking and simply copy the `ease` function shown at the bottom of the visualizer into the `ease` property of your
|
|
415
|
+
* {@link AnimationDefinition}.
|
|
416
|
+
*
|
|
417
|
+
* The `GSAPTWeenVars` are extended by the `shortestWay` property.\
|
|
418
|
+
* This property defines if the camera should move to the target position within the shortest possible distance.\
|
|
419
|
+
* If `shortestWay` is `false`, the camera moves the whole difference between the current camera position and the target
|
|
420
|
+
* position and that could be > 360, which can appear very unconvenient to the operator.\
|
|
421
|
+
* The default value of this flag is `true`.
|
|
422
|
+
*
|
|
423
|
+
* Example usage in {@link SceneJson | SceneJson.animations}:
|
|
424
|
+
*
|
|
425
|
+
* ```js
|
|
426
|
+
* // ...
|
|
427
|
+
* scene: {
|
|
428
|
+
* // ...
|
|
429
|
+
* animations: {
|
|
430
|
+
* DefaultCameraAnimation: {
|
|
431
|
+
* ease: 'Power3.easeInOut',
|
|
432
|
+
* duration: 0.8,
|
|
433
|
+
* },
|
|
434
|
+
* },
|
|
435
|
+
* // ...
|
|
436
|
+
* }
|
|
437
|
+
* // ...
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
type AnimationDefinition = GSAPTweenVars & { shortestWay?: boolean };
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Extends Babylon.js's {@link IExportOptions} by some viewer specific settings
|
|
444
|
+
*/
|
|
445
|
+
interface IExportOptionsExtended extends IExportOptions {
|
|
446
|
+
/**
|
|
447
|
+
* In certain situations multiple meshes in the viewer scene have the same name (e.g. when cloning instances).\
|
|
448
|
+
* If this option is set, the exporter adjusts all mesh names before export to have a unique name.\
|
|
449
|
+
* This is required e.g. if the exported file is used to show an AR scene with the model viewer which requires all
|
|
450
|
+
* meshes to have unique names.
|
|
451
|
+
*/
|
|
452
|
+
createUniqueMeshNames?: boolean;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
type SpecGenerationData = {
|
|
456
|
+
name: string;
|
|
457
|
+
url: string;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Key = Old tag name\
|
|
462
|
+
* Value = New tag name
|
|
463
|
+
*/
|
|
464
|
+
type TagMapping = {
|
|
465
|
+
[tagName: string]: string;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
type TagManagerSubject = {
|
|
469
|
+
tagName?: string;
|
|
470
|
+
nodeName?: string;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* The observer should return `false` in cases where the given value was not actually applied. E.g. when wanting to
|
|
475
|
+
* apply a property on the given `node`s material which doesn't exist at the time the observer is called etc.
|
|
476
|
+
*/
|
|
477
|
+
type TagManagerParameterObserver = (payload: TagManagerParameterObserverPayload) => Promise<ParameterObserverResult>;
|
|
478
|
+
|
|
479
|
+
type TagManagerParameterBag = FuzzyMap<TagManagerSubject, ParameterBag>;
|
|
480
|
+
|
|
481
|
+
type TagManagerParameterObserverBag = Map<string, TagManagerParameterObserver>;
|
|
482
|
+
|
|
483
|
+
type TagManagerParameterObserverPayload = {
|
|
484
|
+
subject: TagManagerSubject;
|
|
485
|
+
nodes: TransformNode[];
|
|
486
|
+
newValue: ParameterValue;
|
|
487
|
+
oldValue: Undefinable<ParameterValue>;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
type TagManagerParameterValue = {
|
|
491
|
+
tagName?: string;
|
|
492
|
+
nodeName?: string;
|
|
493
|
+
parameterName: string;
|
|
494
|
+
value: ParameterValue;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
type NodeNamingStrategyPayload = {
|
|
498
|
+
variantInstance: VariantInstance;
|
|
499
|
+
variant: Variant;
|
|
500
|
+
variantParameterizable: VariantParameterizable;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
type NodeNamingStrategyHandler = (node: TransformNode, payload: NodeNamingStrategyPayload) => string;
|
|
504
|
+
|
|
505
|
+
type NodeNamingStrategy = {
|
|
506
|
+
handler: NodeNamingStrategyHandler;
|
|
507
|
+
payload: NodeNamingStrategyPayload;
|
|
508
|
+
};
|