@xtctwins/tctwins-core 1.1.19 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +4 -4
  2. package/dist/tctwins-core.es5.js +27517 -27493
  3. package/dist/tctwins-core.min.es5.js +4 -4
  4. package/package.json +84 -84
  5. package/types/extras/ContextMenu/ContextMenu.d.ts +127 -127
  6. package/types/extras/ContextMenu/index.d.ts +1 -1
  7. package/types/extras/PointerCircle/PointerCircle.d.ts +51 -51
  8. package/types/extras/PointerCircle/index.d.ts +1 -1
  9. package/types/extras/PointerLens/PointerLens.d.ts +146 -146
  10. package/types/extras/index.d.ts +3 -3
  11. package/types/index.d.ts +3 -3
  12. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +204 -204
  13. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +91 -91
  14. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +125 -125
  15. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +151 -151
  16. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsSimulateMouseControl.d.ts +86 -86
  17. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +124 -124
  18. package/types/plugins/AngleMeasurementsPlugin/index.d.ts +5 -5
  19. package/types/plugins/AnnotationsPlugin/Annotation.d.ts +135 -135
  20. package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +172 -172
  21. package/types/plugins/AnnotationsPlugin/index.d.ts +2 -2
  22. package/types/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.d.ts +148 -148
  23. package/types/plugins/BCFViewpointsPlugin/index.d.ts +1 -1
  24. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +253 -253
  25. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +96 -96
  26. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts +102 -102
  27. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +192 -192
  28. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsSimulateMouseControl.d.ts +83 -83
  29. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +103 -103
  30. package/types/plugins/DistanceMeasurementsPlugin/index.d.ts +5 -5
  31. package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +223 -223
  32. package/types/plugins/FastNavPlugin/index.d.ts +1 -1
  33. package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +142 -142
  34. package/types/plugins/GLTFLoaderPlugin/index.d.ts +1 -1
  35. package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +240 -240
  36. package/types/plugins/LASLoaderPlugin/index.d.ts +1 -1
  37. package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +177 -177
  38. package/types/plugins/NavCubePlugin/index.d.ts +1 -1
  39. package/types/plugins/ObjectEditPlugin/ObjectEditPlugin.d.ts +242 -242
  40. package/types/plugins/ObjectEditPlugin/index.d.ts +1 -1
  41. package/types/plugins/SectionPlanesPlugin/SectionBoxControl.d.ts +36 -36
  42. package/types/plugins/SectionPlanesPlugin/SectionPlanesPlugin.d.ts +186 -186
  43. package/types/plugins/SectionPlanesPlugin/index.d.ts +2 -2
  44. package/types/plugins/SkyboxesPlugin/SkyboxesPlugin.d.ts +66 -66
  45. package/types/plugins/SkyboxesPlugin/index.d.ts +1 -1
  46. package/types/plugins/StoreyViewsPlugin/Storey.d.ts +69 -69
  47. package/types/plugins/StoreyViewsPlugin/StoreyMap.d.ts +41 -41
  48. package/types/plugins/StoreyViewsPlugin/StoreyViewsPlugin.d.ts +180 -180
  49. package/types/plugins/StoreyViewsPlugin/index.d.ts +1 -1
  50. package/types/plugins/TreeViewPlugin/ModelTreeView.d.ts +24 -24
  51. package/types/plugins/TreeViewPlugin/TreeViewNode.d.ts +71 -71
  52. package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +267 -267
  53. package/types/plugins/TreeViewPlugin/index.d.ts +1 -1
  54. package/types/plugins/TreeViewPlugin/renderService.d.ts +128 -128
  55. package/types/plugins/ViewCullPlugin/ViewCullPlugin.d.ts +34 -34
  56. package/types/plugins/ViewCullPlugin/index.d.ts +1 -1
  57. package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +236 -236
  58. package/types/plugins/WebIFCLoaderPlugin/index.d.ts +1 -1
  59. package/types/plugins/XTCLoaderPlugin/XTCLoaderPlugin.d.ts +288 -288
  60. package/types/plugins/XTCLoaderPlugin/index.d.ts +1 -1
  61. package/types/plugins/index.d.ts +30 -30
  62. package/types/viewer/Configs.d.ts +46 -46
  63. package/types/viewer/Plugin.d.ts +69 -69
  64. package/types/viewer/Viewer.d.ts +282 -282
  65. package/types/viewer/index.d.ts +6 -6
  66. package/types/viewer/localization/LocaleService.d.ts +183 -183
  67. package/types/viewer/metadata/IFCObjectDefaults.d.ts +9 -9
  68. package/types/viewer/metadata/MetaModel.d.ts +94 -102
  69. package/types/viewer/metadata/MetaObject.d.ts +74 -74
  70. package/types/viewer/metadata/MetaScene.d.ts +135 -135
  71. package/types/viewer/metadata/Property.d.ts +29 -29
  72. package/types/viewer/metadata/PropertySet.d.ts +31 -31
  73. package/types/viewer/metadata/index.d.ts +6 -6
  74. package/types/viewer/scene/Bitmap/Bitmap.d.ts +255 -255
  75. package/types/viewer/scene/CameraControl/CameraControl.d.ts +777 -777
  76. package/types/viewer/scene/Component.d.ts +155 -155
  77. package/types/viewer/scene/Entity.d.ts +401 -401
  78. package/types/viewer/scene/LineSet/LineSet.d.ts +111 -111
  79. package/types/viewer/scene/camera/Camera.d.ts +364 -364
  80. package/types/viewer/scene/camera/CameraFlightAnimation.d.ts +167 -167
  81. package/types/viewer/scene/camera/CameraPath.d.ts +28 -28
  82. package/types/viewer/scene/camera/CameraPathAnimation.d.ts +95 -95
  83. package/types/viewer/scene/camera/CustomProjection.d.ts +57 -57
  84. package/types/viewer/scene/camera/Frustum.d.ts +166 -166
  85. package/types/viewer/scene/camera/Ortho.d.ts +115 -115
  86. package/types/viewer/scene/camera/Perspective.d.ts +136 -136
  87. package/types/viewer/scene/camera/index.d.ts +4 -4
  88. package/types/viewer/scene/geometry/Geometry.d.ts +7 -7
  89. package/types/viewer/scene/geometry/ReadableGeometry.d.ts +95 -95
  90. package/types/viewer/scene/geometry/VBOGeometry.d.ts +62 -62
  91. package/types/viewer/scene/geometry/builders/buildBoxGeometry.d.ts +21 -21
  92. package/types/viewer/scene/geometry/builders/buildBoxLinesGeometry.d.ts +21 -21
  93. package/types/viewer/scene/geometry/builders/buildCylinderGeometry.d.ts +27 -27
  94. package/types/viewer/scene/geometry/builders/buildGridGeometry.d.ts +17 -17
  95. package/types/viewer/scene/geometry/builders/buildPlaneGeometry.d.ts +21 -21
  96. package/types/viewer/scene/geometry/builders/buildSphereGeometry.d.ts +21 -21
  97. package/types/viewer/scene/geometry/builders/buildTorusGeometry.d.ts +25 -25
  98. package/types/viewer/scene/geometry/builders/buildVectorTextGeometry.d.ts +21 -21
  99. package/types/viewer/scene/geometry/builders/index.d.ts +8 -8
  100. package/types/viewer/scene/geometry/index.d.ts +2 -2
  101. package/types/viewer/scene/index.d.ts +23 -23
  102. package/types/viewer/scene/input/input.d.ts +69 -69
  103. package/types/viewer/scene/lights/AmbientLight.d.ts +19 -19
  104. package/types/viewer/scene/lights/DirLight.d.ts +25 -25
  105. package/types/viewer/scene/lights/Light.d.ts +3 -3
  106. package/types/viewer/scene/lights/PointLight.d.ts +30 -30
  107. package/types/viewer/scene/lights/index.d.ts +2 -2
  108. package/types/viewer/scene/marker/Marker.d.ts +136 -136
  109. package/types/viewer/scene/marker/SpriteMarker.d.ts +185 -185
  110. package/types/viewer/scene/marker/index.d.ts +2 -2
  111. package/types/viewer/scene/materials/EdgeMaterial.d.ts +83 -83
  112. package/types/viewer/scene/materials/EmphasisMaterial.d.ts +241 -241
  113. package/types/viewer/scene/materials/Fresnel.d.ts +148 -148
  114. package/types/viewer/scene/materials/LinesMaterial.d.ts +71 -71
  115. package/types/viewer/scene/materials/Material.d.ts +3 -3
  116. package/types/viewer/scene/materials/PhongMaterial.d.ts +468 -468
  117. package/types/viewer/scene/materials/PointsMaterial.d.ts +206 -206
  118. package/types/viewer/scene/materials/Texture.d.ts +260 -260
  119. package/types/viewer/scene/materials/index.d.ts +6 -6
  120. package/types/viewer/scene/math/Frustum.d.ts +41 -41
  121. package/types/viewer/scene/math/index.d.ts +1 -1
  122. package/types/viewer/scene/math/math.d.ts +104 -104
  123. package/types/viewer/scene/mementos/CameraMemento.d.ts +28 -28
  124. package/types/viewer/scene/mementos/ModelMemento.d.ts +44 -44
  125. package/types/viewer/scene/mementos/ObjectsMemento.d.ts +39 -39
  126. package/types/viewer/scene/mementos/index.d.ts +3 -3
  127. package/types/viewer/scene/mesh/Mesh.d.ts +793 -793
  128. package/types/viewer/scene/mesh/index.d.ts +1 -1
  129. package/types/viewer/scene/models/PerformanceModel/PerformanceModel.d.ts +9 -9
  130. package/types/viewer/scene/models/PerformanceModel/index.d.ts +1 -1
  131. package/types/viewer/scene/models/SceneModel.d.ts +757 -762
  132. package/types/viewer/scene/models/SceneModelEntity.d.ts +417 -417
  133. package/types/viewer/scene/models/SceneModelMesh.d.ts +68 -68
  134. package/types/viewer/scene/models/SceneModelTexture.d.ts +16 -16
  135. package/types/viewer/scene/models/SceneModelTextureSet.d.ts +51 -51
  136. package/types/viewer/scene/models/SceneModelTransform.d.ts +197 -197
  137. package/types/viewer/scene/models/VBOSceneModel/VBOSceneModel.d.ts +7 -7
  138. package/types/viewer/scene/models/index.d.ts +7 -7
  139. package/types/viewer/scene/nodes/Node.d.ts +664 -664
  140. package/types/viewer/scene/nodes/index.d.ts +1 -1
  141. package/types/viewer/scene/postfx/CrossSections.d.ts +42 -42
  142. package/types/viewer/scene/postfx/SAO.d.ts +209 -209
  143. package/types/viewer/scene/scene/Scene.d.ts +1068 -1068
  144. package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +110 -110
  145. package/types/viewer/scene/sectionPlane/index.d.ts +1 -1
  146. package/types/viewer/scene/stats.d.ts +40 -40
  147. package/types/viewer/scene/viewport/Viewport.d.ts +23 -23
  148. package/types/viewer/scene/viewport/index.d.ts +1 -1
  149. package/types/viewer/scene/webgl/PickResult.d.ts +115 -115
  150. package/types/viewer/scene/webgl/index.d.ts +1 -1
  151. package/dist/tctwins-core.umd.js +0 -37
