@shapediver/viewer.features.attribute-visualization 2.0.12 → 2.1.2
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/AttributeVisualizationEngine.d.ts +4 -0
- package/dist/implementation/AttributeVisualizationEngine.d.ts.map +1 -1
- package/dist/implementation/AttributeVisualizationEngine.js +66 -17
- package/dist/implementation/AttributeVisualizationEngine.js.map +1 -1
- package/dist/implementation/AttributeVisualizationUtils.d.ts +2 -2
- package/dist/implementation/AttributeVisualizationUtils.d.ts.map +1 -1
- package/dist/implementation/AttributeVisualizationUtils.js +38 -38
- package/dist/implementation/AttributeVisualizationUtils.js.map +1 -1
- package/package.json +5 -5
- package/src/implementation/AttributeVisualizationEngine.ts +69 -15
- package/src/implementation/AttributeVisualizationUtils.ts +39 -39
|
@@ -11,10 +11,14 @@ export declare class AttributeVisualizationEngine implements IAttributeVisualiza
|
|
|
11
11
|
get layers(): {
|
|
12
12
|
[key: string]: ILayer;
|
|
13
13
|
};
|
|
14
|
+
get layerMaterialType(): 'unlit' | 'standard';
|
|
15
|
+
get visualizedMaterialType(): 'unlit' | 'standard';
|
|
14
16
|
get overview(): ISDTFOverview;
|
|
15
17
|
updateAttributes(attributes: IAttribute[]): void;
|
|
16
18
|
updateDefaultLayer(layer: ILayer): void;
|
|
17
19
|
updateDefaultMaterial(material: IMaterialAbstractData): void;
|
|
20
|
+
updateLayerMaterialType(type: 'unlit' | 'standard'): void;
|
|
21
|
+
updateVisualizedMaterialType(type: 'unlit' | 'standard'): void;
|
|
18
22
|
updateLayers(layers: {
|
|
19
23
|
[key: string]: ILayer;
|
|
20
24
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeVisualizationEngine.d.ts","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,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G,MAAM,CAAA;KAAE;IAM9C,WAAW,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM;IAMnC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAU7C,OAAO,CAAC,+BAA+B;IAkJvC,OAAO,CAAC,YAAY;CAiBvB"}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _AttributeVisualizationEngine_converter, _AttributeVisualizationEngine_uuidGenerator, _AttributeVisualizationEngine_viewport, _AttributeVisualizationEngine_attributes, _AttributeVisualizationEngine_defaultMaterial, _AttributeVisualizationEngine_defaultLayer, _AttributeVisualizationEngine_layers, _AttributeVisualizationEngine_overview, _AttributeVisualizationEngine_listeners;
|
|
13
|
+
var _AttributeVisualizationEngine_converter, _AttributeVisualizationEngine_uuidGenerator, _AttributeVisualizationEngine_viewport, _AttributeVisualizationEngine_attributes, _AttributeVisualizationEngine_defaultMaterial, _AttributeVisualizationEngine_defaultLayer, _AttributeVisualizationEngine_layers, _AttributeVisualizationEngine_overview, _AttributeVisualizationEngine_listeners, _AttributeVisualizationEngine_visualizedMaterialType, _AttributeVisualizationEngine_layerMaterialType;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AttributeVisualizationEngine = void 0;
|
|
16
16
|
const viewer_1 = require("@shapediver/viewer");
|
|
@@ -37,6 +37,8 @@ class AttributeVisualizationEngine {
|
|
|
37
37
|
_AttributeVisualizationEngine_layers.set(this, {});
|
|
38
38
|
_AttributeVisualizationEngine_overview.set(this, void 0);
|
|
39
39
|
_AttributeVisualizationEngine_listeners.set(this, {});
|
|
40
|
+
_AttributeVisualizationEngine_visualizedMaterialType.set(this, 'unlit');
|
|
41
|
+
_AttributeVisualizationEngine_layerMaterialType.set(this, 'unlit');
|
|
40
42
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_viewport, viewport, "f");
|
|
41
43
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_overview, __classPrivateFieldGet(this, _AttributeVisualizationEngine_viewport, "f").createSDTFOverview(viewer_1.sceneTree.root), "f");
|
|
42
44
|
this.createLayers();
|
|
@@ -60,6 +62,12 @@ class AttributeVisualizationEngine {
|
|
|
60
62
|
get layers() {
|
|
61
63
|
return __classPrivateFieldGet(this, _AttributeVisualizationEngine_layers, "f");
|
|
62
64
|
}
|
|
65
|
+
get layerMaterialType() {
|
|
66
|
+
return __classPrivateFieldGet(this, _AttributeVisualizationEngine_layerMaterialType, "f");
|
|
67
|
+
}
|
|
68
|
+
get visualizedMaterialType() {
|
|
69
|
+
return __classPrivateFieldGet(this, _AttributeVisualizationEngine_visualizedMaterialType, "f");
|
|
70
|
+
}
|
|
63
71
|
get overview() {
|
|
64
72
|
return __classPrivateFieldGet(this, _AttributeVisualizationEngine_overview, "f");
|
|
65
73
|
}
|
|
@@ -67,18 +75,32 @@ class AttributeVisualizationEngine {
|
|
|
67
75
|
// #region Public Methods (3)
|
|
68
76
|
updateAttributes(attributes) {
|
|
69
77
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_attributes, attributes, "f");
|
|
78
|
+
this.createLayers();
|
|
70
79
|
this.constructAttributeVisualization();
|
|
71
80
|
}
|
|
72
81
|
updateDefaultLayer(layer) {
|
|
73
82
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_defaultLayer, layer, "f");
|
|
83
|
+
this.createLayers();
|
|
74
84
|
this.constructAttributeVisualization();
|
|
75
85
|
}
|
|
76
86
|
updateDefaultMaterial(material) {
|
|
77
87
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_defaultMaterial, material, "f");
|
|
88
|
+
this.createLayers();
|
|
89
|
+
this.constructAttributeVisualization();
|
|
90
|
+
}
|
|
91
|
+
updateLayerMaterialType(type) {
|
|
92
|
+
__classPrivateFieldSet(this, _AttributeVisualizationEngine_layerMaterialType, type, "f");
|
|
93
|
+
this.createLayers();
|
|
94
|
+
this.constructAttributeVisualization();
|
|
95
|
+
}
|
|
96
|
+
updateVisualizedMaterialType(type) {
|
|
97
|
+
__classPrivateFieldSet(this, _AttributeVisualizationEngine_visualizedMaterialType, type, "f");
|
|
98
|
+
this.createLayers();
|
|
78
99
|
this.constructAttributeVisualization();
|
|
79
100
|
}
|
|
80
101
|
updateLayers(layers) {
|
|
81
102
|
__classPrivateFieldSet(this, _AttributeVisualizationEngine_layers, layers, "f");
|
|
103
|
+
this.createLayers();
|
|
82
104
|
this.constructAttributeVisualization();
|
|
83
105
|
}
|
|
84
106
|
addListener(cb) {
|
|
@@ -100,10 +122,19 @@ class AttributeVisualizationEngine {
|
|
|
100
122
|
if (!itemData || !itemData.attributes) {
|
|
101
123
|
if (__classPrivateFieldGet(this, _AttributeVisualizationEngine_attributes, "f").length === 0) {
|
|
102
124
|
// return default layer material
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
125
|
+
let material;
|
|
126
|
+
if (__classPrivateFieldGet(this, _AttributeVisualizationEngine_layerMaterialType, "f") === 'unlit') {
|
|
127
|
+
material = new viewer_shared_types_1.MaterialUnlitData({
|
|
128
|
+
opacity: __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").enabled ? __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").opacity : 0,
|
|
129
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(__classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").color)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
material = new viewer_shared_types_1.MaterialStandardData({
|
|
134
|
+
opacity: __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").enabled ? __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").opacity : 0,
|
|
135
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(__classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").color)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
107
138
|
return {
|
|
108
139
|
matrix: gl_matrix_1.mat4.create(),
|
|
109
140
|
material
|
|
@@ -111,10 +142,19 @@ class AttributeVisualizationEngine {
|
|
|
111
142
|
}
|
|
112
143
|
else {
|
|
113
144
|
// return default layer material
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
145
|
+
let material;
|
|
146
|
+
if (__classPrivateFieldGet(this, _AttributeVisualizationEngine_layerMaterialType, "f") === 'unlit') {
|
|
147
|
+
material = new viewer_shared_types_1.MaterialUnlitData({
|
|
148
|
+
opacity: __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").enabled ? __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").opacity * __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f").opacity : 0,
|
|
149
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(__classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f").color)
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
material = new viewer_shared_types_1.MaterialStandardData({
|
|
154
|
+
opacity: __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").enabled ? __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultLayer, "f").opacity * __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f").opacity : 0,
|
|
155
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(__classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f").color)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
118
158
|
return {
|
|
119
159
|
matrix: gl_matrix_1.mat4.create(),
|
|
120
160
|
material
|
|
@@ -138,10 +178,19 @@ class AttributeVisualizationEngine {
|
|
|
138
178
|
}
|
|
139
179
|
if (__classPrivateFieldGet(this, _AttributeVisualizationEngine_attributes, "f").length === 0) {
|
|
140
180
|
// no attributes are specified, we go into layer visualization mode
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
181
|
+
let material;
|
|
182
|
+
if (__classPrivateFieldGet(this, _AttributeVisualizationEngine_layerMaterialType, "f") === 'unlit') {
|
|
183
|
+
material = new viewer_shared_types_1.MaterialUnlitData({
|
|
184
|
+
opacity: layer.opacity,
|
|
185
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(layer.color)
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
material = new viewer_shared_types_1.MaterialStandardData({
|
|
190
|
+
opacity: layer.opacity,
|
|
191
|
+
color: __classPrivateFieldGet(this, _AttributeVisualizationEngine_converter, "f").toColor(layer.color)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
145
194
|
return {
|
|
146
195
|
matrix: gl_matrix_1.mat4.create(),
|
|
147
196
|
material
|
|
@@ -149,7 +198,7 @@ class AttributeVisualizationEngine {
|
|
|
149
198
|
}
|
|
150
199
|
else {
|
|
151
200
|
// attributes are specified, we go into attribute visualization mode
|
|
152
|
-
const material = new viewer_shared_types_1.MaterialUnlitData();
|
|
201
|
+
const material = __classPrivateFieldGet(this, _AttributeVisualizationEngine_visualizedMaterialType, "f") === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData() : new viewer_shared_types_1.MaterialStandardData();
|
|
153
202
|
for (let i = 0; i < __classPrivateFieldGet(this, _AttributeVisualizationEngine_attributes, "f").length; i++) {
|
|
154
203
|
const a = __classPrivateFieldGet(this, _AttributeVisualizationEngine_attributes, "f")[i];
|
|
155
204
|
if (itemData.attributes[a.key] && itemData.attributes[a.key].typeHint === a.type) {
|
|
@@ -165,12 +214,12 @@ class AttributeVisualizationEngine {
|
|
|
165
214
|
};
|
|
166
215
|
case viewer_shared_types_1.SdtfPrimitiveTypeGuard.isNumberType(a.type):
|
|
167
216
|
const numberAttribute = a;
|
|
168
|
-
const numberVisualizationData = AttributeVisualizationUtils_1.AttributeVisualizationUtils.numberVisualization(itemDataAttribute.value, (numberAttribute.min !== undefined ? numberAttribute.min : itemDataAttributeOverview.min), (numberAttribute.max !== undefined ? numberAttribute.max : itemDataAttributeOverview.max), numberAttribute.visualization, __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f"));
|
|
217
|
+
const numberVisualizationData = AttributeVisualizationUtils_1.AttributeVisualizationUtils.numberVisualization(itemDataAttribute.value, (numberAttribute.min !== undefined ? numberAttribute.min : itemDataAttributeOverview.min), (numberAttribute.max !== undefined ? numberAttribute.max : itemDataAttributeOverview.max), numberAttribute.visualization, __classPrivateFieldGet(this, _AttributeVisualizationEngine_visualizedMaterialType, "f"), __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f"));
|
|
169
218
|
numberVisualizationData.material.opacity *= layer.opacity;
|
|
170
219
|
return numberVisualizationData;
|
|
171
220
|
case viewer_shared_types_1.SdtfPrimitiveTypeGuard.isStringType(a.type):
|
|
172
221
|
const stringAttribute = a;
|
|
173
|
-
const stringVisualizationData = AttributeVisualizationUtils_1.AttributeVisualizationUtils.stringVisualization(itemDataAttribute.value, stringAttribute.values || itemDataAttributeOverview.values, stringAttribute.visualization, __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f"));
|
|
222
|
+
const stringVisualizationData = AttributeVisualizationUtils_1.AttributeVisualizationUtils.stringVisualization(itemDataAttribute.value, stringAttribute.values || itemDataAttributeOverview.values, stringAttribute.visualization, __classPrivateFieldGet(this, _AttributeVisualizationEngine_visualizedMaterialType, "f"), __classPrivateFieldGet(this, _AttributeVisualizationEngine_defaultMaterial, "f"));
|
|
174
223
|
stringVisualizationData.material.opacity *= layer.opacity;
|
|
175
224
|
return stringVisualizationData;
|
|
176
225
|
default:
|
|
@@ -213,5 +262,5 @@ class AttributeVisualizationEngine {
|
|
|
213
262
|
}
|
|
214
263
|
}
|
|
215
264
|
exports.AttributeVisualizationEngine = AttributeVisualizationEngine;
|
|
216
|
-
_AttributeVisualizationEngine_converter = new WeakMap(), _AttributeVisualizationEngine_uuidGenerator = new WeakMap(), _AttributeVisualizationEngine_viewport = new WeakMap(), _AttributeVisualizationEngine_attributes = new WeakMap(), _AttributeVisualizationEngine_defaultMaterial = new WeakMap(), _AttributeVisualizationEngine_defaultLayer = new WeakMap(), _AttributeVisualizationEngine_layers = new WeakMap(), _AttributeVisualizationEngine_overview = new WeakMap(), _AttributeVisualizationEngine_listeners = new WeakMap();
|
|
265
|
+
_AttributeVisualizationEngine_converter = new WeakMap(), _AttributeVisualizationEngine_uuidGenerator = new WeakMap(), _AttributeVisualizationEngine_viewport = new WeakMap(), _AttributeVisualizationEngine_attributes = new WeakMap(), _AttributeVisualizationEngine_defaultMaterial = new WeakMap(), _AttributeVisualizationEngine_defaultLayer = new WeakMap(), _AttributeVisualizationEngine_layers = new WeakMap(), _AttributeVisualizationEngine_overview = new WeakMap(), _AttributeVisualizationEngine_listeners = new WeakMap(), _AttributeVisualizationEngine_visualizedMaterialType = new WeakMap(), _AttributeVisualizationEngine_layerMaterialType = new WeakMap();
|
|
217
266
|
//# sourceMappingURL=AttributeVisualizationEngine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeVisualizationEngine.js","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationEngine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAA0E;AAE1E,yCAAiC;AACjC,uCAAqC;AACrC,+EAAyF;AAEzF,
|
|
1
|
+
{"version":3,"file":"AttributeVisualizationEngine.js","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationEngine.ts"],"names":[],"mappings":";;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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IMaterialAbstractData, ISDTFAttributeVisualizationData } from "@shapediver/viewer.shared.types";
|
|
2
2
|
import { ATTRIBUTE_VISUALIZATION } from "../interfaces/IAttribute";
|
|
3
3
|
export declare const AttributeVisualizationUtils: {
|
|
4
|
-
numberVisualization: (value: number, min: number, max: number, type: ATTRIBUTE_VISUALIZATION, defaultMaterial?: IMaterialAbstractData | undefined) => ISDTFAttributeVisualizationData;
|
|
5
|
-
stringVisualization: (value: string, values: string[], type: ATTRIBUTE_VISUALIZATION, defaultMaterial?: IMaterialAbstractData | undefined) => ISDTFAttributeVisualizationData;
|
|
4
|
+
numberVisualization: (value: number, min: number, max: number, type: ATTRIBUTE_VISUALIZATION, materialType: 'unlit' | 'standard', defaultMaterial?: IMaterialAbstractData | undefined) => ISDTFAttributeVisualizationData;
|
|
5
|
+
stringVisualization: (value: string, values: string[], type: ATTRIBUTE_VISUALIZATION, materialType: 'unlit' | 'standard', defaultMaterial?: IMaterialAbstractData | undefined) => ISDTFAttributeVisualizationData;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=AttributeVisualizationUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeVisualizationUtils.d.ts","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"AttributeVisualizationUtils.d.ts","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAA2C,MAAM,iCAAiC,CAAC;AAElJ,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AA8LnE,eAAO,MAAM,2BAA2B;iCAnDJ,MAAM,OAAO,MAAM,OAAO,MAAM,QAAQ,uBAAuB,gBAAgB,OAAO,GAAG,UAAU,0DAA4C,+BAA+B;iCA0B9K,MAAM,UAAU,MAAM,EAAE,QAAQ,uBAAuB,gBAAgB,OAAO,GAAG,UAAU,0DAA4C,+BAA+B;CA4BzM,CAAC"}
|
|
@@ -4,28 +4,28 @@ exports.AttributeVisualizationUtils = void 0;
|
|
|
4
4
|
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
5
5
|
const gl_matrix_1 = require("gl-matrix");
|
|
6
6
|
const IAttribute_1 = require("../interfaces/IAttribute");
|
|
7
|
-
const grayscaleVisualization = (factor) => {
|
|
7
|
+
const grayscaleVisualization = (factor, materialType) => {
|
|
8
8
|
const color = Math.floor(factor * 255.0);
|
|
9
9
|
return {
|
|
10
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1 }),
|
|
10
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1 }),
|
|
11
11
|
matrix: gl_matrix_1.mat4.create()
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
const opacityVisualization = (factor, defaultMaterial) => {
|
|
14
|
+
const opacityVisualization = (factor, materialType, defaultMaterial) => {
|
|
15
15
|
return {
|
|
16
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: (defaultMaterial === null || defaultMaterial === void 0 ? void 0 : defaultMaterial.color) || '#00fff7', opacity: factor }),
|
|
16
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: (defaultMaterial === null || defaultMaterial === void 0 ? void 0 : defaultMaterial.color) || '#00fff7', opacity: factor }) : new viewer_shared_types_1.MaterialStandardData({ color: (defaultMaterial === null || defaultMaterial === void 0 ? void 0 : defaultMaterial.color) || '#00fff7', opacity: factor }),
|
|
17
17
|
matrix: gl_matrix_1.mat4.create()
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
const blueRedVisualization = (factor) => {
|
|
20
|
+
const blueRedVisualization = (factor, materialType) => {
|
|
21
21
|
const red = factor * 255.0;
|
|
22
22
|
const blue = (1 - factor) * 255.0;
|
|
23
23
|
return {
|
|
24
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
24
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
25
25
|
matrix: gl_matrix_1.mat4.create()
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
const blueWhiteRedVisualization = (factor) => {
|
|
28
|
+
const blueWhiteRedVisualization = (factor, materialType) => {
|
|
29
29
|
let red = 255, green = 255, blue = 255;
|
|
30
30
|
if (factor < 0.5) {
|
|
31
31
|
const remappedFactor = factor / 0.5;
|
|
@@ -40,19 +40,19 @@ const blueWhiteRedVisualization = (factor) => {
|
|
|
40
40
|
blue = 255.0 * (1 - remappedFactor);
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
43
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
44
44
|
matrix: gl_matrix_1.mat4.create()
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
const greenRedVisualization = (factor) => {
|
|
47
|
+
const greenRedVisualization = (factor, materialType) => {
|
|
48
48
|
const red = factor * 255.0;
|
|
49
49
|
const green = (1 - factor) * 255.0;
|
|
50
50
|
return {
|
|
51
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1 }),
|
|
51
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1 }),
|
|
52
52
|
matrix: gl_matrix_1.mat4.create()
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
const greenWhiteRedVisualization = (factor) => {
|
|
55
|
+
const greenWhiteRedVisualization = (factor, materialType) => {
|
|
56
56
|
let red = 255, green = 255, blue = 255;
|
|
57
57
|
if (factor < 0.5) {
|
|
58
58
|
const remappedFactor = factor / 0.5;
|
|
@@ -67,11 +67,11 @@ const greenWhiteRedVisualization = (factor) => {
|
|
|
67
67
|
blue = 255.0 * (1 - remappedFactor);
|
|
68
68
|
}
|
|
69
69
|
return {
|
|
70
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
70
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
71
71
|
matrix: gl_matrix_1.mat4.create()
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
const blueGreenRedVisualization = (factor) => {
|
|
74
|
+
const blueGreenRedVisualization = (factor, materialType) => {
|
|
75
75
|
let red = 255, green = 255, blue = 255;
|
|
76
76
|
if (factor < 0.5) {
|
|
77
77
|
const remappedFactor = factor / 0.5;
|
|
@@ -86,11 +86,11 @@ const blueGreenRedVisualization = (factor) => {
|
|
|
86
86
|
blue = 0;
|
|
87
87
|
}
|
|
88
88
|
return {
|
|
89
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
89
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
90
90
|
matrix: gl_matrix_1.mat4.create()
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
const blueGreenYellowRedPurpleWhiteVisualization = (factor) => {
|
|
93
|
+
const blueGreenYellowRedPurpleWhiteVisualization = (factor, materialType) => {
|
|
94
94
|
let red = 255, green = 255, blue = 255;
|
|
95
95
|
if (factor < 0.2) {
|
|
96
96
|
const remappedFactor = factor / 0.2;
|
|
@@ -123,63 +123,63 @@ const blueGreenYellowRedPurpleWhiteVisualization = (factor) => {
|
|
|
123
123
|
blue = 255.0;
|
|
124
124
|
}
|
|
125
125
|
return {
|
|
126
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
126
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }),
|
|
127
127
|
matrix: gl_matrix_1.mat4.create()
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
|
-
const hslVisualization = (factor) => {
|
|
130
|
+
const hslVisualization = (factor, materialType) => {
|
|
131
131
|
const hue = factor * 359.99;
|
|
132
132
|
return {
|
|
133
|
-
material: new viewer_shared_types_1.MaterialUnlitData({ color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1 }),
|
|
133
|
+
material: materialType === 'unlit' ? new viewer_shared_types_1.MaterialUnlitData({ color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1 }) : new viewer_shared_types_1.MaterialStandardData({ color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1 }),
|
|
134
134
|
matrix: gl_matrix_1.mat4.create()
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
const numberVisualization = (value, min, max, type, defaultMaterial) => {
|
|
137
|
+
const numberVisualization = (value, min, max, type, materialType, defaultMaterial) => {
|
|
138
138
|
let factor = (value - min) / (max - min);
|
|
139
139
|
factor = Math.min(1, Math.max(0, factor));
|
|
140
140
|
switch (type) {
|
|
141
141
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GRAYSCALE:
|
|
142
|
-
return grayscaleVisualization(factor);
|
|
142
|
+
return grayscaleVisualization(factor, materialType);
|
|
143
143
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.OPACITY:
|
|
144
|
-
return opacityVisualization(factor, defaultMaterial);
|
|
144
|
+
return opacityVisualization(factor, materialType, defaultMaterial);
|
|
145
145
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_RED:
|
|
146
|
-
return blueRedVisualization(factor);
|
|
146
|
+
return blueRedVisualization(factor, materialType);
|
|
147
147
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_WHITE_RED:
|
|
148
|
-
return blueWhiteRedVisualization(factor);
|
|
148
|
+
return blueWhiteRedVisualization(factor, materialType);
|
|
149
149
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GREEN_RED:
|
|
150
|
-
return greenRedVisualization(factor);
|
|
150
|
+
return greenRedVisualization(factor, materialType);
|
|
151
151
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GREEN_WHITE_RED:
|
|
152
|
-
return greenWhiteRedVisualization(factor);
|
|
152
|
+
return greenWhiteRedVisualization(factor, materialType);
|
|
153
153
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_GREEN_RED:
|
|
154
|
-
return blueGreenRedVisualization(factor);
|
|
154
|
+
return blueGreenRedVisualization(factor, materialType);
|
|
155
155
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_GREEN_YELLOW_RED_PURPLE_WHITE:
|
|
156
|
-
return blueGreenYellowRedPurpleWhiteVisualization(factor);
|
|
156
|
+
return blueGreenYellowRedPurpleWhiteVisualization(factor, materialType);
|
|
157
157
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.HSL:
|
|
158
|
-
return hslVisualization(factor);
|
|
158
|
+
return hslVisualization(factor, materialType);
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
const stringVisualization = (value, values, type, defaultMaterial) => {
|
|
161
|
+
const stringVisualization = (value, values, type, materialType, defaultMaterial) => {
|
|
162
162
|
let factor = values.indexOf(value) / (values.length - 1);
|
|
163
163
|
factor = Math.min(1, Math.max(0, factor));
|
|
164
164
|
switch (type) {
|
|
165
165
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GRAYSCALE:
|
|
166
|
-
return grayscaleVisualization(factor);
|
|
166
|
+
return grayscaleVisualization(factor, materialType);
|
|
167
167
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.OPACITY:
|
|
168
|
-
return opacityVisualization(factor, defaultMaterial);
|
|
168
|
+
return opacityVisualization(factor, materialType, defaultMaterial);
|
|
169
169
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_RED:
|
|
170
|
-
return blueRedVisualization(factor);
|
|
170
|
+
return blueRedVisualization(factor, materialType);
|
|
171
171
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_WHITE_RED:
|
|
172
|
-
return blueWhiteRedVisualization(factor);
|
|
172
|
+
return blueWhiteRedVisualization(factor, materialType);
|
|
173
173
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GREEN_RED:
|
|
174
|
-
return greenRedVisualization(factor);
|
|
174
|
+
return greenRedVisualization(factor, materialType);
|
|
175
175
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.GREEN_WHITE_RED:
|
|
176
|
-
return greenWhiteRedVisualization(factor);
|
|
176
|
+
return greenWhiteRedVisualization(factor, materialType);
|
|
177
177
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_GREEN_RED:
|
|
178
|
-
return blueGreenRedVisualization(factor);
|
|
178
|
+
return blueGreenRedVisualization(factor, materialType);
|
|
179
179
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.BLUE_GREEN_YELLOW_RED_PURPLE_WHITE:
|
|
180
|
-
return blueGreenYellowRedPurpleWhiteVisualization(factor);
|
|
180
|
+
return blueGreenYellowRedPurpleWhiteVisualization(factor, materialType);
|
|
181
181
|
case IAttribute_1.ATTRIBUTE_VISUALIZATION.HSL:
|
|
182
|
-
return hslVisualization(factor);
|
|
182
|
+
return hslVisualization(factor, materialType);
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
exports.AttributeVisualizationUtils = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeVisualizationUtils.js","sourceRoot":"","sources":["../../src/implementation/AttributeVisualizationUtils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"A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xC,OAAO,0BAA0B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5D,KAAK,oCAAuB,CAAC,cAAc;YACvC,OAAO,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC3D,KAAK,oCAAuB,CAAC,kCAAkC;YAC3D,OAAO,0CAA0C,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5E,KAAK,oCAAuB,CAAC,GAAG;YAC5B,OAAO,gBAAgB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACrD;AACL,CAAC,CAAA;AAEY,QAAA,2BAA2B,GAAG;IACvC,mBAAmB;IACnB,mBAAmB;CACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapediver/viewer.features.attribute-visualization",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"testEnvironment": "node"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@shapediver/viewer": "2.
|
|
44
|
-
"@shapediver/viewer.shared.services": "2.
|
|
45
|
-
"@shapediver/viewer.shared.types": "2.
|
|
43
|
+
"@shapediver/viewer": "2.1.2",
|
|
44
|
+
"@shapediver/viewer.shared.services": "2.1.2",
|
|
45
|
+
"@shapediver/viewer.shared.types": "2.1.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"detect-it": "4.0.1",
|
|
49
49
|
"gl-matrix": "3.3.0",
|
|
50
50
|
"tsyringe": "^4.5.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "fb0624317d043edaa75b7341beeb674b1c0cb43f"
|
|
53
53
|
}
|
|
@@ -5,7 +5,7 @@ import { mat4 } from "gl-matrix";
|
|
|
5
5
|
import { container } from "tsyringe";
|
|
6
6
|
import { Converter, EVENTTYPE, UuidGenerator } from "@shapediver/viewer.shared.services";
|
|
7
7
|
import { IAttributeVisualizationEngine } from "../interfaces/IAttributeVisualizationEngine";
|
|
8
|
-
import { IMaterialAbstractData, ISDTFItemData, ISDTFOverview, MaterialUnlitData, SdtfPrimitiveTypeGuard } from "@shapediver/viewer.shared.types";
|
|
8
|
+
import { IMaterialAbstractData, ISDTFItemData, ISDTFOverview, MaterialStandardData, MaterialUnlitData, SdtfPrimitiveTypeGuard } from "@shapediver/viewer.shared.types";
|
|
9
9
|
import { AttributeVisualizationUtils } from "./AttributeVisualizationUtils";
|
|
10
10
|
|
|
11
11
|
export class AttributeVisualizationEngine implements IAttributeVisualizationEngine {
|
|
@@ -29,6 +29,8 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
29
29
|
#listeners: {
|
|
30
30
|
[key: string]: () => void
|
|
31
31
|
} = {};
|
|
32
|
+
#visualizedMaterialType: 'unlit' | 'standard' = 'unlit';
|
|
33
|
+
#layerMaterialType: 'unlit' | 'standard' = 'unlit';
|
|
32
34
|
|
|
33
35
|
// #endregion Properties (7)
|
|
34
36
|
|
|
@@ -66,6 +68,14 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
66
68
|
return this.#layers;
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
public get layerMaterialType(): 'unlit' | 'standard' {
|
|
72
|
+
return this.#layerMaterialType;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public get visualizedMaterialType(): 'unlit' | 'standard' {
|
|
76
|
+
return this.#visualizedMaterialType;
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
public get overview(): ISDTFOverview {
|
|
70
80
|
return this.#overview;
|
|
71
81
|
}
|
|
@@ -76,21 +86,37 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
76
86
|
|
|
77
87
|
public updateAttributes(attributes: IAttribute[]) {
|
|
78
88
|
this.#attributes = attributes;
|
|
89
|
+
this.createLayers();
|
|
79
90
|
this.constructAttributeVisualization();
|
|
80
91
|
}
|
|
81
92
|
|
|
82
93
|
public updateDefaultLayer(layer: ILayer) {
|
|
83
94
|
this.#defaultLayer = layer;
|
|
95
|
+
this.createLayers();
|
|
84
96
|
this.constructAttributeVisualization();
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
public updateDefaultMaterial(material: IMaterialAbstractData) {
|
|
88
100
|
this.#defaultMaterial = material;
|
|
101
|
+
this.createLayers();
|
|
102
|
+
this.constructAttributeVisualization();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public updateLayerMaterialType(type: 'unlit' | 'standard') {
|
|
106
|
+
this.#layerMaterialType = type;
|
|
107
|
+
this.createLayers();
|
|
108
|
+
this.constructAttributeVisualization();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public updateVisualizedMaterialType(type: 'unlit' | 'standard') {
|
|
112
|
+
this.#visualizedMaterialType = type;
|
|
113
|
+
this.createLayers();
|
|
89
114
|
this.constructAttributeVisualization();
|
|
90
115
|
}
|
|
91
116
|
|
|
92
117
|
public updateLayers(layers: { [key: string]: ILayer }) {
|
|
93
118
|
this.#layers = layers;
|
|
119
|
+
this.createLayers();
|
|
94
120
|
this.constructAttributeVisualization();
|
|
95
121
|
}
|
|
96
122
|
|
|
@@ -116,20 +142,36 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
116
142
|
if (!itemData || !itemData.attributes) {
|
|
117
143
|
if (this.#attributes.length === 0) {
|
|
118
144
|
// return default layer material
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
145
|
+
let material;
|
|
146
|
+
if(this.#layerMaterialType === 'unlit') {
|
|
147
|
+
material = new MaterialUnlitData({
|
|
148
|
+
opacity: this.#defaultLayer.enabled ? this.#defaultLayer.opacity : 0,
|
|
149
|
+
color: this.#converter.toColor(this.#defaultLayer.color)
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
material = new MaterialStandardData({
|
|
153
|
+
opacity: this.#defaultLayer.enabled ? this.#defaultLayer.opacity : 0,
|
|
154
|
+
color: this.#converter.toColor(this.#defaultLayer.color)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
123
157
|
return {
|
|
124
158
|
matrix: mat4.create(),
|
|
125
159
|
material
|
|
126
160
|
}
|
|
127
161
|
} else {
|
|
128
162
|
// return default layer material
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
163
|
+
let material;
|
|
164
|
+
if(this.#layerMaterialType === 'unlit') {
|
|
165
|
+
material = new MaterialUnlitData({
|
|
166
|
+
opacity: this.#defaultLayer.enabled ? this.#defaultLayer.opacity * this.#defaultMaterial.opacity : 0,
|
|
167
|
+
color: this.#converter.toColor(this.#defaultMaterial.color)
|
|
168
|
+
});
|
|
169
|
+
} else {
|
|
170
|
+
material = new MaterialStandardData({
|
|
171
|
+
opacity: this.#defaultLayer.enabled ? this.#defaultLayer.opacity * this.#defaultMaterial.opacity : 0,
|
|
172
|
+
color: this.#converter.toColor(this.#defaultMaterial.color)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
133
175
|
return {
|
|
134
176
|
matrix: mat4.create(),
|
|
135
177
|
material
|
|
@@ -156,17 +198,26 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
156
198
|
|
|
157
199
|
if (this.#attributes.length === 0) {
|
|
158
200
|
// no attributes are specified, we go into layer visualization mode
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
201
|
+
let material;
|
|
202
|
+
if(this.#layerMaterialType === 'unlit') {
|
|
203
|
+
material = new MaterialUnlitData({
|
|
204
|
+
opacity: layer.opacity,
|
|
205
|
+
color: this.#converter.toColor(layer.color)
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
material = new MaterialStandardData({
|
|
209
|
+
opacity: layer.opacity,
|
|
210
|
+
color: this.#converter.toColor(layer.color)
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
163
214
|
return {
|
|
164
215
|
matrix: mat4.create(),
|
|
165
216
|
material
|
|
166
217
|
}
|
|
167
218
|
} else {
|
|
168
219
|
// attributes are specified, we go into attribute visualization mode
|
|
169
|
-
const material = new MaterialUnlitData();
|
|
220
|
+
const material = this.#visualizedMaterialType === 'unlit' ? new MaterialUnlitData() : new MaterialStandardData();
|
|
170
221
|
for (let i = 0; i < this.#attributes.length; i++) {
|
|
171
222
|
const a = this.#attributes[i];
|
|
172
223
|
if (itemData.attributes[a.key] && itemData.attributes[a.key].typeHint === a.type) {
|
|
@@ -188,6 +239,7 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
188
239
|
(numberAttribute.min !== undefined ? numberAttribute.min : itemDataAttributeOverview.min)!,
|
|
189
240
|
(numberAttribute.max !== undefined ? numberAttribute.max : itemDataAttributeOverview.max)!,
|
|
190
241
|
numberAttribute.visualization,
|
|
242
|
+
this.#visualizedMaterialType,
|
|
191
243
|
this.#defaultMaterial
|
|
192
244
|
);
|
|
193
245
|
numberVisualizationData.material.opacity *= layer.opacity;
|
|
@@ -198,7 +250,9 @@ export class AttributeVisualizationEngine implements IAttributeVisualizationEngi
|
|
|
198
250
|
itemDataAttribute.value,
|
|
199
251
|
stringAttribute.values || itemDataAttributeOverview.values,
|
|
200
252
|
stringAttribute.visualization,
|
|
201
|
-
this.#
|
|
253
|
+
this.#visualizedMaterialType,
|
|
254
|
+
this.#defaultMaterial
|
|
255
|
+
);
|
|
202
256
|
|
|
203
257
|
stringVisualizationData.material.opacity *= layer.opacity;
|
|
204
258
|
return stringVisualizationData;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { IMaterialAbstractData, ISDTFAttributeVisualizationData, MaterialUnlitData } from "@shapediver/viewer.shared.types";
|
|
1
|
+
import { IMaterialAbstractData, ISDTFAttributeVisualizationData, MaterialStandardData, MaterialUnlitData } from "@shapediver/viewer.shared.types";
|
|
2
2
|
import { mat4 } from "gl-matrix";
|
|
3
3
|
import { ATTRIBUTE_VISUALIZATION } from "../interfaces/IAttribute";
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
const grayscaleVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
6
|
+
const grayscaleVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
7
7
|
const color = Math.floor(factor * 255.0);
|
|
8
8
|
return {
|
|
9
|
-
material: new MaterialUnlitData({color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1}),
|
|
9
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1}),
|
|
10
10
|
matrix: mat4.create()
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const opacityVisualization = (factor: number, defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
14
|
+
const opacityVisualization = (factor: number, materialType: 'unlit' | 'standard', defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
15
15
|
return {
|
|
16
|
-
material: new MaterialUnlitData({color: defaultMaterial?.color || '#00fff7', opacity: factor}),
|
|
16
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: defaultMaterial?.color || '#00fff7', opacity: factor}) : new MaterialStandardData({color: defaultMaterial?.color || '#00fff7', opacity: factor}),
|
|
17
17
|
matrix: mat4.create()
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const blueRedVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
21
|
+
const blueRedVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
22
22
|
const red = factor * 255.0;
|
|
23
23
|
const blue = (1 - factor) * 255.0;
|
|
24
24
|
return {
|
|
25
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
25
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
26
26
|
matrix: mat4.create()
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const blueWhiteRedVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
30
|
+
const blueWhiteRedVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
31
31
|
let red = 255, green = 255, blue = 255;
|
|
32
32
|
|
|
33
33
|
if(factor < 0.5) {
|
|
@@ -42,21 +42,21 @@ const blueWhiteRedVisualization = (factor: number): ISDTFAttributeVisualizationD
|
|
|
42
42
|
blue = 255.0 * (1 - remappedFactor);
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
45
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
46
46
|
matrix: mat4.create()
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const greenRedVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
50
|
+
const greenRedVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
51
51
|
const red = factor * 255.0;
|
|
52
52
|
const green = (1 - factor) * 255.0;
|
|
53
53
|
return {
|
|
54
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1}),
|
|
54
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1}),
|
|
55
55
|
matrix: mat4.create()
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const greenWhiteRedVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
59
|
+
const greenWhiteRedVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
60
60
|
let red = 255, green = 255, blue = 255;
|
|
61
61
|
|
|
62
62
|
if(factor < 0.5) {
|
|
@@ -71,12 +71,12 @@ const greenWhiteRedVisualization = (factor: number): ISDTFAttributeVisualization
|
|
|
71
71
|
blue = 255.0 * (1 - remappedFactor);
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
74
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
75
75
|
matrix: mat4.create()
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const blueGreenRedVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
79
|
+
const blueGreenRedVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
80
80
|
let red = 255, green = 255, blue = 255;
|
|
81
81
|
|
|
82
82
|
if(factor < 0.5) {
|
|
@@ -91,12 +91,12 @@ const blueGreenRedVisualization = (factor: number): ISDTFAttributeVisualizationD
|
|
|
91
91
|
blue = 0;
|
|
92
92
|
}
|
|
93
93
|
return {
|
|
94
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
94
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
95
95
|
matrix: mat4.create()
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const blueGreenYellowRedPurpleWhiteVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
99
|
+
const blueGreenYellowRedPurpleWhiteVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
100
100
|
let red = 255, green = 255, blue = 255;
|
|
101
101
|
|
|
102
102
|
if(factor < 0.2) {
|
|
@@ -126,67 +126,67 @@ const blueGreenYellowRedPurpleWhiteVisualization = (factor: number): ISDTFAttrib
|
|
|
126
126
|
blue = 255.0;
|
|
127
127
|
}
|
|
128
128
|
return {
|
|
129
|
-
material: new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
129
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}) : new MaterialStandardData({color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1}),
|
|
130
130
|
matrix: mat4.create()
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const hslVisualization = (factor: number): ISDTFAttributeVisualizationData => {
|
|
134
|
+
const hslVisualization = (factor: number, materialType: 'unlit' | 'standard'): ISDTFAttributeVisualizationData => {
|
|
135
135
|
const hue = factor * 359.99;
|
|
136
136
|
return {
|
|
137
|
-
material: new MaterialUnlitData({color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1}),
|
|
137
|
+
material: materialType === 'unlit' ? new MaterialUnlitData({color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1}) : new MaterialStandardData({color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1}),
|
|
138
138
|
matrix: mat4.create()
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const numberVisualization = (value: number, min: number, max: number, type: ATTRIBUTE_VISUALIZATION, defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
142
|
+
const numberVisualization = (value: number, min: number, max: number, type: ATTRIBUTE_VISUALIZATION, materialType: 'unlit' | 'standard', defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
143
143
|
let factor = (value - min) / (max - min);
|
|
144
144
|
factor = Math.min(1, Math.max(0, factor))
|
|
145
145
|
|
|
146
146
|
switch(type) {
|
|
147
147
|
case ATTRIBUTE_VISUALIZATION.GRAYSCALE:
|
|
148
|
-
return grayscaleVisualization(factor);
|
|
148
|
+
return grayscaleVisualization(factor, materialType);
|
|
149
149
|
case ATTRIBUTE_VISUALIZATION.OPACITY:
|
|
150
|
-
return opacityVisualization(factor, defaultMaterial);
|
|
150
|
+
return opacityVisualization(factor, materialType, defaultMaterial);
|
|
151
151
|
case ATTRIBUTE_VISUALIZATION.BLUE_RED:
|
|
152
|
-
return blueRedVisualization(factor);
|
|
152
|
+
return blueRedVisualization(factor, materialType);
|
|
153
153
|
case ATTRIBUTE_VISUALIZATION.BLUE_WHITE_RED:
|
|
154
|
-
return blueWhiteRedVisualization(factor);
|
|
154
|
+
return blueWhiteRedVisualization(factor, materialType);
|
|
155
155
|
case ATTRIBUTE_VISUALIZATION.GREEN_RED:
|
|
156
|
-
return greenRedVisualization(factor);
|
|
156
|
+
return greenRedVisualization(factor, materialType);
|
|
157
157
|
case ATTRIBUTE_VISUALIZATION.GREEN_WHITE_RED:
|
|
158
|
-
return greenWhiteRedVisualization(factor);
|
|
158
|
+
return greenWhiteRedVisualization(factor, materialType);
|
|
159
159
|
case ATTRIBUTE_VISUALIZATION.BLUE_GREEN_RED:
|
|
160
|
-
return blueGreenRedVisualization(factor);
|
|
160
|
+
return blueGreenRedVisualization(factor, materialType);
|
|
161
161
|
case ATTRIBUTE_VISUALIZATION.BLUE_GREEN_YELLOW_RED_PURPLE_WHITE:
|
|
162
|
-
return blueGreenYellowRedPurpleWhiteVisualization(factor);
|
|
162
|
+
return blueGreenYellowRedPurpleWhiteVisualization(factor, materialType);
|
|
163
163
|
case ATTRIBUTE_VISUALIZATION.HSL:
|
|
164
|
-
return hslVisualization(factor);
|
|
164
|
+
return hslVisualization(factor, materialType);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const stringVisualization = (value: string, values: string[], type: ATTRIBUTE_VISUALIZATION, defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
168
|
+
const stringVisualization = (value: string, values: string[], type: ATTRIBUTE_VISUALIZATION, materialType: 'unlit' | 'standard', defaultMaterial?: IMaterialAbstractData): ISDTFAttributeVisualizationData => {
|
|
169
169
|
let factor = values.indexOf(value) / (values.length - 1);
|
|
170
170
|
factor = Math.min(1, Math.max(0, factor))
|
|
171
171
|
switch(type) {
|
|
172
172
|
case ATTRIBUTE_VISUALIZATION.GRAYSCALE:
|
|
173
|
-
return grayscaleVisualization(factor);
|
|
173
|
+
return grayscaleVisualization(factor, materialType);
|
|
174
174
|
case ATTRIBUTE_VISUALIZATION.OPACITY:
|
|
175
|
-
return opacityVisualization(factor, defaultMaterial);
|
|
175
|
+
return opacityVisualization(factor, materialType, defaultMaterial);
|
|
176
176
|
case ATTRIBUTE_VISUALIZATION.BLUE_RED:
|
|
177
|
-
return blueRedVisualization(factor);
|
|
177
|
+
return blueRedVisualization(factor, materialType);
|
|
178
178
|
case ATTRIBUTE_VISUALIZATION.BLUE_WHITE_RED:
|
|
179
|
-
return blueWhiteRedVisualization(factor);
|
|
179
|
+
return blueWhiteRedVisualization(factor, materialType);
|
|
180
180
|
case ATTRIBUTE_VISUALIZATION.GREEN_RED:
|
|
181
|
-
return greenRedVisualization(factor);
|
|
181
|
+
return greenRedVisualization(factor, materialType);
|
|
182
182
|
case ATTRIBUTE_VISUALIZATION.GREEN_WHITE_RED:
|
|
183
|
-
return greenWhiteRedVisualization(factor);
|
|
183
|
+
return greenWhiteRedVisualization(factor, materialType);
|
|
184
184
|
case ATTRIBUTE_VISUALIZATION.BLUE_GREEN_RED:
|
|
185
|
-
return blueGreenRedVisualization(factor);
|
|
185
|
+
return blueGreenRedVisualization(factor, materialType);
|
|
186
186
|
case ATTRIBUTE_VISUALIZATION.BLUE_GREEN_YELLOW_RED_PURPLE_WHITE:
|
|
187
|
-
return blueGreenYellowRedPurpleWhiteVisualization(factor);
|
|
187
|
+
return blueGreenYellowRedPurpleWhiteVisualization(factor, materialType);
|
|
188
188
|
case ATTRIBUTE_VISUALIZATION.HSL:
|
|
189
|
-
return hslVisualization(factor);
|
|
189
|
+
return hslVisualization(factor, materialType);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|