Object Mode: Use stipple shader for relationship lines.
This commit is contained in:
@@ -214,12 +214,18 @@ void DRW_globals_free(void)
|
||||
}
|
||||
}
|
||||
|
||||
DRWShadingGroup *shgroup_dynlines_uniform_color(DRWPass *pass, float color[4])
|
||||
DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, float color[4])
|
||||
{
|
||||
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
||||
|
||||
static float dash_width = 12.0f;
|
||||
static float dash_factor = 0.5f;
|
||||
DRWShadingGroup *grp = DRW_shgroup_line_batch_create(sh, pass);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
|
||||
DRW_shgroup_uniform_vec2(grp, "viewport_size", DRW_viewport_size_get(), 1);
|
||||
DRW_shgroup_uniform_float(grp, "dash_width", &dash_width, 1);
|
||||
DRW_shgroup_uniform_float(grp, "dash_factor", &dash_factor, 1);
|
||||
DRW_shgroup_uniform_int_copy(grp, "num_colors", 0); /* "simple" mode */
|
||||
|
||||
return grp;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ typedef struct GlobalsUboStorage {
|
||||
void DRW_globals_update(void);
|
||||
void DRW_globals_free(void);
|
||||
|
||||
struct DRWShadingGroup *shgroup_dynlines_uniform_color(struct DRWPass *pass, float color[4]);
|
||||
struct DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(struct DRWPass *pass, float color[4]);
|
||||
struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, float color[4], float *size);
|
||||
struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, float color[4]);
|
||||
struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, float color[4]);
|
||||
|
||||
@@ -109,10 +109,6 @@ static void EDIT_ARMATURE_cache_init(void *vedata)
|
||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS |
|
||||
DRW_STATE_BLEND | DRW_STATE_WIRE;
|
||||
psl->relationship = DRW_pass_create("Bone Relationship Pass", state);
|
||||
|
||||
/* Relationship Lines */
|
||||
stl->g_data->relationship_lines = shgroup_dynlines_uniform_color(psl->relationship, ts.colorWire);
|
||||
DRW_shgroup_state_enable(stl->g_data->relationship_lines, DRW_STATE_STIPPLE_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,21 +1191,22 @@ static void OBJECT_cache_init(void *vedata)
|
||||
|
||||
{
|
||||
/* -------- STIPPLES ------- */
|
||||
/* TODO port to shader stipple */
|
||||
struct Gwn_Batch *geom;
|
||||
|
||||
/* Relationship Lines */
|
||||
stl->g_data->relationship_lines = shgroup_dynlines_uniform_color(psl->non_meshes, ts.colorWire);
|
||||
DRW_shgroup_state_enable(stl->g_data->relationship_lines, DRW_STATE_STIPPLE_3);
|
||||
stl->g_data->relationship_lines = shgroup_dynlines_dashed_uniform_color(psl->non_meshes, ts.colorWire);
|
||||
|
||||
/* Force Field Curve Guide End (here because of stipple) */
|
||||
/* TODO port to shader stipple */
|
||||
geom = DRW_cache_screenspace_circle_get();
|
||||
stl->g_data->field_curve_end = shgroup_instance_screen_aligned(psl->non_meshes, geom);
|
||||
|
||||
/* Force Field Limits */
|
||||
/* TODO port to shader stipple */
|
||||
geom = DRW_cache_field_tube_limit_get();
|
||||
stl->g_data->field_tube_limit = shgroup_instance_scaled(psl->non_meshes, geom);
|
||||
|
||||
/* TODO port to shader stipple */
|
||||
geom = DRW_cache_field_cone_limit_get();
|
||||
stl->g_data->field_cone_limit = shgroup_instance_scaled(psl->non_meshes, geom);
|
||||
}
|
||||
@@ -1874,8 +1875,8 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
|
||||
static void DRW_shgroup_relationship_lines(OBJECT_StorageList *stl, Object *ob)
|
||||
{
|
||||
if (ob->parent && DRW_check_object_visible_within_active_context(ob->parent)) {
|
||||
DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]);
|
||||
DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]);
|
||||
DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,10 +118,6 @@ static void POSE_cache_init(void *vedata)
|
||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS |
|
||||
DRW_STATE_BLEND | DRW_STATE_WIRE;
|
||||
psl->relationship = DRW_pass_create("Bone Relationship Pass", state);
|
||||
|
||||
/* Relationship Lines */
|
||||
stl->g_data->relationship_lines = shgroup_dynlines_uniform_color(psl->relationship, ts.colorWire);
|
||||
DRW_shgroup_state_enable(stl->g_data->relationship_lines, DRW_STATE_STIPPLE_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user