Refactor: GLSL: Cleanup Clip Space vs. NDC Space naming #105423
|
@ -84,9 +84,9 @@ void main()
|
|||
vec2 stippleStart1 = stipplePos1;
|
||||
|
||||
/* Geometry shader equivalent calculations. */
|
||||
vec2 ss_pos[2];
|
||||
ss_pos[0] = hs_pos0.xy / hs_pos0.w;
|
||||
ss_pos[1] = hs_pos1.xy / hs_pos1.w;
|
||||
vec2 ndc_pos[2];
|
||||
fclem marked this conversation as resolved
|
||||
ndc_pos[0] = hs_pos0.xy / hs_pos0.w;
|
||||
ndc_pos[1] = hs_pos1.xy / hs_pos1.w;
|
||||
|
||||
float half_size = sizeEdge;
|
||||
|
||||
|
@ -100,7 +100,7 @@ void main()
|
|||
half_size += 0.5;
|
||||
}
|
||||
|
||||
vec2 line = ss_pos[0] - ss_pos[1];
|
||||
vec2 line = ndc_pos[0] - ndc_pos[1];
|
||||
vec2 line_dir = normalize(line);
|
||||
vec2 line_perp = vec2(-line_dir.y, line_dir.x);
|
||||
vec2 edge_ofs = line_perp * sizeViewportInv * ceil(half_size);
|
||||
|
|
|
@ -45,7 +45,7 @@ void main()
|
|||
vec3 world_pos;
|
||||
if (hairThicknessRes > 1) {
|
||||
/* Calculate the thickness, thicktime, worldpos taken into account the outline. */
|
||||
float outline_width = point_world_to_homogenous (center_wpos).w * 1.25 * sizeViewportInv.y *
|
||||
float outline_width = point_world_to_homogenous(center_wpos).w * 1.25 * sizeViewportInv.y *
|
||||
fclem marked this conversation as resolved
Clément Foucault
commented
Did you run Did you run `make format`? there is an extra blank space here that should have been fixed by clang format.
|
||||
drw_view.wininv[1][1];
|
||||
thickness += outline_width;
|
||||
float thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
|
||||
|
|
|
@ -32,8 +32,8 @@ void main()
|
|||
vec3 ray_ori = pos;
|
||||
vec3 ray_dir = (is_persp) ? (drw_view.viewinv[3].xyz - pos) : drw_view.viewinv[2].xyz;
|
||||
vec3 isect = ray_plane_intersection(ray_ori, ray_dir, gpDepthPlane);
|
||||
vec4 hs = point_world_to_homogenous(isect);
|
||||
gl_FragDepth = (hs.z / hs.w) * 0.5 + 0.5;
|
||||
vec4 hs_isect = point_world_to_homogenous(isect);
|
||||
fclem marked this conversation as resolved
Clément Foucault
commented
Rename to Rename to `hs_isect`.
|
||||
gl_FragDepth = (hs_isect.z / hs_isect.w) * 0.5 + 0.5;
|
||||
}
|
||||
else {
|
||||
gl_FragDepth = gl_FragCoord.z;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
f#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
Clément Foucault
commented
An extra "f" is present at the beginning of the line. Seems like it was committed by mistake. An extra "f" is present at the beginning of the line. Seems like it was committed by mistake.
|
||||
|
||||
/* Two variants, split pass, generates either 2 triangles or 6 triangles depending on input
|
||||
* geometry manifold type */
|
||||
|
|
|
@ -220,17 +220,17 @@ vec4 gpencil_vertex(vec4 viewport_size,
|
|||
vec3 B = cross(T, ViewMatrixInverse[2].xyz);
|
||||
out_N = normalize(cross(B, T));
|
||||
|
||||
vec4 hs_adj = point_world_to_hs(wpos_adj);
|
||||
vec4 hs1 = point_world_to_homogenous(wpos1);
|
||||
vec4 hs2 = point_world_to_homogenous(wpos2);
|
||||
vec4 hs_pos_adj = point_world_to_hs(wpos_adj);
|
||||
fclem marked this conversation as resolved
Clément Foucault
commented
Rename to Rename to `hs_pos_adj`.
|
||||
vec4 hs_pos1 = point_world_to_homogenous(wpos1);
|
||||
fclem marked this conversation as resolved
Clément Foucault
commented
Rename to Rename to `hs_pos1` and `hs_pos2`.
|
||||
vec4 hs_pos2 = point_world_to_homogenous(wpos2);
|
||||
|
||||
out_hs = (use_curr) ? hs1 : hs2;
|
||||
out_hs = (use_curr) ? hs_pos1 : hs_pos2;
|
||||
out_P = (use_curr) ? wpos1 : wpos2;
|
||||
out_strength = abs((use_curr) ? strength1 : strength2);
|
||||
|
||||
vec2 ss_adj = gpencil_project_to_screenspace(hs_adj, viewport_size);
|
||||
vec2 ss1 = gpencil_project_to_screenspace(hs1, viewport_size);
|
||||
vec2 ss2 = gpencil_project_to_screenspace(hs2, viewport_size);
|
||||
vec2 ss_adj = gpencil_project_to_screenspace(hs_pos_adj, viewport_size);
|
||||
vec2 ss1 = gpencil_project_to_screenspace(hs_pos1, viewport_size);
|
||||
vec2 ss2 = gpencil_project_to_screenspace(hs_pos2, viewport_size);
|
||||
/* Screenspace Lines tangents. */
|
||||
float line_len;
|
||||
vec2 line = safe_normalize_len(ss2 - ss1, line_len);
|
||||
|
|
Loading…
Reference in New Issue
This should become
ndc_pos
since it is the position after the division.