Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/crazyspace.cc
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| using namespace blender; | using namespace blender; | ||||
| using namespace blender::bke; | using namespace blender::bke; | ||||
| BLI_bitmap *vert_tag = BLI_BITMAP_NEW(me->totvert, __func__); | BLI_bitmap *vert_tag = BLI_BITMAP_NEW(me->totvert, __func__); | ||||
| /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ | /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ | ||||
| const Span<float3> positions = me->vert_positions(); | const Span<float3> positions = me->vert_positions(); | ||||
| const Span<MPoly> polys = me->polys(); | const Span<MPoly> polys = me->polys(); | ||||
| const Span<MLoop> loops = me->loops(); | const Span<int> corner_verts = me->corner_verts(); | ||||
| for (int i = 0; i < me->totpoly; i++) { | for (int i = 0; i < me->totpoly; i++) { | ||||
| const MPoly *poly = &polys[i]; | const MPoly *poly = &polys[i]; | ||||
| const MLoop *ml_next = &loops[poly->loopstart]; | const int *corner_vert_next = &corner_verts[poly->loopstart]; | ||||
| const MLoop *ml_curr = &ml_next[poly->totloop - 1]; | const int *corner_vert_curr = &corner_vert_next[poly->totloop - 1]; | ||||
| const MLoop *ml_prev = &ml_next[poly->totloop - 2]; | const int *corner_vert_prev = &corner_vert_next[poly->totloop - 2]; | ||||
| for (int j = 0; j < poly->totloop; j++) { | for (int j = 0; j < poly->totloop; j++) { | ||||
| if (!BLI_BITMAP_TEST(vert_tag, ml_curr->v)) { | if (!BLI_BITMAP_TEST(vert_tag, *corner_vert_curr)) { | ||||
| const float *co_prev, *co_curr, *co_next; /* orig */ | const float *co_prev, *co_curr, *co_next; /* orig */ | ||||
| const float *vd_prev, *vd_curr, *vd_next; /* deform */ | const float *vd_prev, *vd_curr, *vd_next; /* deform */ | ||||
| /* retrieve mapped coordinates */ | /* retrieve mapped coordinates */ | ||||
| vd_prev = mappedcos[ml_prev->v]; | vd_prev = mappedcos[*corner_vert_prev]; | ||||
| vd_curr = mappedcos[ml_curr->v]; | vd_curr = mappedcos[*corner_vert_curr]; | ||||
| vd_next = mappedcos[ml_next->v]; | vd_next = mappedcos[*corner_vert_next]; | ||||
| if (origcos) { | if (origcos) { | ||||
| co_prev = origcos[ml_prev->v]; | co_prev = origcos[*corner_vert_prev]; | ||||
| co_curr = origcos[ml_curr->v]; | co_curr = origcos[*corner_vert_curr]; | ||||
| co_next = origcos[ml_next->v]; | co_next = origcos[*corner_vert_next]; | ||||
| } | } | ||||
| else { | else { | ||||
| co_prev = positions[ml_prev->v]; | co_prev = positions[*corner_vert_prev]; | ||||
| co_curr = positions[ml_curr->v]; | co_curr = positions[*corner_vert_curr]; | ||||
| co_next = positions[ml_next->v]; | co_next = positions[*corner_vert_next]; | ||||
| } | } | ||||
| set_crazy_vertex_quat( | set_crazy_vertex_quat( | ||||
| quats[ml_curr->v], co_curr, co_next, co_prev, vd_curr, vd_next, vd_prev); | quats[*corner_vert_curr], co_curr, co_next, co_prev, vd_curr, vd_next, vd_prev); | ||||
| BLI_BITMAP_ENABLE(vert_tag, ml_curr->v); | BLI_BITMAP_ENABLE(vert_tag, *corner_vert_curr); | ||||
| } | } | ||||
| ml_prev = ml_curr; | corner_vert_prev = corner_vert_curr; | ||||
| ml_curr = ml_next; | corner_vert_curr = corner_vert_next; | ||||
| ml_next++; | corner_vert_next++; | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(vert_tag); | MEM_freeN(vert_tag); | ||||
| } | } | ||||
| int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, | int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||