Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_runtime.cc
| Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | |||||
| void BKE_mesh_runtime_looptri_recalc(Mesh *mesh) | void BKE_mesh_runtime_looptri_recalc(Mesh *mesh) | ||||
| { | { | ||||
| mesh_ensure_looptri_data(mesh); | mesh_ensure_looptri_data(mesh); | ||||
| BLI_assert(mesh->totpoly == 0 || mesh->runtime.looptris.array_wip != nullptr); | BLI_assert(mesh->totpoly == 0 || mesh->runtime.looptris.array_wip != nullptr); | ||||
| const Span<MVert> verts = mesh->verts(); | const Span<MVert> verts = mesh->verts(); | ||||
| const Span<MPoly> polys = mesh->polys(); | const Span<MPoly> polys = mesh->polys(); | ||||
| const Span<MLoop> loops = mesh->loops(); | const Span<MLoop> loops = mesh->loops(); | ||||
| if (BKE_mesh_poly_normals_are_dirty(mesh)) { | |||||
| BKE_mesh_recalc_looptri_with_normals(loops.data(), | |||||
| polys.data(), | |||||
| verts.data(), | |||||
| mesh->totloop, | |||||
| mesh->totpoly, | |||||
| mesh->runtime.looptris.array_wip, | |||||
| BKE_mesh_poly_normals_ensure(mesh)); | |||||
| } | |||||
| else { | |||||
| BKE_mesh_recalc_looptri(loops.data(), | BKE_mesh_recalc_looptri(loops.data(), | ||||
| polys.data(), | polys.data(), | ||||
| verts.data(), | verts.data(), | ||||
| mesh->totloop, | mesh->totloop, | ||||
| mesh->totpoly, | mesh->totpoly, | ||||
| mesh->runtime.looptris.array_wip); | mesh->runtime.looptris.array_wip); | ||||
| } | |||||
| BLI_assert(mesh->runtime.looptris.array == nullptr); | BLI_assert(mesh->runtime.looptris.array == nullptr); | ||||
| atomic_cas_ptr((void **)&mesh->runtime.looptris.array, | atomic_cas_ptr((void **)&mesh->runtime.looptris.array, | ||||
| mesh->runtime.looptris.array, | mesh->runtime.looptris.array, | ||||
| mesh->runtime.looptris.array_wip); | mesh->runtime.looptris.array_wip); | ||||
| mesh->runtime.looptris.array_wip = nullptr; | mesh->runtime.looptris.array_wip = nullptr; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines | |||||