Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_weightvgproximity.cc
| Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | static void get_vert2ob_distance( | ||||
| int verts_num, float (*v_cos)[3], float *dist, Object *ob, Object *obr) | int verts_num, float (*v_cos)[3], float *dist, Object *ob, Object *obr) | ||||
| { | { | ||||
| /* Vertex and ref object coordinates. */ | /* Vertex and ref object coordinates. */ | ||||
| float v_wco[3]; | float v_wco[3]; | ||||
| uint i = verts_num; | uint i = verts_num; | ||||
| while (i-- > 0) { | while (i-- > 0) { | ||||
| /* Get world-coordinates of the vertex (constraints and anim included). */ | /* Get world-coordinates of the vertex (constraints and anim included). */ | ||||
| mul_v3_m4v3(v_wco, ob->obmat, v_cos[i]); | mul_v3_m4v3(v_wco, ob->object_to_world, v_cos[i]); | ||||
| /* Return distance between both coordinates. */ | /* Return distance between both coordinates. */ | ||||
| dist[i] = len_v3v3(v_wco, obr->obmat[3]); | dist[i] = len_v3v3(v_wco, obr->object_to_world[3]); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns the real distance between an object and another reference object. | * Returns the real distance between an object and another reference object. | ||||
| * Note that it works in final world space (i.e. with constraints etc. applied). | * Note that it works in final world space (i.e. with constraints etc. applied). | ||||
| */ | */ | ||||
| static float get_ob2ob_distance(const Object *ob, const Object *obr) | static float get_ob2ob_distance(const Object *ob, const Object *obr) | ||||
| { | { | ||||
| return len_v3v3(ob->obmat[3], obr->obmat[3]); | return len_v3v3(ob->object_to_world[3], obr->object_to_world[3]); | ||||
| } | } | ||||
| /** | /** | ||||
| * Maps distances to weights, with an optional "smoothing" mapping. | * Maps distances to weights, with an optional "smoothing" mapping. | ||||
| */ | */ | ||||
| static void do_map(Object *ob, | static void do_map(Object *ob, | ||||
| float *weights, | float *weights, | ||||
| const int nidx, | const int nidx, | ||||
| ▲ Show 20 Lines • Show All 524 Lines • Show Last 20 Lines | |||||