Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_armature.c
| Show First 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Custom (geometry) */ | /* Custom (geometry) */ | ||||
| extern void drw_batch_cache_validate(Object *custom); | extern void drw_batch_cache_validate(Object *custom); | ||||
| extern void drw_batch_cache_generate_requested(Object *custom); | extern void drw_batch_cache_generate_requested_delayed(Object *custom); | ||||
| BLI_INLINE DRWCallBuffer *custom_bone_instance_shgroup(ArmatureDrawContext *ctx, | BLI_INLINE DRWCallBuffer *custom_bone_instance_shgroup(ArmatureDrawContext *ctx, | ||||
| DRWShadingGroup *grp, | DRWShadingGroup *grp, | ||||
| struct GPUBatch *custom_geom) | struct GPUBatch *custom_geom) | ||||
| { | { | ||||
| DRWCallBuffer *buf = BLI_ghash_lookup(ctx->custom_shapes_ghash, custom_geom); | DRWCallBuffer *buf = BLI_ghash_lookup(ctx->custom_shapes_ghash, custom_geom); | ||||
| if (buf == NULL) { | if (buf == NULL) { | ||||
| OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get(); | OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get(); | ||||
| Show All 40 Lines | static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx, | ||||
| if (ledges) { | if (ledges) { | ||||
| buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, ledges); | buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, ledges); | ||||
| OVERLAY_bone_instance_data_set_color_hint(&inst_data, outline_color); | OVERLAY_bone_instance_data_set_color_hint(&inst_data, outline_color); | ||||
| OVERLAY_bone_instance_data_set_color(&inst_data, outline_color); | OVERLAY_bone_instance_data_set_color(&inst_data, outline_color); | ||||
| DRW_buffer_add_entry_struct(buf, inst_data.mat); | DRW_buffer_add_entry_struct(buf, inst_data.mat); | ||||
| } | } | ||||
| /* TODO(fclem) needs to be moved elsewhere. */ | /* TODO(fclem) needs to be moved elsewhere. */ | ||||
| drw_batch_cache_generate_requested(custom); | drw_batch_cache_generate_requested_delayed(custom); | ||||
| } | } | ||||
| static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, | static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, | ||||
| const float (*bone_mat)[4], | const float (*bone_mat)[4], | ||||
| const float color[4], | const float color[4], | ||||
| Object *custom) | Object *custom) | ||||
| { | { | ||||
| /* TODO(fclem) arg... less than ideal but we never iter on this object | /* TODO(fclem) arg... less than ideal but we never iter on this object | ||||
| * to assure batch cache is valid. */ | * to assure batch cache is valid. */ | ||||
| drw_batch_cache_validate(custom); | drw_batch_cache_validate(custom); | ||||
| struct GPUBatch *geom = DRW_cache_object_all_edges_get(custom); | struct GPUBatch *geom = DRW_cache_object_all_edges_get(custom); | ||||
| if (geom) { | if (geom) { | ||||
| DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, geom); | DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, geom); | ||||
| BoneInstanceData inst_data; | BoneInstanceData inst_data; | ||||
| mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat); | mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat); | ||||
| OVERLAY_bone_instance_data_set_color_hint(&inst_data, color); | OVERLAY_bone_instance_data_set_color_hint(&inst_data, color); | ||||
| OVERLAY_bone_instance_data_set_color(&inst_data, color); | OVERLAY_bone_instance_data_set_color(&inst_data, color); | ||||
| DRW_buffer_add_entry_struct(buf, inst_data.mat); | DRW_buffer_add_entry_struct(buf, inst_data.mat); | ||||
| } | } | ||||
| /* TODO(fclem) needs to be moved elsewhere. */ | /* TODO(fclem) needs to be moved elsewhere. */ | ||||
| drw_batch_cache_generate_requested(custom); | drw_batch_cache_generate_requested_delayed(custom); | ||||
| } | } | ||||
| static void drw_shgroup_bone_custom_empty(ArmatureDrawContext *ctx, | static void drw_shgroup_bone_custom_empty(ArmatureDrawContext *ctx, | ||||
| const float (*bone_mat)[4], | const float (*bone_mat)[4], | ||||
| const float color[4], | const float color[4], | ||||
| Object *custom) | Object *custom) | ||||
| { | { | ||||
| float final_color[4] = {color[0], color[1], color[2], 1.0f}; | float final_color[4] = {color[0], color[1], color[2], 1.0f}; | ||||
| ▲ Show 20 Lines • Show All 1,692 Lines • Show Last 20 Lines | |||||