forked from bartvdbraak/blender
dynamic paint
- replace inline code with existig defvert_find_index() - use madd_v3_v3fl() func and remove redundant normalize call.
This commit is contained in:
parent
c9edbab08a
commit
d24bbba150
@ -1703,21 +1703,11 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
|
|||||||
MDeformWeight *def_weight = defvert_find_index(dv, defgrp_index);
|
MDeformWeight *def_weight = defvert_find_index(dv, defgrp_index);
|
||||||
|
|
||||||
/* skip if weight value is 0 and no existing weight is found */
|
/* skip if weight value is 0 and no existing weight is found */
|
||||||
if (!def_weight && !weight[i])
|
if ((def_weight != NULL) || (weight[i] != 0.0f)) {
|
||||||
continue;
|
|
||||||
|
|
||||||
/* if not found, add a weight for it */
|
/* if not found, add a weight for it */
|
||||||
if (!def_weight) {
|
if (def_weight == NULL) {
|
||||||
MDeformWeight *newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1),
|
def_weight= defvert_verify_index(dv, defgrp_index);
|
||||||
"deformWeight");
|
|
||||||
if(dv->dw){
|
|
||||||
memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
|
|
||||||
MEM_freeN(dv->dw);
|
|
||||||
}
|
|
||||||
dv->dw=newdw;
|
|
||||||
dv->dw[dv->totweight].def_nr=defgrp_index;
|
|
||||||
def_weight = &dv->dw[dv->totweight];
|
|
||||||
dv->totweight++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set weight value */
|
/* set weight value */
|
||||||
@ -1725,6 +1715,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* wave simulation */
|
/* wave simulation */
|
||||||
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
|
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
|
||||||
MVert *mvert = result->getVertArray(result);
|
MVert *mvert = result->getVertArray(result);
|
||||||
@ -1735,11 +1726,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
|
|||||||
for (i=0; i<sData->total_points; i++) {
|
for (i=0; i<sData->total_points; i++) {
|
||||||
float normal[3];
|
float normal[3];
|
||||||
normal_short_to_float_v3(normal, mvert[i].no);
|
normal_short_to_float_v3(normal, mvert[i].no);
|
||||||
normalize_v3(normal);
|
madd_v3_v3fl(mvert[i].co, normal, wPoint[i].height);
|
||||||
|
|
||||||
mvert[i].co[0] += normal[0]*wPoint[i].height;
|
|
||||||
mvert[i].co[1] += normal[1]*wPoint[i].height;
|
|
||||||
mvert[i].co[2] += normal[2]*wPoint[i].height;
|
|
||||||
}
|
}
|
||||||
CDDM_calc_normals(result);
|
CDDM_calc_normals(result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user