66 const float deform_mat[4][4],
71 float mat_accum[3][3])
112 y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
118 &quats[index], mats[index + 1].mat, co, weight * (1.0f -
blend), vec, dq, defmat);
120 &quats[index + 1], mats[index + 2].mat, co, weight *
blend, vec, dq, defmat);
125 const float vec[3],
const float b1[3],
const float b2[3],
float rad1,
float rad2,
float rdist)
130 float hsqr,
a,
l, rad;
151 dist_sq = (hsqr - (
a *
a));
155 rad = rad * rad2 + (1.0f - rad) * rad1;
169 if (rdist == 0.0f || dist_sq >=
l) {
174 return 1.0f - (
a *
a) / (rdist * rdist);
181 float fac, contrib = 0.0;
193 if (contrib > 0.0f) {
229 (*contrib) += weight;
274 float(*
const vert_coords)[3] =
data->vert_coords;
275 float(*
const vert_deform_mats)[3][3] =
data->vert_deform_mats;
276 float(*
const vert_coords_prev)[3] =
data->vert_coords_prev;
277 const bool use_envelope =
data->use_envelope;
278 const bool use_quaternion =
data->use_quaternion;
279 const bool use_dverts =
data->use_dverts;
280 const int armature_def_nr =
data->armature_def_nr;
285 float sumvec[3], summat[3][3];
286 float *vec =
NULL, (*smat)[3] =
NULL;
287 float contrib = 0.0f;
288 float armature_weight = 1.0f;
289 float prevco_weight = 1.0f;
291 if (use_quaternion) {
292 memset(&sumdq, 0,
sizeof(
DualQuat));
299 if (vert_deform_mats) {
305 if (armature_def_nr != -1 && dvert) {
308 if (
data->invert_vgroup) {
309 armature_weight = 1.0f - armature_weight;
313 if (vert_coords_prev) {
314 prevco_weight = armature_weight;
315 armature_weight = 1.0f;
320 if (armature_weight == 0.0f) {
325 co = vert_coords_prev ? vert_coords_prev[i] : vert_coords[i];
330 if (use_dverts && dvert && dvert->
totweight) {
334 for (j = dvert->
totweight; j != 0; j--, dw++) {
336 if (index < data->defbase_len && (pchan =
data->pchan_from_defbase[index])) {
337 float weight = dw->
weight;
351 if (deformed == 0 && use_envelope) {
352 for (pchan =
data->ob_arm->pose->chanbase.first; pchan; pchan = pchan->
next) {
359 else if (use_envelope) {
360 for (pchan =
data->ob_arm->pose->chanbase.first; pchan; pchan = pchan->
next) {
368 if (contrib > 0.0001f) {
369 if (use_quaternion) {
372 if (armature_weight != 1.0f) {
386 mul_v3_fl(vec, armature_weight / contrib);
390 if (vert_deform_mats) {
391 float pre[3][3], post[3][3], tmpmat[3][3];
397 if (!use_quaternion) {
398 mul_m3_fl(smat, armature_weight / contrib);
409 if (vert_coords_prev) {
410 float mw = 1.0f - prevco_weight;
411 vert_coords[i][0] = prevco_weight * vert_coords[i][0] + mw * co[0];
412 vert_coords[i][1] = prevco_weight * vert_coords[i][1] + mw * co[1];
413 vert_coords[i][2] = prevco_weight * vert_coords[i][2] + mw * co[2];
423 if (
data->use_dverts ||
data->armature_def_nr != -1) {
424 if (
data->me_target) {
426 if (
data->me_target->dvert !=
NULL) {
427 dvert =
data->me_target->dvert + i;
433 else if (
data->dverts && i < data->dverts_len) {
434 dvert =
data->dverts + i;
464 float (*vert_coords)[3],
465 float (*vert_deform_mats)[3][3],
466 const int vert_coords_len,
467 const int deformflag,
468 float (*vert_coords_prev)[3],
469 const char *defgrp_name,
470 const Mesh *me_target,
482 int i, dverts_len = 0;
483 bool use_dverts =
false;
485 int cd_dvert_offset = -1;
494 "Trying to evaluate influence of armature '%s' which needs Pose recalc!",
506 if (em_target ==
NULL) {
522 dverts = gps_target->
dvert;
535 use_dverts = (cd_dvert_offset != -1);
537 else if (me_target) {
545 pchan_from_defbase =
MEM_callocN(
sizeof(*pchan_from_defbase) * defbase_len,
"defnrToBone");
553 if (pchan_from_defbase[i]) {
555 pchan_from_defbase[i] =
NULL;
565 .ob_target = ob_target,
566 .me_target = me_target,
567 .vert_coords = vert_coords,
568 .vert_deform_mats = vert_deform_mats,
569 .vert_coords_prev = vert_coords_prev,
570 .use_envelope = use_envelope,
571 .use_quaternion = use_quaternion,
572 .invert_vgroup = invert_vgroup,
573 .use_dverts = use_dverts,
574 .armature_def_nr = armature_def_nr,
576 .dverts_len = dverts_len,
577 .pchan_from_defbase = pchan_from_defbase,
578 .defbase_len = defbase_len,
581 .cd_dvert_offset = cd_dvert_offset,
591 if (em_target !=
NULL) {
611 if (pchan_from_defbase) {
618 float (*vert_coords)[3],
619 float (*vert_deform_mats)[3][3],
622 float (*vert_coords_prev)[3],
623 const char *defgrp_name,
641 float (*vert_coords)[3],
642 float (*vert_deform_mats)[3][3],
645 float (*vert_coords_prev)[3],
646 const char *defgrp_name,
647 const Mesh *me_target)
664 float (*vert_coords)[3],
665 float (*vert_deform_mats)[3][3],
668 float (*vert_coords_prev)[3],
669 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)
int CustomData_get_offset(const struct CustomData *data, int type)
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 mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
#define mul_m3_series(...)
void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], const float f)
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])
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
struct MempoolIterData MempoolIterData
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_parallel_mempool(struct BLI_mempool *mempool, void *userdata, TaskParallelMempoolFunc func, const bool use_threading)
#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
float(* vert_coords_prev)[3]
struct ArmatureUserdata::@79 bmesh
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)