@@ -1,282 +1,282 @@
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/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
- /** Reference of an existing div to contain the canvas */
17
- viewerElement?: HTMLDivElement;
18
- /** Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document. */
19
- keyboardEventsElement?: HTMLElement;
20
- /** ID of existing HTML element to show the {@link Spinner} - internally creates a default element automatically if this is omitted. */
21
- spinnerElementId?: string;
22
- /** The number of times the {@link Viewer.scene} renders per frame. */
23
- passes?: number;
24
- /** When doing multiple passes per frame, specifies if to clear the canvas before each pass (true) or just before the first pass (false). */
25
- clearEachPass?: boolean;
26
- /** Whether or not to preserve the WebGL drawing buffer. This needs to be ````true```` for {@link Viewer.getSnapshot} to work.*/
27
- preserveDrawingBuffer?: boolean;
28
- /** Whether or not the canvas is transparent. */
29
- transparent?: boolean;
30
- /** Whether or not you want alpha composition with premultiplied alpha. Highlighting and selection works best when this is ````false````. */
31
- premultipliedAlpha?: boolean;
32
- /** set resolution scale to make scene unblur on different device*/
33
- resolutionScale: number;
34
- /** When true, expects that all textures and colors are premultiplied gamma. */
35
- gammaInput?: boolean;
36
- /** Whether or not to render with pre-multiplied gama. */
37
- gammaOutput?: boolean;
38
- /** The gamma factor to use when rendering with pre-multiplied gamma. */
39
- gammaFactor?: number;
40
- /** Sets the canvas background color to use when ````transparent```` is false. */
41
- backgroundColor?: number[];
42
- /**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````. */
43
- backgroundColorFromAmbientLight?: boolean;
44
- /** The measurement unit type. */
45
- units?: "meters" | "centimeters" | "millimeters" | "yards" | "feet" | "inches";
46
- /** The number of Real-space units in each World-space coordinate system unit. */
47
- scale?: number;
48
- /** The Real-space 3D origin, in current measurement units, at which the World-space coordinate origin ````[0,0,0]```` sits. */
49
- origin?: number[];
50
- /** Whether to enable Scalable Ambient Obscurance (SAO) effect. See {@link SAO} for more info. */
51
- saoEnabled?: boolean;
52
- /**snapRadius for measurements */
53
- snapRadius?: number;
54
- /** Whether to enable anti-aliasing. */
55
- antialias?: boolean;
56
- /** Whether writing into the depth buffer is enabled or disabled when rendering transparent objects. */
57
- alphaDepthMask?: boolean;
58
- /** Whether to enable {@link Entity.offset}. For best performance, only set this ````true```` when you need to use {@link Entity.offset}. */
59
- entityOffsetsEnabled?: boolean;
60
- /** Whether to enable full-precision accuracy when surface picking with {@link Scene.pick}. */
61
- pickSurfacePrecisionEnabled?: boolean;
62
- /** Whether to enable logarithmic depth buffer. */
63
- logarithmicDepthBufferEnabled?: boolean;
64
- /** Whether to automatically fit the perspective Camera's far clipping plane to the whole Scene on each tick (default true), so that large models are never clipped by the far plane when the camera moves away. Set false to manage Perspective.far manually. */
65
- autoFarPlaneFitEnabled?: boolean;
66
- /** Whether to enable base color texture rendering. */
67
- colorTextureEnabled?: boolean;
68
- /** Whether to enable physically-based rendering. */
69
- pbrEnabled?: boolean;
70
- /** Optional locale-based translation service. */
71
- localeService?: LocaleService;
72
- /** Whether to enable data texture-based (DTX) scene representation within the Viewer. */
73
- dtxEnabled?: boolean;
74
- /** Whether to show edges */
75
- edgesEnabled?: boolean;
76
- /** Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity of SectionPlanes.*/
77
- numCachedSectionPlanes?: number;
78
- /** Whether to use lod */
79
- lodEnabled?: boolean;
80
- /** set canvas offset */
81
- offset?: number[];
82
- /** 世界坐标系矩阵 */
83
- worldAxis?: number[];
84
- };
85
-
86
- /**
87
- * The 3D Viewer at the heart of the xeokit SDK.
88
- */
89
- export declare class Viewer {
90
- /**
91
- * @constructor
92
- * @param {ViewerConfiguration} cfg Viewer configuration.
93
- */
94
- constructor(cfg: ViewerConfiguration);
95
-
96
- /**
97
- * The viewer's locale service.
98
- *
99
- * This is configured via the Viewer's constructor.
100
- *
101
- * By default, this service will be an instance of {@link LocaleService}, which will just return
102
- * null translations for all given strings and phrases.
103
- *
104
- * @property localeService
105
- * @type {LocaleService}
106
- * @since 2.0
107
- */
108
- localeService: LocaleService;
109
-
110
- /**
111
- * The Viewer's {@link Scene}.
112
- * @property scene
113
- * @type {Scene}
114
- */
115
- scene: Scene;
116
-
117
- /**
118
- * Metadata about the {@link Scene} and the models and objects within it.
119
- * @property metaScene
120
- * @type {MetaScene}
121
- * @readonly
122
- */
123
- readonly metaScene: MetaScene;
124
-
125
- /**
126
- * The Viewer's ID.
127
- * @property id
128
- *
129
- * @type {String|Number}
130
- */
131
- id: string | number;
132
-
133
- /**
134
- * The Viewer's {@link Camera}. This is also found on {@link Scene.camera}.
135
- * @property camera
136
- * @type {Camera}
137
- */
138
- camera: Camera;
139
-
140
- /**
141
- * The Viewer's {@link CameraFlightAnimation}, which
142
- * is used to fly the {@link Scene}'s {@link Camera} to given targets.
143
- * @property cameraFlight
144
- * @type {CameraFlightAnimation}
145
- */
146
- cameraFlight: CameraFlightAnimation;
147
-
148
- /**
149
- * The Viewer's {@link CameraControl}, which
150
- * controls the {@link Scene}'s {@link Camera} with mouse, touch and keyboard input.
151
- * @property cameraControl
152
- * @type {CameraControl}
153
- */
154
- cameraControl: CameraControl;
155
-
156
- /**
157
- * Subscribes to an event fired at this Viewer.
158
- *
159
- * @param {String} event The event
160
- * @param {Function} callback Callback fired on the event
161
- */
162
- on(event: string, callback: Function): void;
163
-
164
- /**
165
- * Fires an event at this Viewer.
166
- *
167
- * @param {String} event Event name
168
- * @param {Object} value Event parameters
169
- */
170
- fire(event: string, value: any): void;
171
-
172
- /**
173
- * Logs a message to the JavaScript developer console, prefixed with the ID of this Viewer.
174
- *
175
- * @param {String} msg The message
176
- */
177
- log(msg: string): void;
178
-
179
- /**
180
- * Logs an error message to the JavaScript developer console, prefixed with the ID of this Viewer.
181
- *
182
- * @param {String} msg The error message
183
- */
184
- error(msg: string): void;
185
-
186
- /**
187
- * Installs a Plugin.
188
- *
189
- * @private
190
- */
191
- addPlugin(plugin: Plugin): void;
192
-
193
- /**
194
- * Enter snapshot mode.
195
- *
196
- * Switches rendering to a hidden snapshot canvas.
197
- *
198
- * Exit snapshot mode using {@link Viewer.endSnapshot}.
199
- */
200
- beginSnapshot(): void;
201
-
202
- /**
203
- * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image.
204
- *
205
- * #### Usage:
206
- *
207
- * ````javascript
208
- * const imageData = viewer.getSnapshot({
209
- * width: 500,
210
- * height: 500,
211
- * format: "png"
212
- * });
213
- * ````
214
- * @param {*} [params] Capture options.
215
- * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.
216
- * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.
217
- * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
218
- * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
219
- * @returns {String} String-encoded image data URI.
220
- */
221
- getSnapshot(params: {
222
- width?: number;
223
- height?: number;
224
- format?: "jpeg" | "png" | "bmp";
225
- includeGizmos?: boolean;
226
- }): string;
227
-
228
- /**
229
- * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
230
- * the HTML elements created by various plugins.
231
- *
232
- * The snapshot image is composed of an image of the viewer canvas, overlaid with an image
233
- * of the HTML container element belonging to each installed Viewer plugin. Each container
234
- * element is only rendered once, so it's OK for plugins to share the same container.
235
- *
236
- * #### Usage:
237
- *
238
- * ````javascript
239
- * viewer.getSnapshotWithPlugins({
240
- * width: 500,
241
- * height: 500,
242
- * format: "png"
243
- * }).then((imageData)=>{
244
- *
245
- * });
246
- * ````
247
- * @param {*} [params] Capture options.
248
- * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.
249
- * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.
250
- * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
251
- * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
252
- * @returns {Promise} Promise which returns a string-encoded image data URI.
253
- */
254
- getSnapshotWithPlugins(params: {
255
- width?: number;
256
- height?: number;
257
- format?: "jpeg" | "png" | "bmp";
258
- includeGizmos?: boolean;
259
- }): Promise<String>;
260
-
261
- /**
262
- * Exits snapshot mode.
263
- *
264
- * Switches rendering back to the main canvas.
265
- *
266
- */
267
- endSnapshot(): void;
268
-
269
- /** Destroys this Viewer.
270
- */
271
- destroy(callback?: Function): void;
272
-
273
- /**
274
- * Focus camera on a given model (by ID or instance).
275
- * @param {String|Number|Object} modelId Model id or SceneModel instance
276
- * @param {*} [options] Options: { hideOthers: boolean, duration: number, callback: Function }
277
- */
278
- focusModel(
279
- modelId: string | number | any,
280
- options?: { hideOthers?: boolean; duration?: number; callback?: Function }
281
- ): void;
282
- }
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/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
+ /** Reference of an existing div to contain the canvas */
17
+ viewerElement?: HTMLDivElement;
18
+ /** Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document. */
19
+ keyboardEventsElement?: HTMLElement;
20
+ /** ID of existing HTML element to show the {@link Spinner} - internally creates a default element automatically if this is omitted. */
21
+ spinnerElementId?: string;
22
+ /** The number of times the {@link Viewer.scene} renders per frame. */
23
+ passes?: number;
24
+ /** When doing multiple passes per frame, specifies if to clear the canvas before each pass (true) or just before the first pass (false). */
25
+ clearEachPass?: boolean;
26
+ /** Whether or not to preserve the WebGL drawing buffer. This needs to be ````true```` for {@link Viewer.getSnapshot} to work.*/
27
+ preserveDrawingBuffer?: boolean;
28
+ /** Whether or not the canvas is transparent. */
29
+ transparent?: boolean;
30
+ /** Whether or not you want alpha composition with premultiplied alpha. Highlighting and selection works best when this is ````false````. */
31
+ premultipliedAlpha?: boolean;
32
+ /** set resolution scale to make scene unblur on different device*/
33
+ resolutionScale: number;
34
+ /** When true, expects that all textures and colors are premultiplied gamma. */
35
+ gammaInput?: boolean;
36
+ /** Whether or not to render with pre-multiplied gama. */
37
+ gammaOutput?: boolean;
38
+ /** The gamma factor to use when rendering with pre-multiplied gamma. */
39
+ gammaFactor?: number;
40
+ /** Sets the canvas background color to use when ````transparent```` is false. */
41
+ backgroundColor?: number[];
42
+ /**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````. */
43
+ backgroundColorFromAmbientLight?: boolean;
44
+ /** The measurement unit type. */
45
+ units?: "meters" | "centimeters" | "millimeters" | "yards" | "feet" | "inches";
46
+ /** The number of Real-space units in each World-space coordinate system unit. */
47
+ scale?: number;
48
+ /** The Real-space 3D origin, in current measurement units, at which the World-space coordinate origin ````[0,0,0]```` sits. */
49
+ origin?: number[];
50
+ /** Whether to enable Scalable Ambient Obscurance (SAO) effect. See {@link SAO} for more info. */
51
+ saoEnabled?: boolean;
52
+ /**snapRadius for measurements */
53
+ snapRadius?: number;
54
+ /** Whether to enable anti-aliasing. */
55
+ antialias?: boolean;
56
+ /** Whether writing into the depth buffer is enabled or disabled when rendering transparent objects. */
57
+ alphaDepthMask?: boolean;
58
+ /** Whether to enable {@link Entity.offset}. For best performance, only set this ````true```` when you need to use {@link Entity.offset}. */
59
+ entityOffsetsEnabled?: boolean;
60
+ /** Whether to enable full-precision accuracy when surface picking with {@link Scene.pick}. */
61
+ pickSurfacePrecisionEnabled?: boolean;
62
+ /** Whether to enable logarithmic depth buffer. */
63
+ logarithmicDepthBufferEnabled?: boolean;
64
+ /** Whether to automatically fit the perspective Camera's far clipping plane to the whole Scene on each tick (default true), so that large models are never clipped by the far plane when the camera moves away. Set false to manage Perspective.far manually. */
65
+ autoFarPlaneFitEnabled?: boolean;
66
+ /** Whether to enable base color texture rendering. */
67
+ colorTextureEnabled?: boolean;
68
+ /** Whether to enable physically-based rendering. */
69
+ pbrEnabled?: boolean;
70
+ /** Optional locale-based translation service. */
71
+ localeService?: LocaleService;
72
+ /** Whether to enable data texture-based (DTX) scene representation within the Viewer. */
73
+ dtxEnabled?: boolean;
74
+ /** Whether to show edges */
75
+ edgesEnabled?: boolean;
76
+ /** Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity of SectionPlanes.*/
77
+ numCachedSectionPlanes?: number;
78
+ /** Whether to use lod */
79
+ lodEnabled?: boolean;
80
+ /** set canvas offset */
81
+ offset?: number[];
82
+ /** 世界坐标系矩阵 */
83
+ worldAxis?: number[];
84
+ };
85
+
86
+ /**
87
+ * The 3D Viewer at the heart of the xeokit SDK.
88
+ */
89
+ export declare class Viewer {
90
+ /**
91
+ * @constructor
92
+ * @param {ViewerConfiguration} cfg Viewer configuration.
93
+ */
94
+ constructor(cfg: ViewerConfiguration);
95
+
96
+ /**
97
+ * The viewer's locale service.
98
+ *
99
+ * This is configured via the Viewer's constructor.
100
+ *
101
+ * By default, this service will be an instance of {@link LocaleService}, which will just return
102
+ * null translations for all given strings and phrases.
103
+ *
104
+ * @property localeService
105
+ * @type {LocaleService}
106
+ * @since 2.0
107
+ */
108
+ localeService: LocaleService;
109
+
110
+ /**
111
+ * The Viewer's {@link Scene}.
112
+ * @property scene
113
+ * @type {Scene}
114
+ */
115
+ scene: Scene;
116
+
117
+ /**
118
+ * Metadata about the {@link Scene} and the models and objects within it.
119
+ * @property metaScene
120
+ * @type {MetaScene}
121
+ * @readonly
122
+ */
123
+ readonly metaScene: MetaScene;
124
+
125
+ /**
126
+ * The Viewer's ID.
127
+ * @property id
128
+ *
129
+ * @type {String|Number}
130
+ */
131
+ id: string | number;
132
+
133
+ /**
134
+ * The Viewer's {@link Camera}. This is also found on {@link Scene.camera}.
135
+ * @property camera
136
+ * @type {Camera}
137
+ */
138
+ camera: Camera;
139
+
140
+ /**
141
+ * The Viewer's {@link CameraFlightAnimation}, which
142
+ * is used to fly the {@link Scene}'s {@link Camera} to given targets.
143
+ * @property cameraFlight
144
+ * @type {CameraFlightAnimation}
145
+ */
146
+ cameraFlight: CameraFlightAnimation;
147
+
148
+ /**
149
+ * The Viewer's {@link CameraControl}, which
150
+ * controls the {@link Scene}'s {@link Camera} with mouse, touch and keyboard input.
151
+ * @property cameraControl
152
+ * @type {CameraControl}
153
+ */
154
+ cameraControl: CameraControl;
155
+
156
+ /**
157
+ * Subscribes to an event fired at this Viewer.
158
+ *
159
+ * @param {String} event The event
160
+ * @param {Function} callback Callback fired on the event
161
+ */
162
+ on(event: string, callback: Function): void;
163
+
164
+ /**
165
+ * Fires an event at this Viewer.
166
+ *
167
+ * @param {String} event Event name
168
+ * @param {Object} value Event parameters
169
+ */
170
+ fire(event: string, value: any): void;
171
+
172
+ /**
173
+ * Logs a message to the JavaScript developer console, prefixed with the ID of this Viewer.
174
+ *
175
+ * @param {String} msg The message
176
+ */
177
+ log(msg: string): void;
178
+
179
+ /**
180
+ * Logs an error message to the JavaScript developer console, prefixed with the ID of this Viewer.
181
+ *
182
+ * @param {String} msg The error message
183
+ */
184
+ error(msg: string): void;
185
+
186
+ /**
187
+ * Installs a Plugin.
188
+ *
189
+ * @private
190
+ */
191
+ addPlugin(plugin: Plugin): void;
192
+
193
+ /**
194
+ * Enter snapshot mode.
195
+ *
196
+ * Switches rendering to a hidden snapshot canvas.
197
+ *
198
+ * Exit snapshot mode using {@link Viewer.endSnapshot}.
199
+ */
200
+ beginSnapshot(): void;
201
+
202
+ /**
203
+ * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image.
204
+ *
205
+ * #### Usage:
206
+ *
207
+ * ````javascript
208
+ * const imageData = viewer.getSnapshot({
209
+ * width: 500,
210
+ * height: 500,
211
+ * format: "png"
212
+ * });
213
+ * ````
214
+ * @param {*} [params] Capture options.
215
+ * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.
216
+ * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.
217
+ * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
218
+ * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
219
+ * @returns {String} String-encoded image data URI.
220
+ */
221
+ getSnapshot(params: {
222
+ width?: number;
223
+ height?: number;
224
+ format?: "jpeg" | "png" | "bmp";
225
+ includeGizmos?: boolean;
226
+ }): string;
227
+
228
+ /**
229
+ * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
230
+ * the HTML elements created by various plugins.
231
+ *
232
+ * The snapshot image is composed of an image of the viewer canvas, overlaid with an image
233
+ * of the HTML container element belonging to each installed Viewer plugin. Each container
234
+ * element is only rendered once, so it's OK for plugins to share the same container.
235
+ *
236
+ * #### Usage:
237
+ *
238
+ * ````javascript
239
+ * viewer.getSnapshotWithPlugins({
240
+ * width: 500,
241
+ * height: 500,
242
+ * format: "png"
243
+ * }).then((imageData)=>{
244
+ *
245
+ * });
246
+ * ````
247
+ * @param {*} [params] Capture options.
248
+ * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.
249
+ * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.
250
+ * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
251
+ * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
252
+ * @returns {Promise} Promise which returns a string-encoded image data URI.
253
+ */
254
+ getSnapshotWithPlugins(params: {
255
+ width?: number;
256
+ height?: number;
257
+ format?: "jpeg" | "png" | "bmp";
258
+ includeGizmos?: boolean;
259
+ }): Promise<String>;
260
+
261
+ /**
262
+ * Exits snapshot mode.
263
+ *
264
+ * Switches rendering back to the main canvas.
265
+ *
266
+ */
267
+ endSnapshot(): void;
268
+
269
+ /** Destroys this Viewer.
270
+ */
271
+ destroy(callback?: Function): void;
272
+
273
+ /**
274
+ * Focus camera on a given model (by ID or instance).
275
+ * @param {String|Number|Object} modelId Model id or SceneModel instance
276
+ * @param {*} [options] Options: { hideOthers: boolean, duration: number, callback: Function }
277
+ */
278
+ focusModel(
279
+ modelId: string | number | any,
280
+ options?: { hideOthers?: boolean; duration?: number; callback?: Function }
281
+ ): void;
282
+ }
@@ -1,6 +1,6 @@
1
- export * from "./localization/LocaleService";
2
- export * from "./scene";
3
- export * from "./Plugin";
4
- export * from "./Viewer";
5
- export * from "./Configs";
6
- export * from "./metadata";
1
+ export * from "./localization/LocaleService";
2
+ export * from "./scene";
3
+ export * from "./Plugin";
4
+ export * from "./Viewer";
5
+ export * from "./Configs";
6
+ export * from "./metadata";