@shapediver/viewer.shared.types 3.3.4 → 3.3.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.
Files changed (78) hide show
  1. package/dist/implementation/data/GeometryData.d.ts.map +1 -1
  2. package/dist/implementation/data/GeometryData.js +1 -0
  3. package/dist/implementation/data/GeometryData.js.map +1 -1
  4. package/dist/index.d.ts +5 -4
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/interfaces/parameter/IDrawingParametersSettings.d.ts +121 -0
  9. package/dist/interfaces/parameter/IDrawingParametersSettings.d.ts.map +1 -0
  10. package/dist/interfaces/parameter/IDrawingParametersSettings.js +22 -0
  11. package/dist/interfaces/parameter/IDrawingParametersSettings.js.map +1 -0
  12. package/dist/interfaces/parameter/IDrawingToolsParametersSettings.d.ts +159 -0
  13. package/dist/interfaces/parameter/IDrawingToolsParametersSettings.d.ts.map +1 -0
  14. package/dist/interfaces/parameter/IDrawingToolsParametersSettings.js +29 -0
  15. package/dist/interfaces/parameter/IDrawingToolsParametersSettings.js.map +1 -0
  16. package/dist/interfaces/parameter/IGumballParameterSettings.d.ts +1 -5
  17. package/dist/interfaces/parameter/IGumballParameterSettings.d.ts.map +1 -1
  18. package/dist/interfaces/parameter/IGumballParameterSettings.js +0 -7
  19. package/dist/interfaces/parameter/IGumballParameterSettings.js.map +1 -1
  20. package/dist/interfaces/parameter/ISelectionParameterSettings.d.ts +1 -5
  21. package/dist/interfaces/parameter/ISelectionParameterSettings.d.ts.map +1 -1
  22. package/dist/interfaces/parameter/ISelectionParameterSettings.js +0 -7
  23. package/dist/interfaces/parameter/ISelectionParameterSettings.js.map +1 -1
  24. package/package.json +7 -8
  25. package/src/implementation/data/AnimationData.ts +0 -310
  26. package/src/implementation/data/BoneData.ts +0 -32
  27. package/src/implementation/data/CustomData.ts +0 -52
  28. package/src/implementation/data/GeometryData.ts +0 -426
  29. package/src/implementation/data/HTMLElementAnchorData.ts +0 -365
  30. package/src/implementation/material/AbstractMaterialData.ts +0 -268
  31. package/src/implementation/material/MapData.ts +0 -218
  32. package/src/implementation/material/MaterialBasicLineData.ts +0 -99
  33. package/src/implementation/material/MaterialGemData.ts +0 -310
  34. package/src/implementation/material/MaterialMultiPointData.ts +0 -659
  35. package/src/implementation/material/MaterialPointData.ts +0 -136
  36. package/src/implementation/material/MaterialShadowData.ts +0 -45
  37. package/src/implementation/material/MaterialSpecularGlossinessData.ts +0 -191
  38. package/src/implementation/material/MaterialStandardData.ts +0 -502
  39. package/src/implementation/material/MaterialUnlitData.ts +0 -122
  40. package/src/implementation/material/MaterialVariantsData.ts +0 -60
  41. package/src/implementation/sdtf/SDTFAttributesData.ts +0 -128
  42. package/src/implementation/sdtf/SDTFItemData.ts +0 -72
  43. package/src/implementation/sdtf/SDTFOverviewData.ts +0 -80
  44. package/src/index.ts +0 -141
  45. package/src/interfaces/data/IAnimationData.ts +0 -42
  46. package/src/interfaces/data/IBoneData.ts +0 -9
  47. package/src/interfaces/data/ICustomData.ts +0 -15
  48. package/src/interfaces/data/IGeometryData.ts +0 -87
  49. package/src/interfaces/data/IHTMLElementAnchorData.ts +0 -68
  50. package/src/interfaces/data/material/IMapData.ts +0 -64
  51. package/src/interfaces/data/material/IMaterialAbstractData.ts +0 -86
  52. package/src/interfaces/data/material/IMaterialBasicLineData.ts +0 -21
  53. package/src/interfaces/data/material/IMaterialGemDataProperties.ts +0 -46
  54. package/src/interfaces/data/material/IMaterialMultiPointData.ts +0 -72
  55. package/src/interfaces/data/material/IMaterialPointData.ts +0 -31
  56. package/src/interfaces/data/material/IMaterialShadowData.ts +0 -21
  57. package/src/interfaces/data/material/IMaterialSpecularGlossinessDataProperties.ts +0 -36
  58. package/src/interfaces/data/material/IMaterialStandardData.ts +0 -60
  59. package/src/interfaces/data/material/IMaterialUnlitData.ts +0 -30
  60. package/src/interfaces/data/material/IMaterialVariantsData.ts +0 -19
  61. package/src/interfaces/events/EventResponseMapping.ts +0 -53
  62. package/src/interfaces/events/ICameraEvent.ts +0 -16
  63. package/src/interfaces/events/IOutputEvent.ts +0 -29
  64. package/src/interfaces/events/IParameterEvent.ts +0 -21
  65. package/src/interfaces/events/IRenderingEvent.ts +0 -7
  66. package/src/interfaces/events/ISceneEvent.ts +0 -17
  67. package/src/interfaces/events/ISessionEvent.ts +0 -16
  68. package/src/interfaces/events/ITaskEvent.ts +0 -61
  69. package/src/interfaces/events/IViewportEvent.ts +0 -13
  70. package/src/interfaces/parameter/IGumballParameterSettings.ts +0 -44
  71. package/src/interfaces/parameter/IInteractionParameterSettings.ts +0 -85
  72. package/src/interfaces/parameter/ISelectionParameterSettings.ts +0 -37
  73. package/src/interfaces/sdtf/ISDTFAttributeVisualizationData.ts +0 -7
  74. package/src/interfaces/sdtf/ISDTFAttributesData.ts +0 -27
  75. package/src/interfaces/sdtf/ISDTFItemData.ts +0 -23
  76. package/src/interfaces/sdtf/ISDTFOverviewData.ts +0 -31
  77. package/src/types.ts +0 -68
  78. package/tsconfig.json +0 -17
