@combeenation/3d-viewer 14.0.1-rc1 → 15.0.0
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 +9 -9
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/index.d.ts +51 -62
- package/dist/lib-cjs/index.js +84 -94
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.d.ts +10 -10
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js +131 -131
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js.map +1 -1
- package/dist/lib-cjs/internal/cloning-helper.d.ts +19 -19
- package/dist/lib-cjs/internal/cloning-helper.js +163 -163
- package/dist/lib-cjs/internal/device-helper.d.ts +9 -9
- package/dist/lib-cjs/internal/device-helper.js +24 -24
- package/dist/lib-cjs/internal/geometry-helper.d.ts +21 -21
- package/dist/lib-cjs/internal/geometry-helper.js +145 -145
- package/dist/lib-cjs/internal/metadata-helper.d.ts +26 -26
- package/dist/lib-cjs/internal/metadata-helper.js +50 -50
- package/dist/lib-cjs/internal/paintable-helper.d.ts +40 -40
- package/dist/lib-cjs/internal/paintable-helper.js +234 -286
- package/dist/lib-cjs/internal/paintable-helper.js.map +1 -1
- package/dist/lib-cjs/internal/svg-helper.d.ts +4 -0
- package/dist/lib-cjs/internal/svg-helper.js +67 -0
- package/dist/lib-cjs/internal/svg-helper.js.map +1 -0
- package/dist/lib-cjs/internal/tags-helper.d.ts +12 -12
- package/dist/lib-cjs/internal/tags-helper.js +39 -37
- package/dist/lib-cjs/internal/tags-helper.js.map +1 -1
- package/dist/lib-cjs/internal/texture-parameter-helper.d.ts +37 -0
- package/dist/lib-cjs/internal/texture-parameter-helper.js +287 -0
- package/dist/lib-cjs/internal/texture-parameter-helper.js.map +1 -0
- package/dist/lib-cjs/manager/camera-manager.d.ts +110 -110
- package/dist/lib-cjs/manager/camera-manager.js +209 -206
- package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
- package/dist/lib-cjs/manager/debug-manager.d.ts +60 -60
- package/dist/lib-cjs/manager/debug-manager.js +217 -217
- package/dist/lib-cjs/manager/event-manager.d.ts +52 -52
- package/dist/lib-cjs/manager/event-manager.js +71 -71
- package/dist/lib-cjs/manager/gltf-export-manager.d.ts +75 -84
- package/dist/lib-cjs/manager/gltf-export-manager.js +286 -290
- package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
- package/dist/lib-cjs/manager/material-manager.d.ts +35 -35
- package/dist/lib-cjs/manager/material-manager.js +125 -125
- package/dist/lib-cjs/manager/model-manager.d.ts +145 -145
- package/dist/lib-cjs/manager/model-manager.js +382 -382
- package/dist/lib-cjs/manager/parameter-manager.d.ts +228 -210
- package/dist/lib-cjs/manager/parameter-manager.js +573 -514
- package/dist/lib-cjs/manager/parameter-manager.js.map +1 -1
- package/dist/lib-cjs/manager/scene-manager.d.ts +45 -45
- package/dist/lib-cjs/manager/scene-manager.js +64 -64
- package/dist/lib-cjs/manager/texture-manager.d.ts +12 -12
- package/dist/lib-cjs/manager/texture-manager.js +43 -43
- package/dist/lib-cjs/viewer-error.d.ts +49 -48
- package/dist/lib-cjs/viewer-error.js +61 -60
- package/dist/lib-cjs/viewer-error.js.map +1 -1
- package/dist/lib-cjs/viewer.d.ts +115 -115
- package/dist/lib-cjs/viewer.js +217 -217
- package/dist/lib-cjs/viewer.js.map +1 -1
- package/package.json +94 -91
- package/src/buildinfo.json +3 -3
- package/src/dev.ts +47 -47
- package/src/global-types.d.ts +39 -39
- package/src/index.ts +71 -81
- package/src/internal/cbn-custom-babylon-loader-plugin.ts +159 -159
- package/src/internal/cloning-helper.ts +225 -225
- package/src/internal/device-helper.ts +25 -25
- package/src/internal/geometry-helper.ts +181 -181
- package/src/internal/metadata-helper.ts +63 -63
- package/src/internal/paintable-helper.ts +258 -310
- package/src/internal/svg-helper.ts +52 -0
- package/src/internal/tags-helper.ts +43 -41
- package/src/internal/texture-parameter-helper.ts +353 -0
- package/src/manager/camera-manager.ts +368 -365
- package/src/manager/debug-manager.ts +245 -245
- package/src/manager/event-manager.ts +72 -72
- package/src/manager/gltf-export-manager.ts +356 -357
- package/src/manager/material-manager.ts +135 -135
- package/src/manager/model-manager.ts +458 -458
- package/src/manager/parameter-manager.ts +730 -652
- package/src/manager/scene-manager.ts +101 -101
- package/src/manager/texture-manager.ts +32 -32
- package/src/viewer-error.ts +69 -68
- package/src/viewer.ts +290 -290
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import { AssetContainer, TransformNode, Viewer } from '../index';
|
|
2
|
-
export declare type ModelAssetDefinition = {
|
|
3
|
-
name: string;
|
|
4
|
-
url: string;
|
|
5
|
-
};
|
|
6
|
-
export declare type ModelVisibilityEntry = {
|
|
7
|
-
name: string;
|
|
8
|
-
visible: boolean;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Callback for renaming nodes when cloning nodes in a model
|
|
12
|
-
*/
|
|
13
|
-
export declare type NodeNamingStrategy = (node: TransformNode, newModelName: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Callback for renaming tags when cloning nodes in a model
|
|
16
|
-
*/
|
|
17
|
-
export declare type TagNamingStrategy = (tag: string, newModelName: string) => string;
|
|
18
|
-
export declare type ModelCloneOptions = {
|
|
19
|
-
nodeNamingStrategy
|
|
20
|
-
tagNamingStrategy
|
|
21
|
-
};
|
|
22
|
-
declare type Model = {
|
|
23
|
-
name: string;
|
|
24
|
-
url: string;
|
|
25
|
-
state: ModelAssetState;
|
|
26
|
-
assetContainer: AssetContainer;
|
|
27
|
-
isClone: boolean;
|
|
28
|
-
visibilityCallId?: number;
|
|
29
|
-
};
|
|
30
|
-
declare type ModelAssetState = 'notLoaded' | 'loading' | 'loaded' | 'inScene';
|
|
31
|
-
/**
|
|
32
|
-
* Manager for handling 3d models.\
|
|
33
|
-
* Responsible for loading models and handling their visibility.\
|
|
34
|
-
* Also contains advanced features like model cloning.
|
|
35
|
-
*/
|
|
36
|
-
export declare class ModelManager {
|
|
37
|
-
protected viewer: Viewer;
|
|
38
|
-
/**
|
|
39
|
-
* CAUTION: this has to be in sync with the Combeenation backend!
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
static readonly CBN_FALLBACK_MODEL_ASSET_NAME = "$fallback";
|
|
43
|
-
protected _modelAssets: {
|
|
44
|
-
[name: string]: Model;
|
|
45
|
-
};
|
|
46
|
-
protected _fallbackModelAsset: Model;
|
|
47
|
-
protected _loadModelPromises: {
|
|
48
|
-
[modelName: string]: Promise<void>;
|
|
49
|
-
};
|
|
50
|
-
get modelNames(): string[];
|
|
51
|
-
/**
|
|
52
|
-
* Nested models were targeted with slash notation previously, as Spec couldn't work with dots.
|
|
53
|
-
* Dots were interpreted as inherited model.
|
|
54
|
-
* Now the Hive viewer parameters are returning slash notated asset names, whereas the asset names from the
|
|
55
|
-
* prepacked asset manager are dot notated.
|
|
56
|
-
* This function converts slash to dot notation, so that models can be target with slash and dot notation alike.
|
|
57
|
-
*/
|
|
58
|
-
protected static _replaceSlashes(inputStr: string): string;
|
|
59
|
-
constructor(viewer: Viewer);
|
|
60
|
-
/**
|
|
61
|
-
* Creates content for the fallback model, which is actually just a black cube.
|
|
62
|
-
* This is used for 3d assets that are linked in a data source but not available (yet).
|
|
63
|
-
* The Combeenation backend exchanges the missing 3d asset name with "$fallback", which indicates that we shouldn't
|
|
64
|
-
* throw an error but just show the fallback model instead.
|
|
65
|
-
*
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
createFallbackModel(): void;
|
|
69
|
-
/**
|
|
70
|
-
* Register models for 3d viewer, this is required for each model before it can be loaded/shown.\
|
|
71
|
-
* The "viewer control" inside the Combeenation framework calls this function automatically with all assigned
|
|
72
|
-
* 3d assets.
|
|
73
|
-
*/
|
|
74
|
-
registerModels(modelAssets: ModelAssetDefinition[]): void;
|
|
75
|
-
/**
|
|
76
|
-
* Loads the model and all it's assigned materials.\
|
|
77
|
-
* This function should be used for "eager loading" of models, so that model switching will be instant in the
|
|
78
|
-
* process.\
|
|
79
|
-
* If you don't plan to do this, just use {@link setModelVisibility} as this function will load the model under the
|
|
80
|
-
* hood the first time the model gets visible.
|
|
81
|
-
*/
|
|
82
|
-
loadModel(name: string): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Enables/disables multiple one or multiple models simultaniously.\
|
|
85
|
-
* All required models are loaded before adjusting the visibility to avoid flashing in the 3d scene.
|
|
86
|
-
*
|
|
87
|
-
* @returns Array of changed visibility status, combined with the corresponding model name
|
|
88
|
-
*/
|
|
89
|
-
setModelVisibility(modelVisibility: ModelVisibilityEntry | ModelVisibilityEntry[]): Promise<ModelVisibilityEntry[]>;
|
|
90
|
-
/**
|
|
91
|
-
* Create a clone of an existing model.\
|
|
92
|
-
* Only the geometry (meshes, transform nodes) gets cloned, as materials are typically shared across the whole scene.
|
|
93
|
-
*
|
|
94
|
-
* @param show show model immediately after cloning
|
|
95
|
-
* @param options additional options for the cloning procedure, like renaming algorithms
|
|
96
|
-
*/
|
|
97
|
-
cloneModel(name: string, newModelName: string, show?: boolean, options?: ModelCloneOptions): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Removes a cloned model from the scene and from the internal model storage.\
|
|
100
|
-
* Deleted clones can not be shown again.
|
|
101
|
-
*/
|
|
102
|
-
deleteClonedModel(name: string): void;
|
|
103
|
-
/**
|
|
104
|
-
* Removes all cloned models from the scene and the internal model storage.
|
|
105
|
-
*/
|
|
106
|
-
deleteAllClonedModels(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Loads and returns the asset container of a certain model.\
|
|
109
|
-
* This can be used to access the models content without having to add it to the scene.\
|
|
110
|
-
* A typical use case is to clone or instantiate a node from a "library" model.
|
|
111
|
-
*/
|
|
112
|
-
getAssetContainerOfModel(name: string): Promise<AssetContainer>;
|
|
113
|
-
/**
|
|
114
|
-
* Get model by name
|
|
115
|
-
*/
|
|
116
|
-
protected _getModel(name: string): Model | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Load model into scene, but don't show it immediately
|
|
119
|
-
*/
|
|
120
|
-
protected _loadModel(model: Model): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Apply parameter to the model in the asset container.
|
|
123
|
-
* This is typically done before the model is added to the scene to avoid changes on the visible model, which ensures
|
|
124
|
-
* a smooth model switch behaviour.
|
|
125
|
-
*/
|
|
126
|
-
protected _prepareModelForScene(model: Model): Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* Add assets of asset container to scene, do the scene preparation if required.
|
|
129
|
-
* CAUTION: model is expected to be in the correct loading state already.
|
|
130
|
-
*
|
|
131
|
-
* @param skipPreparation optionally skip applying parameter values to model before showing it
|
|
132
|
-
* (see {@link _prepareModelForScene})
|
|
133
|
-
*/
|
|
134
|
-
protected _showModel(model: Model, skipPreparation?: boolean): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Remove assets of asset container from scene
|
|
137
|
-
*/
|
|
138
|
-
protected _hideModel(model: Model): void;
|
|
139
|
-
/**
|
|
140
|
-
* Creates and assigns each "deferred" material to the corresponding mesh, if the mesh is visible.
|
|
141
|
-
* Model should be ready to use immediately after this function has done it's job.
|
|
142
|
-
*/
|
|
143
|
-
protected _applyDeferredMaterialsForAllVisibleMeshes(model: Model): Promise<void>;
|
|
144
|
-
}
|
|
145
|
-
export {};
|
|
1
|
+
import { AssetContainer, TransformNode, Viewer } from '../index';
|
|
2
|
+
export declare type ModelAssetDefinition = {
|
|
3
|
+
name: string;
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type ModelVisibilityEntry = {
|
|
7
|
+
name: string;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Callback for renaming nodes when cloning nodes in a model
|
|
12
|
+
*/
|
|
13
|
+
export declare type NodeNamingStrategy = (node: TransformNode, newModelName: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Callback for renaming tags when cloning nodes in a model
|
|
16
|
+
*/
|
|
17
|
+
export declare type TagNamingStrategy = (tag: string, newModelName: string) => string;
|
|
18
|
+
export declare type ModelCloneOptions = {
|
|
19
|
+
nodeNamingStrategy?: NodeNamingStrategy;
|
|
20
|
+
tagNamingStrategy?: TagNamingStrategy;
|
|
21
|
+
};
|
|
22
|
+
declare type Model = {
|
|
23
|
+
name: string;
|
|
24
|
+
url: string;
|
|
25
|
+
state: ModelAssetState;
|
|
26
|
+
assetContainer: AssetContainer;
|
|
27
|
+
isClone: boolean;
|
|
28
|
+
visibilityCallId?: number;
|
|
29
|
+
};
|
|
30
|
+
declare type ModelAssetState = 'notLoaded' | 'loading' | 'loaded' | 'inScene';
|
|
31
|
+
/**
|
|
32
|
+
* Manager for handling 3d models.\
|
|
33
|
+
* Responsible for loading models and handling their visibility.\
|
|
34
|
+
* Also contains advanced features like model cloning.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ModelManager {
|
|
37
|
+
protected viewer: Viewer;
|
|
38
|
+
/**
|
|
39
|
+
* CAUTION: this has to be in sync with the Combeenation backend!
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
static readonly CBN_FALLBACK_MODEL_ASSET_NAME = "$fallback";
|
|
43
|
+
protected _modelAssets: {
|
|
44
|
+
[name: string]: Model;
|
|
45
|
+
};
|
|
46
|
+
protected _fallbackModelAsset: Model;
|
|
47
|
+
protected _loadModelPromises: {
|
|
48
|
+
[modelName: string]: Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
get modelNames(): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Nested models were targeted with slash notation previously, as Spec couldn't work with dots.
|
|
53
|
+
* Dots were interpreted as inherited model.
|
|
54
|
+
* Now the Hive viewer parameters are returning slash notated asset names, whereas the asset names from the
|
|
55
|
+
* prepacked asset manager are dot notated.
|
|
56
|
+
* This function converts slash to dot notation, so that models can be target with slash and dot notation alike.
|
|
57
|
+
*/
|
|
58
|
+
protected static _replaceSlashes(inputStr: string): string;
|
|
59
|
+
constructor(viewer: Viewer);
|
|
60
|
+
/**
|
|
61
|
+
* Creates content for the fallback model, which is actually just a black cube.
|
|
62
|
+
* This is used for 3d assets that are linked in a data source but not available (yet).
|
|
63
|
+
* The Combeenation backend exchanges the missing 3d asset name with "$fallback", which indicates that we shouldn't
|
|
64
|
+
* throw an error but just show the fallback model instead.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
createFallbackModel(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Register models for 3d viewer, this is required for each model before it can be loaded/shown.\
|
|
71
|
+
* The "viewer control" inside the Combeenation framework calls this function automatically with all assigned
|
|
72
|
+
* 3d assets.
|
|
73
|
+
*/
|
|
74
|
+
registerModels(modelAssets: ModelAssetDefinition[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Loads the model and all it's assigned materials.\
|
|
77
|
+
* This function should be used for "eager loading" of models, so that model switching will be instant in the
|
|
78
|
+
* process.\
|
|
79
|
+
* If you don't plan to do this, just use {@link setModelVisibility} as this function will load the model under the
|
|
80
|
+
* hood the first time the model gets visible.
|
|
81
|
+
*/
|
|
82
|
+
loadModel(name: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Enables/disables multiple one or multiple models simultaniously.\
|
|
85
|
+
* All required models are loaded before adjusting the visibility to avoid flashing in the 3d scene.
|
|
86
|
+
*
|
|
87
|
+
* @returns Array of changed visibility status, combined with the corresponding model name
|
|
88
|
+
*/
|
|
89
|
+
setModelVisibility(modelVisibility: ModelVisibilityEntry | ModelVisibilityEntry[]): Promise<ModelVisibilityEntry[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Create a clone of an existing model.\
|
|
92
|
+
* Only the geometry (meshes, transform nodes) gets cloned, as materials are typically shared across the whole scene.
|
|
93
|
+
*
|
|
94
|
+
* @param show show model immediately after cloning
|
|
95
|
+
* @param options additional options for the cloning procedure, like renaming algorithms
|
|
96
|
+
*/
|
|
97
|
+
cloneModel(name: string, newModelName: string, show?: boolean, options?: ModelCloneOptions): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Removes a cloned model from the scene and from the internal model storage.\
|
|
100
|
+
* Deleted clones can not be shown again.
|
|
101
|
+
*/
|
|
102
|
+
deleteClonedModel(name: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Removes all cloned models from the scene and the internal model storage.
|
|
105
|
+
*/
|
|
106
|
+
deleteAllClonedModels(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Loads and returns the asset container of a certain model.\
|
|
109
|
+
* This can be used to access the models content without having to add it to the scene.\
|
|
110
|
+
* A typical use case is to clone or instantiate a node from a "library" model.
|
|
111
|
+
*/
|
|
112
|
+
getAssetContainerOfModel(name: string): Promise<AssetContainer>;
|
|
113
|
+
/**
|
|
114
|
+
* Get model by name
|
|
115
|
+
*/
|
|
116
|
+
protected _getModel(name: string): Model | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Load model into scene, but don't show it immediately
|
|
119
|
+
*/
|
|
120
|
+
protected _loadModel(model: Model): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Apply parameter to the model in the asset container.
|
|
123
|
+
* This is typically done before the model is added to the scene to avoid changes on the visible model, which ensures
|
|
124
|
+
* a smooth model switch behaviour.
|
|
125
|
+
*/
|
|
126
|
+
protected _prepareModelForScene(model: Model): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Add assets of asset container to scene, do the scene preparation if required.
|
|
129
|
+
* CAUTION: model is expected to be in the correct loading state already.
|
|
130
|
+
*
|
|
131
|
+
* @param skipPreparation optionally skip applying parameter values to model before showing it
|
|
132
|
+
* (see {@link _prepareModelForScene})
|
|
133
|
+
*/
|
|
134
|
+
protected _showModel(model: Model, skipPreparation?: boolean): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Remove assets of asset container from scene
|
|
137
|
+
*/
|
|
138
|
+
protected _hideModel(model: Model): void;
|
|
139
|
+
/**
|
|
140
|
+
* Creates and assigns each "deferred" material to the corresponding mesh, if the mesh is visible.
|
|
141
|
+
* Model should be ready to use immediately after this function has done it's job.
|
|
142
|
+
*/
|
|
143
|
+
protected _applyDeferredMaterialsForAllVisibleMeshes(model: Model): Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
export {};
|