mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-14 13:02:39 -07:00
SLA gizmo clipping plane logic moved to fragment shader
This means the clipping now works again with both legacy and modern OpenGL
This commit is contained in:
@@ -8,16 +8,22 @@ varying vec2 intensity;
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying float world_z;
|
||||
varying vec3 world_pos;
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
|
||||
// x = min z, y = max z;
|
||||
uniform vec2 z_range;
|
||||
|
||||
// clipping plane (general orientation):
|
||||
uniform vec4 clipping_plane;
|
||||
|
||||
void main()
|
||||
{
|
||||
if ((world_z < z_range.x) || (z_range.y < world_z))
|
||||
if ((world_pos.z < z_range.x) || (z_range.y < world_pos.z))
|
||||
discard;
|
||||
|
||||
if (world_pos.x*clipping_plane.x + world_pos.y*clipping_plane.y + world_pos.z*clipping_plane.z + clipping_plane.w < 0.f )
|
||||
discard;
|
||||
|
||||
// if the fragment is outside the print volume -> use darker color
|
||||
|
||||
@@ -34,7 +34,7 @@ varying vec2 intensity;
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying float world_z;
|
||||
varying vec3 world_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -69,5 +69,5 @@ void main()
|
||||
}
|
||||
|
||||
gl_Position = ftransform();
|
||||
world_z = vec3(print_box.volume_world_matrix * gl_Vertex).z;
|
||||
world_pos = vec3(print_box.volume_world_matrix * gl_Vertex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user