@@ -1,426 +0,0 @@
1
- import { AbstractTreeNodeData } from '@shapediver/viewer.shared.node-tree';
2
- import { Box, IBox } from '@shapediver/viewer.shared.math';
3
- import {
4
- IAttributeData,
5
- IGeometryData,
6
- IPrimitiveData,
7
- PRIMITIVE_MODE
8
- } from '../../interfaces/data/IGeometryData';
9
- import { IMaterialAbstractData } from '../../interfaces/data/material/IMaterialAbstractData';
10
- import { mat4, quat, vec3 } from 'gl-matrix';
11
-
12
- // #region Classes (3)
13
-
14
- export class AttributeData extends AbstractTreeNodeData implements IAttributeData {
15
- // #region Properties (15)
16
-
17
- readonly #array: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array;
18
- readonly #byteOffset: number;
19
- readonly #byteStride?: number;
20
- readonly #count: number;
21
- readonly #elementBytes: number;
22
- readonly #itemBytes: number;
23
- readonly #itemSize: number;
24
- readonly #max: number[] = [];
25
- readonly #min: number[] = [];
26
- readonly #morphAttributeData: IAttributeData[] = [];
27
- readonly #normalized: boolean;
28
- readonly #sparse?: boolean;
29
- readonly #sparseIndices?: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array;
30
- readonly #sparseValues?: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array;
31
- readonly #target?: number;
32
-
33
- // #endregion Properties (15)
34
-
35
- // #region Constructors (1)
36
-
37
- /**
38
- * Creates an attribute data object.
39
- *
40
- * @param _array the array of the data
41
- * @param _itemSize the size
42
- * @param _hasOffset notifier if there is an offset
43
- * @param _offset the offset
44
- * @param _stride the stride
45
- * @param _normalized boolean if the data is normalized
46
- */
47
- constructor(
48
- array: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array,
49
- itemSize: number,
50
- itemBytes: number,
51
- byteOffset: number,
52
- elementBytes: number,
53
- normalized: boolean,
54
- count: number,
55
- min: number[] = [],
56
- max: number[] = [],
57
- byteStride?: number,
58
- target?: number,
59
- sparse?: boolean,
60
- sparseIndices?: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array,
61
- sparseValues?: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array,
62
- morphAttributeData: IAttributeData[] = [],
63
- id?: string,
64
- version?: string
65
- ) {
66
- super(id, version);
67
- this.#array = array;
68
- this.#itemSize = itemSize;
69
- this.#itemBytes = itemBytes;
70
- this.#byteOffset = byteOffset;
71
- this.#elementBytes = elementBytes;
72
- this.#normalized = normalized;
73
- this.#count = count;
74
- this.#min = min;
75
- this.#max = max;
76
- this.#byteStride = byteStride;
77
- this.#target = target;
78
- this.#sparse = sparse;
79
- this.#sparseIndices = sparseIndices;
80
- this.#sparseValues = sparseValues;
81
- this.#morphAttributeData = morphAttributeData;
82
- }
83
-
84
- // #endregion Constructors (1)
85
-
86
- // #region Public Getters And Setters (15)
87
-
88
- public get array(): Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array {
89
- return this.#array;
90
- }
91
-
92
- public get byteOffset(): number {
93
- return this.#byteOffset;
94
- }
95
-
96
- public get byteStride(): number | undefined {
97
- return this.#byteStride;
98
- }
99
-
100
- public get count(): number {
101
- return this.#count;
102
- }
103
-
104
- public get elementBytes(): number {
105
- return this.#elementBytes;
106
- }
107
-
108
- public get itemBytes(): number {
109
- return this.#itemBytes;
110
- }
111
-
112
- public get itemSize(): number {
113
- return this.#itemSize;
114
- }
115
-
116
- public get max(): number[] {
117
- return this.#max;
118
- }
119
-
120
- public get min(): number[] {
121
- return this.#min;
122
- }
123
-
124
- public get morphAttributeData(): IAttributeData[] {
125
- return this.#morphAttributeData;
126
- }
127
-
128
- public get normalized(): boolean {
129
- return this.#normalized;
130
- }
131
-
132
- public get sparse(): boolean | undefined {
133
- return this.#sparse;
134
- }
135
-
136
- public get sparseIndices(): Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array | undefined {
137
- return this.#sparseIndices;
138
- }
139
-
140
- public get sparseValues(): Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array | undefined {
141
- return this.#sparseValues;
142
- }
143
-
144
- public get target(): number | undefined {
145
- return this.#target;
146
- }
147
-
148
- // #endregion Public Getters And Setters (15)
149
-
150
- // #region Public Methods (1)
151
-
152
- /**
153
- * Clones the attribute data.
154
- */
155
- public clone(): IAttributeData {
156
- return new AttributeData(
157
- this.#array,
158
- this.#itemSize,
159
- this.#itemBytes,
160
- this.#byteOffset,
161
- this.#elementBytes,
162
- this.#normalized,
163
- this.#count,
164
- this.#min,
165
- this.#max,
166
- this.#byteStride,
167
- this.#target,
168
- this.#sparse,
169
- this.#sparseIndices,
170
- this.#sparseValues,
171
- this.#morphAttributeData,
172
- this.id,
173
- this.version
174
- );
175
- }
176
-
177
- // #endregion Public Methods (1)
178
- }
179
-
180
- export class GeometryData extends AbstractTreeNodeData implements IGeometryData {
181
- // #region Properties (10)
182
-
183
- readonly #mode: PRIMITIVE_MODE = PRIMITIVE_MODE.TRIANGLES;
184
- readonly #primitive: IPrimitiveData;
185
-
186
- #attributeMaterial: IMaterialAbstractData | null = null;
187
- #boundingBox: IBox = new Box();
188
- #effectMaterials: { material: IMaterialAbstractData, token: string }[] = [];
189
- #material: IMaterialAbstractData | null = null;
190
- #materialVariants: { material: IMaterialAbstractData, variant: number }[] = [];
191
- #morphWeights: number[] = [];
192
- #renderOrder: number = 0;
193
- #standardMaterial: IMaterialAbstractData | null = null;
194
-
195
- // #endregion Properties (10)
196
-
197
- // #region Constructors (1)
198
-
199
- /**
200
- * Creates a geometry data object.
201
- *
202
- * @param _primitive the primitive
203
- * @param id the id
204
- */
205
- constructor(
206
- primitive: IPrimitiveData,
207
- mode: PRIMITIVE_MODE = PRIMITIVE_MODE.TRIANGLES,
208
- material: IMaterialAbstractData | null = null,
209
- morphWeights: number[] = [],
210
- attributeMaterial: IMaterialAbstractData | null = null,
211
- id?: string,
212
- version?: string
213
- ) {
214
- super(id, version);
215
- this.#primitive = primitive;
216
- this.#boundingBox = this.primitive.boundingBox.clone();
217
- this.#morphWeights = morphWeights;
218
-
219
- this.#mode = mode;
220
- this.#material = material;
221
- this.#standardMaterial = material;
222
- this.#attributeMaterial = attributeMaterial;
223
- }
224
-
225
- // #endregion Constructors (1)
226
-
227
- // #region Public Getters And Setters (15)
228
-
229
- public get attributeMaterial(): IMaterialAbstractData | null {
230
- return this.#attributeMaterial;
231
- }
232
-
233
- public set attributeMaterial(value: IMaterialAbstractData | null) {
234
- this.#attributeMaterial = value;
235
- }
236
-
237
- public get boundingBox(): IBox {
238
- return this.#boundingBox;
239
- }
240
-
241
- public get effectMaterials(): { material: IMaterialAbstractData, token: string }[] {
242
- return this.#effectMaterials;
243
- }
244
-
245
- public get material(): IMaterialAbstractData | null {
246
- return this.#material;
247
- }
248
-
249
- public set material(value: IMaterialAbstractData | null) {
250
- this.#material = value;
251
- }
252
-
253
- public get materialVariants(): { material: IMaterialAbstractData, variant: number }[] {
254
- return this.#materialVariants;
255
- }
256
-
257
- public get mode(): PRIMITIVE_MODE {
258
- return this.#mode;
259
- }
260
-
261
- public get morphWeights(): number[] {
262
- return this.#morphWeights;
263
- }
264
-
265
- public set morphWeights(value: number[]) {
266
- this.#morphWeights = value;
267
- }
268
-
269
- public get primitive(): IPrimitiveData {
270
- return this.#primitive;
271
- }
272
-
273
- public get renderOrder(): number {
274
- return this.#renderOrder;
275
- }
276
-
277
- public set renderOrder(value: number) {
278
- this.#renderOrder = value;
279
- }
280
-
281
- public get standardMaterial(): IMaterialAbstractData | null {
282
- return this.#standardMaterial;
283
- }
284
-
285
- public set standardMaterial(value: IMaterialAbstractData | null) {
286
- this.#standardMaterial = value;
287
- }
288
-
289
- // #endregion Public Getters And Setters (15)
290
-
291
- // #region Public Methods (2)
292
-
293
- /**
294
- * Clones the scene graph data.
295
- */
296
- public clone(): IGeometryData {
297
- return new GeometryData(this.#primitive, this.#mode, this.#material, this.#morphWeights, this.#attributeMaterial);
298
- }
299
-
300
- public intersect(origin: vec3, direction: vec3): number | null {
301
- if (this.mode !== PRIMITIVE_MODE.TRIANGLES) return null;
302
- return this.boundingBox.intersect(origin, direction);
303
- }
304
-
305
- // #endregion Public Methods (2)
306
- }
307
-
308
- export class PrimitiveData extends AbstractTreeNodeData implements IPrimitiveData {
309
- // #region Properties (3)
310
-
311
- readonly #attributes: {
312
- [key: string]: IAttributeData
313
- } = {};
314
-
315
- #boundingBoxes: {
316
- matrix: mat4,
317
- boundingBox: IBox
318
- }[] = [];
319
- #indices: IAttributeData | null = null;
320
-
321
- // #endregion Properties (3)
322
-
323
- // #region Constructors (1)
324
-
325
- /**
326
- * Creates a primitive data object.
327
- *
328
- * @param _attributes the attributes as key-value pairs
329
- * @param _indices the indices
330
- */
331
- constructor(
332
- attributes: {
333
- [key: string]: IAttributeData
334
- } = {},
335
- indices: IAttributeData | null = null,
336
- id?: string,
337
- version?: string
338
- ) {
339
- super(id, version);
340
- this.#attributes = attributes;
341
- this.#indices = indices;
342
- }
343
-
344
- // #endregion Constructors (1)
345
-
346
- // #region Public Getters And Setters (4)
347
-
348
- public get attributes(): {
349
- [key: string]: IAttributeData
350
- } {
351
- return this.#attributes;
352
- }
353
-
354
- public get boundingBox(): IBox {
355
- return this.computeBoundingBox(mat4.create());
356
- }
357
-
358
- public get indices(): IAttributeData | null {
359
- return this.#indices;
360
- }
361
-
362
- public set indices(value: IAttributeData | null) {
363
- this.#indices = value;
364
- }
365
-
366
- // #endregion Public Getters And Setters (4)
367
-
368
- // #region Public Methods (2)
369
-
370
- /**
371
- * Clones the primitive data.
372
- */
373
- public clone(): IPrimitiveData {
374
- const attributes: {
375
- [key: string]: IAttributeData
376
- } = {};
377
- for (const attribute in this.#attributes)
378
- attributes[attribute] = <IAttributeData>this.#attributes[attribute].clone();
379
-
380
- return new PrimitiveData(attributes, <AttributeData>this.#indices, this.id, this.version);
381
- }
382
-
383
- public computeBoundingBox(matrix: mat4): IBox {
384
- const res = this.#boundingBoxes.find(b => mat4.equals(matrix, b.matrix));
385
- if (res) return res.boundingBox;
386
-
387
- if (this.#attributes['POSITION']) {
388
- if (this.#attributes['POSITION'].min.length === 3 && this.#attributes['POSITION'].max.length === 3 && mat4.equals(matrix, mat4.create())) {
389
- const boundingBox = new Box(vec3.fromValues(this.#attributes['POSITION'].min[0], this.#attributes['POSITION'].min[1], this.#attributes['POSITION'].min[2]), vec3.fromValues(this.#attributes['POSITION'].max[0], this.#attributes['POSITION'].max[1], this.#attributes['POSITION'].max[2]));
390
- this.#boundingBoxes.push({
391
- boundingBox,
392
- matrix: mat4.clone(matrix)
393
- });
394
- return boundingBox;
395
- } else if (mat4.equals(matrix, mat4.create())) {
396
- const boundingBox = new Box();
397
- boundingBox.setFromAttributeArray(this.#attributes['POSITION'].array, this.#attributes['POSITION'].byteStride, this.#attributes['POSITION'].itemBytes);
398
- this.#boundingBoxes.push({
399
- boundingBox,
400
- matrix: mat4.clone(matrix)
401
- });
402
- } else if (quat.equals(mat4.getRotation(quat.create(), matrix), quat.create())) {
403
- const identityBB = this.computeBoundingBox(mat4.create());
404
- const boundingBox = identityBB.clone().applyMatrix(matrix);
405
- this.#boundingBoxes.push({
406
- boundingBox,
407
- matrix: mat4.clone(matrix)
408
- });
409
- return boundingBox;
410
- } else {
411
- const boundingBox = new Box();
412
- boundingBox.setFromAttributeArray(this.#attributes['POSITION'].array, this.#attributes['POSITION'].byteStride, this.#attributes['POSITION'].itemBytes, matrix);
413
- this.#boundingBoxes.push({
414
- boundingBox,
415
- matrix: mat4.clone(matrix)
416
- });
417
- return boundingBox;
418
- }
419
- }
420
- return new Box();
421
- }
422
-
423
- // #endregion Public Methods (2)
424
- }
425
-
426
- // #endregion Classes (3)