@shapediver/viewer.shared.types
Advanced tools
Comparing version 1.8.14 to 1.9.0
@@ -19,8 +19,5 @@ import { mat4 } from "gl-matrix"; | ||
export declare const SDTFAttributeVisualization: { | ||
numberVisualization: (value: number, min: number, max: number, type: ATTRIBUTEVISUALIZATION) => SDTFAttributeVisualizationData; | ||
stringVisualization: (value: string, values: string[], type: ATTRIBUTEVISUALIZATION) => SDTFAttributeVisualizationData; | ||
stringOpacityVisualization: (value: string, opacities: { | ||
[key: string]: number; | ||
}) => SDTFAttributeVisualizationData; | ||
numberVisualization: (value: number, min: number, max: number, type: ATTRIBUTEVISUALIZATION, defaultMaterial?: MaterialData | undefined) => SDTFAttributeVisualizationData; | ||
stringVisualization: (value: string, values: string[], type: ATTRIBUTEVISUALIZATION, defaultMaterial?: MaterialData | undefined) => SDTFAttributeVisualizationData; | ||
}; | ||
//# sourceMappingURL=SDTFAttributeVisualization.d.ts.map |
@@ -21,9 +21,9 @@ "use strict"; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + color + ', ' + color + ', ' + color + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
}; | ||
const opacityVisualization = (factor) => { | ||
const opacityVisualization = (factor, defaultMaterial) => { | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: '#00fff7', opacity: factor }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: (defaultMaterial === null || defaultMaterial === void 0 ? void 0 : defaultMaterial.color) || '#00fff7', opacity: factor }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -36,3 +36,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(0) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -56,3 +56,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -65,3 +65,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(0) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -85,3 +85,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -105,3 +105,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -143,3 +143,3 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'rgb(' + Math.floor(red) + ', ' + Math.floor(green) + ', ' + Math.floor(blue) + ')', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
@@ -151,8 +151,9 @@ }; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1 }), | ||
material: new MaterialData_1.MaterialData({ KHR_materials_unlit: true, color: 'hsl(' + Math.floor(hue) + ', 100%, 50%)', opacity: 1 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
}; | ||
const numberVisualization = (value, min, max, type) => { | ||
const factor = (value - min) / (max - min); | ||
const numberVisualization = (value, min, max, type, defaultMaterial) => { | ||
let factor = (value - min) / (max - min); | ||
factor = Math.min(1, Math.max(0, factor)); | ||
switch (type) { | ||
@@ -162,3 +163,3 @@ case ATTRIBUTEVISUALIZATION.GRAYSCALE: | ||
case ATTRIBUTEVISUALIZATION.OPACITY: | ||
return opacityVisualization(factor); | ||
return opacityVisualization(factor, defaultMaterial); | ||
case ATTRIBUTEVISUALIZATION.BLUE_RED: | ||
@@ -180,15 +181,5 @@ return blueRedVisualization(factor); | ||
}; | ||
const stringOpacityVisualization = (value, opacities) => { | ||
if (!opacities[value]) | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: '#00fff7', opacity: 0 }), | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
return { | ||
material: new MaterialData_1.MaterialData({ color: '#00fff7', opacity: opacities[value] }), | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
}; | ||
const stringVisualization = (value, values, type) => { | ||
const factor = values.indexOf(value) / (values.length - 1); | ||
const stringVisualization = (value, values, type, defaultMaterial) => { | ||
let factor = values.indexOf(value) / (values.length - 1); | ||
factor = Math.min(1, Math.max(0, factor)); | ||
switch (type) { | ||
@@ -198,3 +189,3 @@ case ATTRIBUTEVISUALIZATION.GRAYSCALE: | ||
case ATTRIBUTEVISUALIZATION.OPACITY: | ||
return opacityVisualization(factor); | ||
return opacityVisualization(factor, defaultMaterial); | ||
case ATTRIBUTEVISUALIZATION.BLUE_RED: | ||
@@ -218,5 +209,4 @@ return blueRedVisualization(factor); | ||
numberVisualization, | ||
stringVisualization, | ||
stringOpacityVisualization | ||
stringVisualization | ||
}; | ||
//# sourceMappingURL=SDTFAttributeVisualization.js.map |
{ | ||
"name": "@shapediver/viewer.shared.types", | ||
"version": "1.8.14", | ||
"version": "1.9.0", | ||
"description": "", | ||
@@ -39,9 +39,9 @@ "keywords": [], | ||
"dependencies": { | ||
"@shapediver/viewer.shared.math": "^1.8.14", | ||
"@shapediver/viewer.shared.node-tree": "^1.8.14", | ||
"@shapediver/viewer.shared.services": "^1.8.14", | ||
"@shapediver/viewer.shared.math": "^1.9.0", | ||
"@shapediver/viewer.shared.node-tree": "^1.9.0", | ||
"@shapediver/viewer.shared.services": "^1.9.0", | ||
"gl-matrix": "3.3.0", | ||
"tsyringe": "^4.5.0" | ||
}, | ||
"gitHead": "db4b8714e087e716c875ab642d7b69779562b641" | ||
"gitHead": "fe27c1e7a529779c4476b683101a5bf69c521d1b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158640
1845