@shapediver/viewer.shared.types 3.3.3 → 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.
- package/dist/implementation/data/GeometryData.d.ts.map +1 -1
- package/dist/implementation/data/GeometryData.js +1 -0
- package/dist/implementation/data/GeometryData.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces/parameter/IDrawingParametersSettings.d.ts +121 -0
- package/dist/interfaces/parameter/IDrawingParametersSettings.d.ts.map +1 -0
- package/dist/interfaces/parameter/IDrawingParametersSettings.js +22 -0
- package/dist/interfaces/parameter/IDrawingParametersSettings.js.map +1 -0
- package/dist/interfaces/parameter/IDrawingToolsParametersSettings.d.ts +159 -0
- package/dist/interfaces/parameter/IDrawingToolsParametersSettings.d.ts.map +1 -0
- package/dist/interfaces/parameter/IDrawingToolsParametersSettings.js +29 -0
- package/dist/interfaces/parameter/IDrawingToolsParametersSettings.js.map +1 -0
- package/dist/interfaces/parameter/IGumballParameterSettings.d.ts +1 -5
- package/dist/interfaces/parameter/IGumballParameterSettings.d.ts.map +1 -1
- package/dist/interfaces/parameter/IGumballParameterSettings.js +0 -7
- package/dist/interfaces/parameter/IGumballParameterSettings.js.map +1 -1
- package/dist/interfaces/parameter/ISelectionParameterSettings.d.ts +1 -5
- package/dist/interfaces/parameter/ISelectionParameterSettings.d.ts.map +1 -1
- package/dist/interfaces/parameter/ISelectionParameterSettings.js +0 -7
- package/dist/interfaces/parameter/ISelectionParameterSettings.js.map +1 -1
- package/package.json +7 -8
- package/src/implementation/data/AnimationData.ts +0 -310
- package/src/implementation/data/BoneData.ts +0 -32
- package/src/implementation/data/CustomData.ts +0 -52
- package/src/implementation/data/GeometryData.ts +0 -426
- package/src/implementation/data/HTMLElementAnchorData.ts +0 -365
- package/src/implementation/material/AbstractMaterialData.ts +0 -268
- package/src/implementation/material/MapData.ts +0 -218
- package/src/implementation/material/MaterialBasicLineData.ts +0 -99
- package/src/implementation/material/MaterialGemData.ts +0 -310
- package/src/implementation/material/MaterialMultiPointData.ts +0 -659
- package/src/implementation/material/MaterialPointData.ts +0 -136
- package/src/implementation/material/MaterialShadowData.ts +0 -45
- package/src/implementation/material/MaterialSpecularGlossinessData.ts +0 -191
- package/src/implementation/material/MaterialStandardData.ts +0 -502
- package/src/implementation/material/MaterialUnlitData.ts +0 -122
- package/src/implementation/material/MaterialVariantsData.ts +0 -60
- package/src/implementation/sdtf/SDTFAttributesData.ts +0 -128
- package/src/implementation/sdtf/SDTFItemData.ts +0 -72
- package/src/implementation/sdtf/SDTFOverviewData.ts +0 -80
- package/src/index.ts +0 -141
- package/src/interfaces/data/IAnimationData.ts +0 -42
- package/src/interfaces/data/IBoneData.ts +0 -9
- package/src/interfaces/data/ICustomData.ts +0 -15
- package/src/interfaces/data/IGeometryData.ts +0 -87
- package/src/interfaces/data/IHTMLElementAnchorData.ts +0 -68
- package/src/interfaces/data/material/IMapData.ts +0 -64
- package/src/interfaces/data/material/IMaterialAbstractData.ts +0 -86
- package/src/interfaces/data/material/IMaterialBasicLineData.ts +0 -21
- package/src/interfaces/data/material/IMaterialGemDataProperties.ts +0 -46
- package/src/interfaces/data/material/IMaterialMultiPointData.ts +0 -72
- package/src/interfaces/data/material/IMaterialPointData.ts +0 -31
- package/src/interfaces/data/material/IMaterialShadowData.ts +0 -21
- package/src/interfaces/data/material/IMaterialSpecularGlossinessDataProperties.ts +0 -36
- package/src/interfaces/data/material/IMaterialStandardData.ts +0 -60
- package/src/interfaces/data/material/IMaterialUnlitData.ts +0 -30
- package/src/interfaces/data/material/IMaterialVariantsData.ts +0 -19
- package/src/interfaces/events/EventResponseMapping.ts +0 -53
- package/src/interfaces/events/ICameraEvent.ts +0 -16
- package/src/interfaces/events/IOutputEvent.ts +0 -29
- package/src/interfaces/events/IParameterEvent.ts +0 -21
- package/src/interfaces/events/IRenderingEvent.ts +0 -7
- package/src/interfaces/events/ISceneEvent.ts +0 -17
- package/src/interfaces/events/ISessionEvent.ts +0 -16
- package/src/interfaces/events/ITaskEvent.ts +0 -61
- package/src/interfaces/events/IViewportEvent.ts +0 -13
- package/src/interfaces/parameter/IGumballParameterSettings.ts +0 -44
- package/src/interfaces/parameter/IInteractionParameterSettings.ts +0 -85
- package/src/interfaces/parameter/ISelectionParameterSettings.ts +0 -37
- package/src/interfaces/sdtf/ISDTFAttributeVisualizationData.ts +0 -7
- package/src/interfaces/sdtf/ISDTFAttributesData.ts +0 -27
- package/src/interfaces/sdtf/ISDTFItemData.ts +0 -23
- package/src/interfaces/sdtf/ISDTFOverviewData.ts +0 -31
- package/src/types.ts +0 -68
- package/tsconfig.json +0 -17
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { Box } from '@shapediver/viewer.shared.math'
|
|
2
|
-
import { AbstractTreeNodeData, ITreeNodeData } from '@shapediver/viewer.shared.node-tree'
|
|
3
|
-
import { vec2, vec3 } from 'gl-matrix'
|
|
4
|
-
import { IAnchorDataImage, IAnchorDataText, IHTMLElementAnchorData } from '../../interfaces/data/IHTMLElementAnchorData';
|
|
5
|
-
|
|
6
|
-
export abstract class HTMLElementAnchorData extends AbstractTreeNodeData implements IHTMLElementAnchorData {
|
|
7
|
-
// #region Properties (9)
|
|
8
|
-
|
|
9
|
-
protected internalHtmlElement: HTMLDivElement;
|
|
10
|
-
readonly #viewerHtmlElement: {
|
|
11
|
-
[key: string]: HTMLDivElement;
|
|
12
|
-
} = {};
|
|
13
|
-
|
|
14
|
-
#data: IAnchorDataImage | IAnchorDataText | any;
|
|
15
|
-
#format: 'text' | 'image' | 'custom';
|
|
16
|
-
#hideable: boolean = true;
|
|
17
|
-
#intersectionTarget?: Box | string | string[];
|
|
18
|
-
#location: vec3;
|
|
19
|
-
#viewports: string[] = [];
|
|
20
|
-
|
|
21
|
-
// #endregion Properties (9)
|
|
22
|
-
|
|
23
|
-
// #region Constructors (1)
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates a custom data node.
|
|
27
|
-
*
|
|
28
|
-
* @param _data the data as key- value pairs
|
|
29
|
-
* @param id the id
|
|
30
|
-
*/
|
|
31
|
-
constructor(properties:
|
|
32
|
-
{
|
|
33
|
-
location: vec3,
|
|
34
|
-
data: IAnchorDataImage | IAnchorDataText | any,
|
|
35
|
-
format: 'text' | 'image' | 'custom',
|
|
36
|
-
hideable?: boolean,
|
|
37
|
-
viewports?: string[],
|
|
38
|
-
intersectionTarget?: Box | string | string[],
|
|
39
|
-
id?: string,
|
|
40
|
-
version?: string
|
|
41
|
-
}
|
|
42
|
-
) {
|
|
43
|
-
super(properties.id, properties.version);
|
|
44
|
-
|
|
45
|
-
this.#location = properties.location;
|
|
46
|
-
this.#data = properties.data;
|
|
47
|
-
this.#format = properties.format;
|
|
48
|
-
this.#hideable = properties.hideable === undefined ? true : properties.hideable;
|
|
49
|
-
this.#viewports = properties.viewports || [];
|
|
50
|
-
this.#intersectionTarget = properties.intersectionTarget;
|
|
51
|
-
|
|
52
|
-
this.internalHtmlElement = <HTMLDivElement>document.createElement('div');
|
|
53
|
-
this.internalHtmlElement.classList.add('sdv-anchor-inner-container');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// #endregion Constructors (1)
|
|
57
|
-
|
|
58
|
-
// #region Public Accessors (12)
|
|
59
|
-
|
|
60
|
-
public get data(): IAnchorDataImage | IAnchorDataText | any {
|
|
61
|
-
return this.#data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public set data(value: IAnchorDataImage | IAnchorDataText | any) {
|
|
65
|
-
this.#data = value;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public get format(): 'text' | 'image' | 'custom' {
|
|
69
|
-
return this.#format;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public set format(value: 'text' | 'image' | 'custom') {
|
|
73
|
-
this.#format = value;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public get hideable(): boolean {
|
|
77
|
-
return this.#hideable;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public set hideable(value: boolean) {
|
|
81
|
-
this.#hideable = value;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
public get intersectionTarget(): Box | string | string[] | undefined {
|
|
85
|
-
return this.#intersectionTarget;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public set intersectionTarget(value: Box | string | string[] | undefined) {
|
|
89
|
-
this.#intersectionTarget = value;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public get location(): vec3 {
|
|
93
|
-
return this.#location;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public set location(value: vec3) {
|
|
97
|
-
this.#location = value;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public get viewports(): string[] {
|
|
101
|
-
return this.#viewports;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public set viewports(value: string[]) {
|
|
105
|
-
this.#viewports = value;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// #endregion Public Accessors (12)
|
|
109
|
-
|
|
110
|
-
// #region Public Methods (3)
|
|
111
|
-
|
|
112
|
-
public createViewerHtmlElement(viewer: string): HTMLDivElement | null {
|
|
113
|
-
if (this.#viewerHtmlElement[viewer]) return this.#viewerHtmlElement[viewer];
|
|
114
|
-
if (this.viewports.includes(viewer) || this.viewports.length === 0) {
|
|
115
|
-
this.#viewerHtmlElement[viewer] = <HTMLDivElement>this.internalHtmlElement.cloneNode(true);
|
|
116
|
-
this.create({ anchor: this, parent: this.#viewerHtmlElement[viewer] });
|
|
117
|
-
return this.#viewerHtmlElement[viewer];
|
|
118
|
-
}
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public getViewerHtmlElement(viewer: string): HTMLDivElement | null {
|
|
123
|
-
if (this.#viewerHtmlElement[viewer]) return this.#viewerHtmlElement[viewer];
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public abstract create(properties: { anchor: IHTMLElementAnchorData, parent: HTMLDivElement }): void;
|
|
128
|
-
|
|
129
|
-
public update(properties: {
|
|
130
|
-
anchor: IHTMLElementAnchorData,
|
|
131
|
-
htmlElement: HTMLDivElement,
|
|
132
|
-
page: vec2,
|
|
133
|
-
container: vec2,
|
|
134
|
-
client: vec2,
|
|
135
|
-
scale: vec2,
|
|
136
|
-
hidden: boolean,
|
|
137
|
-
visible: boolean
|
|
138
|
-
}) {
|
|
139
|
-
properties.htmlElement.style.display = '';
|
|
140
|
-
if ((this.hideable && properties.hidden) || properties.visible === false) properties.htmlElement.style.display = 'none';
|
|
141
|
-
|
|
142
|
-
let x, y;
|
|
143
|
-
|
|
144
|
-
if (this.data.position && this.data.position.horizontal === 'right') {
|
|
145
|
-
x = properties.container[0] - properties.htmlElement.offsetWidth;
|
|
146
|
-
} else if (this.data.position && this.data.position.horizontal === 'left') {
|
|
147
|
-
x = properties.container[0];
|
|
148
|
-
} else {
|
|
149
|
-
x = properties.container[0] - properties.htmlElement.offsetWidth / 2;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (this.data.position && this.data.position.vertical === 'bottom') {
|
|
153
|
-
y = properties.container[1] - properties.htmlElement.offsetHeight;
|
|
154
|
-
} else if (this.data.position && this.data.position.vertical === 'top') {
|
|
155
|
-
y = properties.container[1];
|
|
156
|
-
} else {
|
|
157
|
-
y = properties.container[1] - properties.htmlElement.offsetHeight / 2;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
x = x / properties.scale[0];
|
|
161
|
-
y = y / properties.scale[1];
|
|
162
|
-
|
|
163
|
-
properties.htmlElement.style.left = x + 'px';
|
|
164
|
-
properties.htmlElement.style.top = y + 'px';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// #endregion Public Methods (3)
|
|
168
|
-
|
|
169
|
-
// #region Public Abstract Methods (1)
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Clones the scene graph data.
|
|
173
|
-
*/
|
|
174
|
-
public abstract clone(): IHTMLElementAnchorData;
|
|
175
|
-
|
|
176
|
-
// #endregion Public Abstract Methods (1)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export class HTMLElementAnchorTextData extends HTMLElementAnchorData {
|
|
180
|
-
// #region Constructors (1)
|
|
181
|
-
|
|
182
|
-
constructor(properties:
|
|
183
|
-
{
|
|
184
|
-
location: vec3,
|
|
185
|
-
data: IAnchorDataText,
|
|
186
|
-
hideable?: boolean,
|
|
187
|
-
viewports?: string[],
|
|
188
|
-
intersectionTarget?: Box | string | string[],
|
|
189
|
-
id?: string,
|
|
190
|
-
version?: string
|
|
191
|
-
}) {
|
|
192
|
-
super({
|
|
193
|
-
location: properties.location,
|
|
194
|
-
data: properties.data,
|
|
195
|
-
format: 'text',
|
|
196
|
-
hideable: properties.hideable,
|
|
197
|
-
viewports: properties.viewports,
|
|
198
|
-
intersectionTarget: properties.intersectionTarget,
|
|
199
|
-
id: properties.id,
|
|
200
|
-
version: properties.version,
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// #endregion Constructors (1)
|
|
205
|
-
|
|
206
|
-
// #region Public Methods (1)
|
|
207
|
-
|
|
208
|
-
public clone(): HTMLElementAnchorTextData {
|
|
209
|
-
return new HTMLElementAnchorTextData({
|
|
210
|
-
location: this.location,
|
|
211
|
-
data: this.data,
|
|
212
|
-
hideable: this.hideable,
|
|
213
|
-
viewports: this.viewports,
|
|
214
|
-
intersectionTarget: this.intersectionTarget,
|
|
215
|
-
id: this.id,
|
|
216
|
-
version: this.version
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// #endregion Public Methods (1)
|
|
221
|
-
|
|
222
|
-
// #region Private Methods (1)
|
|
223
|
-
|
|
224
|
-
public create(properties: { anchor: HTMLElementAnchorData, parent: HTMLDivElement }) {
|
|
225
|
-
|
|
226
|
-
const span = document.createElement('span');
|
|
227
|
-
span.classList.add('sdv-anchor-text');
|
|
228
|
-
span.style.color = properties.anchor.data.color?.toString();
|
|
229
|
-
span.innerHTML = properties.anchor.data.text;
|
|
230
|
-
properties.parent.appendChild(span);
|
|
231
|
-
|
|
232
|
-
if (properties.anchor.data.textAlign && (properties.anchor.data.textAlign === 'right' || properties.anchor.data.textAlign === 'center')) {
|
|
233
|
-
span.style.textAlign = properties.anchor.data.textAlign;
|
|
234
|
-
} else {
|
|
235
|
-
span.style.textAlign = 'left';
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// #endregion Private Methods (1)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export class HTMLElementAnchorImageData extends HTMLElementAnchorData {
|
|
243
|
-
// #region Constructors (1)
|
|
244
|
-
|
|
245
|
-
constructor(properties:
|
|
246
|
-
{
|
|
247
|
-
location: vec3,
|
|
248
|
-
data: IAnchorDataImage,
|
|
249
|
-
hideable?: boolean,
|
|
250
|
-
viewports?: string[],
|
|
251
|
-
intersectionTarget?: Box | string | string[],
|
|
252
|
-
id?: string,
|
|
253
|
-
version?: string
|
|
254
|
-
}) {
|
|
255
|
-
super({
|
|
256
|
-
location: properties.location,
|
|
257
|
-
data: properties.data,
|
|
258
|
-
format: 'image',
|
|
259
|
-
hideable: properties.hideable,
|
|
260
|
-
viewports: properties.viewports,
|
|
261
|
-
intersectionTarget: properties.intersectionTarget,
|
|
262
|
-
id: properties.id,
|
|
263
|
-
version: properties.version
|
|
264
|
-
})
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// #endregion Constructors (1)
|
|
268
|
-
|
|
269
|
-
// #region Public Methods (1)
|
|
270
|
-
|
|
271
|
-
public clone(): HTMLElementAnchorImageData {
|
|
272
|
-
return new HTMLElementAnchorImageData({
|
|
273
|
-
location: this.location,
|
|
274
|
-
data: this.data,
|
|
275
|
-
hideable: this.hideable,
|
|
276
|
-
viewports: this.viewports,
|
|
277
|
-
intersectionTarget: this.intersectionTarget,
|
|
278
|
-
id: this.id,
|
|
279
|
-
version: this.version
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// #endregion Public Methods (1)
|
|
284
|
-
|
|
285
|
-
// #region Private Methods (1)
|
|
286
|
-
|
|
287
|
-
public create(properties: { anchor: HTMLElementAnchorData, parent: HTMLDivElement }) {
|
|
288
|
-
|
|
289
|
-
const img = document.createElement('img');
|
|
290
|
-
img.classList.add('sdv-anchor-image');
|
|
291
|
-
properties.parent.appendChild(img);
|
|
292
|
-
img.src = properties.anchor.data.src;
|
|
293
|
-
if (properties.anchor.data.height) img.height = properties.anchor.data.height;
|
|
294
|
-
if (properties.anchor.data.width) img.width = properties.anchor.data.width;
|
|
295
|
-
if (properties.anchor.data.alt) img.alt = properties.anchor.data.alt;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// #endregion Private Methods (1)
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export class HTMLElementAnchorCustomData extends HTMLElementAnchorData {
|
|
302
|
-
// #region Properties (1)
|
|
303
|
-
|
|
304
|
-
readonly #create: (properties: { anchor: HTMLElementAnchorData, parent: HTMLDivElement }) => void;
|
|
305
|
-
readonly #update: (properties: { anchor: HTMLElementAnchorData, htmlElement: HTMLDivElement, page: vec2, container: vec2, client: vec2, scale: vec2, hidden: boolean, visible: boolean }) => void;
|
|
306
|
-
|
|
307
|
-
// #endregion Properties (1)
|
|
308
|
-
|
|
309
|
-
// #region Constructors (1)
|
|
310
|
-
|
|
311
|
-
constructor(properties:
|
|
312
|
-
{
|
|
313
|
-
location: vec3,
|
|
314
|
-
data: any,
|
|
315
|
-
hideable?: boolean,
|
|
316
|
-
viewports?: string[],
|
|
317
|
-
intersectionTarget?: Box | string | string[],
|
|
318
|
-
id?: string,
|
|
319
|
-
version?: string
|
|
320
|
-
create: (properties: { anchor: HTMLElementAnchorData, parent: HTMLDivElement }) => void,
|
|
321
|
-
update: (properties: { anchor: HTMLElementAnchorData, htmlElement: HTMLDivElement, page: vec2, container: vec2, client: vec2, scale: vec2, hidden: boolean, visible: boolean }) => void
|
|
322
|
-
}) {
|
|
323
|
-
super({
|
|
324
|
-
location: properties.location,
|
|
325
|
-
data: properties.data,
|
|
326
|
-
format: 'custom',
|
|
327
|
-
hideable: properties.hideable,
|
|
328
|
-
viewports: properties.viewports,
|
|
329
|
-
intersectionTarget: properties.intersectionTarget,
|
|
330
|
-
id: properties.id,
|
|
331
|
-
version: properties.version
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
this.#create = properties.create;
|
|
335
|
-
this.#update = properties.update;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// #endregion Constructors (1)
|
|
339
|
-
|
|
340
|
-
public create(properties: { anchor: HTMLElementAnchorData, parent: HTMLDivElement }) {
|
|
341
|
-
this.#create(properties)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
public update(properties: { anchor: HTMLElementAnchorData, htmlElement: HTMLDivElement, page: vec2, container: vec2, client: vec2, scale: vec2, hidden: boolean, visible: boolean }) {
|
|
345
|
-
this.#update(properties)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// #region Public Methods (1)
|
|
349
|
-
|
|
350
|
-
public clone(): HTMLElementAnchorCustomData {
|
|
351
|
-
return new HTMLElementAnchorCustomData({
|
|
352
|
-
location: this.location,
|
|
353
|
-
data: this.data,
|
|
354
|
-
hideable: this.hideable,
|
|
355
|
-
viewports: this.viewports,
|
|
356
|
-
intersectionTarget: this.intersectionTarget,
|
|
357
|
-
id: this.id,
|
|
358
|
-
version: this.version,
|
|
359
|
-
create: this.#create,
|
|
360
|
-
update: this.#update,
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// #endregion Public Methods (1)
|
|
365
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { AbstractTreeNodeData } from '@shapediver/viewer.shared.node-tree';
|
|
2
|
-
import { Color } from '../../types';
|
|
3
|
-
import { IMapData } from '../../interfaces/data/material/IMapData';
|
|
4
|
-
import {
|
|
5
|
-
IMaterialAbstractData,
|
|
6
|
-
IMaterialAbstractDataProperties,
|
|
7
|
-
MATERIAL_ALPHA,
|
|
8
|
-
MATERIAL_SHADING,
|
|
9
|
-
MATERIAL_SIDE
|
|
10
|
-
} from '../../interfaces/data/material/IMaterialAbstractData';
|
|
11
|
-
|
|
12
|
-
export abstract class AbstractMaterialData extends AbstractTreeNodeData implements IMaterialAbstractData {
|
|
13
|
-
// #region Properties (21)
|
|
14
|
-
|
|
15
|
-
#alphaCutoff: number = 0;
|
|
16
|
-
#alphaMap?: IMapData;
|
|
17
|
-
#alphaMode: MATERIAL_ALPHA = MATERIAL_ALPHA.OPAQUE;
|
|
18
|
-
#aoMap?: IMapData;
|
|
19
|
-
#aoMapIntensity: number = 1.0;
|
|
20
|
-
#bumpMap?: IMapData;
|
|
21
|
-
#bumpScale: number = 1.0;
|
|
22
|
-
#color: Color = '#ffffff';
|
|
23
|
-
#depthTest?: boolean;
|
|
24
|
-
#depthWrite?: boolean;
|
|
25
|
-
#emissiveMap?: IMapData;
|
|
26
|
-
#emissiveness: Color = '#000000';
|
|
27
|
-
#map?: IMapData;
|
|
28
|
-
#materialOutput: boolean = false;
|
|
29
|
-
#name?: string;
|
|
30
|
-
#normalMap?: IMapData;
|
|
31
|
-
#normalScale: number = 1.0;
|
|
32
|
-
#opacity = 1.0;
|
|
33
|
-
#shading: MATERIAL_SHADING = MATERIAL_SHADING.SMOOTH;
|
|
34
|
-
#side: MATERIAL_SIDE = MATERIAL_SIDE.DOUBLE;
|
|
35
|
-
#transparent?: boolean;
|
|
36
|
-
|
|
37
|
-
// #endregion Properties (21)
|
|
38
|
-
|
|
39
|
-
// #region Constructors (1)
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Creates a material data object.
|
|
43
|
-
*
|
|
44
|
-
* @param _attributes the attributes of the material
|
|
45
|
-
* @param id the id
|
|
46
|
-
*/
|
|
47
|
-
constructor(
|
|
48
|
-
properties?: IMaterialAbstractDataProperties,
|
|
49
|
-
id?: string,
|
|
50
|
-
version?: string
|
|
51
|
-
) {
|
|
52
|
-
super(id, version);
|
|
53
|
-
if (!properties) return;
|
|
54
|
-
if (properties.alphaMap !== undefined) this.alphaMap = properties.alphaMap;
|
|
55
|
-
if (properties.alphaCutoff !== undefined) this.alphaCutoff = properties.alphaCutoff;
|
|
56
|
-
if (properties.alphaMode !== undefined) this.alphaMode = properties.alphaMode;
|
|
57
|
-
if (properties.aoMap !== undefined) this.aoMap = properties.aoMap;
|
|
58
|
-
if (properties.aoMapIntensity !== undefined) this.aoMapIntensity = properties.aoMapIntensity;
|
|
59
|
-
if (properties.bumpMap !== undefined) this.bumpMap = properties.bumpMap;
|
|
60
|
-
if (properties.bumpScale !== undefined) this.bumpScale = properties.bumpScale;
|
|
61
|
-
if (properties.color !== undefined) this.color = properties.color;
|
|
62
|
-
if (properties.depthTest !== undefined) this.depthTest = properties.depthTest;
|
|
63
|
-
if (properties.depthWrite !== undefined) this.depthWrite = properties.depthWrite;
|
|
64
|
-
if (properties.emissiveMap !== undefined) this.emissiveMap = properties.emissiveMap;
|
|
65
|
-
if (properties.emissiveness !== undefined) this.emissiveness = properties.emissiveness;
|
|
66
|
-
if (properties.shading !== undefined) this.shading = properties.shading;
|
|
67
|
-
if (properties.map !== undefined) this.map = properties.map;
|
|
68
|
-
if (properties.name !== undefined) this.name = properties.name;
|
|
69
|
-
if (properties.normalMap !== undefined) this.normalMap = properties.normalMap;
|
|
70
|
-
if (properties.normalScale !== undefined) this.normalScale = properties.normalScale;
|
|
71
|
-
if (properties.opacity !== undefined) this.opacity = properties.opacity;
|
|
72
|
-
if (properties.side !== undefined) this.side = properties.side;
|
|
73
|
-
if (properties.transparent !== undefined) this.transparent = properties.transparent;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// #endregion Constructors (1)
|
|
77
|
-
|
|
78
|
-
// #region Public Getters And Setters (42)
|
|
79
|
-
|
|
80
|
-
public get alphaCutoff(): number {
|
|
81
|
-
return this.#alphaCutoff;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
public set alphaCutoff(value: number) {
|
|
85
|
-
this.#alphaCutoff = value;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public get alphaMap(): IMapData | undefined {
|
|
89
|
-
return this.#alphaMap;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public set alphaMap(value: IMapData | undefined) {
|
|
93
|
-
this.#alphaMap = value;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public get alphaMode(): MATERIAL_ALPHA {
|
|
97
|
-
return this.#alphaMode;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public set alphaMode(value: MATERIAL_ALPHA) {
|
|
101
|
-
this.#alphaMode = value;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public get aoMap(): IMapData | undefined {
|
|
105
|
-
return this.#aoMap;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public set aoMap(value: IMapData | undefined) {
|
|
109
|
-
this.#aoMap = value;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public get aoMapIntensity(): number {
|
|
113
|
-
return this.#aoMapIntensity;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public set aoMapIntensity(value: number) {
|
|
117
|
-
this.#aoMapIntensity = value;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public get bumpMap(): IMapData | undefined {
|
|
121
|
-
return this.#bumpMap;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public set bumpMap(value: IMapData | undefined) {
|
|
125
|
-
this.#bumpMap = value;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public get bumpScale(): number {
|
|
129
|
-
return this.#bumpScale;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public set bumpScale(value: number) {
|
|
133
|
-
this.#bumpScale = value;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public get color(): Color {
|
|
137
|
-
return this.#color;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
public set color(value: Color) {
|
|
141
|
-
this.#color = value;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
public get depthTest(): boolean | undefined {
|
|
145
|
-
return this.#depthTest;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public set depthTest(value: boolean | undefined) {
|
|
149
|
-
this.#depthTest = value;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public get depthWrite(): boolean | undefined {
|
|
153
|
-
return this.#depthWrite;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public set depthWrite(value: boolean | undefined) {
|
|
157
|
-
this.#depthWrite = value;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
public get emissiveMap(): IMapData | undefined {
|
|
161
|
-
return this.#emissiveMap;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public set emissiveMap(value: IMapData | undefined) {
|
|
165
|
-
this.#emissiveMap = value;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
public get emissiveness(): Color {
|
|
169
|
-
return this.#emissiveness;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public set emissiveness(value: Color) {
|
|
173
|
-
this.#emissiveness = value;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
public get map(): IMapData | undefined {
|
|
177
|
-
return this.#map;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
public set map(value: IMapData | undefined) {
|
|
181
|
-
this.#map = value;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
public get materialOutput(): boolean {
|
|
185
|
-
return this.#materialOutput;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public set materialOutput(value: boolean) {
|
|
189
|
-
this.#materialOutput = value;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public get name(): string | undefined {
|
|
193
|
-
return this.#name;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
public set name(value: string | undefined) {
|
|
197
|
-
this.#name = value;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
public get normalMap(): IMapData | undefined {
|
|
201
|
-
return this.#normalMap;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public set normalMap(value: IMapData | undefined) {
|
|
205
|
-
this.#normalMap = value;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
public get normalScale(): number {
|
|
209
|
-
return this.#normalScale;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
public set normalScale(value: number) {
|
|
213
|
-
this.#normalScale = value;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
public get opacity(): number {
|
|
217
|
-
return this.#opacity;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
public set opacity(value: number) {
|
|
221
|
-
this.#opacity = value;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
public get shading(): MATERIAL_SHADING {
|
|
225
|
-
return this.#shading;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
public set shading(value: MATERIAL_SHADING) {
|
|
229
|
-
this.#shading = value;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
public get side(): MATERIAL_SIDE {
|
|
233
|
-
return this.#side;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
public set side(value: MATERIAL_SIDE) {
|
|
237
|
-
this.#side = value;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public get transparent(): boolean | undefined {
|
|
241
|
-
return this.#transparent;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
public set transparent(value: boolean | undefined) {
|
|
245
|
-
this.#transparent = value;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// #endregion Public Getters And Setters (42)
|
|
249
|
-
|
|
250
|
-
// #region Public Abstract Methods (3)
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Clones the scene graph data.
|
|
254
|
-
*/
|
|
255
|
-
public abstract clone(): IMaterialAbstractData;
|
|
256
|
-
/**
|
|
257
|
-
* Copy all properties of another material data object.
|
|
258
|
-
*
|
|
259
|
-
* @param source
|
|
260
|
-
*/
|
|
261
|
-
public abstract copy(source: IMaterialAbstractData): void;
|
|
262
|
-
/**
|
|
263
|
-
* Reset the material data.
|
|
264
|
-
*/
|
|
265
|
-
public abstract reset(): void;
|
|
266
|
-
|
|
267
|
-
// #endregion Public Abstract Methods (3)
|
|
268
|
-
}
|