mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix rendering issue in flow view
This commit is contained in:
parent
dd952c7f63
commit
91c4d8b5f2
1 changed files with 15 additions and 7 deletions
|
@ -109,18 +109,26 @@ vertex41core =
|
||||||
|
|
||||||
float clamp(float v)
|
float clamp(float v)
|
||||||
{
|
{
|
||||||
float t = v < 0 ? 0 : v;
|
float t = v < 0 ? 0 : v;
|
||||||
return t > 1.0 ? 1.0 : t;
|
return t > 1.0 ? 1.0 : t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspired by https://stackoverflow.com/a/46628410
|
// Inspired by https://stackoverflow.com/a/46628410
|
||||||
vec4 flowRateGradientColor(float abs_value, float min_value, float max_value)
|
vec4 flowRateGradientColor(float abs_value, float min_value, float max_value)
|
||||||
{
|
{
|
||||||
float t = 2.0 * ((abs_value - min_value) / (max_value - min_value)) - 1;
|
float t;
|
||||||
float red = clamp(1.5 - abs(2.0 * t - 1.0));
|
if(abs(min_value - max_value) < 0.0001)
|
||||||
float green = clamp(1.5 - abs(2.0 * t));
|
{
|
||||||
float blue = clamp(1.5 - abs(2.0 * t + 1.0));
|
t = 0;
|
||||||
return vec4(red, green, blue, 1.0);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 2.0 * ((abs_value - min_value) / (max_value - min_value)) - 1;
|
||||||
|
}
|
||||||
|
float red = clamp(1.5 - abs(2.0 * t - 1.0));
|
||||||
|
float green = clamp(1.5 - abs(2.0 * t));
|
||||||
|
float blue = clamp(1.5 - abs(2.0 * t + 1.0));
|
||||||
|
return vec4(red, green, blue, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue