mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-14 04:27:36 +00:00
Fix external outline Thickness (#14741)
* Fix external outline * Format and values * frag_color -> gl_FragColor * Remove Transform3d& view_matrix * Clarify rendering comments in 3DScene.cpp Updated comments to clarify rendering process using stencil buffer. --------- Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
@@ -14,6 +14,8 @@ uniform mat4 projection_matrix;
|
||||
uniform mat3 view_normal_matrix;
|
||||
uniform mat4 volume_world_matrix;
|
||||
uniform SlopeDetection slope;
|
||||
uniform bool is_outline;
|
||||
uniform vec2 screen_size;
|
||||
|
||||
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
|
||||
uniform vec2 z_range;
|
||||
@@ -48,6 +50,15 @@ void main()
|
||||
world_normal_z = slope.actived ? (normalize(slope.volume_world_normal_matrix * v_normal)).z : 0.0;
|
||||
|
||||
gl_Position = projection_matrix * position;
|
||||
if (is_outline) {
|
||||
vec3 n = normalize((view_normal_matrix * v_normal).xyz);
|
||||
vec2 dir = normalize(n.xy);
|
||||
if (dot(dir, dir) > 0.0) {
|
||||
//set outline thickness
|
||||
float px = 3.0;
|
||||
gl_Position.xy += dir * (px * 2.0 / screen_size) * gl_Position.w;
|
||||
}
|
||||
}
|
||||
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
|
||||
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
|
||||
color_clip_plane_dot = dot(world_pos, color_clip_plane);
|
||||
|
||||
Reference in New Issue
Block a user