UI: Make Wireframe size respect DPI settings
This commit is contained in:
@@ -185,22 +185,27 @@ static void overlay_cache_init(void *vedata)
|
||||
{
|
||||
/* Wireframe */
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND;
|
||||
float wire_size = max_ff(0.0f, U.pixelsize - 1.0f) * 0.5f;
|
||||
|
||||
psl->flat_wireframe_pass = DRW_pass_create("Flat Object Wires", state | DRW_STATE_WRITE_DEPTH);
|
||||
|
||||
psl->face_wireframe_full_pass = DRW_pass_create("All Face Wires", state);
|
||||
|
||||
stl->g_data->sculpt_wires_full = DRW_shgroup_create(e_data.face_wireframe_sculpt_sh, psl->face_wireframe_full_pass);
|
||||
DRW_shgroup_uniform_float_copy(stl->g_data->sculpt_wires_full, "wireSize", wire_size);
|
||||
|
||||
DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.face_wireframe_sh, psl->face_wireframe_full_pass);
|
||||
DRW_shgroup_uniform_float_copy(shgrp, "wireSize", wire_size);
|
||||
|
||||
psl->face_wireframe_pass = DRW_pass_create("Face Wires", state);
|
||||
|
||||
stl->g_data->sculpt_wires = DRW_shgroup_create(e_data.face_wireframe_sculpt_pretty_sh, psl->face_wireframe_pass);
|
||||
DRW_shgroup_uniform_vec2(stl->g_data->sculpt_wires, "wireStepParam", stl->g_data->wire_step_param, 1);
|
||||
DRW_shgroup_uniform_float_copy(stl->g_data->sculpt_wires, "wireSize", wire_size);
|
||||
|
||||
shgrp = DRW_shgroup_create(e_data.face_wireframe_pretty_sh, psl->face_wireframe_pass);
|
||||
DRW_shgroup_uniform_vec2(shgrp, "wireStepParam", stl->g_data->wire_step_param, 1);
|
||||
DRW_shgroup_uniform_float_copy(shgrp, "wireSize", wire_size);
|
||||
|
||||
/**
|
||||
* The wireframe threshold ranges from 0.0 to 1.0
|
||||
|
||||
@@ -16,7 +16,7 @@ float min_v3(vec3 v) { return min(v.x, min(v.y, v.z)); }
|
||||
float max_v3(vec3 v) { return max(v.x, max(v.y, v.z)); }
|
||||
|
||||
/* In pixels */
|
||||
const float wire_size = 0.0; /* Expands the core of the wire (part that is 100% wire color) */
|
||||
uniform float wireSize = 0.0; /* Expands the core of the wire (part that is 100% wire color) */
|
||||
const float wire_smooth = 1.2; /* Smoothing distance after the 100% core. */
|
||||
|
||||
/* Alpha constants could be exposed in the future. */
|
||||
@@ -41,7 +41,7 @@ void main()
|
||||
float fac = min_v3(abs(dist_to_edge));
|
||||
# endif
|
||||
|
||||
fac = smoothstep(wire_size + wire_smooth, wire_size, fac);
|
||||
fac = smoothstep(wireSize + wire_smooth, wireSize, fac);
|
||||
|
||||
float facing_clamped = clamp((gl_FrontFacing) ? facing : -facing, 0.0, 1.0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user