mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-09 23:05:04 -06:00
GCodeViewer -> Shaders code cleanup
This commit is contained in:
parent
edaabf3fbd
commit
9c8892c869
6 changed files with 10 additions and 30 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue