Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2018-11-27 16:50:57 +0300
committerEnrico Turri <enricoturri@seznam.cz>2018-11-27 16:50:57 +0300
commite6369fe548aec684528ed44dfb6e20d8289eba31 (patch)
tree72bafea7f4a73ff35d5e5a295e1d48cc863262bc /resources
parent21d5acfdd7aeb3dff33cdf0cf729f23628803e38 (diff)
SLA slices preview - wip 3
Diffstat (limited to 'resources')
-rw-r--r--resources/shaders/gouraud.fs8
-rw-r--r--resources/shaders/gouraud.vs3
2 files changed, 11 insertions, 0 deletions
diff --git a/resources/shaders/gouraud.fs b/resources/shaders/gouraud.fs
index 9edc8fa76..f6116eec7 100644
--- a/resources/shaders/gouraud.fs
+++ b/resources/shaders/gouraud.fs
@@ -8,10 +8,18 @@ varying vec2 intensity;
varying vec3 delta_box_min;
varying vec3 delta_box_max;
+varying float world_z;
+
uniform vec4 uniform_color;
+// x = min z, y = max z;
+uniform vec2 z_range;
+
void main()
{
+ if ((world_z < z_range.x) || (z_range.y < world_z))
+ discard;
+
// if the fragment is outside the print volume -> use darker color
vec3 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(uniform_color.rgb, ZERO, 0.3333) : uniform_color.rgb;
gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + color * intensity.x, uniform_color.a);
diff --git a/resources/shaders/gouraud.vs b/resources/shaders/gouraud.vs
index ea7e46e79..84ae51391 100644
--- a/resources/shaders/gouraud.vs
+++ b/resources/shaders/gouraud.vs
@@ -34,6 +34,8 @@ varying vec2 intensity;
varying vec3 delta_box_min;
varying vec3 delta_box_max;
+varying float world_z;
+
void main()
{
// First transform the normal into camera space and normalize the result.
@@ -67,4 +69,5 @@ void main()
}
gl_Position = ftransform();
+ world_z = vec3(print_box.volume_world_matrix * gl_Vertex).z;
}