mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-07 13:31:50 +08:00
Change layer thickness colormap to parula-like (https://es.mathworks.com/help/matlab/ref/parula.html)
This commit is contained in:
parent
0fbcd2d2ec
commit
0328050548
@ -485,7 +485,7 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradient colors for layer thickness
|
// Gradient colors for layer thickness (similar to parula colormap)
|
||||||
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
||||||
// Invert values because then the bar is rotated 90 degrees
|
// Invert values because then the bar is rotated 90 degrees
|
||||||
id: thicknessGradient
|
id: thicknessGradient
|
||||||
@ -499,23 +499,23 @@ Item
|
|||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0.000
|
position: 0.000
|
||||||
color: Qt.rgba(1, 0, 0, 1)
|
color: Qt.rgba(1, 1, 0, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0.25
|
position: 0.25
|
||||||
color: Qt.rgba(0.5, 0.5, 0, 1)
|
color: Qt.rgba(1, 0.75, 0.25, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0.5
|
position: 0.5
|
||||||
color: Qt.rgba(0, 1, 0, 1)
|
color: Qt.rgba(0, 0.75, 0.5, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0.75
|
position: 0.75
|
||||||
color: Qt.rgba(0, 0.5, 0.5, 1)
|
color: Qt.rgba(0, 0.375, 0.75, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 1.0
|
position: 1.0
|
||||||
color: Qt.rgba(0, 0, 1, 1)
|
color: Qt.rgba(0, 0, 0.5, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,13 @@ vertex41core =
|
|||||||
vec4 layerThicknessGradientColor(float abs_value, float min_value, float max_value)
|
vec4 layerThicknessGradientColor(float abs_value, float min_value, float max_value)
|
||||||
{
|
{
|
||||||
float value = (abs_value - min_value)/(max_value - min_value);
|
float value = (abs_value - min_value)/(max_value - min_value);
|
||||||
float red = max(2*value-1, 0);
|
float red = min(max(4*value-2, 0), 1);
|
||||||
float green = 1-abs(1-2*value);
|
float green = min(1.5*value, 0.75);
|
||||||
float blue = max(1-2*value, 0);
|
if (value > 0.75)
|
||||||
|
{
|
||||||
|
green = value;
|
||||||
|
}
|
||||||
|
float blue = 0.75-abs(0.25-value);
|
||||||
return vec4(red, green, blue, 1.0);
|
return vec4(red, green, blue, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user