diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-06-27 13:46:05 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-06-27 13:46:47 +0300 |
commit | 2b806cb9558f174fb4b2fa7254ca2e9e113bfd17 (patch) | |
tree | ef4db479ec7654ccf3edc4bfd7b4b70371ca4802 /source/blender/draw/engines/overlay | |
parent | ddc6b86a5bab833c7599f5545b9aff0ad7349e02 (diff) |
Cleanup: DRW: Remove drw_view renaming MACROS
Diffstat (limited to 'source/blender/draw/engines/overlay')
22 files changed, 47 insertions, 47 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_outline_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_outline_vert.glsl index 0a8e279e9b0..612ce8c6300 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_outline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_outline_vert.glsl @@ -17,8 +17,8 @@ vec2 compute_dir(vec2 v0, vec2 v1, vec2 v2) mat3 compute_mat(vec4 sphere, vec3 bone_vec, out float z_ofs) { - bool is_persp = (ProjectionMatrix[3][3] == 0.0); - vec3 cam_ray = (is_persp) ? sphere.xyz - ViewMatrixInverse[3].xyz : -ViewMatrixInverse[2].xyz; + bool is_persp = (drw_view.winmat[3][3] == 0.0); + vec3 cam_ray = (is_persp) ? sphere.xyz - drw_view.viewinv[3].xyz : -drw_view.viewinv[2].xyz; /* Sphere center distance from the camera (persp) in world space. */ float cam_dist = length(cam_ray); @@ -88,13 +88,13 @@ vec3 get_outline_point(vec2 pos, void main() { - float dst_head = distance(headSphere.xyz, ViewMatrixInverse[3].xyz); - float dst_tail = distance(tailSphere.xyz, ViewMatrixInverse[3].xyz); - // float dst_head = -dot(headSphere.xyz, ViewMatrix[2].xyz); - // float dst_tail = -dot(tailSphere.xyz, ViewMatrix[2].xyz); + float dst_head = distance(headSphere.xyz, drw_view.viewinv[3].xyz); + float dst_tail = distance(tailSphere.xyz, drw_view.viewinv[3].xyz); + // float dst_head = -dot(headSphere.xyz, drw_view.viewmat[2].xyz); + // float dst_tail = -dot(tailSphere.xyz, drw_view.viewmat[2].xyz); vec4 sph_near, sph_far; - if ((dst_head > dst_tail) && (ProjectionMatrix[3][3] == 0.0)) { + if ((dst_head > dst_tail) && (drw_view.winmat[3][3] == 0.0)) { sph_near = tailSphere; sph_far = headSphere; } diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_solid_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_solid_vert.glsl index 2dd86a57dfd..4d21ffd96b5 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_solid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_envelope_solid_vert.glsl @@ -30,7 +30,7 @@ void main() sp = bone_mat * sp.xzy + headSphere.xyz; nor = bone_mat * nor.xzy; - normalView = mat3(ViewMatrix) * nor; + normalView = mat3(drw_view.viewmat) * nor; finalStateColor = stateColor; finalBoneColor = boneColor; @@ -38,5 +38,5 @@ void main() view_clipping_distances(sp); vec4 pos_4d = vec4(sp, 1.0); - gl_Position = ViewProjectionMatrix * pos_4d; + gl_Position = drw_view.persmat * pos_4d; } diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_geom.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_geom.glsl index 47c5dada708..b485b0a7807 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_geom.glsl @@ -5,7 +5,7 @@ void main(void) { finalColor = vec4(geom_in[0].vColSize.rgb, 1.0); - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); vec3 view_vec = (is_persp) ? normalize(geom_in[1].vPos) : vec3(0.0, 0.0, -1.0); vec3 v10 = geom_in[0].vPos - geom_in[1].vPos; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_vert.glsl index 29319b3f7ac..91eb6265192 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_vert.glsl @@ -14,10 +14,10 @@ void main() mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color); vec4 world_pos = model_mat * vec4(pos, 1.0); - vec4 view_pos = ViewMatrix * world_pos; + vec4 view_pos = drw_view.viewmat * world_pos; geom_in.vPos = view_pos.xyz; - geom_in.pPos = ProjectionMatrix * view_pos; + geom_in.pPos = drw_view.winmat * view_pos; geom_in.inverted = int(dot(cross(model_mat[0].xyz, model_mat[1].xyz), model_mat[2].xyz) < 0.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_solid_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_solid_vert.glsl index cdbe8c3d7df..68f7e75673f 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_solid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_solid_vert.glsl @@ -25,7 +25,7 @@ void main() finalColor.a = 1.0; vec4 world_pos = model_mat * vec4(pos, 1.0); - gl_Position = ViewProjectionMatrix * world_pos; + gl_Position = drw_view.persmat * world_pos; view_clipping_distances(world_pos.xyz); } diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_outline_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_outline_vert.glsl index 31369e0c3df..4d79fab718f 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_outline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_outline_vert.glsl @@ -13,10 +13,10 @@ void main() vec4 bone_color, state_color; mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color); - mat4 model_view_matrix = ViewMatrix * model_mat; + mat4 model_view_matrix = drw_view.viewmat * model_mat; mat4 sphereMatrix = inverse(model_view_matrix); - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); /* This is the local space camera ray (not normalize). * In perspective mode it's also the viewspace position @@ -58,8 +58,8 @@ void main() vec3 cam_pos0 = x_axis * pos.x + y_axis * pos.y + z_axis * z_ofs; vec4 V = model_view_matrix * vec4(cam_pos0, 1.0); - gl_Position = ProjectionMatrix * V; - vec4 center = ProjectionMatrix * vec4(model_view_matrix[3].xyz, 1.0); + gl_Position = drw_view.winmat * V; + vec4 center = drw_view.winmat * vec4(model_view_matrix[3].xyz, 1.0); /* Offset away from the center to avoid overlap with solid shape. */ vec2 ofs_dir = normalize(proj(gl_Position) - proj(center)); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_frag.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_frag.glsl index e60b6e94492..150701b78df 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_frag.glsl @@ -5,7 +5,7 @@ void main() { const float sphere_radius = 0.05; - bool is_perp = (ProjectionMatrix[3][3] == 0.0); + bool is_perp = (drw_view.winmat[3][3] == 0.0); vec3 ray_ori_view = (is_perp) ? vec3(0.0) : viewPosition.xyz; vec3 ray_dir_view = (is_perp) ? viewPosition : vec3(0.0, 0.0, -1.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_vert.glsl index abbaad8cd10..3d2dfc018bb 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_sphere_solid_vert.glsl @@ -10,10 +10,10 @@ void main() vec4 bone_color, state_color; mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color); - mat4 model_view_matrix = ViewMatrix * model_mat; + mat4 model_view_matrix = drw_view.viewmat * model_mat; sphereMatrix = inverse(model_view_matrix); - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); /* This is the local space camera ray (not normalize). * In perspective mode it's also the viewspace position @@ -65,7 +65,7 @@ void main() vec4 pos_4d = vec4(cam_pos, 1.0); vec4 V = model_view_matrix * pos_4d; - gl_Position = ProjectionMatrix * V; + gl_Position = drw_view.winmat * V; viewPosition = V.xyz; finalStateColor = state_color.xyz; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_stick_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_stick_vert.glsl index b5edcd2858b..e7917a46312 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_stick_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_stick_vert.glsl @@ -31,12 +31,12 @@ void main() vec4 boneStart_4d = vec4(boneStart, 1.0); vec4 boneEnd_4d = vec4(boneEnd, 1.0); - vec4 v0 = ViewMatrix * boneStart_4d; - vec4 v1 = ViewMatrix * boneEnd_4d; + vec4 v0 = drw_view.viewmat * boneStart_4d; + vec4 v1 = drw_view.viewmat * boneEnd_4d; /* Clip the bone to the camera origin plane (not the clip plane) * to avoid glitches if one end is behind the camera origin (in persp). */ - float clip_dist = (ProjectionMatrix[3][3] == 0.0) ? + float clip_dist = (drw_view.winmat[3][3] == 0.0) ? -1e-7 : 1e20; /* hardcoded, -1e-8 is giving gliches. */ vec3 bvec = v1.xyz - v0.xyz; @@ -48,8 +48,8 @@ void main() v1.xyz = clip_pt; } - vec4 p0 = ProjectionMatrix * v0; - vec4 p1 = ProjectionMatrix * v1; + vec4 p0 = drw_view.winmat * v0; + vec4 p1 = drw_view.winmat * v1; float h = (is_head) ? p0.w : p1.w; @@ -58,7 +58,7 @@ void main() /* 2D screen aligned pos at the point */ vec2 vpos = pos.x * x_screen_vec + pos.y * y_screen_vec; - vpos *= (ProjectionMatrix[3][3] == 0.0) ? h : 1.0; + vpos *= (drw_view.winmat[3][3] == 0.0) ? h : 1.0; vpos *= (do_wire) ? 1.0 : 0.5; if (finalInnerColor.a > 0.0) { diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl index 6ff8d0665d1..dc5c43f417e 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl @@ -45,7 +45,7 @@ void main() if (gl_VertexID == 0) { if (isConstantScreenSizeNormals) { - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); if (is_persp) { float dist_fac = length(cameraPos - world_pos); float cos_fac = dot(cameraForward, cameraVec(world_pos)); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_skin_root_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_skin_root_vert.glsl index f1fbdac7847..76a944c6987 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_skin_root_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_skin_root_vert.glsl @@ -9,7 +9,7 @@ void main() vec3 up = normalize(imat * screenVecs[1].xyz); vec3 screen_pos = (right * pos.x + up * pos.z) * size; vec4 pos_4d = ModelMatrix * vec4(local_pos + screen_pos, 1.0); - gl_Position = ViewProjectionMatrix * pos_4d; + gl_Position = drw_view.persmat * pos_4d; /* Manual stipple: one segment out of 2 is transparent. */ finalColor = ((gl_VertexID & 1) == 0) ? colorSkinRoot : vec4(0.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl index 374fb50af75..a50bc5e6e68 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_edit_mesh_vert.glsl @@ -74,7 +74,7 @@ void main() finalColor = EDIT_MESH_facedot_color(norAndFlag.w); /* Bias Facedot Z position in clipspace. */ - gl_Position.z -= (ProjectionMatrix[3][3] == 0.0) ? 0.00035 : 1e-6; + gl_Position.z -= (drw_view.winmat[3][3] == 0.0) ? 0.00035 : 1e-6; gl_PointSize = sizeFaceDot; bool occluded = test_occlusion(); @@ -87,7 +87,7 @@ void main() /* Facing based color blend */ vec3 vpos = point_world_to_view(world_pos); vec3 view_normal = normalize(normal_object_to_view(vnor) + 1e-4); - vec3 view_vec = (ProjectionMatrix[3][3] == 0.0) ? normalize(vpos) : vec3(0.0, 0.0, 1.0); + vec3 view_vec = (drw_view.winmat[3][3] == 0.0) ? normalize(vpos) : vec3(0.0, 0.0, 1.0); float facing = dot(view_vec, view_normal); facing = 1.0 - abs(facing) * 0.2; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_extra_vert.glsl index b2578970c9b..acaf04219c0 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_extra_vert.glsl @@ -198,8 +198,8 @@ void main() vec3 edge = obmat[3].xyz - world_pos; vec3 n0 = normalize(cross(edge, p0 - world_pos)); vec3 n1 = normalize(cross(edge, world_pos - p1)); - bool persp = (ProjectionMatrix[3][3] == 0.0); - vec3 V = (persp) ? normalize(ViewMatrixInverse[3].xyz - world_pos) : ViewMatrixInverse[2].xyz; + bool persp = (drw_view.winmat[3][3] == 0.0); + vec3 V = (persp) ? normalize(drw_view.viewinv[3].xyz - world_pos) : drw_view.viewinv[2].xyz; /* Discard non-silhouette edges. */ bool facing0 = dot(n0, V) > 0.0; bool facing1 = dot(n1, V) > 0.0; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_grid_frag.glsl b/source/blender/draw/engines/overlay/shaders/overlay_grid_frag.glsl index 25f4984f119..54a4231590e 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_grid_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_grid_frag.glsl @@ -53,7 +53,7 @@ void main() P += cameraPos * plane_axes; float dist, fade; - bool is_persp = ProjectionMatrix[3][3] == 0.0; + bool is_persp = drw_view.winmat[3][3] == 0.0; if (is_persp) { vec3 V = cameraPos - P; dist = length(V); @@ -83,7 +83,7 @@ void main() dist = 1.0; /* Avoid branch after. */ if (flag_test(grid_flag, PLANE_XY)) { - float angle = 1.0 - abs(ViewMatrixInverse[2].z); + float angle = 1.0 - abs(drw_view.viewinv[2].z); dist = 1.0 + angle * 2.0; angle *= angle; fade *= 1.0 - angle * angle; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_grid_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_grid_vert.glsl index b81f1a24358..b43b1eb4a52 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_grid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_grid_vert.glsl @@ -39,5 +39,5 @@ void main() local_pos.z = clamp(local_pos.z, -1.0, 0.0); } - gl_Position = ViewProjectionMatrix * vec4(real_pos, 1.0); + gl_Position = drw_view.persmat * vec4(real_pos, 1.0); } diff --git a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_geom.glsl b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_geom.glsl index 29346a44863..25e13e7c212 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_geom.glsl @@ -15,7 +15,7 @@ void main(void) vec2 edge_dir = compute_dir(interp_in[0].ss_pos, interp_in[1].ss_pos) * drw_view.viewport_size_inverse; - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); float line_size = float(lineThickness) * sizePixel; view_clipping_distances_set(gl_in[0]); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl index bc74a436f5e..e6281f75b8f 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl @@ -18,7 +18,7 @@ vec2 proj(vec4 pos) void main() { - gl_Position = ViewProjectionMatrix * vec4(pos, 1.0); + gl_Position = drw_view.persmat * vec4(pos, 1.0); interp.ss_pos = proj(gl_Position); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl index 5027525b9b3..70892954cd8 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_point_vert.glsl @@ -9,7 +9,7 @@ void main() { - gl_Position = ViewProjectionMatrix * vec4(pos, 1.0); + gl_Position = drw_view.persmat * vec4(pos, 1.0); gl_PointSize = float(pointSize + 2); int frame = gl_VertexID + cacheStart; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_geom.glsl b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_geom.glsl index 8a196620af9..5e0074e9f0b 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_geom.glsl @@ -11,7 +11,7 @@ void vert_from_gl_in(int v) void main() { - bool is_persp = (ProjectionMatrix[3][3] == 0.0); + bool is_persp = (drw_view.winmat[3][3] == 0.0); vec3 view_vec = (is_persp) ? normalize(vert[1].pos) : vec3(0.0, 0.0, -1.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl index b6d5cd96c12..92be9ec3bcb 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_gpencil_frag.glsl @@ -22,14 +22,14 @@ void main() if (!gpStrokeOrder3d) { /* Stroke order 2D. Project to gpDepthPlane. */ - bool is_persp = ProjectionMatrix[3][3] == 0.0; + bool is_persp = drw_view.winmat[3][3] == 0.0; vec2 uvs = vec2(gl_FragCoord.xy) * drw_view.viewport_size_inverse; vec3 pos_ndc = vec3(uvs, gl_FragCoord.z) * 2.0 - 1.0; - vec4 pos_world = ViewProjectionMatrixInverse * vec4(pos_ndc, 1.0); + vec4 pos_world = drw_view.persinv * vec4(pos_ndc, 1.0); vec3 pos = pos_world.xyz / pos_world.w; vec3 ray_ori = pos; - vec3 ray_dir = (is_persp) ? (ViewMatrixInverse[3].xyz - pos) : ViewMatrixInverse[2].xyz; + 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 ndc = point_world_to_ndc(isect); gl_FragDepth = (ndc.z / ndc.w) * 0.5 + 0.5; diff --git a/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl index fb981a8167a..c48e7cce550 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl @@ -23,7 +23,7 @@ void main() #ifdef USE_DOTS gl_Position = point_world_to_ndc(world_pos); /* World sized points. */ - gl_PointSize = sizePixel * draw_size * ProjectionMatrix[1][1] * sizeViewport.y / gl_Position.w; + gl_PointSize = sizePixel * draw_size * drw_view.winmat[1][1] * sizeViewport.y / gl_Position.w; #else if ((vclass & VCLASS_SCREENALIGNED) != 0) { diff --git a/source/blender/draw/engines/overlay/shaders/overlay_wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_wireframe_vert.glsl index 41bd7791dd7..d189ab1b72c 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_wireframe_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_wireframe_vert.glsl @@ -72,7 +72,7 @@ void wire_object_color_get(out vec3 rim_col, out vec3 wire_col) void main() { bool no_attr = all(equal(nor, vec3(0))); - vec3 wnor = no_attr ? ViewMatrixInverse[2].xyz : normalize(normal_object_to_world(nor)); + vec3 wnor = no_attr ? drw_view.viewinv[2].xyz : normalize(normal_object_to_world(nor)); vec3 wpos = point_object_to_world(pos); if (isHair) { @@ -81,8 +81,8 @@ void main() wnor = -normalize(mat3(obmat) * nor); } - bool is_persp = (ProjectionMatrix[3][3] == 0.0); - vec3 V = (is_persp) ? normalize(ViewMatrixInverse[3].xyz - wpos) : ViewMatrixInverse[2].xyz; + bool is_persp = (drw_view.winmat[3][3] == 0.0); + vec3 V = (is_persp) ? normalize(drw_view.viewinv[3].xyz - wpos) : drw_view.viewinv[2].xyz; float facing = dot(wnor, V); |