|
|
|
|
@ -40,6 +40,7 @@ typedef struct OVERLAY_StorageList {
|
|
|
|
|
|
|
|
|
|
typedef struct OVERLAY_PassList {
|
|
|
|
|
struct DRWPass *face_orientation_pass;
|
|
|
|
|
struct DRWPass *flat_wireframe_pass;
|
|
|
|
|
struct DRWPass *face_wireframe_pass;
|
|
|
|
|
struct DRWPass *face_wireframe_full_pass;
|
|
|
|
|
} OVERLAY_PassList;
|
|
|
|
|
@ -176,6 +177,8 @@ static void overlay_cache_init(void *vedata)
|
|
|
|
|
/* Wireframe */
|
|
|
|
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
@ -216,6 +219,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
|
|
|
|
|
OVERLAY_PrivateData *pd = stl->g_data;
|
|
|
|
|
OVERLAY_PassList *psl = data->psl;
|
|
|
|
|
const DRWContextState *draw_ctx = DRW_context_state_get();
|
|
|
|
|
RegionView3D *rv3d = draw_ctx->rv3d;
|
|
|
|
|
View3D *v3d = draw_ctx->v3d;
|
|
|
|
|
|
|
|
|
|
if (!stl->g_data->show_overlays)
|
|
|
|
|
@ -242,12 +246,27 @@ static void overlay_cache_populate(void *vedata, Object *ob)
|
|
|
|
|
const bool all_wires = (stl->g_data->overlay.wireframe_threshold == 1.0f) ||
|
|
|
|
|
(ob->dtx & OB_DRAW_ALL_EDGES);
|
|
|
|
|
|
|
|
|
|
/* This fixes only the biggest case which is a plane in ortho view. */
|
|
|
|
|
int flat_axis = 0;
|
|
|
|
|
bool is_flat_object_viewed_from_side = (rv3d->persp == RV3D_ORTHO) &&
|
|
|
|
|
DRW_object_is_flat(ob, &flat_axis) &&
|
|
|
|
|
DRW_object_axis_orthogonal_to_view(ob, flat_axis);
|
|
|
|
|
|
|
|
|
|
if (is_sculpt_mode) {
|
|
|
|
|
DRWShadingGroup *shgrp = (all_wires || DRW_object_is_flat_normal(ob))
|
|
|
|
|
? stl->g_data->sculpt_wires_full
|
|
|
|
|
: stl->g_data->sculpt_wires;
|
|
|
|
|
DRW_shgroup_call_sculpt_add(shgrp, ob, ob->obmat);
|
|
|
|
|
}
|
|
|
|
|
else if (is_flat_object_viewed_from_side) {
|
|
|
|
|
/* Avoid loosing flat objects when in ortho views (see T56549) */
|
|
|
|
|
struct GPUBatch *geom = DRW_cache_object_wire_outline_get(ob);
|
|
|
|
|
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
|
|
|
|
DRWShadingGroup *shgrp = DRW_shgroup_create(sh, psl->flat_wireframe_pass);
|
|
|
|
|
DRW_shgroup_stencil_mask(shgrp, (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF);
|
|
|
|
|
DRW_shgroup_uniform_vec4(shgrp, "color", ts.colorWire, 1);
|
|
|
|
|
DRW_shgroup_call_object_add(shgrp, geom, ob);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
int tri_count;
|
|
|
|
|
GPUTexture *verts = NULL, *faceids;
|
|
|
|
|
@ -283,7 +302,6 @@ static void overlay_cache_populate(void *vedata, Object *ob)
|
|
|
|
|
DRW_shgroup_uniform_vec3(shgrp, "rimColor", rim_col, 1);
|
|
|
|
|
DRW_shgroup_call_object_procedural_triangles_culled_add(shgrp, tri_count, ob);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -322,6 +340,7 @@ static void overlay_draw_scene(void *vedata)
|
|
|
|
|
GPU_framebuffer_bind(dfbl->default_fb);
|
|
|
|
|
}
|
|
|
|
|
DRW_draw_pass(psl->face_orientation_pass);
|
|
|
|
|
DRW_draw_pass(psl->flat_wireframe_pass);
|
|
|
|
|
DRW_draw_pass(psl->face_wireframe_pass);
|
|
|
|
|
DRW_draw_pass(psl->face_wireframe_full_pass);
|
|
|
|
|
}
|
|
|
|
|
|