Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_armature.c
| Show First 20 Lines • Show All 407 Lines • ▼ Show 20 Lines | if (ctx->envelope_distance) { | ||||
| /* Still less operation than m4 multiplication. */ | /* Still less operation than m4 multiplication. */ | ||||
| mul_m4_v4(bone_mat, head_sph); | mul_m4_v4(bone_mat, head_sph); | ||||
| mul_m4_v4(bone_mat, tail_sph); | mul_m4_v4(bone_mat, tail_sph); | ||||
| mul_m4_v4(bone_mat, xaxis); | mul_m4_v4(bone_mat, xaxis); | ||||
| mul_m4_v4(ctx->ob->obmat, head_sph); | mul_m4_v4(ctx->ob->obmat, head_sph); | ||||
| mul_m4_v4(ctx->ob->obmat, tail_sph); | mul_m4_v4(ctx->ob->obmat, tail_sph); | ||||
| mul_m4_v4(ctx->ob->obmat, xaxis); | mul_m4_v4(ctx->ob->obmat, xaxis); | ||||
| sub_v3_v3(xaxis, head_sph); | sub_v3_v3(xaxis, head_sph); | ||||
| head_sph[3] = *radius_head; | float obscale = mat4_to_scale(ctx->ob->obmat); | ||||
| head_sph[3] += *distance; | head_sph[3] = *radius_head * obscale; | ||||
| tail_sph[3] = *radius_tail; | head_sph[3] += *distance * obscale; | ||||
| tail_sph[3] += *distance; | tail_sph[3] = *radius_tail * obscale; | ||||
| tail_sph[3] += *distance * obscale; | |||||
| DRW_buffer_add_entry(ctx->envelope_distance, head_sph, tail_sph, xaxis); | DRW_buffer_add_entry(ctx->envelope_distance, head_sph, tail_sph, xaxis); | ||||
| } | } | ||||
| } | } | ||||
| static void drw_shgroup_bone_envelope(ArmatureDrawContext *ctx, | static void drw_shgroup_bone_envelope(ArmatureDrawContext *ctx, | ||||
| const float (*bone_mat)[4], | const float (*bone_mat)[4], | ||||
| const float bone_col[4], | const float bone_col[4], | ||||
| const float hint_col[4], | const float hint_col[4], | ||||
| const float outline_col[4], | const float outline_col[4], | ||||
| const float *radius_head, | const float *radius_head, | ||||
| const float *radius_tail) | const float *radius_tail) | ||||
| { | { | ||||
| float head_sph[4] = {0.0f, 0.0f, 0.0f, 1.0f}, tail_sph[4] = {0.0f, 1.0f, 0.0f, 1.0f}; | float head_sph[4] = {0.0f, 0.0f, 0.0f, 1.0f}, tail_sph[4] = {0.0f, 1.0f, 0.0f, 1.0f}; | ||||
| float xaxis[4] = {1.0f, 0.0f, 0.0f, 1.0f}; | float xaxis[4] = {1.0f, 0.0f, 0.0f, 1.0f}; | ||||
| /* Still less operation than m4 multiplication. */ | /* Still less operation than m4 multiplication. */ | ||||
| mul_m4_v4(bone_mat, head_sph); | mul_m4_v4(bone_mat, head_sph); | ||||
| mul_m4_v4(bone_mat, tail_sph); | mul_m4_v4(bone_mat, tail_sph); | ||||
| mul_m4_v4(bone_mat, xaxis); | mul_m4_v4(bone_mat, xaxis); | ||||
| mul_m4_v4(ctx->ob->obmat, head_sph); | mul_m4_v4(ctx->ob->obmat, head_sph); | ||||
| mul_m4_v4(ctx->ob->obmat, tail_sph); | mul_m4_v4(ctx->ob->obmat, tail_sph); | ||||
| mul_m4_v4(ctx->ob->obmat, xaxis); | mul_m4_v4(ctx->ob->obmat, xaxis); | ||||
| head_sph[3] = *radius_head; | float obscale = mat4_to_scale(ctx->ob->obmat); | ||||
| tail_sph[3] = *radius_tail; | head_sph[3] = *radius_head * obscale; | ||||
| tail_sph[3] = *radius_tail * obscale; | |||||
| if (head_sph[3] < 0.0f || tail_sph[3] < 0.0f) { | if (head_sph[3] < 0.0f || tail_sph[3] < 0.0f) { | ||||
| BoneInstanceData inst_data; | BoneInstanceData inst_data; | ||||
| if (head_sph[3] < 0.0f) { | if (head_sph[3] < 0.0f) { | ||||
| /* Draw Tail only */ | /* Draw Tail only */ | ||||
| scale_m4_fl(inst_data.mat, tail_sph[3] / PT_DEFAULT_RAD); | scale_m4_fl(inst_data.mat, tail_sph[3] / PT_DEFAULT_RAD); | ||||
| copy_v3_v3(inst_data.mat[3], tail_sph); | copy_v3_v3(inst_data.mat[3], tail_sph); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,839 Lines • Show Last 20 Lines | |||||