diff --git a/resources/shaders/extrusions.fs b/resources/shaders/extrusions.fs index fc81e487f..65db0667a 100644 --- a/resources/shaders/extrusions.fs +++ b/resources/shaders/extrusions.fs @@ -17,7 +17,6 @@ uniform vec3 uniform_color; varying vec3 eye_position; varying vec3 eye_normal; -//varying float world_normal_z; // x = tainted, y = specular; vec2 intensity; @@ -37,9 +36,5 @@ void main() NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; -// // darkens fragments whose normal points downward -// if (world_normal_z < 0.0) -// intensity.x *= (1.0 + world_normal_z * (1.0 - INTENSITY_AMBIENT)); - gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + uniform_color * intensity.x, 1.0); } diff --git a/resources/shaders/extrusions.vs b/resources/shaders/extrusions.vs index d97adbabe..8980f3944 100644 --- a/resources/shaders/extrusions.vs +++ b/resources/shaders/extrusions.vs @@ -2,14 +2,10 @@ varying vec3 eye_position; varying vec3 eye_normal; -//// world z component of the normal used to darken the lower side of the toolpaths -//varying float world_normal_z; void main() { eye_position = (gl_ModelViewMatrix * gl_Vertex).xyz; eye_normal = gl_NormalMatrix * vec3(0.0, 0.0, 1.0); -// eye_normal = gl_NormalMatrix * gl_Normal; -// world_normal_z = gl_Normal.z; gl_Position = ftransform(); } diff --git a/resources/shaders/options_120_solid.fs b/resources/shaders/options_120_solid.fs index b7770cf0d..c7a57d547 100644 --- a/resources/shaders/options_120_solid.fs +++ b/resources/shaders/options_120_solid.fs @@ -16,14 +16,9 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074); #define INTENSITY_AMBIENT 0.3 uniform vec3 uniform_color; -uniform float percent_outline_radius; -uniform float percent_center_radius; // x = width, y = height uniform ivec2 viewport_sizes; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -//uniform vec2 z_range; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ uniform mat4 inv_proj_matrix; varying vec3 eye_center; @@ -77,10 +72,8 @@ vec4 on_sphere_color(vec3 eye_on_sphere_position) float fragment_depth(vec3 eye_pos) { - // see: https://stackoverflow.com/questions/10264949/glsl-gl-fragcoord-z-calculation-and-setting-gl-fragdepth vec4 clip_pos = gl_ProjectionMatrix * vec4(eye_pos, 1.0); float ndc_depth = clip_pos.z / clip_pos.w; - return (((gl_DepthRange.far - gl_DepthRange.near) * ndc_depth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0; } @@ -94,7 +87,5 @@ void main() vec3 eye_on_sphere_position = eye_position_on_sphere(eye_position_from_fragment()); gl_FragDepth = fragment_depth(eye_on_sphere_position); -// gl_FragDepth = eye_on_sphere_position.z; -// gl_FragDepth = (eye_on_sphere_position.z - z_range.x) / (z_range.y - z_range.x); gl_FragColor = on_sphere_color(eye_on_sphere_position); } diff --git a/resources/shaders/travels.fs b/resources/shaders/travels.fs index fc81e487f..65db0667a 100644 --- a/resources/shaders/travels.fs +++ b/resources/shaders/travels.fs @@ -17,7 +17,6 @@ uniform vec3 uniform_color; varying vec3 eye_position; varying vec3 eye_normal; -//varying float world_normal_z; // x = tainted, y = specular; vec2 intensity; @@ -37,9 +36,5 @@ void main() NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; -// // darkens fragments whose normal points downward -// if (world_normal_z < 0.0) -// intensity.x *= (1.0 + world_normal_z * (1.0 - INTENSITY_AMBIENT)); - gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + uniform_color * intensity.x, 1.0); } diff --git a/resources/shaders/travels.vs b/resources/shaders/travels.vs index d97adbabe..8980f3944 100644 --- a/resources/shaders/travels.vs +++ b/resources/shaders/travels.vs @@ -2,14 +2,10 @@ varying vec3 eye_position; varying vec3 eye_normal; -//// world z component of the normal used to darken the lower side of the toolpaths -//varying float world_normal_z; void main() { eye_position = (gl_ModelViewMatrix * gl_Vertex).xyz; eye_normal = gl_NormalMatrix * vec3(0.0, 0.0, 1.0); -// eye_normal = gl_NormalMatrix * gl_Normal; -// world_normal_z = gl_Normal.z; gl_Position = ftransform(); } diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 25432f1cf..896a42b10 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -771,11 +771,16 @@ void GCodeViewer::render_toolpaths() const const std::array<int, 4>& viewport = camera.get_viewport(); std::array<int, 2> viewport_sizes = { viewport[2], viewport[3] }; const std::pair<double, double>& camera_z_range = camera.get_z_range(); - std::array<float, 2> z_range = { static_cast<float>(camera_z_range.first), static_cast<float>(camera_z_range.second) }; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +// std::array<float, 2> z_range = { static_cast<float>(camera_z_range.first), static_cast<float>(camera_z_range.second) }; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Transform3d inv_proj = camera.get_projection_matrix().inverse(); - auto render_options = [this, is_glsl_120, zoom, viewport, inv_proj, viewport_sizes, z_range, point_sizes](const IBuffer& buffer, EOptionsColors colors_id, GLShaderProgram& shader) { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + auto render_options = [this, is_glsl_120, zoom, viewport, inv_proj, viewport_sizes, point_sizes](const IBuffer& buffer, EOptionsColors colors_id, GLShaderProgram& shader) { +// auto render_options = [this, is_glsl_120, zoom, viewport, inv_proj, viewport_sizes, z_range, point_sizes](const IBuffer& buffer, EOptionsColors colors_id, GLShaderProgram& shader) { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ shader.set_uniform("uniform_color", Options_Colors[static_cast<unsigned int>(colors_id)]); #if ENABLE_GCODE_VIEWER_SHADERS_EDITOR shader.set_uniform("zoom", m_shaders_editor.size_dependent_on_zoom ? zoom : 1.0f); @@ -788,7 +793,9 @@ void GCodeViewer::render_toolpaths() const #endif // ENABLE_GCODE_VIEWER_SHADERS_EDITOR shader.set_uniform("viewport_sizes", viewport_sizes); shader.set_uniform("inv_proj_matrix", inv_proj); - shader.set_uniform("z_range", z_range); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +// shader.set_uniform("z_range", z_range); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ shader.set_uniform("point_sizes", point_sizes); glsafe(::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)); if (is_glsl_120)