@xeokit/xeokit-sdk 2.2.4 → 2.2.5-beta-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/dist/xeokit-sdk.cjs.js +77 -40
- package/dist/xeokit-sdk.es.js +77 -40
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/package.json +4 -2
- package/types/extras/ContextMenu/ContextMenu.d.ts +125 -0
- package/types/extras/ContextMenu/index.d.ts +1 -0
- package/types/extras/index.d.ts +1 -0
- package/types/index.d.ts +3 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +144 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +42 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +85 -0
- package/types/plugins/AngleMeasurementsPlugin/index.d.ts +1 -0
- package/types/plugins/AnnotationsPlugin/Annotation.d.ts +134 -0
- package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +117 -0
- package/types/plugins/AnnotationsPlugin/index.d.ts +1 -0
- package/types/plugins/AxisGizmoPlugin/AxisGizmoPlugin.d.ts +28 -0
- package/types/plugins/AxisGizmoPlugin/index.d.ts +1 -0
- package/types/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.d.ts +146 -0
- package/types/plugins/BCFViewpointsPlugin/index.d.ts +1 -0
- package/types/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.d.ts +81 -0
- package/types/plugins/CityJSONLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +137 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +40 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +120 -0
- package/types/plugins/DistanceMeasurementsPlugin/index.d.ts +1 -0
- package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +203 -0
- package/types/plugins/FastNavPlugin/index.d.ts +1 -0
- package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +140 -0
- package/types/plugins/GLTFLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +146 -0
- package/types/plugins/LASLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +160 -0
- package/types/plugins/NavCubePlugin/index.d.ts +1 -0
- package/types/plugins/OBJLoaderPlugin/OBJLoaderPlugin.d.ts +44 -0
- package/types/plugins/OBJLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/STLLoaderPlugin/STLLoaderPlugin.d.ts +88 -0
- package/types/plugins/STLLoaderPlugin/index.d.ts +2 -0
- package/types/plugins/SectionPlanesPlugin/SectionPlanesPlugin.d.ts +103 -0
- package/types/plugins/SectionPlanesPlugin/index.d.ts +1 -0
- package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +34 -0
- package/types/plugins/SkyboxesPlugin/index.d.ts +1 -0
- package/types/plugins/StoreyViewsPlugin/Storey.d.ts +47 -0
- package/types/plugins/StoreyViewsPlugin/StoreyMap.d.ts +41 -0
- package/types/plugins/StoreyViewsPlugin/StoreyViewsPlugin.d.ts +173 -0
- package/types/plugins/StoreyViewsPlugin/index.d.ts +1 -0
- package/types/plugins/TreeViewPlugin/ModelTreeView.d.ts +24 -0
- package/types/plugins/TreeViewPlugin/TreeViewNode.d.ts +66 -0
- package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +136 -0
- package/types/plugins/TreeViewPlugin/index.d.ts +1 -0
- package/types/plugins/ViewCullPlugin/ViewCullPlugin.d.ts +34 -0
- package/types/plugins/ViewCullPlugin/index.d.ts +1 -0
- package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +230 -0
- package/types/plugins/WebIFCLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +277 -0
- package/types/plugins/XKTLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.d.ts +65 -0
- package/types/plugins/XML3DLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/index.d.ts +34 -0
- package/types/viewer/Configs.d.ts +20 -0
- package/types/viewer/Plugin.d.ts +69 -0
- package/types/viewer/Viewer.d.ts +212 -0
- package/types/viewer/index.d.ts +6 -0
- package/types/viewer/localization/LocaleService.d.ts +176 -0
- package/types/viewer/metadata/IFCObjectDefaults.d.ts +9 -0
- package/types/viewer/metadata/MetaModel.d.ts +65 -0
- package/types/viewer/metadata/MetaObject.d.ts +74 -0
- package/types/viewer/metadata/MetaScene.d.ts +135 -0
- package/types/viewer/metadata/Property.d.ts +29 -0
- package/types/viewer/metadata/PropertySet.d.ts +31 -0
- package/types/viewer/metadata/index.d.ts +6 -0
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +591 -0
- package/types/viewer/scene/Component.d.ts +155 -0
- package/types/viewer/scene/Entity.d.ts +394 -0
- package/types/viewer/scene/PerformanceModel/PerformanceModel.d.ts +605 -0
- package/types/viewer/scene/PerformanceModel/PerformanceNode.d.ts +302 -0
- package/types/viewer/scene/camera/Camera.d.ts +364 -0
- package/types/viewer/scene/camera/CameraFlightAnimation.d.ts +167 -0
- package/types/viewer/scene/camera/CameraPath.d.ts +28 -0
- package/types/viewer/scene/camera/CameraPathAnimation.d.ts +95 -0
- package/types/viewer/scene/camera/CustomProjection.d.ts +57 -0
- package/types/viewer/scene/camera/Frustum.d.ts +166 -0
- package/types/viewer/scene/camera/Ortho.d.ts +115 -0
- package/types/viewer/scene/camera/Perspective.d.ts +136 -0
- package/types/viewer/scene/camera/index.d.ts +4 -0
- package/types/viewer/scene/geometry/Geometry.d.ts +7 -0
- package/types/viewer/scene/geometry/ReadableGeometry.d.ts +95 -0
- package/types/viewer/scene/geometry/index.d.ts +1 -0
- package/types/viewer/scene/index.d.ts +6 -0
- package/types/viewer/scene/marker/Marker.d.ts +136 -0
- package/types/viewer/scene/marker/index.d.ts +1 -0
- package/types/viewer/scene/materials/EdgeMaterial.d.ts +83 -0
- package/types/viewer/scene/materials/EmphasisMaterial.d.ts +241 -0
- package/types/viewer/scene/materials/Fresnel.d.ts +149 -0
- package/types/viewer/scene/materials/LinesMaterial.d.ts +71 -0
- package/types/viewer/scene/materials/Material.d.ts +3 -0
- package/types/viewer/scene/materials/PhongMaterial.d.ts +468 -0
- package/types/viewer/scene/materials/PointsMaterial.d.ts +206 -0
- package/types/viewer/scene/materials/Texture.d.ts +261 -0
- package/types/viewer/scene/materials/index.d.ts +5 -0
- package/types/viewer/scene/math/math.d.ts +36 -0
- package/types/viewer/scene/postfx/SAO.d.ts +209 -0
- package/types/viewer/scene/scene/Scene.d.ts +727 -0
- package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +93 -0
- package/types/viewer/scene/sectionPlane/index.d.ts +1 -0
- package/types/viewer/scene/viewport/Viewport.d.ts +23 -0
- package/types/viewer/scene/webgl/PickResult.d.ts +103 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Plugin, Viewer, PerformanceModel } from "../../viewer";
|
|
2
|
+
|
|
3
|
+
export declare type XML3DLoaderPluginConfiguration = {
|
|
4
|
+
/** Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}. */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Path to the directory that contains the bundled [zip.js](https://gildas-lormeau.github.io/zip.js/) archive */
|
|
7
|
+
workerScriptsPath: string;
|
|
8
|
+
/** What type of materials to create while loading */
|
|
9
|
+
materialType?: "MetallicMaterial" | "SpecularMaterial" | "PhongMaterial";
|
|
10
|
+
/** When true, will create a {@link MetaModel} for the model in {@link MetaScene#metaModels}. */
|
|
11
|
+
createMetaModel?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare type LoadXML3DModel = {
|
|
15
|
+
/** ID to assign to the model's root {@link Entity}, unique among all components in the Viewer's {@link Scene}. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Path to a 3DXML file. */
|
|
18
|
+
src: string;
|
|
19
|
+
/** Whether or not xeokit renders the {@link Entity} with edges emphasized. */
|
|
20
|
+
edges?: boolean;
|
|
21
|
+
/** The model's World-space 3D position. */
|
|
22
|
+
position?: number[];
|
|
23
|
+
/** The model's World-space scale. */
|
|
24
|
+
scale?: number[];
|
|
25
|
+
/** The model's World-space rotation, as Euler angles given in degrees, for each of the X, Y and Z axis. */
|
|
26
|
+
rotation?: number[];
|
|
27
|
+
/** The model's world transform matrix. Overrides the position, scale and rotation parameters. */
|
|
28
|
+
matrix?: number[];
|
|
29
|
+
/** When true, allows visible backfaces, wherever specified in the 3DXML. When false, ignores backfaces. */
|
|
30
|
+
backfaces?: boolean;
|
|
31
|
+
/** When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn. */
|
|
32
|
+
edgeThreshold?: number;
|
|
33
|
+
/** What type of materials to create while loading: "MetallicMaterial" to create {@link MetallicMaterial}s, "SpecularMaterial" to create {@link SpecularMaterial}s or "PhongMaterial" to create {@link PhongMaterial}s. As it loads XML3D's Phong materials, the XMLLoaderPlugin will do its best approximate conversion of those to the specified workflow. */
|
|
34
|
+
materialType?: "MetallicMaterial" | "SpecularMaterial" | "PhongMaterial";
|
|
35
|
+
/** When true, will create a {@link MetaModel} for the model in {@link MetaScene#metaModels}. */
|
|
36
|
+
createMetaModel?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* {@link Viewer} plugin that loads models from [3DXML](https://en.wikipedia.org/wiki/3DXML) files.
|
|
41
|
+
*/
|
|
42
|
+
export declare class XML3DLoaderPlugin extends Plugin {
|
|
43
|
+
/**
|
|
44
|
+
* @constructor
|
|
45
|
+
* @param {Viewer} viewer The Viewer.
|
|
46
|
+
* @param {XML3DLoaderPluginConfiguration} cfg Plugin configuration.
|
|
47
|
+
*/
|
|
48
|
+
constructor(viewer: Viewer, cfg?:XML3DLoaderPluginConfiguration );
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Supported 3DXML schema versions
|
|
52
|
+
* @type {string[]}
|
|
53
|
+
*/
|
|
54
|
+
supportedSchemas: string[];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Loads a 3DXML model from a file into this XML3DLoaderPlugin's {@link Viewer}.
|
|
58
|
+
*
|
|
59
|
+
* Creates a tree of {@link Entity}s within the Viewer's {@link Scene} that represents the model.
|
|
60
|
+
*
|
|
61
|
+
* @param {LoadXML3DModel} params Loading parameters.
|
|
62
|
+
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
63
|
+
*/
|
|
64
|
+
load(params: LoadXML3DModel): PerformanceModel;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./XML3DLoaderPlugin";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./AngleMeasurementsPlugin";
|
|
2
|
+
export * from "./AnnotationsPlugin";
|
|
3
|
+
export * from "./AxisGizmoPlugin";
|
|
4
|
+
export * from "./BCFViewpointsPlugin";
|
|
5
|
+
export * from "./CityJSONLoaderPlugin";
|
|
6
|
+
export * from "./DistanceMeasurementsPlugin";
|
|
7
|
+
export * from "./FastNavPlugin";
|
|
8
|
+
export * from "./GLTFLoaderPlugin";
|
|
9
|
+
export * from "./LASLoaderPlugin";
|
|
10
|
+
export * from "./NavCubePlugin";
|
|
11
|
+
export * from "./OBJLoaderPlugin";
|
|
12
|
+
export * from "./SectionPlanesPlugin";
|
|
13
|
+
export * from "./SkyboxesPlugin";
|
|
14
|
+
export * from "./STLLoaderPlugin";
|
|
15
|
+
export * from "./StoreyViewsPlugin";
|
|
16
|
+
export * from "./TreeViewPlugin";
|
|
17
|
+
export * from "./ViewCullPlugin";
|
|
18
|
+
export * from "./XKTLoaderPlugin";
|
|
19
|
+
export * from "./WebIFCLoaderPlugin";
|
|
20
|
+
export * from "./XML3DLoaderPlugin";
|
|
21
|
+
|
|
22
|
+
export declare type ModelStats = {
|
|
23
|
+
sourceFormat: string;
|
|
24
|
+
schemaVersion: string;
|
|
25
|
+
title: string;
|
|
26
|
+
author: string;
|
|
27
|
+
created: string;
|
|
28
|
+
numMetaObjects: number;
|
|
29
|
+
numPropertySets: number;
|
|
30
|
+
numObjects: number;
|
|
31
|
+
numGeometries: number;
|
|
32
|
+
numTriangles: number;
|
|
33
|
+
numVertices: number;
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages global configurations for all {@link Viewer}s.
|
|
3
|
+
*/
|
|
4
|
+
export declare abstract class Configs {
|
|
5
|
+
/**
|
|
6
|
+
* Sets whether double precision mode is enabled for Viewers.
|
|
7
|
+
*
|
|
8
|
+
* When double precision mode is enabled (default), Viewers will accurately render models that contain
|
|
9
|
+
* double-precision coordinates, without jittering.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
set doublePrecisionEnabled(doublePrecision: boolean);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets whether double precision mode is enabled for all Viewers.
|
|
16
|
+
*
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
get doublePrecisionEnabled(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Viewer } from "./Viewer";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
@desc Base class for {@link Viewer} plugin classes.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class Plugin {
|
|
7
|
+
/**
|
|
8
|
+
* Creates this Plugin and installs it into the given {@link Viewer}.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} id ID for this plugin, unique among all plugins in the viewer.
|
|
11
|
+
* @param {Viewer} viewer The viewer.
|
|
12
|
+
* @param {Object} [cfg] Options
|
|
13
|
+
*/
|
|
14
|
+
constructor(id: string, viewer: Viewer, cfg?: {});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ID for this Plugin, unique within its {@link Viewer}.
|
|
18
|
+
*
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The Viewer that contains this Plugin.
|
|
25
|
+
*
|
|
26
|
+
* @type {Viewer}
|
|
27
|
+
*/
|
|
28
|
+
viewer: Viewer;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Subscribes to an event fired at this Plugin.
|
|
32
|
+
@param {String} event The event
|
|
33
|
+
@param {Function} callback Callback fired on the event
|
|
34
|
+
*/
|
|
35
|
+
on(event: string, callback: ()=> void): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Fires an event at this Plugin.
|
|
39
|
+
@param {String} event The event type name
|
|
40
|
+
@param {Object} value The event parameters
|
|
41
|
+
*/
|
|
42
|
+
fire(event: string, value: any): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.
|
|
46
|
+
*
|
|
47
|
+
* @param {String} msg The error message
|
|
48
|
+
*/
|
|
49
|
+
log(msg: string): void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.
|
|
53
|
+
*
|
|
54
|
+
* @param {String} msg The error message
|
|
55
|
+
*/
|
|
56
|
+
warn(msg: string): void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.
|
|
60
|
+
*
|
|
61
|
+
* @param {String} msg The error message
|
|
62
|
+
*/
|
|
63
|
+
error(msg: string): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Destroys this Plugin and removes it from its {@link Viewer}.
|
|
67
|
+
*/
|
|
68
|
+
destroy(): void;
|
|
69
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { LocaleService } from "./localization/LocaleService";
|
|
2
|
+
import { Scene } from "./scene/scene/Scene";
|
|
3
|
+
import { MetaScene } from "./metadata/MetaScene";
|
|
4
|
+
import { Camera } from "./scene/Camera";
|
|
5
|
+
import { CameraFlightAnimation } from "./scene/Camera/CameraFlightAnimation";
|
|
6
|
+
import { CameraControl } from "./scene/CameraControl/CameraControl";
|
|
7
|
+
import { Plugin } from "./Plugin";
|
|
8
|
+
|
|
9
|
+
export declare type ViewerConfiguration = {
|
|
10
|
+
/** Optional ID for this Viewer, defaults to the ID of {@link Viewer#scene}, which xeokit automatically generates. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** ID of an existing HTML canvas for the {@link Viewer#scene} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID. */
|
|
13
|
+
canvasId?: string;
|
|
14
|
+
/** Reference of an existing HTML canvas for the {@link Viewer#scene} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID. */
|
|
15
|
+
canvasElement?: HTMLCanvasElement;
|
|
16
|
+
/** Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document. */
|
|
17
|
+
keyboardEventsElement?: HTMLElement;
|
|
18
|
+
/** ID of existing HTML element to show the {@link Spinner} - internally creates a default element automatically if this is omitted. */
|
|
19
|
+
spinnerElementId?: string;
|
|
20
|
+
/** The number of times the {@link Viewer#scene} renders per frame. */
|
|
21
|
+
passes?: number;
|
|
22
|
+
/** When doing multiple passes per frame, specifies if to clear the canvas before each pass (true) or just before the first pass (false). */
|
|
23
|
+
clearEachPass?: boolean;
|
|
24
|
+
/** Whether or not to preserve the WebGL drawing buffer. This needs to be ````true```` for {@link Viewer#getSnapshot} to work.*/
|
|
25
|
+
preserveDrawingBuffer?: boolean;
|
|
26
|
+
/** Whether or not the canvas is transparent. */
|
|
27
|
+
transparent?: boolean;
|
|
28
|
+
/** Whether or not you want alpha composition with premultiplied alpha. Highlighting and selection works best when this is ````false````. */
|
|
29
|
+
premultipliedAlpha?: boolean;
|
|
30
|
+
/** When true, expects that all textures and colors are premultiplied gamma. */
|
|
31
|
+
gammaInput?: boolean;
|
|
32
|
+
/** Whether or not to render with pre-multiplied gama. */
|
|
33
|
+
gammaOutput?: boolean;
|
|
34
|
+
/** The gamma factor to use when rendering with pre-multiplied gamma. */
|
|
35
|
+
gammaFactor?: number;
|
|
36
|
+
/** Sets the canvas background color to use when ````transparent```` is false. */
|
|
37
|
+
backgroundColor?: number[];
|
|
38
|
+
/**When ````transparent```` is false, set this ````true```` to derive the canvas background color from {@link AmbientLight#color}, or ````false```` to set the canvas background to ````backgroundColor````. */
|
|
39
|
+
backgroundColorFromAmbientLight?: boolean;
|
|
40
|
+
/** The measurement unit type. */
|
|
41
|
+
units?: "meters" | "centimeters" | "millimeters" | "yards" | "feet" | "inches" ;
|
|
42
|
+
/** The number of Real-space units in each World-space coordinate system unit. */
|
|
43
|
+
scale?: number;
|
|
44
|
+
/** The Real-space 3D origin, in current measurement units, at which the World-space coordinate origin ````[0,0,0]```` sits. */
|
|
45
|
+
origin?: number[];
|
|
46
|
+
/** Whether to enable Scalable Ambient Obscurance (SAO) effect. See {@link SAO} for more info. */
|
|
47
|
+
saoEnabled?: boolean;
|
|
48
|
+
/** Whether to enable anti-aliasing. */
|
|
49
|
+
antialias?: boolean;
|
|
50
|
+
/** Whether writing into the depth buffer is enabled or disabled when rendering transparent objects. */
|
|
51
|
+
alphaDepthMask?: boolean;
|
|
52
|
+
/** Whether to enable {@link Entity#offset}. For best performance, only set this ````true```` when you need to use {@link Entity#offset}. */
|
|
53
|
+
entityOffsetsEnabled?: boolean;
|
|
54
|
+
/** Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. */
|
|
55
|
+
pickSurfacePrecisionEnabled?: boolean;
|
|
56
|
+
/** Whether to enable logarithmic depth buffer. */
|
|
57
|
+
logarithmicDepthBufferEnabled?: boolean;
|
|
58
|
+
/** Whether to enable physically-based rendering. */
|
|
59
|
+
pbrEnabled?: boolean;
|
|
60
|
+
/** Optional locale-based translation service. */
|
|
61
|
+
localeService?: LocaleService;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The 3D Viewer at the heart of the xeokit SDK.
|
|
66
|
+
*/
|
|
67
|
+
export declare class Viewer {
|
|
68
|
+
/**
|
|
69
|
+
* @constructor
|
|
70
|
+
* @param {ViewerConfiguration} cfg Viewer configuration.
|
|
71
|
+
*/
|
|
72
|
+
constructor(cfg: ViewerConfiguration);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The viewer's locale service.
|
|
76
|
+
*
|
|
77
|
+
* This is configured via the Viewer's constructor.
|
|
78
|
+
*
|
|
79
|
+
* By default, this service will be an instance of {@link LocaleService}, which will just return
|
|
80
|
+
* null translations for all given strings and phrases.
|
|
81
|
+
*
|
|
82
|
+
* @property localeService
|
|
83
|
+
* @type {LocaleService}
|
|
84
|
+
* @since 2.0
|
|
85
|
+
*/
|
|
86
|
+
localeService: LocaleService;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The Viewer's {@link Scene}.
|
|
90
|
+
* @property scene
|
|
91
|
+
* @type {Scene}
|
|
92
|
+
*/
|
|
93
|
+
scene: Scene;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Metadata about the {@link Scene} and the models and objects within it.
|
|
97
|
+
* @property metaScene
|
|
98
|
+
* @type {MetaScene}
|
|
99
|
+
* @readonly
|
|
100
|
+
*/
|
|
101
|
+
readonly metaScene: MetaScene;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The Viewer's ID.
|
|
105
|
+
* @property id
|
|
106
|
+
*
|
|
107
|
+
* @type {String|Number}
|
|
108
|
+
*/
|
|
109
|
+
id: string | number;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The Viewer's {@link Camera}. This is also found on {@link Scene#camera}.
|
|
113
|
+
* @property camera
|
|
114
|
+
* @type {Camera}
|
|
115
|
+
*/
|
|
116
|
+
camera: Camera;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The Viewer's {@link CameraFlightAnimation}, which
|
|
120
|
+
* is used to fly the {@link Scene}'s {@link Camera} to given targets.
|
|
121
|
+
* @property cameraFlight
|
|
122
|
+
* @type {CameraFlightAnimation}
|
|
123
|
+
*/
|
|
124
|
+
cameraFlight: CameraFlightAnimation;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The Viewer's {@link CameraControl}, which
|
|
128
|
+
* controls the {@link Scene}'s {@link Camera} with mouse, touch and keyboard input.
|
|
129
|
+
* @property cameraControl
|
|
130
|
+
* @type {CameraControl}
|
|
131
|
+
*/
|
|
132
|
+
cameraControl: CameraControl;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Subscribes to an event fired at this Viewer.
|
|
136
|
+
*
|
|
137
|
+
* @param {String} event The event
|
|
138
|
+
* @param {Function} callback Callback fired on the event
|
|
139
|
+
*/
|
|
140
|
+
on(event: string, callback: Function): void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Fires an event at this Viewer.
|
|
144
|
+
*
|
|
145
|
+
* @param {String} event Event name
|
|
146
|
+
* @param {Object} value Event parameters
|
|
147
|
+
*/
|
|
148
|
+
fire(event: string, value: any): void;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Logs a message to the JavaScript developer console, prefixed with the ID of this Viewer.
|
|
152
|
+
*
|
|
153
|
+
* @param {String} msg The message
|
|
154
|
+
*/
|
|
155
|
+
log(msg: string): void;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Logs an error message to the JavaScript developer console, prefixed with the ID of this Viewer.
|
|
159
|
+
*
|
|
160
|
+
* @param {String} msg The error message
|
|
161
|
+
*/
|
|
162
|
+
error(msg: string): void;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Installs a Plugin.
|
|
166
|
+
*
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
addPlugin(plugin: Plugin);
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Enter snapshot mode.
|
|
173
|
+
*
|
|
174
|
+
* Switches rendering to a hidden snapshot canvas.
|
|
175
|
+
*
|
|
176
|
+
* Exit snapshot mode using {@link Viewer#endSnapshot}.
|
|
177
|
+
*/
|
|
178
|
+
beginSnapshot(): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image.
|
|
182
|
+
*
|
|
183
|
+
* #### Usage:
|
|
184
|
+
*
|
|
185
|
+
* ````javascript
|
|
186
|
+
* const imageData = viewer.getSnapshot({
|
|
187
|
+
* width: 500,
|
|
188
|
+
* height: 500,
|
|
189
|
+
* format: "png"
|
|
190
|
+
* });
|
|
191
|
+
* ````
|
|
192
|
+
* @param {*} [params] Capture options.
|
|
193
|
+
* @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.
|
|
194
|
+
* @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.
|
|
195
|
+
* @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
|
|
196
|
+
* @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
|
|
197
|
+
* @returns {String} String-encoded image data URI.
|
|
198
|
+
*/
|
|
199
|
+
getSnapshot(params?: any): string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Exits snapshot mode.
|
|
203
|
+
*
|
|
204
|
+
* Switches rendering back to the main canvas.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
endSnapshot(): void;
|
|
208
|
+
|
|
209
|
+
/** Destroys this Viewer.
|
|
210
|
+
*/
|
|
211
|
+
destroy(): void;
|
|
212
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export declare type LocaleServiceConfiguration = {
|
|
2
|
+
messages: any;
|
|
3
|
+
locale?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Localization service for a {@link Viewer}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LocaleService {
|
|
10
|
+
/**
|
|
11
|
+
* @constructor
|
|
12
|
+
* @param {LocaleServiceConfiguration} cfg LocaleService configuration
|
|
13
|
+
*/
|
|
14
|
+
constructor(cfg?: LocaleServiceConfiguration);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Replaces the current set of locale translations.
|
|
18
|
+
*
|
|
19
|
+
* * Fires an "updated" event when done.
|
|
20
|
+
* * Automatically refreshes any plugins that depend on the translations.
|
|
21
|
+
* * Does not change the current locale.
|
|
22
|
+
*
|
|
23
|
+
* ## Usage
|
|
24
|
+
*
|
|
25
|
+
* ````javascript
|
|
26
|
+
* viewer.localeService.setMessages({
|
|
27
|
+
* messages: {
|
|
28
|
+
* "en": { // English
|
|
29
|
+
* "NavCube": {
|
|
30
|
+
* "front": "Front",
|
|
31
|
+
* "back": "Back",
|
|
32
|
+
* "top": "Top",
|
|
33
|
+
* "bottom": "Bottom",
|
|
34
|
+
* "left": "Left",
|
|
35
|
+
* "right": "Right"
|
|
36
|
+
* }
|
|
37
|
+
* },
|
|
38
|
+
* "mi": { // Māori
|
|
39
|
+
* "NavCube": {
|
|
40
|
+
* "front": "Mua",
|
|
41
|
+
* "back": "Tuarā",
|
|
42
|
+
* "top": "Runga",
|
|
43
|
+
* "bottom": "Raro",
|
|
44
|
+
* "left": "Mauī",
|
|
45
|
+
* "right": "Tika"
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* ````
|
|
51
|
+
*
|
|
52
|
+
* @param {*} messages The new translations.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
set messages(arg: any);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sets the current locale.
|
|
59
|
+
*
|
|
60
|
+
* * Fires an "updated" event when done.
|
|
61
|
+
* * The given locale does not need to be in the list of available locales returned by {@link LocaleService#locales}, since
|
|
62
|
+
* this method assumes that you may want to load the locales at a later point.
|
|
63
|
+
* * Automatically refreshes any plugins that depend on the translations.
|
|
64
|
+
* * We can then get translations for the locale, if translations have been loaded for it, via {@link LocaleService#translate} and {@link LocaleService#translatePlurals}.
|
|
65
|
+
*
|
|
66
|
+
* @param {String} locale The new current locale.
|
|
67
|
+
*/
|
|
68
|
+
set locale(arg: string);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Gets the current locale.
|
|
72
|
+
*
|
|
73
|
+
* @returns {String} The current locale.
|
|
74
|
+
*/
|
|
75
|
+
get locale(): string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Loads a new set of locale translations, adding them to the existing translations.
|
|
79
|
+
*
|
|
80
|
+
* * Fires an "updated" event when done.
|
|
81
|
+
* * Automatically refreshes any plugins that depend on the translations.
|
|
82
|
+
* * Does not change the current locale.
|
|
83
|
+
*
|
|
84
|
+
* ## Usage
|
|
85
|
+
*
|
|
86
|
+
* ````javascript
|
|
87
|
+
* viewer.localeService.loadMessages({
|
|
88
|
+
* "jp": { // Japanese
|
|
89
|
+
* "NavCube": {
|
|
90
|
+
* "front": "前部",
|
|
91
|
+
* "back": "裏",
|
|
92
|
+
* "top": "上",
|
|
93
|
+
* "bottom": "底",
|
|
94
|
+
* "left": "左",
|
|
95
|
+
* "right": "右"
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* });
|
|
99
|
+
* ````
|
|
100
|
+
*
|
|
101
|
+
* @param {*} messages The new translations.
|
|
102
|
+
*/
|
|
103
|
+
loadMessages(messages?: any): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Clears all locale translations.
|
|
107
|
+
*
|
|
108
|
+
* * Fires an "updated" event when done.
|
|
109
|
+
* * Does not change the current locale.
|
|
110
|
+
* * Automatically refreshes any plugins that depend on the translations, which will cause those
|
|
111
|
+
* plugins to fall back on their internal hard-coded text values, since this method removes all
|
|
112
|
+
* our translations.
|
|
113
|
+
*/
|
|
114
|
+
clearMessages(): void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Gets the list of available locales.
|
|
118
|
+
*
|
|
119
|
+
* These are derived from the currently configured set of translations.
|
|
120
|
+
*
|
|
121
|
+
* @returns {String[]} The list of available locales.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
get locales(): string[];
|
|
125
|
+
/**
|
|
126
|
+
* Translates the given string according to the current locale.
|
|
127
|
+
*
|
|
128
|
+
* Returns null if no translation can be found.
|
|
129
|
+
*
|
|
130
|
+
* @param {String} msg String to translate.
|
|
131
|
+
* @param {*} [args] Extra parameters.
|
|
132
|
+
* @returns {String|null} Translated string if found, else null.
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
translate(msg: string, args?: any): string | null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Translates the given phrase according to the current locale.
|
|
139
|
+
*
|
|
140
|
+
* Returns null if no translation can be found.
|
|
141
|
+
*
|
|
142
|
+
* @param {String} msg Phrase to translate.
|
|
143
|
+
* @param {Number} count The plural number.
|
|
144
|
+
* @param {*} [args] Extra parameters.
|
|
145
|
+
* @returns {String|null} Translated string if found, else null.
|
|
146
|
+
*/
|
|
147
|
+
translatePlurals(msg: string, count: number, args?: any): string | null;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Fires an event on this LocaleService.
|
|
151
|
+
*
|
|
152
|
+
* Notifies existing subscribers to the event, optionally retains the event to give to
|
|
153
|
+
* any subsequent notifications on the event as they are made.
|
|
154
|
+
*
|
|
155
|
+
* @param {String} event The event type name.
|
|
156
|
+
* @param {Object} value The event parameters.
|
|
157
|
+
* @param {Boolean} [forget=false] When true, does not retain for subsequent subscribers.
|
|
158
|
+
*/
|
|
159
|
+
fire(event: string, value: any, forget?: boolean): void;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Subscribes to an event on this LocaleService.
|
|
163
|
+
*
|
|
164
|
+
* @param {String} event The event
|
|
165
|
+
* @param {Function} callback Callback fired on the event
|
|
166
|
+
* @return {String} Handle to the subscription, which may be used to unsubscribe with {@link #off}.
|
|
167
|
+
*/
|
|
168
|
+
on(event: string, callback: Function): string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Cancels an event subscription that was previously made with {@link LocaleService#on}.
|
|
172
|
+
*
|
|
173
|
+
* @param {String} subId Subscription ID
|
|
174
|
+
*/
|
|
175
|
+
off(subId: string): void;
|
|
176
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { MetaScene } from "./MetaScene";
|
|
2
|
+
import { PropertySet } from "./PropertySet";
|
|
3
|
+
import { MetaObject } from "./MetaObject";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Metadata corresponding to an {@link Entity} that represents a model.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MetaModel {
|
|
9
|
+
/**
|
|
10
|
+
* Globally-unique ID.
|
|
11
|
+
*
|
|
12
|
+
* MetaModels are registered by ID in {@link MetaScene#metaModels}.
|
|
13
|
+
*
|
|
14
|
+
* When this MetaModel corresponds to an {@link Entity} then this ID will match the {@link Entity#id}.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
id: string | number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The project ID
|
|
21
|
+
*/
|
|
22
|
+
projectId: string | number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The revision ID, if available.
|
|
26
|
+
*/
|
|
27
|
+
revisionId?: string | number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The model author, if available.
|
|
31
|
+
*/
|
|
32
|
+
author?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The date the model was created, if available.
|
|
36
|
+
*/
|
|
37
|
+
createdAt?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The application that created the model, if available.
|
|
41
|
+
*/
|
|
42
|
+
creatingApplication?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The model schema version, if available.
|
|
46
|
+
*/
|
|
47
|
+
schema?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Metadata on the {@link Scene}.
|
|
51
|
+
*/
|
|
52
|
+
metaScene?: MetaScene;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The {@link PropertySet}s in this MetaModel.
|
|
56
|
+
*/
|
|
57
|
+
propertySets: {
|
|
58
|
+
String: PropertySet;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The root {@link MetaObject} in this MetaModel's composition structure hierarchy.
|
|
63
|
+
*/
|
|
64
|
+
rootMetaObject: MetaObject;
|
|
65
|
+
}
|