51 const float deform_mat[4][4],
56 float mat_accum[3][3])
97 y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
103 &quats[index], mats[index + 1].mat, co, weight * (1.0f -
blend), vec, dq, defmat);
105 &quats[index + 1], mats[index + 2].mat, co, weight *
blend, vec, dq, defmat);
109 const float vec[3],
const float b1[3],
const float b2[3],
float rad1,
float rad2,
float rdist)
114 float hsqr,
a,
l, rad;
135 dist_sq = (hsqr - (
a *
a));
139 rad = rad * rad2 + (1.0f - rad) * rad1;
153 if (rdist == 0.0f || dist_sq >=
l) {
158 return 1.0f - (
a *
a) / (rdist * rdist);
165 float fac, contrib = 0.0;
177 if (contrib > 0.0f) {
213 (*contrib) += weight;
257 float(*
const vert_coords)[3] =
data->vert_coords;
258 float(*
const vert_deform_mats)[3][3] =
data->vert_deform_mats;
259 float(*
const vert_coords_prev)[3] =
data->vert_coords_prev;
260 const bool use_envelope =
data->use_envelope;
261 const bool use_quaternion =
data->use_quaternion;
262 const bool use_dverts =
data->use_dverts;
263 const int armature_def_nr =
data->armature_def_nr;
268 float sumvec[3], summat[3][3];
269 float *vec =
NULL, (*smat)[3] =
NULL;
270 float contrib = 0.0f;
271 float armature_weight = 1.0f;
272 float prevco_weight = 1.0f;
274 if (use_quaternion) {
275 memset(&sumdq, 0,
sizeof(
DualQuat));
282 if (vert_deform_mats) {
288 if (armature_def_nr != -1 && dvert) {
291 if (
data->invert_vgroup) {
292 armature_weight = 1.0f - armature_weight;
296 if (vert_coords_prev) {
297 prevco_weight = armature_weight;
298 armature_weight = 1.0f;
303 if (armature_weight == 0.0f) {
308 co = vert_coords_prev ? vert_coords_prev[i] : vert_coords[i];
313 if (use_dverts && dvert && dvert->
totweight) {
317 for (j = dvert->
totweight; j != 0; j--, dw++) {
319 if (index < data->defbase_len && (pchan =
data->pchan_from_defbase[index])) {
320 float weight = dw->
weight;
334 if (deformed == 0 && use_envelope) {
335 for (pchan =
data->ob_arm->pose->chanbase.first; pchan; pchan = pchan->
next) {
342 else if (use_envelope) {
343 for (pchan =
data->ob_arm->pose->chanbase.first; pchan; pchan = pchan->
next) {
351 if (contrib > 0.0001f) {
352 if (use_quaternion) {
355 if (armature_weight != 1.0f) {
369 mul_v3_fl(vec, armature_weight / contrib);
373 if (vert_deform_mats) {
374 float pre[3][3], post[3][3], tmpmat[3][3];
380 if (!use_quaternion) {
381 mul_m3_fl(smat, armature_weight / contrib);
392 if (vert_coords_prev) {
393 float mw = 1.0f - prevco_weight;
394 vert_coords[i][0] = prevco_weight * vert_coords[i][0] + mw * co[0];
395 vert_coords[i][1] = prevco_weight * vert_coords[i][1] + mw * co[1];
396 vert_coords[i][2] = prevco_weight * vert_coords[i][2] + mw * co[2];
406 if (
data->use_dverts ||
data->armature_def_nr != -1) {
407 if (
data->me_target) {
409 if (
data->me_target->dvert !=
NULL) {
410 dvert =
data->me_target->dvert + i;
416 else if (
data->dverts && i < data->dverts_len) {
417 dvert =
data->dverts + i;
451 float (*vert_coords)[3],
452 float (*vert_deform_mats)[3][3],
453 const int vert_coords_len,
454 const int deformflag,
455 float (*vert_coords_prev)[3],
456 const char *defgrp_name,
457 const Mesh *me_target,
469 bool use_dverts =
false;
470 int armature_def_nr = -1;
471 int cd_dvert_offset = -1;
480 "Trying to evaluate influence of armature '%s' which needs Pose recalc!",
486 const ID *target_data_id =
NULL;
488 target_data_id = me_target ==
NULL ? (
const ID *)ob_target->
data : &me_target->
id;
490 const Mesh *me = (
const Mesh *)target_data_id;
499 target_data_id = (
const ID *)ob_target->
data;
506 target_data_id = (
const ID *)ob_target->
data;
507 dverts = gps_target->
dvert;
523 use_dverts = (cd_dvert_offset != -1);
525 else if (me_target) {
533 pchan_from_defbase =
MEM_callocN(
sizeof(*pchan_from_defbase) * defbase_len,
"defnrToBone");
542 if (pchan_from_defbase[i]) {
544 pchan_from_defbase[i] =
NULL;
554 .me_target = me_target,
555 .vert_coords = vert_coords,
556 .vert_deform_mats = vert_deform_mats,
557 .vert_coords_prev = vert_coords_prev,
558 .use_envelope = use_envelope,
559 .use_quaternion = use_quaternion,
560 .invert_vgroup = invert_vgroup,
561 .use_dverts = use_dverts,
562 .armature_def_nr = armature_def_nr,
564 .dverts_len = dverts_len,
565 .pchan_from_defbase = pchan_from_defbase,
566 .defbase_len = defbase_len,
569 .cd_dvert_offset = cd_dvert_offset,
579 if (em_target !=
NULL) {
603 if (pchan_from_defbase) {
610 float (*vert_coords)[3],
611 float (*vert_deform_mats)[3][3],
614 float (*vert_coords_prev)[3],
615 const char *defgrp_name,
633 float (*vert_coords)[3],
634 float (*vert_deform_mats)[3][3],
637 float (*vert_coords_prev)[3],
638 const char *defgrp_name,
639 const Mesh *me_target)
656 float (*vert_coords)[3],
657 float (*vert_deform_mats)[3][3],
660 float (*vert_coords_prev)[3],
661 const char *defgrp_name,
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
void BKE_pchan_bbone_deform_segment_index(const struct bPoseChannel *pchan, float pos, int *r_index, float *r_blend_next)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mul_m3_fl(float R[3][3], float f)
bool invert_m4_m4(float R[4][4], const float A[4][4])
void zero_m3(float m[3][3])
void mul_m4_v3(const float M[4][4], float r[3])
void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], float f)
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
#define mul_m3_series(...)
void add_weighted_dq_dq(DualQuat *dq_sum, const DualQuat *dq, float weight)
void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq)
void normalize_dq(DualQuat *dq, float totw)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
struct MempoolIterData MempoolIterData
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_parallel_mempool(struct BLI_mempool *mempool, void *userdata, TaskParallelMempoolFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_mempool_settings_defaults(TaskParallelSettings *settings)
#define CLOG_ERROR(clg_ref,...)
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
float(* vert_deform_mats)[3][3]
bPoseChannel ** pchan_from_defbase
const MDeformVert * dverts
struct ArmatureUserdata::@80 bmesh
float(* vert_coords_prev)[3]
struct BLI_mempool * vpool
struct MDeformVert * dvert
struct MDeformVert * dvert
struct MDeformVert * dvert
struct Mat4 * bbone_deform_mats
struct DualQuat deform_dual_quat
struct DualQuat * bbone_dual_quats
struct bPoseChannel * next
struct bPoseChannel_Runtime runtime
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)