@reall3d/reall3dviewer 0.1.3 → 0.1.6
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/pkg.d.ts +110 -99
- package/dist/pkg.js +2531 -1915
- package/dist/pkg.umd.cjs +324 -280
- package/package.json +1 -1
package/dist/pkg.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { AmbientLight } from 'three';
|
|
|
2
2
|
import { DirectionalLight } from 'three';
|
|
3
3
|
import { EventDispatcher } from 'three';
|
|
4
4
|
import { MapControls } from 'three/examples/jsm/controls/MapControls.js';
|
|
5
|
-
import { Matrix4 } from 'three';
|
|
6
5
|
import { Mesh } from 'three';
|
|
6
|
+
import { Object3D } from 'three';
|
|
7
7
|
import { OrbitControls } from 'three/examples/jsm/Addons.js';
|
|
8
8
|
import { PerspectiveCamera } from 'three';
|
|
9
9
|
import { Renderer } from 'three';
|
|
@@ -11,6 +11,13 @@ import { Scene } from 'three';
|
|
|
11
11
|
import * as tt from '@gotoeasy/three-tile';
|
|
12
12
|
import { WebGLRenderer } from 'three';
|
|
13
13
|
|
|
14
|
+
declare class BoundBox extends Object3D {
|
|
15
|
+
private boxLines;
|
|
16
|
+
constructor(minX?: number, minY?: number, minZ?: number, maxX?: number, maxY?: number, maxZ?: number);
|
|
17
|
+
update(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number, show?: boolean): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
/**
|
|
15
22
|
* 相机参数信息
|
|
16
23
|
*/
|
|
@@ -56,73 +63,77 @@ declare class Events {
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
/**
|
|
59
|
-
*
|
|
66
|
+
* Metadata
|
|
60
67
|
*/
|
|
61
68
|
export declare interface MetaData {
|
|
62
|
-
/**
|
|
69
|
+
/** Name */
|
|
63
70
|
name?: string;
|
|
64
|
-
/**
|
|
71
|
+
/** Version */
|
|
65
72
|
version?: string;
|
|
66
|
-
/**
|
|
73
|
+
/** Update date (YYYYMMDD) */
|
|
67
74
|
updateDate?: number;
|
|
68
|
-
/**
|
|
75
|
+
/** Enable auto-rotation */
|
|
69
76
|
autoRotate?: boolean;
|
|
70
|
-
/**
|
|
77
|
+
/** Enable debug mode */
|
|
71
78
|
debugMode?: boolean;
|
|
72
|
-
/**
|
|
79
|
+
/** Enable point-cloud rendering */
|
|
73
80
|
pointcloudMode?: boolean;
|
|
74
|
-
/**
|
|
81
|
+
/** Maximum render count for mobile */
|
|
75
82
|
maxRenderCountOfMobile?: number;
|
|
76
|
-
/** PC
|
|
83
|
+
/** Maximum render count for PC */
|
|
77
84
|
maxRenderCountOfPc?: number;
|
|
78
|
-
/**
|
|
85
|
+
/** Maximum download count for mobile splats */
|
|
79
86
|
mobileDownloadLimitSplatCount?: number;
|
|
80
|
-
/** PC
|
|
87
|
+
/** Maximum download count for PC splats */
|
|
81
88
|
pcDownloadLimitSplatCount?: number;
|
|
82
|
-
/**
|
|
89
|
+
/** Meter scale factor */
|
|
83
90
|
meterScale?: number;
|
|
84
|
-
/**
|
|
91
|
+
/** Text watermark */
|
|
85
92
|
watermark?: string;
|
|
86
|
-
/**
|
|
93
|
+
/** Display watermark */
|
|
87
94
|
showWatermark?: boolean;
|
|
88
|
-
/**
|
|
95
|
+
/** Display bounding box */
|
|
96
|
+
showBoundBox?: boolean;
|
|
97
|
+
/** Camera parameters */
|
|
89
98
|
cameraInfo?: CameraInfo;
|
|
90
|
-
/**
|
|
99
|
+
/** Annotations */
|
|
91
100
|
marks?: any[];
|
|
92
|
-
/**
|
|
101
|
+
/** Fly-through camera positions */
|
|
93
102
|
flyPositions?: number[];
|
|
94
|
-
/**
|
|
103
|
+
/** Fly-through camera look-at points */
|
|
95
104
|
flyTargets?: number[];
|
|
96
|
-
/**
|
|
105
|
+
/** Enable particle loading effect (small scenes) */
|
|
106
|
+
particleMode?: boolean;
|
|
107
|
+
/** Auto-cut count */
|
|
97
108
|
autoCut?: number;
|
|
98
|
-
/**
|
|
109
|
+
/** Transformation matrix */
|
|
99
110
|
transform?: number[];
|
|
100
|
-
/**
|
|
111
|
+
/** Geolocation (EPSG:4326 WGS 84) */
|
|
101
112
|
WGS84?: number[];
|
|
102
|
-
/**
|
|
113
|
+
/** Model URL */
|
|
103
114
|
url?: string;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
/**
|
|
107
|
-
*
|
|
118
|
+
* Gaussian Model Options
|
|
108
119
|
*/
|
|
109
120
|
export declare interface ModelOptions {
|
|
110
121
|
/**
|
|
111
|
-
*
|
|
122
|
+
* Model URL
|
|
112
123
|
*/
|
|
113
124
|
url: string;
|
|
114
125
|
/**
|
|
115
|
-
*
|
|
126
|
+
* Model format (ply | splat | spx | spz | obj), auto-detected by default
|
|
116
127
|
*/
|
|
117
|
-
format?: 'ply' | 'splat' | 'spx' | 'spz';
|
|
128
|
+
format?: 'ply' | 'splat' | 'spx' | 'spz' | 'obj';
|
|
118
129
|
/**
|
|
119
|
-
*
|
|
130
|
+
* Whether to force re-download
|
|
120
131
|
*/
|
|
121
132
|
fetchReload?: boolean;
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
/**
|
|
125
|
-
*
|
|
136
|
+
* Built-in Map viewer with Gaussian Splatting model support
|
|
126
137
|
*/
|
|
127
138
|
export declare class Reall3dMapViewer extends EventDispatcher<tt.plugin.GLViewerEventMap> {
|
|
128
139
|
scene: Scene;
|
|
@@ -152,43 +163,45 @@ export declare class Reall3dMapViewer extends EventDispatcher<tt.plugin.GLViewer
|
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
/**
|
|
155
|
-
*
|
|
166
|
+
* Configuration options for Reall3dMapViewer
|
|
156
167
|
*/
|
|
157
168
|
export declare interface Reall3dMapViewerOptions {
|
|
158
169
|
/**
|
|
159
|
-
*
|
|
170
|
+
* Container element or its selector (default: '#map').
|
|
171
|
+
* Will be automatically created if not found.
|
|
160
172
|
*/
|
|
161
173
|
root?: HTMLElement | string;
|
|
162
174
|
/**
|
|
163
|
-
*
|
|
175
|
+
* Enable keyboard controls (default: false)
|
|
164
176
|
*/
|
|
165
177
|
enableKeyboard?: boolean;
|
|
166
178
|
/**
|
|
167
|
-
*
|
|
179
|
+
* Minimum panning boundaries (default: [-20000, 0.1, -60000])
|
|
168
180
|
*/
|
|
169
181
|
minPan?: number[];
|
|
170
182
|
/**
|
|
171
|
-
*
|
|
183
|
+
* Maximum panning boundaries (default: [50000, 10000, 0])
|
|
172
184
|
*/
|
|
173
185
|
maxPan?: number[];
|
|
174
186
|
/**
|
|
175
|
-
*
|
|
187
|
+
* Background color (default: '#dbf0ff')
|
|
176
188
|
*/
|
|
177
189
|
background?: string;
|
|
178
190
|
/**
|
|
179
|
-
*
|
|
191
|
+
* Debug mode flag (default: false in production)
|
|
180
192
|
*/
|
|
181
193
|
debugMode?: boolean;
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
/**
|
|
185
|
-
*
|
|
197
|
+
* Built-in Gaussian Splatting model viewer
|
|
186
198
|
*/
|
|
187
199
|
export declare class Reall3dViewer {
|
|
188
200
|
private disposed;
|
|
189
201
|
private splatMesh;
|
|
190
202
|
private events;
|
|
191
203
|
private updateTime;
|
|
204
|
+
private metaMatrix;
|
|
192
205
|
needUpdate: boolean;
|
|
193
206
|
constructor(opts?: Reall3dViewerOptions);
|
|
194
207
|
private init;
|
|
@@ -237,151 +250,152 @@ export declare class Reall3dViewer {
|
|
|
237
250
|
}
|
|
238
251
|
|
|
239
252
|
/**
|
|
240
|
-
*
|
|
253
|
+
* Configuration options for Reall3dViewer
|
|
241
254
|
*/
|
|
242
255
|
export declare interface Reall3dViewerOptions {
|
|
243
256
|
/**
|
|
244
|
-
*
|
|
257
|
+
* Specify a custom renderer instance. If undefined, one will be created automatically.
|
|
245
258
|
*/
|
|
246
259
|
renderer?: Renderer | undefined;
|
|
247
260
|
/**
|
|
248
|
-
*
|
|
261
|
+
* Specify a custom scene instance. If undefined, one will be created automatically.
|
|
249
262
|
*/
|
|
250
263
|
scene?: Scene | undefined;
|
|
251
264
|
/**
|
|
252
|
-
*
|
|
265
|
+
* Specify a custom camera instance. If undefined, one will be created automatically.
|
|
253
266
|
*/
|
|
254
267
|
camera?: PerspectiveCamera | undefined;
|
|
255
268
|
/**
|
|
256
|
-
*
|
|
269
|
+
* Orbit controls instance
|
|
257
270
|
*/
|
|
258
271
|
controls?: OrbitControls;
|
|
259
272
|
/**
|
|
260
|
-
*
|
|
273
|
+
* Renderer event manager
|
|
261
274
|
*/
|
|
262
275
|
viewerEvents?: Events | undefined;
|
|
263
276
|
/**
|
|
264
|
-
*
|
|
277
|
+
* Debug mode flag. Defaults to false in production.
|
|
265
278
|
*/
|
|
266
279
|
debugMode?: boolean | undefined;
|
|
267
280
|
/**
|
|
268
|
-
*
|
|
281
|
+
* Large scene mode flag. Cannot be modified after initialization.
|
|
269
282
|
*/
|
|
270
283
|
bigSceneMode?: boolean;
|
|
271
284
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
285
|
+
* Point cloud rendering mode. Defaults to true.
|
|
286
|
+
* Can be dynamically updated via viewer.options()
|
|
274
287
|
*/
|
|
275
288
|
pointcloudMode?: boolean | undefined;
|
|
276
289
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
290
|
+
* Maximum renderable Gaussian points count for mobile devices.
|
|
291
|
+
* Can be dynamically updated via viewer.options()
|
|
279
292
|
*/
|
|
280
293
|
maxRenderCountOfMobile?: number | undefined;
|
|
281
294
|
/**
|
|
282
|
-
* PC
|
|
283
|
-
*
|
|
295
|
+
* Maximum renderable Gaussian points count for PC.
|
|
296
|
+
* Can be dynamically updated via viewer.options()
|
|
284
297
|
*/
|
|
285
298
|
maxRenderCountOfPc?: number | undefined;
|
|
286
299
|
/**
|
|
287
|
-
*
|
|
300
|
+
* Color brightness factor. Defaults to 1.1.
|
|
288
301
|
*/
|
|
289
302
|
lightFactor?: number | undefined;
|
|
290
303
|
/**
|
|
291
|
-
*
|
|
304
|
+
* Container element or its selector. Defaults to '#gsviewer'.
|
|
305
|
+
* If no container is found when creating canvas, one will be automatically created under body.
|
|
292
306
|
*/
|
|
293
307
|
root?: HTMLElement | string | undefined;
|
|
294
308
|
/**
|
|
295
|
-
*
|
|
309
|
+
* Camera field of view. Defaults to 45.
|
|
296
310
|
*/
|
|
297
311
|
fov?: number | undefined;
|
|
298
312
|
/**
|
|
299
|
-
*
|
|
313
|
+
* Camera near clipping plane. Defaults to 0.1.
|
|
300
314
|
*/
|
|
301
315
|
near?: number | undefined;
|
|
302
316
|
/**
|
|
303
|
-
*
|
|
317
|
+
* Camera far clipping plane. Defaults to 1000.
|
|
304
318
|
*/
|
|
305
319
|
far?: number | undefined;
|
|
306
320
|
/**
|
|
307
|
-
*
|
|
321
|
+
* Camera position. Defaults to [0, -5, 15].
|
|
308
322
|
*/
|
|
309
323
|
position?: number[] | undefined;
|
|
310
324
|
/**
|
|
311
|
-
*
|
|
325
|
+
* Camera look-at target. Defaults to [0, 0, 0].
|
|
312
326
|
*/
|
|
313
327
|
lookAt?: number[] | undefined;
|
|
314
328
|
/**
|
|
315
|
-
*
|
|
329
|
+
* Camera up vector. Defaults to [0, -1, 0].
|
|
316
330
|
*/
|
|
317
331
|
lookUp?: number[] | undefined;
|
|
318
332
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
333
|
+
* Auto-rotation flag. Defaults to true.
|
|
334
|
+
* Can be dynamically updated via viewer.options()
|
|
321
335
|
*/
|
|
322
336
|
autoRotate?: boolean | undefined;
|
|
323
337
|
/**
|
|
324
|
-
*
|
|
338
|
+
* Damping effect flag. Defaults to true.
|
|
325
339
|
*/
|
|
326
340
|
enableDamping?: boolean | undefined;
|
|
327
341
|
/**
|
|
328
|
-
*
|
|
342
|
+
* Zoom control flag. Defaults to true.
|
|
329
343
|
*/
|
|
330
344
|
enableZoom?: boolean | undefined;
|
|
331
345
|
/**
|
|
332
|
-
*
|
|
346
|
+
* Rotation control flag. Defaults to true.
|
|
333
347
|
*/
|
|
334
348
|
enableRotate?: boolean | undefined;
|
|
335
349
|
/**
|
|
336
|
-
*
|
|
350
|
+
* Pan control flag. Defaults to true.
|
|
337
351
|
*/
|
|
338
352
|
enablePan?: boolean | undefined;
|
|
339
353
|
/**
|
|
340
|
-
*
|
|
354
|
+
* Minimum camera distance
|
|
341
355
|
*/
|
|
342
356
|
minDistance?: number | undefined;
|
|
343
357
|
/**
|
|
344
|
-
*
|
|
358
|
+
* Maximum camera distance
|
|
345
359
|
*/
|
|
346
360
|
maxDistance?: number | undefined;
|
|
347
361
|
/**
|
|
348
|
-
*
|
|
362
|
+
* Minimum polar angle (vertical rotation limit)
|
|
349
363
|
*/
|
|
350
364
|
minPolarAngle?: number | undefined;
|
|
351
365
|
/**
|
|
352
|
-
*
|
|
366
|
+
* Maximum polar angle (vertical rotation limit)
|
|
353
367
|
*/
|
|
354
368
|
maxPolarAngle?: number | undefined;
|
|
355
369
|
/**
|
|
356
|
-
*
|
|
370
|
+
* Keyboard controls flag. Defaults to true.
|
|
357
371
|
*/
|
|
358
372
|
enableKeyboard?: boolean | undefined;
|
|
359
373
|
/**
|
|
360
|
-
*
|
|
374
|
+
* Annotation mode flag. Defaults to false.
|
|
361
375
|
*/
|
|
362
376
|
markMode?: boolean | undefined;
|
|
363
377
|
/**
|
|
364
|
-
*
|
|
378
|
+
* Annotation type (point/lines/plans/distance/area/circle)
|
|
365
379
|
*/
|
|
366
380
|
markType?: 'point' | 'lines' | 'plans' | 'distance' | 'area' | 'circle' | undefined;
|
|
367
381
|
/**
|
|
368
|
-
*
|
|
382
|
+
* Annotation visibility flag. Defaults to true.
|
|
369
383
|
*/
|
|
370
384
|
markVisible?: boolean | undefined;
|
|
371
385
|
/**
|
|
372
|
-
*
|
|
386
|
+
* Meter scale (how many meters per unit length). Defaults to 1.
|
|
373
387
|
*/
|
|
374
388
|
meterScale?: number | undefined;
|
|
375
389
|
/**
|
|
376
|
-
*
|
|
390
|
+
* Disable local file drag-and-drop flag. Defaults to false.
|
|
377
391
|
*/
|
|
378
392
|
disableDropLocalFile?: boolean | undefined;
|
|
379
393
|
/**
|
|
380
|
-
*
|
|
394
|
+
* Spherical harmonics rendering level. Defaults to the maximum renderable level of model data.
|
|
381
395
|
*/
|
|
382
396
|
shDegree?: number | undefined;
|
|
383
397
|
/**
|
|
384
|
-
*
|
|
398
|
+
* Background color (defaults to '#000000')
|
|
385
399
|
*/
|
|
386
400
|
background?: string;
|
|
387
401
|
}
|
|
@@ -395,6 +409,7 @@ export declare class SplatMesh extends Mesh {
|
|
|
395
409
|
private disposed;
|
|
396
410
|
private events;
|
|
397
411
|
private opts;
|
|
412
|
+
boundBox: BoundBox;
|
|
398
413
|
/**
|
|
399
414
|
* 构造函数
|
|
400
415
|
* @param options 渲染器、场景、相机都应该传入
|
|
@@ -420,70 +435,66 @@ export declare class SplatMesh extends Mesh {
|
|
|
420
435
|
}
|
|
421
436
|
|
|
422
437
|
/**
|
|
423
|
-
*
|
|
438
|
+
* Splat mesh configuration options
|
|
424
439
|
*/
|
|
425
440
|
export declare interface SplatMeshOptions {
|
|
426
441
|
/**
|
|
427
|
-
*
|
|
442
|
+
* Name
|
|
428
443
|
*/
|
|
429
444
|
name?: string;
|
|
430
445
|
/**
|
|
431
|
-
*
|
|
446
|
+
* Renderer instance to be used
|
|
432
447
|
*/
|
|
433
448
|
renderer: Renderer;
|
|
434
449
|
/**
|
|
435
|
-
*
|
|
450
|
+
* Scene instance to be used
|
|
436
451
|
*/
|
|
437
452
|
scene: Scene;
|
|
438
453
|
/**
|
|
439
|
-
*
|
|
454
|
+
* Camera controls
|
|
440
455
|
*/
|
|
441
456
|
controls?: OrbitControls;
|
|
442
457
|
/**
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
matrix?: Matrix4;
|
|
446
|
-
/**
|
|
447
|
-
* 渲染器事件管理器
|
|
458
|
+
* Renderer event manager
|
|
448
459
|
*/
|
|
449
460
|
viewerEvents?: Events;
|
|
450
461
|
/**
|
|
451
|
-
*
|
|
462
|
+
* Debug mode flag; defaults to false in production
|
|
452
463
|
*/
|
|
453
464
|
debugMode?: boolean;
|
|
454
465
|
/**
|
|
455
|
-
*
|
|
466
|
+
* Large-scene mode flag; cannot be changed after initialization
|
|
456
467
|
*/
|
|
457
468
|
bigSceneMode?: boolean;
|
|
458
469
|
/**
|
|
459
|
-
*
|
|
460
|
-
*
|
|
470
|
+
* Point-cloud rendering mode; defaults to true,
|
|
471
|
+
* Can be updated dynamically via viewer.options()
|
|
461
472
|
*/
|
|
462
473
|
pointcloudMode?: boolean;
|
|
463
474
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
475
|
+
* Maximum number of Gaussians to render on mobile devices,
|
|
476
|
+
* Can be updated dynamically via viewer.options()
|
|
466
477
|
*/
|
|
467
478
|
maxRenderCountOfMobile?: number;
|
|
468
479
|
/**
|
|
469
|
-
* PC
|
|
470
|
-
*
|
|
480
|
+
* Maximum number of Gaussians to render on PC,
|
|
481
|
+
* Can be updated dynamically via viewer.options()
|
|
471
482
|
*/
|
|
472
483
|
maxRenderCountOfPc?: number;
|
|
473
484
|
/**
|
|
474
|
-
*
|
|
485
|
+
* Brightness scale factor; defaults to 1.0
|
|
475
486
|
*/
|
|
476
487
|
lightFactor?: number;
|
|
477
488
|
/**
|
|
478
|
-
*
|
|
489
|
+
* Whether to display a watermark; defaults to true
|
|
479
490
|
*/
|
|
480
491
|
showWatermark?: boolean;
|
|
481
492
|
/**
|
|
482
|
-
*
|
|
493
|
+
* Spherical harmonics rendering degree; defaults to 0
|
|
483
494
|
*/
|
|
484
495
|
shDegree?: number;
|
|
485
496
|
/**
|
|
486
|
-
*
|
|
497
|
+
* Enable depth testing; defaults to true
|
|
487
498
|
*/
|
|
488
499
|
depthTest?: boolean;
|
|
489
500
|
}
|