Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh_pixels.cc
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** Update the geometry primitives of the pbvh. */ | /** Update the geometry primitives of the pbvh. */ | ||||
| static void update_geom_primitives(PBVH &pbvh, const uv_islands::MeshData &mesh_data) | static void update_geom_primitives(PBVH &pbvh, const uv_islands::MeshData &mesh_data) | ||||
| { | { | ||||
| PBVHData &pbvh_data = BKE_pbvh_pixels_data_get(pbvh); | PBVHData &pbvh_data = BKE_pbvh_pixels_data_get(pbvh); | ||||
| pbvh_data.clear_data(); | pbvh_data.clear_data(); | ||||
| for (const MLoopTri &looptri : mesh_data.looptris) { | for (const MLoopTri &looptri : mesh_data.looptris) { | ||||
| pbvh_data.geom_primitives.append(int3(mesh_data.loops[looptri.tri[0]].v, | pbvh_data.geom_primitives.append(int3(mesh_data.corner_verts[looptri.tri[0]], | ||||
| mesh_data.loops[looptri.tri[1]].v, | mesh_data.corner_verts[looptri.tri[1]], | ||||
| mesh_data.loops[looptri.tri[2]].v)); | mesh_data.corner_verts[looptri.tri[2]])); | ||||
| } | } | ||||
| } | } | ||||
| struct UVPrimitiveLookup { | struct UVPrimitiveLookup { | ||||
| struct Entry { | struct Entry { | ||||
| uv_islands::UVPrimitive *uv_primitive; | uv_islands::UVPrimitive *uv_primitive; | ||||
| uint64_t uv_island_index; | uint64_t uv_island_index; | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| return false; | return false; | ||||
| } | } | ||||
| const AttributeAccessor attributes = mesh->attributes(); | const AttributeAccessor attributes = mesh->attributes(); | ||||
| const VArraySpan<float2> uv_map = attributes.lookup<float2>(active_uv_name, ATTR_DOMAIN_CORNER); | const VArraySpan<float2> uv_map = attributes.lookup<float2>(active_uv_name, ATTR_DOMAIN_CORNER); | ||||
| uv_islands::MeshData mesh_data( | uv_islands::MeshData mesh_data( | ||||
| {pbvh->looptri, pbvh->totprim}, | {pbvh->looptri, pbvh->totprim}, | ||||
| {pbvh->mloop, mesh->totloop}, | {pbvh->corner_verts, mesh->totloop}, | ||||
| pbvh->totvert, | pbvh->totvert, | ||||
| uv_map, | uv_map, | ||||
| {static_cast<blender::float3 *>(static_cast<void *>(pbvh->vert_positions)), pbvh->totvert}); | {static_cast<blender::float3 *>(static_cast<void *>(pbvh->vert_positions)), pbvh->totvert}); | ||||
| uv_islands::UVIslands islands(mesh_data); | uv_islands::UVIslands islands(mesh_data); | ||||
| uv_islands::UVIslandsMask uv_masks; | uv_islands::UVIslandsMask uv_masks; | ||||
| ImageUser tile_user = *image_user; | ImageUser tile_user = *image_user; | ||||
| LISTBASE_FOREACH (ImageTile *, tile_data, &image->tiles) { | LISTBASE_FOREACH (ImageTile *, tile_data, &image->tiles) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||