@x-viewer/core 0.21.13 → 0.21.15
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/chunks/libredwg-web-wsfHeJkP.js +9 -0
- package/dist/index.esm.js +970 -966
- package/dist/types/core/Configs.d.ts +7 -0
- package/dist/types/core/Constants.d.ts +23 -0
- package/dist/types/core/controls/TransformControls.d.ts +292 -0
- package/dist/types/core/controls/TransformGizmo.d.ts +92 -0
- package/dist/types/core/controls/index.d.ts +2 -0
- package/dist/types/core/dxf/DxfLoader.d.ts +0 -11
- package/dist/types/core/dxf-parser/DxfParser.d.ts +2 -423
- package/dist/types/core/effect/EffectManager.d.ts +28 -2
- package/dist/types/core/loaders/BaseModelLoader.d.ts +16 -0
- package/dist/types/core/loaders/GltfLoader.d.ts +4 -3
- package/dist/types/core/loaders/ModelLoaderManager.d.ts +12 -5
- package/dist/types/core/model/Model3d.d.ts +5 -0
- package/dist/types/core/utils/GeometryUtils.d.ts +45 -0
- package/dist/types/core/utils/TextureUtils.d.ts +9 -0
- package/dist/types/core/viewers/BaseViewer.d.ts +12 -40
- package/dist/types/core/viewers/Viewer2d.d.ts +0 -42
- package/dist/types/core/viewers/Viewer3d.d.ts +57 -4
- package/dist/types/core/viewers/ViewerEvent.d.ts +6 -1
- package/package.json +2 -2
- package/dist/chunks/libredwg-web-DpTeHuNl.js +0 -9
|
@@ -1,118 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { IClass, IObjectParser } from "./objects/common";
|
|
4
|
-
import { IDictionaryObject } from "./objects/dictionary";
|
|
5
|
-
import { IImageDefObject } from "./objects/imagedef";
|
|
6
|
-
import { ILayoutObject } from "./objects/layout";
|
|
7
|
-
import { ISortEntsTableObject } from "./objects/sortentstable";
|
|
8
|
-
import { ISpatialFilterObject } from "./objects/spatialfilter";
|
|
9
|
-
import { IXRecord } from "./objects/xrecord";
|
|
10
|
-
/**
|
|
11
|
-
* Definition of a block. Which contains entities, name, handle, etc.
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export interface IBlock {
|
|
15
|
-
entities: IEntity[];
|
|
16
|
-
ownerHandle: string;
|
|
17
|
-
xrefPath: string;
|
|
18
|
-
name: string;
|
|
19
|
-
name2: string;
|
|
20
|
-
handle: string;
|
|
21
|
-
layer: string;
|
|
22
|
-
position: IPoint;
|
|
23
|
-
paperSpace: boolean;
|
|
24
|
-
blockType: BlockTypeFlags;
|
|
25
|
-
description?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Definition of a viewport.
|
|
29
|
-
* @hidden
|
|
30
|
-
*/
|
|
31
|
-
export interface IViewport {
|
|
32
|
-
name: string;
|
|
33
|
-
handle?: string;
|
|
34
|
-
lowerLeftCorner: IPoint;
|
|
35
|
-
upperRightCorner: IPoint;
|
|
36
|
-
center: IPoint;
|
|
37
|
-
snapBasePoint: IPoint;
|
|
38
|
-
snapSpacing: IPoint;
|
|
39
|
-
gridSpacing: IPoint;
|
|
40
|
-
viewDirectionFromTarget: IPoint;
|
|
41
|
-
viewTarget: IPoint;
|
|
42
|
-
aspectRatio: number;
|
|
43
|
-
lensLength: number;
|
|
44
|
-
frontClippingPlane: string | number | boolean;
|
|
45
|
-
backClippingPlane: string | number | boolean;
|
|
46
|
-
viewHeight: number;
|
|
47
|
-
snapRotationAngle: number;
|
|
48
|
-
viewTwistAngle: number;
|
|
49
|
-
orthographicType: number;
|
|
50
|
-
ucsOrigin: IPoint;
|
|
51
|
-
ucsXAxis: IPoint;
|
|
52
|
-
ucsYAxis: IPoint;
|
|
53
|
-
renderMode: string;
|
|
54
|
-
defaultLightingType: number;
|
|
55
|
-
defaultLightingOn: boolean;
|
|
56
|
-
ownerHandle: string;
|
|
57
|
-
ambientColor: number;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Viewport table definition.
|
|
61
|
-
* @hidden
|
|
62
|
-
*/
|
|
63
|
-
export interface IViewportTableDefinition {
|
|
64
|
-
dxfSymbolName: "VPORT";
|
|
65
|
-
parseTableRecords(): IViewport[];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Reference to DwgLineTypeElement
|
|
69
|
-
*/
|
|
70
|
-
export interface LineTypeElement {
|
|
71
|
-
elementLength: number;
|
|
72
|
-
/**
|
|
73
|
-
* 0: Dash
|
|
74
|
-
* 1: Element is a shape (a vector glyph from a compiled .SHX file)
|
|
75
|
-
* 2: Element is a text string
|
|
76
|
-
* 3: Reserved
|
|
77
|
-
*/
|
|
78
|
-
elementTypeFlag: number;
|
|
79
|
-
/**
|
|
80
|
-
* Index of the shape inside the .SHX file defined by styleObjectId.
|
|
81
|
-
* It should be useful when elementTypeFlag is 1.
|
|
82
|
-
*/
|
|
83
|
-
shapeNumber?: number;
|
|
84
|
-
styleObjectId?: string;
|
|
85
|
-
scale?: number;
|
|
86
|
-
rotation?: number;
|
|
87
|
-
offsetX?: number;
|
|
88
|
-
offsetY?: number;
|
|
89
|
-
text?: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Line type.
|
|
93
|
-
* @hidden
|
|
94
|
-
*/
|
|
95
|
-
export interface ILineType {
|
|
96
|
-
/**
|
|
97
|
-
* AutoCAD entity handle as hex string
|
|
98
|
-
*/
|
|
99
|
-
handle?: string;
|
|
100
|
-
name: string;
|
|
101
|
-
description: string;
|
|
102
|
-
pattern: LineTypeElement[];
|
|
103
|
-
/**
|
|
104
|
-
* The sum length of each pattern segment.
|
|
105
|
-
*/
|
|
106
|
-
patternLength: number;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Line type table definition.
|
|
110
|
-
* @hidden
|
|
111
|
-
*/
|
|
112
|
-
export interface ILineTypeTableDefinition {
|
|
113
|
-
dxfSymbolName: "LTYPE";
|
|
114
|
-
parseTableRecords(): Record<string, ILineType>;
|
|
115
|
-
}
|
|
1
|
+
import IGeometry from "./entities/geomtry";
|
|
2
|
+
import { IObjectParser } from "./objects/common";
|
|
116
3
|
/**
|
|
117
4
|
* Definition of a layer.
|
|
118
5
|
*/
|
|
@@ -152,301 +39,6 @@ export interface ILayer {
|
|
|
152
39
|
*/
|
|
153
40
|
lineweight: 0 | 5 | 9 | 13 | 15 | 18 | 20 | 25 | 30 | 35 | 40 | 50 | 53 | 60 | 70 | 80 | 90 | 100 | 106 | 120 | 140 | 158 | 200 | 211 | -3 | -2 | -1;
|
|
154
41
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Layer table definition.
|
|
157
|
-
* @hidden
|
|
158
|
-
*/
|
|
159
|
-
export interface ILayerTableDefinition {
|
|
160
|
-
dxfSymbolName: "LAYER";
|
|
161
|
-
parseTableRecords(): Record<string, ILayer>;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* BlockRecord
|
|
165
|
-
* @hidden
|
|
166
|
-
*/
|
|
167
|
-
export interface IBlockRecord {
|
|
168
|
-
handle: string;
|
|
169
|
-
ownerHandle: string;
|
|
170
|
-
blockName: string;
|
|
171
|
-
layoutHandle: string;
|
|
172
|
-
blockInsertUnits: number;
|
|
173
|
-
blockExplodability: number;
|
|
174
|
-
blockScalability: number;
|
|
175
|
-
bitmap?: string;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* @hidden
|
|
179
|
-
*/
|
|
180
|
-
export interface IBlockRecordTableDefinition {
|
|
181
|
-
dxfSymbolName: "BLOCK_RECORD";
|
|
182
|
-
parseTableRecords(): Record<string, IBlockRecord>;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Definition of a style.
|
|
186
|
-
* @hidden
|
|
187
|
-
*/
|
|
188
|
-
export interface IStyle {
|
|
189
|
-
handle: string;
|
|
190
|
-
ownerHandle: string;
|
|
191
|
-
styleName: string;
|
|
192
|
-
priorTextHeight: number;
|
|
193
|
-
textHeight: number;
|
|
194
|
-
xScale: number;
|
|
195
|
-
rotation: number;
|
|
196
|
-
mirrorType: number;
|
|
197
|
-
fontFile: string;
|
|
198
|
-
bigFontFile: string;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Style table definition.
|
|
202
|
-
* @hidden
|
|
203
|
-
*/
|
|
204
|
-
export interface IStyleTableDefinition {
|
|
205
|
-
dxfSymbolName: "STYLE";
|
|
206
|
-
parseTableRecords(): Record<string, IStyle>;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Dim style.
|
|
210
|
-
* @hidden
|
|
211
|
-
*/
|
|
212
|
-
export interface IDimStyle {
|
|
213
|
-
/**
|
|
214
|
-
* AutoCAD entity handle as hex string
|
|
215
|
-
*/
|
|
216
|
-
handle?: string;
|
|
217
|
-
styleName: string;
|
|
218
|
-
DIMSCALE: number;
|
|
219
|
-
DIMASZ: number;
|
|
220
|
-
DIMEXO: string;
|
|
221
|
-
DIMEXE: string;
|
|
222
|
-
DIMSE1: string;
|
|
223
|
-
DIMSE2: string;
|
|
224
|
-
DIMTAD: string;
|
|
225
|
-
DIMTXT: string;
|
|
226
|
-
DIMGAP: number;
|
|
227
|
-
DIMCLRD: number;
|
|
228
|
-
DIMCLRT: number;
|
|
229
|
-
DIMLFAC: number;
|
|
230
|
-
DIMDEC: string;
|
|
231
|
-
DIMLDRBLK: string;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Dim style table definition
|
|
235
|
-
* @hidden
|
|
236
|
-
*/
|
|
237
|
-
export interface IDimStyleTableDefinition {
|
|
238
|
-
dxfSymbolName: "DIMSTYLE";
|
|
239
|
-
parseTableRecords(): Record<string, IDimStyle>;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Table definitions.
|
|
243
|
-
* @hidden
|
|
244
|
-
*/
|
|
245
|
-
export interface ITableDefinitions {
|
|
246
|
-
VPORT: IViewportTableDefinition;
|
|
247
|
-
LTYPE: ILineTypeTableDefinition;
|
|
248
|
-
LAYER: ILayerTableDefinition;
|
|
249
|
-
BLOCK_RECORD: IBlockRecordTableDefinition;
|
|
250
|
-
STYLE: IStyleTableDefinition;
|
|
251
|
-
DIMSTYLE: IDimStyleTableDefinition;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Base table
|
|
255
|
-
* @hidden
|
|
256
|
-
*/
|
|
257
|
-
export interface IBaseTable {
|
|
258
|
-
handle: string;
|
|
259
|
-
ownerHandle: string;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Viewport table
|
|
263
|
-
* @hidden
|
|
264
|
-
*/
|
|
265
|
-
export interface IViewportTable extends IBaseTable {
|
|
266
|
-
entries: IViewport[];
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* @hidden
|
|
270
|
-
*/
|
|
271
|
-
export interface ILayerTypesTable extends IBaseTable {
|
|
272
|
-
entries: Record<string, ILineType>;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* @hidden
|
|
276
|
-
*/
|
|
277
|
-
export interface ILayersTable extends IBaseTable {
|
|
278
|
-
entries: Record<string, ILayer>;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* @hidden
|
|
282
|
-
*/
|
|
283
|
-
export interface IStylesTable extends IBaseTable {
|
|
284
|
-
entries: Record<string, IStyle>;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* @hidden
|
|
288
|
-
*/
|
|
289
|
-
export interface IDimStyleTable extends IBaseTable {
|
|
290
|
-
entries: Record<string, IDimStyle>;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Block records table containing metadata for all blocks defined in the DXF file.
|
|
294
|
-
* Each block record provides information about a block, including:
|
|
295
|
-
* - Block name and handle
|
|
296
|
-
* - Associated layout handle (for model space and paper space blocks)
|
|
297
|
-
* - Block insertion units, explodability, and scalability
|
|
298
|
-
* - Preview bitmap (if available)
|
|
299
|
-
*
|
|
300
|
-
* Block records are used to link blocks with their corresponding layouts and provide
|
|
301
|
-
* additional metadata beyond what is stored in the blocks themselves.
|
|
302
|
-
*
|
|
303
|
-
* @hidden
|
|
304
|
-
*/
|
|
305
|
-
export interface IBlockRecordsTable extends IBaseTable {
|
|
306
|
-
/**
|
|
307
|
-
* Block record entries, keyed by block record handle (hex string).
|
|
308
|
-
* Each entry corresponds to a block definition in the DXF file.
|
|
309
|
-
*/
|
|
310
|
-
entries: Record<string, IBlockRecord>;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Collection of all DXF tables.
|
|
314
|
-
* DXF tables are used to define named resources that can be referenced by entities.
|
|
315
|
-
* Each table contains entries that define reusable objects with specific properties.
|
|
316
|
-
* @hidden
|
|
317
|
-
*/
|
|
318
|
-
export interface ITables {
|
|
319
|
-
/**
|
|
320
|
-
* Viewport table containing viewport configurations.
|
|
321
|
-
* Viewports define how the drawing is displayed, including view direction,
|
|
322
|
-
* zoom level, and clipping planes.
|
|
323
|
-
*/
|
|
324
|
-
VPORT: IViewportTable;
|
|
325
|
-
/**
|
|
326
|
-
* Linetype table containing line pattern definitions.
|
|
327
|
-
* Linetypes define how lines are drawn (solid, dashed, dotted, etc.).
|
|
328
|
-
* Common linetypes include "CONTINUOUS", "DASHED", "DOTTED", and custom patterns.
|
|
329
|
-
*/
|
|
330
|
-
LTYPE: ILayerTypesTable;
|
|
331
|
-
/**
|
|
332
|
-
* Layer table containing layer definitions.
|
|
333
|
-
* Layers organize entities and control their visibility, color, linetype, and other properties.
|
|
334
|
-
* Every entity in a DXF file belongs to a layer.
|
|
335
|
-
*/
|
|
336
|
-
LAYER: ILayersTable;
|
|
337
|
-
/**
|
|
338
|
-
* Block records table containing block metadata.
|
|
339
|
-
* Block records provide information about blocks and link them to layouts.
|
|
340
|
-
* This table is essential for understanding the relationship between blocks and layouts.
|
|
341
|
-
*/
|
|
342
|
-
BLOCK_RECORD: IBlockRecordsTable;
|
|
343
|
-
/**
|
|
344
|
-
* Text style table containing font and text formatting definitions.
|
|
345
|
-
* Text styles define how text entities are displayed, including font file,
|
|
346
|
-
* height, width factor, and rotation.
|
|
347
|
-
*/
|
|
348
|
-
STYLE: IStylesTable;
|
|
349
|
-
/**
|
|
350
|
-
* Dimension style table containing dimension formatting definitions.
|
|
351
|
-
* Dimension styles control how dimensions are displayed, including arrow types,
|
|
352
|
-
* text placement, precision, and colors.
|
|
353
|
-
*/
|
|
354
|
-
DIMSTYLE: IDimStyleTable;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Collection of all DXF objects.
|
|
358
|
-
* Provides typed access to common object arrays so callers don't need to use string keys like "LAYOUT" or "DICTIONARY".
|
|
359
|
-
* @hidden
|
|
360
|
-
*/
|
|
361
|
-
export interface IObjects {
|
|
362
|
-
LAYOUT?: ILayoutObject[];
|
|
363
|
-
DICTIONARY?: IDictionaryObject[];
|
|
364
|
-
IMAGEDEF?: IImageDefObject[];
|
|
365
|
-
SORTENTSTABLE?: ISortEntsTableObject[];
|
|
366
|
-
SPATIAL_FILTER?: ISpatialFilterObject[];
|
|
367
|
-
XRECORD?: IXRecord[];
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Union type representing any DXF table.
|
|
371
|
-
* This type can be used when a function or method needs to accept any table type
|
|
372
|
-
* without being specific about which table it is.
|
|
373
|
-
*
|
|
374
|
-
* @hidden
|
|
375
|
-
*/
|
|
376
|
-
export type ITable = IViewportTable | ILayerTypesTable | ILayersTable | IBlockRecordsTable | IStylesTable | IDimStyleTable;
|
|
377
|
-
/**
|
|
378
|
-
* Represents the complete structure of a DXF (Drawing Exchange Format) file.
|
|
379
|
-
* A DXF file is organized into several sections: HEADER, ENTITIES, BLOCKS, TABLES, OBJECTS, and CLASSES.
|
|
380
|
-
*
|
|
381
|
-
* @hidden
|
|
382
|
-
*/
|
|
383
|
-
export interface IDxf {
|
|
384
|
-
/**
|
|
385
|
-
* Header section containing system variables.
|
|
386
|
-
* These variables control various drawing settings such as:
|
|
387
|
-
* - `$ACADVER`: AutoCAD version (e.g., "AC1032" for AutoCAD 2018)
|
|
388
|
-
* - `$CLAYER`: Current layer name
|
|
389
|
-
* - `$LTSCALE`: Global linetype scale
|
|
390
|
-
* - `$INSUNITS`: Units for insertion
|
|
391
|
-
* - And many other system variables
|
|
392
|
-
* Values can be points (IPoint), numbers, or strings.
|
|
393
|
-
*/
|
|
394
|
-
header: Record<string, IPoint | number | string>;
|
|
395
|
-
/**
|
|
396
|
-
* Entities section containing all drawing entities.
|
|
397
|
-
* This includes geometric objects such as:
|
|
398
|
-
* - Lines, arcs, circles, ellipses
|
|
399
|
-
* - Polylines, splines, hatches
|
|
400
|
-
* - Text, dimensions, leaders
|
|
401
|
-
* - Blocks (inserts), images, viewports
|
|
402
|
-
* - And other entity types
|
|
403
|
-
* Note that, it should include entities in model space and paper space.
|
|
404
|
-
* But it should not include entities in blocks.
|
|
405
|
-
*/
|
|
406
|
-
entities: IEntity[];
|
|
407
|
-
/**
|
|
408
|
-
* Blocks section containing block definitions.
|
|
409
|
-
* The key is the block name (e.g., "*Model_Space", "*Paper_Space", or user-defined block names).
|
|
410
|
-
* Each block contains a collection of entities that can be inserted multiple times via INSERT entities.
|
|
411
|
-
* Blocks can represent:
|
|
412
|
-
* - Model space and paper space definitions
|
|
413
|
-
* - User-defined reusable components
|
|
414
|
-
* - Dimension blocks
|
|
415
|
-
*/
|
|
416
|
-
blocks: Record<string, IBlock>;
|
|
417
|
-
/**
|
|
418
|
-
* Tables section containing various DXF tables.
|
|
419
|
-
* Includes:
|
|
420
|
-
* - `VPORT`: Viewport table (view configurations)
|
|
421
|
-
* - `LTYPE`: Linetype table (line pattern definitions)
|
|
422
|
-
* - `LAYER`: Layer table (layer definitions with properties)
|
|
423
|
-
* - `BLOCK_RECORD`: Block record table (block metadata)
|
|
424
|
-
* - `STYLE`: Text style table (font and text formatting)
|
|
425
|
-
* - `DIMSTYLE`: Dimension style table (dimension formatting)
|
|
426
|
-
*/
|
|
427
|
-
tables: ITables;
|
|
428
|
-
/**
|
|
429
|
-
* Objects section containing non-graphical objects.
|
|
430
|
-
* The key is the object type name (e.g., "LAYOUT", "DICTIONARY", "XRECORD").
|
|
431
|
-
* Common object types include:
|
|
432
|
-
* - `LAYOUT`: Layout definitions (Model space and paper space layouts)
|
|
433
|
-
* - `DICTIONARY`: Named object dictionaries
|
|
434
|
-
* - `XRECORD`: Extended record objects
|
|
435
|
-
* - `MATERIAL`: Material definitions
|
|
436
|
-
* - And other application-specific objects
|
|
437
|
-
*/
|
|
438
|
-
objects: IObjects;
|
|
439
|
-
/**
|
|
440
|
-
* Classes section containing application-defined class definitions.
|
|
441
|
-
* Classes define custom entity types or objects that may be used by specific applications.
|
|
442
|
-
* Each class entry describes:
|
|
443
|
-
* - Application name
|
|
444
|
-
* - Class name and C++ class name
|
|
445
|
-
* - DXF name
|
|
446
|
-
* - Capabilities and proxy information
|
|
447
|
-
*/
|
|
448
|
-
classes: IClass[];
|
|
449
|
-
}
|
|
450
42
|
export default class DxfParser {
|
|
451
43
|
constructor(encoding?: string);
|
|
452
44
|
parse(source: string | ArrayBuffer): IDxf | undefined;
|
|
@@ -457,17 +49,4 @@ export default class DxfParser {
|
|
|
457
49
|
parseAsync(source: string | ArrayBuffer): Promise<IDxf | undefined>;
|
|
458
50
|
registerEntityHandler(handlerType: new () => IGeometry): void;
|
|
459
51
|
registerObjectHandler(handlerType: new () => IObjectParser): void;
|
|
460
|
-
/**
|
|
461
|
-
* Loads libredwg if needed, then returns raw convertEx() output plus version/codepage.
|
|
462
|
-
* Used by dwg_json_viewer and debugging tools.
|
|
463
|
-
*/
|
|
464
|
-
libredwgConvertExAsync(data: ArrayBuffer): Promise<{
|
|
465
|
-
version: string;
|
|
466
|
-
codepage: string;
|
|
467
|
-
database: DwgDatabase;
|
|
468
|
-
stats: {
|
|
469
|
-
unknownEntityCount: number;
|
|
470
|
-
};
|
|
471
|
-
} | undefined>;
|
|
472
|
-
private parseDwgDb;
|
|
473
52
|
}
|
|
@@ -58,6 +58,32 @@ export declare class EffectManager {
|
|
|
58
58
|
get unrealBloomPassEnabled(): boolean;
|
|
59
59
|
set unrealBloomPassEnabled(enable: boolean);
|
|
60
60
|
setOutlinePassSelectObjects(objects: THREE.Object3D[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Sets current selection outline objects.
|
|
63
|
+
* When objects is empty, the pass is disabled.
|
|
64
|
+
*
|
|
65
|
+
* Intended for 3D viewer selection highlighting; 2D callers should avoid using this.
|
|
66
|
+
*/
|
|
67
|
+
setSelectionOutline(objects: THREE.Object3D[]): void;
|
|
68
|
+
/**
|
|
69
|
+
* OutlinePass is screen-space (depth/normal): not every geometric edge appears.
|
|
70
|
+
* Colors are sRGB display values (no HDR boost): outline runs after {@link OutputPass}, so it is not
|
|
71
|
+
* washed out by tone mapping.
|
|
72
|
+
*/
|
|
73
|
+
private applySelectionOutlineAppearance;
|
|
74
|
+
/**
|
|
75
|
+
* The stock {@link OutlinePass} overlay material uses `AdditiveBlending`.
|
|
76
|
+
* Additive blend on a white background: `clamp(1 + x) = 1` — the outline is **mathematically invisible**.
|
|
77
|
+
*
|
|
78
|
+
* Replace the overlay with `NormalBlending` + a shader that outputs proper alpha so the edge color
|
|
79
|
+
* **covers** the background instead of being added to it. This works on any background brightness.
|
|
80
|
+
*/
|
|
81
|
+
private patchOutlineOverlayBlending;
|
|
82
|
+
/**
|
|
83
|
+
* Internal buffers must use the same pixel dimensions as {@link EffectComposer} (logical size × DPR);
|
|
84
|
+
* otherwise on HiDPI screens edges are detected on an undersized grid and look ~1px thin and dim.
|
|
85
|
+
*/
|
|
86
|
+
private outlinePassResolution;
|
|
61
87
|
enableModelEdges(enable: boolean): void;
|
|
62
88
|
showVertexNormals(show: boolean, size?: number): void;
|
|
63
89
|
setSize(width: number, height: number): void;
|
|
@@ -74,8 +100,8 @@ export declare class EffectManager {
|
|
|
74
100
|
private syncWatermarkResolution;
|
|
75
101
|
private ensureComposerOutputPass;
|
|
76
102
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
103
|
+
* Order: …other passes… → watermark (linear) → {@link composerOutputPass} (tone map + output encoding)
|
|
104
|
+
* → {@link outlinePass} when present (selection outline avoids tone mapping by compositing last).
|
|
79
105
|
*/
|
|
80
106
|
private ensurePostprocessPassOrder;
|
|
81
107
|
}
|
|
@@ -6,6 +6,11 @@ interface BaseModelLoadContext {
|
|
|
6
6
|
/** Normalized lowercase format token; same semantics as historical `endsWith` checks. */
|
|
7
7
|
readonly format: string;
|
|
8
8
|
readonly onProgress?: (event: ProgressEvent) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Per-load mesh quantization (see {@link ModelConfig.quantize}). When `false` or omitted on
|
|
11
|
+
* {@link ModelConfig}, loaders skip quantization; {@link Viewer3d} fills omission from {@link BaseViewer.enableQuantization}.
|
|
12
|
+
*/
|
|
13
|
+
readonly quantize?: boolean;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* Context for model loading from URL.
|
|
@@ -43,7 +48,18 @@ export declare abstract class BaseModelLoader {
|
|
|
43
48
|
* Override for non-suffix matching.
|
|
44
49
|
*/
|
|
45
50
|
match(format: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When {@link ModelLoadContext.quantize} is strictly `true`, quantizes mesh
|
|
53
|
+
* {@link THREE.BufferGeometry} under `scene` (see {@link GeometryUtils.applyMeshQuantizationToSceneRoot}).
|
|
54
|
+
*/
|
|
55
|
+
protected maybeQuantizeLoadedScene(scene: THREE.Object3D, quantize?: boolean): THREE.Object3D;
|
|
46
56
|
load?(ctx: ModelLoadContext): Promise<THREE.Object3D | void>;
|
|
47
57
|
loadFromBuffer?(ctx: ModelLoadFromBufferContext): Promise<THREE.Object3D | void>;
|
|
58
|
+
/**
|
|
59
|
+
* Called by ModelLoaderManager when the active LoadingManager changes
|
|
60
|
+
* (e.g. for multi-file local loads with a URL modifier).
|
|
61
|
+
* Implementations should reset any cached internal loader instances.
|
|
62
|
+
*/
|
|
63
|
+
updateManager?(manager: THREE.LoadingManager | undefined): void;
|
|
48
64
|
}
|
|
49
65
|
export {};
|
|
@@ -5,17 +5,18 @@ import { BaseModelLoader } from "./BaseModelLoader";
|
|
|
5
5
|
* glTF / GLB model loader wrapping GLTFLoader, DRACO path, and progress handling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class GltfLoader extends BaseModelLoader {
|
|
8
|
-
private readonly manager?;
|
|
9
8
|
readonly id = "loader.builtin.gltf";
|
|
10
9
|
readonly priority = 0;
|
|
11
10
|
readonly formats: readonly ["gltf", "glb"];
|
|
12
11
|
private static dracoDecoderPath;
|
|
13
12
|
static setDracoDecoderPath(path: string): void;
|
|
14
13
|
private gltfLoader?;
|
|
15
|
-
|
|
14
|
+
private manager?;
|
|
15
|
+
constructor(manager?: THREE.LoadingManager);
|
|
16
|
+
updateManager(manager: THREE.LoadingManager | undefined): void;
|
|
16
17
|
load(ctx: ModelLoadContext): Promise<THREE.Object3D>;
|
|
17
18
|
loadFromBuffer(ctx: ModelLoadFromBufferContext): Promise<THREE.Object3D>;
|
|
18
|
-
parseToScene(data: ArrayBuffer | string, path: string, onLoad: (object: THREE.Object3D) => void, onError?: (event: ErrorEvent) => void): void;
|
|
19
|
+
parseToScene(data: ArrayBuffer | string, path: string, onLoad: (object: THREE.Object3D) => void, onError?: (event: ErrorEvent) => void, quantize?: boolean): void;
|
|
19
20
|
private obtainLoader;
|
|
20
21
|
private applyRequestHeader;
|
|
21
22
|
private sanitizeUrlForLoad;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import type { BaseModelLoader } from "./BaseModelLoader";
|
|
3
|
+
import type { ModelConfig } from "../../core/Configs";
|
|
3
4
|
import type { FontManager } from "../../core/font";
|
|
4
5
|
export declare class ModelLoaderManager {
|
|
5
6
|
private manager?;
|
|
@@ -25,14 +26,20 @@ export declare class ModelLoaderManager {
|
|
|
25
26
|
*/
|
|
26
27
|
getLoaderById(id: string): BaseModelLoader | undefined;
|
|
27
28
|
private computeUrlModelFormat;
|
|
29
|
+
/**
|
|
30
|
+
* @param modelCfg Load-related fields from {@link ModelConfig} (`src` is the logical file name for
|
|
31
|
+
* format detection when `blobFetchUrl` is set).
|
|
32
|
+
* @param blobFetchUrl When set (e.g. `blob:` URL), requests use this URL while format is inferred from `modelCfg.src`.
|
|
33
|
+
*/
|
|
28
34
|
private loadModelInternal;
|
|
29
35
|
private loadModelFromBufferInternal;
|
|
30
36
|
setLoadManager(manager?: THREE.LoadingManager): void;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @param blobUrl Fetch URL for the main file (often a `blob:` URL); {@link ModelConfig.src} should stay the real file name for format detection.
|
|
39
|
+
*/
|
|
40
|
+
loadLocalModel(blobUrl: string, modelCfg: ModelConfig, onProgress?: (event: ProgressEvent) => void): Promise<THREE.Object3D>;
|
|
41
|
+
loadModel(modelCfg: ModelConfig, onProgress?: (event: ProgressEvent) => void, unsupportedMessage?: string): Promise<THREE.Object3D | void>;
|
|
42
|
+
loadModelFromBuffer(modelCfg: ModelConfig, onProgress?: (event: ProgressEvent) => void): Promise<THREE.Object3D | void>;
|
|
36
43
|
/**
|
|
37
44
|
* For dwg/dxf, we need to set font first.
|
|
38
45
|
*/
|
|
@@ -37,6 +37,11 @@ export declare class Model3d extends Model {
|
|
|
37
37
|
* Gets the THREE.Object3D of this model.
|
|
38
38
|
*/
|
|
39
39
|
getModelObject(): THREE.Object3D;
|
|
40
|
+
/**
|
|
41
|
+
* Clears cached bounds so the next {@link getBBox} recomputes from the scene graph
|
|
42
|
+
* (e.g. after transform gizmo edits).
|
|
43
|
+
*/
|
|
44
|
+
invalidateBBox(): void;
|
|
40
45
|
/**
|
|
41
46
|
* Gets the bounding box of this model.
|
|
42
47
|
*/
|
|
@@ -67,5 +67,50 @@ export declare class GeometryUtils {
|
|
|
67
67
|
static convertWidthLineToMeshGeometry(points: THREE.Vector2[], width: number): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap> | undefined;
|
|
68
68
|
static releaseGeometryManually(geometry: THREE.BufferGeometry): void;
|
|
69
69
|
static getAdjacentNonRepeatPoints(points: THREE.Vector3[], epsilon?: number): THREE.Vector3[];
|
|
70
|
+
/**
|
|
71
|
+
* True when `attr` is a non-instanced per-vertex {@link THREE.BufferAttribute} or
|
|
72
|
+
* {@link THREE.InterleavedBufferAttribute} with `normalized: true` and an integer
|
|
73
|
+
* `TypedArray` backing (e.g. glTF normalized BYTE/SHORT or **KHR_mesh_quantization**).
|
|
74
|
+
* Use this to detect attributes already stored in normalized integer form (not only `position`).
|
|
75
|
+
*/
|
|
76
|
+
static isNormalizedIntegerVertexAttribute(attr: unknown): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* One axis of POSITION quantization: world coordinate → stored Int16 value in
|
|
79
|
+
* `[-32767, 32767]`, matching `KHR_mesh_quantization` with origin `center` and
|
|
80
|
+
* half-extent `halfExtent` on this axis.
|
|
81
|
+
*/
|
|
82
|
+
static quantizePositionComponent(world: number, center: number, halfExtent: number): number;
|
|
83
|
+
/** Inverse of {@link GeometryUtils.quantizePositionComponent}: quantized → world units. */
|
|
84
|
+
static dequantizePositionComponent(quantized: number, center: number, halfExtent: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Quantizes geometry attributes in-place for KHR_mesh_quantization-style usage.
|
|
87
|
+
*
|
|
88
|
+
* Converts **position** (Float32 → Int16 normalized) when possible, and clears cached
|
|
89
|
+
* `boundingBox` / `boundingSphere` so world AABBs stay correct after baking the decode
|
|
90
|
+
* matrix into mesh transforms.
|
|
91
|
+
*
|
|
92
|
+
* If **position** already satisfies {@link GeometryUtils.isNormalizedIntegerVertexAttribute}
|
|
93
|
+
* (e.g. **KHR_mesh_quantization** from glTF), returns `null` and leaves the geometry unchanged
|
|
94
|
+
* (no double quantization).
|
|
95
|
+
*
|
|
96
|
+
* Other attributes (when present, non-instanced, backed by float arrays):
|
|
97
|
+
* **normal** → Int8 normalized, **uv** / **uv1–uv3** → Uint16 normalized ([0,1] only),
|
|
98
|
+
* **color** → Uint8 normalized ([0,1] only), **tangent** (vec4) → Int8 normalized.
|
|
99
|
+
* Does not touch **skinIndex** / **skinWeight** (skinning), morph targets, etc.
|
|
100
|
+
*
|
|
101
|
+
* @returns The position-decode `Matrix4` (`T(center) * S(halfExtents)`) when position was
|
|
102
|
+
* quantized, or `null` when position was left unchanged. Right-multiply into the
|
|
103
|
+
* mesh node matrix: `M_node_final = M_node_original * M_decode`.
|
|
104
|
+
*/
|
|
105
|
+
static quantizeGeometry(geo: THREE.BufferGeometry): THREE.Matrix4 | null;
|
|
106
|
+
private static meshQuantMatScratch;
|
|
107
|
+
private static meshQuantInstanceTmp;
|
|
108
|
+
/**
|
|
109
|
+
* Walks `scene`, quantizes each unique mesh {@link THREE.BufferGeometry} (see
|
|
110
|
+
* {@link GeometryUtils.quantizeGeometry}), and bakes position decode into mesh
|
|
111
|
+
* transforms / instanced matrices (then syncs pq/s so {@link THREE.Object3D.matrixAutoUpdate}
|
|
112
|
+
* stays compatible with controls that edit position/quaternion/scale). Used after import.
|
|
113
|
+
*/
|
|
114
|
+
static applyMeshQuantizationToSceneRoot(scene: THREE.Object3D): THREE.Object3D;
|
|
70
115
|
static mergeBBoxes(bboxes: THREE.Box3[]): THREE.Box3[];
|
|
71
116
|
}
|
|
@@ -12,5 +12,14 @@ export declare class TextureUtils {
|
|
|
12
12
|
* Creates default environment texture
|
|
13
13
|
*/
|
|
14
14
|
static createEnvTextureFromDataArray(pmremGenerator: THREE.PMREMGenerator | undefined, data?: Uint16Array, width?: number, height?: number): Promise<THREE.Texture>;
|
|
15
|
+
private static readonly MISSING_MAP_KEYS;
|
|
16
|
+
private static fallbackGrayMaterial?;
|
|
17
|
+
private static getFallbackGrayMaterial;
|
|
18
|
+
/**
|
|
19
|
+
* If any 2D map on a mesh material failed to load, replace the whole material with a shared gray MeshStandardMaterial.
|
|
20
|
+
*/
|
|
21
|
+
static replaceBrokenMaterialMaps(root: THREE.Object3D): void;
|
|
22
|
+
private static materialHasBroken2DMap;
|
|
23
|
+
private static isTextureImageInvalid;
|
|
15
24
|
private static readonly HDR_CITY_STREET_64x32;
|
|
16
25
|
}
|