Add vert_ prefix to some uses of "positions"
This commit is contained in:
parent
c525fcb9a3
commit
d08bfb87c0
|
@ -58,7 +58,7 @@ typedef struct BVHTreeFromMesh {
|
|||
BVHTree_RayCastCallback raycast_callback;
|
||||
|
||||
/* Vertex array, so that callbacks have instant access to data. */
|
||||
const float (*positions)[3];
|
||||
const float (*vert_positions)[3];
|
||||
const struct MEdge *edge;
|
||||
const struct MFace *face;
|
||||
const struct MLoop *loop;
|
||||
|
|
|
@ -583,7 +583,7 @@ typedef struct PBVHVertexIter {
|
|||
int gridsize;
|
||||
|
||||
/* mesh */
|
||||
float (*mesh_positions)[3];
|
||||
float (*vert_positions)[3];
|
||||
float (*vert_normals)[3];
|
||||
const bool *hide_vert;
|
||||
int totvert;
|
||||
|
@ -643,7 +643,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
|
|||
} \
|
||||
} \
|
||||
} \
|
||||
else if (vi.mesh_positions) { \
|
||||
else if (vi.vert_positions) { \
|
||||
if (vi.respect_hide) { \
|
||||
vi.visible = !(vi.hide_vert && vi.hide_vert[vi.vert_indices[vi.gx]]); \
|
||||
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
|
||||
|
@ -653,7 +653,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
|
|||
else { \
|
||||
BLI_assert(vi.visible); \
|
||||
} \
|
||||
vi.co = vi.mesh_positions[vi.vert_indices[vi.gx]]; \
|
||||
vi.co = vi.vert_positions[vi.vert_indices[vi.gx]]; \
|
||||
vi.no = vi.vert_normals[vi.vert_indices[vi.gx]]; \
|
||||
vi.index = vi.vertex.i = vi.vert_indices[vi.i]; \
|
||||
if (vi.vmask) { \
|
||||
|
|
|
@ -237,7 +237,7 @@ static void mesh_faces_nearest_point(void *userdata,
|
|||
BVHTreeNearest *nearest)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MFace *face = data->face + index;
|
||||
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
|
@ -272,7 +272,7 @@ static void mesh_looptri_nearest_point(void *userdata,
|
|||
BVHTreeNearest *nearest)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MLoopTri *lt = &data->looptri[index];
|
||||
const float *vtri_co[3] = {
|
||||
positions[data->loop[lt->tri[0]].v],
|
||||
|
@ -333,7 +333,7 @@ static void mesh_faces_spherecast(void *userdata,
|
|||
BVHTreeRayHit *hit)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MFace *face = &data->face[index];
|
||||
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
|
@ -372,7 +372,7 @@ static void mesh_looptri_spherecast(void *userdata,
|
|||
BVHTreeRayHit *hit)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MLoopTri *lt = &data->looptri[index];
|
||||
const float *vtri_co[3] = {
|
||||
positions[data->loop[lt->tri[0]].v],
|
||||
|
@ -442,7 +442,7 @@ static void mesh_edges_nearest_point(void *userdata,
|
|||
BVHTreeNearest *nearest)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MEdge *edge = data->edge + index;
|
||||
float nearest_tmp[3], dist_sq;
|
||||
|
||||
|
@ -507,7 +507,7 @@ static void mesh_verts_spherecast(void *userdata,
|
|||
BVHTreeRayHit *hit)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float *v = data->positions[index];
|
||||
const float *v = data->vert_positions[index];
|
||||
|
||||
mesh_verts_spherecast_do(index, v, ray, hit);
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ static void mesh_edges_spherecast(void *userdata,
|
|||
BVHTreeRayHit *hit)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MEdge *edge = &data->edge[index];
|
||||
|
||||
const float radius_sq = square_f(ray->radius);
|
||||
|
|
|
@ -1391,7 +1391,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
|
|||
float co[3], no[3], new_co[3];
|
||||
float radius;
|
||||
|
||||
copy_v3_v3(co, treedata->positions[v_idx]);
|
||||
copy_v3_v3(co, treedata->vert_positions[v_idx]);
|
||||
negate_v3_v3(no, vert_normals[v_idx]);
|
||||
|
||||
float vec_len = sin(max_diversion);
|
||||
|
|
|
@ -3409,7 +3409,7 @@ static void mesh_tris_spherecast_dp(void *userdata,
|
|||
BVHTreeRayHit *hit)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MLoopTri *mlooptri = data->looptri;
|
||||
const MLoop *mloop = data->loop;
|
||||
|
||||
|
@ -3441,7 +3441,7 @@ static void mesh_tris_nearest_point_dp(void *userdata,
|
|||
BVHTreeNearest *nearest)
|
||||
{
|
||||
const BVHTreeFromMesh *data = (BVHTreeFromMesh *)userdata;
|
||||
const float(*positions)[3] = data->positions;
|
||||
const float(*positions)[3] = data->vert_positions;
|
||||
const MLoopTri *mlooptri = data->looptri;
|
||||
const MLoop *mloop = data->loop;
|
||||
float nearest_tmp[3], dist_sq;
|
||||
|
|
|
@ -306,7 +306,7 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
|||
bool need_face_flip = r_info->has_negative_transform[mi] != r_info->has_negative_transform[0];
|
||||
|
||||
Vector<Vert *> verts(me->totvert);
|
||||
const Span<float3> mesh_positions = me->vert_positions();
|
||||
const Span<float3> vert_positions = me->vert_positions();
|
||||
const Span<MPoly> polys = me->polys();
|
||||
const Span<MLoop> loops = me->loops();
|
||||
|
||||
|
@ -315,9 +315,9 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
|||
* for example when the first mesh is already in the target space. (Note the logic
|
||||
* directly above, which uses an identity matrix with a null input transform). */
|
||||
if (obmats[mi] == nullptr) {
|
||||
threading::parallel_for(mesh_positions.index_range(), 2048, [&](IndexRange range) {
|
||||
threading::parallel_for(vert_positions.index_range(), 2048, [&](IndexRange range) {
|
||||
for (int i : range) {
|
||||
float3 co = mesh_positions[i];
|
||||
float3 co = vert_positions[i];
|
||||
mpq3 mco = mpq3(co.x, co.y, co.z);
|
||||
double3 dco(mco[0].get_d(), mco[1].get_d(), mco[2].get_d());
|
||||
verts[i] = new Vert(mco, dco, NO_INDEX, i);
|
||||
|
@ -325,16 +325,16 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
|||
});
|
||||
}
|
||||
else {
|
||||
threading::parallel_for(mesh_positions.index_range(), 2048, [&](IndexRange range) {
|
||||
threading::parallel_for(vert_positions.index_range(), 2048, [&](IndexRange range) {
|
||||
for (int i : range) {
|
||||
float3 co = r_info->to_target_transform[mi] * mesh_positions[i];
|
||||
float3 co = r_info->to_target_transform[mi] * vert_positions[i];
|
||||
mpq3 mco = mpq3(co.x, co.y, co.z);
|
||||
double3 dco(mco[0].get_d(), mco[1].get_d(), mco[2].get_d());
|
||||
verts[i] = new Vert(mco, dco, NO_INDEX, i);
|
||||
}
|
||||
});
|
||||
}
|
||||
for (int i : mesh_positions.index_range()) {
|
||||
for (int i : vert_positions.index_range()) {
|
||||
r_info->mesh_to_imesh_vert[v] = arena.add_or_find_vert(verts[i]);
|
||||
++v;
|
||||
}
|
||||
|
|
|
@ -644,11 +644,11 @@ void BKE_pointcloud_from_mesh(Mesh *me, PointCloud *pointcloud)
|
|||
bke::AttributeAccessor mesh_attributes = me->attributes();
|
||||
bke::MutableAttributeAccessor point_attributes = pointcloud->attributes_for_write();
|
||||
|
||||
const VArray<float3> mesh_positions = mesh_attributes.lookup_or_default<float3>(
|
||||
const VArray<float3> vert_positions = mesh_attributes.lookup_or_default<float3>(
|
||||
"position", ATTR_DOMAIN_POINT, float3(0));
|
||||
bke::SpanAttributeWriter<float3> point_positions =
|
||||
point_attributes.lookup_or_add_for_write_only_span<float3>("position", ATTR_DOMAIN_POINT);
|
||||
mesh_positions.materialize(point_positions.span);
|
||||
vert_positions.materialize(point_positions.span);
|
||||
point_positions.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -225,12 +225,12 @@ static Mesh *remesh_voxel_volume_to_mesh(const openvdb::FloatGrid::Ptr level_set
|
|||
|
||||
Mesh *mesh = BKE_mesh_new_nomain(
|
||||
vertices.size(), 0, 0, quads.size() * 4 + tris.size() * 3, quads.size() + tris.size());
|
||||
MutableSpan<float3> mesh_positions = mesh->vert_positions_for_write();
|
||||
MutableSpan<float3> vert_positions = mesh->vert_positions_for_write();
|
||||
MutableSpan<MPoly> mesh_polys = mesh->polys_for_write();
|
||||
MutableSpan<MLoop> mesh_loops = mesh->loops_for_write();
|
||||
|
||||
for (const int i : mesh_positions.index_range()) {
|
||||
mesh_positions[i] = float3(vertices[i].x(), vertices[i].y(), vertices[i].z());
|
||||
for (const int i : vert_positions.index_range()) {
|
||||
vert_positions[i] = float3(vertices[i].x(), vertices[i].y(), vertices[i].z());
|
||||
}
|
||||
|
||||
for (const int i : IndexRange(quads.size())) {
|
||||
|
|
|
@ -674,7 +674,7 @@ static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node)
|
|||
args->grid_hidden = pbvh->grid_hidden;
|
||||
args->face_sets_color_default = pbvh->face_sets_color_default;
|
||||
args->face_sets_color_seed = pbvh->face_sets_color_seed;
|
||||
args->mesh_positions = pbvh->mesh_positions;
|
||||
args->vert_positions = pbvh->vert_positions;
|
||||
args->mloop = pbvh->mloop;
|
||||
args->mpoly = pbvh->mpoly;
|
||||
args->mlooptri = pbvh->looptri;
|
||||
|
@ -830,7 +830,7 @@ void BKE_pbvh_build_mesh(PBVH *pbvh,
|
|||
&mesh->pdata, CD_PROP_INT32, "material_index");
|
||||
pbvh->mloop = mloop;
|
||||
pbvh->looptri = looptri;
|
||||
pbvh->mesh_positions = positions;
|
||||
pbvh->vert_positions = positions;
|
||||
BKE_mesh_vertex_normals_ensure(mesh);
|
||||
pbvh->vert_normals = BKE_mesh_vertex_normals_for_write(mesh);
|
||||
pbvh->hide_vert = (bool *)CustomData_get_layer_named(&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
|
||||
|
@ -1024,10 +1024,10 @@ void BKE_pbvh_free(PBVH *pbvh)
|
|||
}
|
||||
|
||||
if (pbvh->deformed) {
|
||||
if (pbvh->mesh_positions) {
|
||||
if (pbvh->vert_positions) {
|
||||
/* if pbvh was deformed, new memory was allocated for verts/faces -- free it */
|
||||
|
||||
MEM_freeN((void *)pbvh->mesh_positions);
|
||||
MEM_freeN((void *)pbvh->vert_positions);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1392,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
/* Face normal and mask */
|
||||
if (lt->poly != mpoly_prev) {
|
||||
const MPoly *mp = &pbvh->mpoly[lt->poly];
|
||||
BKE_mesh_calc_poly_normal(mp, &pbvh->mloop[mp->loopstart], pbvh->mesh_positions, fn);
|
||||
BKE_mesh_calc_poly_normal(mp, &pbvh->mloop[mp->loopstart], pbvh->vert_positions, fn);
|
||||
mpoly_prev = lt->poly;
|
||||
}
|
||||
|
||||
|
@ -2516,7 +2516,7 @@ static bool pbvh_faces_node_raycast(PBVH *pbvh,
|
|||
int *r_active_face_index,
|
||||
float *r_face_normal)
|
||||
{
|
||||
const float(*positions)[3] = pbvh->mesh_positions;
|
||||
const float(*positions)[3] = pbvh->vert_positions;
|
||||
const MLoop *mloop = pbvh->mloop;
|
||||
const int *faces = node->prim_indices;
|
||||
int totface = node->totprim;
|
||||
|
@ -2826,7 +2826,7 @@ static bool pbvh_faces_node_nearest_to_ray(PBVH *pbvh,
|
|||
float *depth,
|
||||
float *dist_sq)
|
||||
{
|
||||
const float(*positions)[3] = pbvh->mesh_positions;
|
||||
const float(*positions)[3] = pbvh->vert_positions;
|
||||
const MLoop *mloop = pbvh->mloop;
|
||||
const int *faces = node->prim_indices;
|
||||
int i, totface = node->totprim;
|
||||
|
@ -3177,9 +3177,9 @@ float (*BKE_pbvh_vert_coords_alloc(PBVH *pbvh))[3]
|
|||
{
|
||||
float(*vertCos)[3] = NULL;
|
||||
|
||||
if (pbvh->mesh_positions) {
|
||||
if (pbvh->vert_positions) {
|
||||
vertCos = MEM_malloc_arrayN(pbvh->totvert, sizeof(float[3]), __func__);
|
||||
memcpy(vertCos, pbvh->mesh_positions, sizeof(float[3]) * pbvh->totvert);
|
||||
memcpy(vertCos, pbvh->vert_positions, sizeof(float[3]) * pbvh->totvert);
|
||||
}
|
||||
|
||||
return vertCos;
|
||||
|
@ -3193,12 +3193,12 @@ void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const float (*vertCos)[3], const int
|
|||
}
|
||||
|
||||
if (!pbvh->deformed) {
|
||||
if (pbvh->mesh_positions) {
|
||||
if (pbvh->vert_positions) {
|
||||
/* if pbvh is not already deformed, verts/faces points to the */
|
||||
/* original data and applying new coords to this arrays would lead to */
|
||||
/* unneeded deformation -- duplicate verts/faces to avoid this */
|
||||
|
||||
pbvh->mesh_positions = MEM_dupallocN(pbvh->mesh_positions);
|
||||
pbvh->vert_positions = MEM_dupallocN(pbvh->vert_positions);
|
||||
/* No need to dupalloc pbvh->looptri, this one is 'totally owned' by pbvh,
|
||||
* it's never some mesh data. */
|
||||
|
||||
|
@ -3206,8 +3206,8 @@ void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const float (*vertCos)[3], const int
|
|||
}
|
||||
}
|
||||
|
||||
if (pbvh->mesh_positions) {
|
||||
float(*positions)[3] = pbvh->mesh_positions;
|
||||
if (pbvh->vert_positions) {
|
||||
float(*positions)[3] = pbvh->vert_positions;
|
||||
/* copy new verts coords */
|
||||
for (int a = 0; a < pbvh->totvert; a++) {
|
||||
/* no need for float comparison here (memory is exactly equal or not) */
|
||||
|
@ -3323,7 +3323,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
|
|||
vi->grid = NULL;
|
||||
vi->no = NULL;
|
||||
vi->fno = NULL;
|
||||
vi->mesh_positions = NULL;
|
||||
vi->vert_positions = NULL;
|
||||
vi->vertex.i = 0LL;
|
||||
|
||||
vi->respect_hide = pbvh->respect_hide;
|
||||
|
@ -3349,8 +3349,8 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
|
|||
vi->totvert = uniq_verts;
|
||||
}
|
||||
vi->vert_indices = vert_indices;
|
||||
vi->mesh_positions = pbvh->mesh_positions;
|
||||
vi->is_mesh = pbvh->mesh_positions != NULL;
|
||||
vi->vert_positions = pbvh->vert_positions;
|
||||
vi->is_mesh = pbvh->vert_positions != NULL;
|
||||
|
||||
if (pbvh->header.type == PBVH_BMESH) {
|
||||
BLI_gsetIterator_init(&vi->bm_unique_verts, node->bm_unique_verts);
|
||||
|
@ -3429,7 +3429,7 @@ void BKE_pbvh_parallel_range_settings(TaskParallelSettings *settings,
|
|||
float (*BKE_pbvh_get_positions(const PBVH *pbvh))[3]
|
||||
{
|
||||
BLI_assert(pbvh->header.type == PBVH_FACES);
|
||||
return pbvh->mesh_positions;
|
||||
return pbvh->vert_positions;
|
||||
}
|
||||
|
||||
const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3]
|
||||
|
|
|
@ -157,7 +157,7 @@ struct PBVH {
|
|||
/* NOTE: Normals are not `const` because they can be updated for drawing by sculpt code. */
|
||||
float (*vert_normals)[3];
|
||||
bool *hide_vert;
|
||||
float (*mesh_positions)[3];
|
||||
float (*vert_positions)[3];
|
||||
const struct MPoly *mpoly;
|
||||
bool *hide_poly;
|
||||
/** Material indices. Only valid for polygon meshes. */
|
||||
|
|
|
@ -934,7 +934,7 @@ static void target_project_edge(const ShrinkwrapTreeData *tree,
|
|||
{
|
||||
const BVHTreeFromMesh *data = &tree->treeData;
|
||||
const MEdge *edge = &data->edge[eidx];
|
||||
const float *vedge_co[2] = {data->positions[edge->v1], data->positions[edge->v2]};
|
||||
const float *vedge_co[2] = {data->vert_positions[edge->v1], data->vert_positions[edge->v2]};
|
||||
|
||||
#ifdef TRACE_TARGET_PROJECT
|
||||
printf("EDGE %d (%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f)\n",
|
||||
|
@ -1012,8 +1012,9 @@ static void mesh_looptri_target_project(void *userdata,
|
|||
const MLoopTri *lt = &data->looptri[index];
|
||||
const MLoop *loop[3] = {
|
||||
&data->loop[lt->tri[0]], &data->loop[lt->tri[1]], &data->loop[lt->tri[2]]};
|
||||
const float *vtri_co[3] = {
|
||||
data->positions[loop[0]->v], data->positions[loop[1]->v], data->positions[loop[2]->v]};
|
||||
const float *vtri_co[3] = {data->vert_positions[loop[0]->v],
|
||||
data->vert_positions[loop[1]->v],
|
||||
data->vert_positions[loop[2]->v]};
|
||||
float raw_hit_co[3], hit_co[3], hit_no[3], dist_sq, vtri_no[3][3];
|
||||
|
||||
/* First find the closest point and bail out if it's worse than the current solution. */
|
||||
|
@ -1201,9 +1202,9 @@ void BKE_shrinkwrap_compute_smooth_normal(const ShrinkwrapTreeData *tree,
|
|||
}
|
||||
|
||||
interp_weights_tri_v3(w,
|
||||
treeData->positions[vert_indices[0]],
|
||||
treeData->positions[vert_indices[1]],
|
||||
treeData->positions[vert_indices[2]],
|
||||
treeData->vert_positions[vert_indices[0]],
|
||||
treeData->vert_positions[vert_indices[1]],
|
||||
treeData->vert_positions[vert_indices[2]],
|
||||
tmp_co);
|
||||
|
||||
/* Interpolate using weights. */
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct PBVH_GPU_Args {
|
|||
|
||||
struct BMesh *bm;
|
||||
const struct Mesh *me;
|
||||
const float (*mesh_positions)[3];
|
||||
const float (*vert_positions)[3];
|
||||
const struct MLoop *mloop;
|
||||
const struct MPoly *mpoly;
|
||||
int mesh_verts_num, mesh_faces_num, mesh_grids_num;
|
||||
|
|
|
@ -346,7 +346,7 @@ struct PBVHBatches {
|
|||
|
||||
if (!(mp->flag & ME_SMOOTH)) {
|
||||
smooth = true;
|
||||
BKE_mesh_calc_poly_normal(mp, args->mloop + mp->loopstart, args->mesh_positions, fno);
|
||||
BKE_mesh_calc_poly_normal(mp, args->mloop + mp->loopstart, args->vert_positions, fno);
|
||||
normal_float_to_short_v3(no, fno);
|
||||
}
|
||||
else {
|
||||
|
@ -588,7 +588,7 @@ struct PBVHBatches {
|
|||
foreach_faces(
|
||||
[&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) {
|
||||
*static_cast<float3 *>(
|
||||
GPU_vertbuf_raw_step(&access)) = args->mesh_positions[vertex_i];
|
||||
GPU_vertbuf_raw_step(&access)) = args->vert_positions[vertex_i];
|
||||
});
|
||||
break;
|
||||
case CD_PBVH_NO_TYPE:
|
||||
|
|
|
@ -652,7 +652,7 @@ void heat_bone_weighting(Object *ob,
|
|||
int a, tris_num, j, bbone, firstsegment, lastsegment;
|
||||
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
|
||||
|
||||
const float(*mesh_positions)[3] = BKE_mesh_vert_positions(me);
|
||||
const float(*vert_positions)[3] = BKE_mesh_vert_positions(me);
|
||||
const MPoly *polys = BKE_mesh_polys(me);
|
||||
const MLoop *loops = BKE_mesh_loops(me);
|
||||
bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
|
||||
|
@ -700,7 +700,7 @@ void heat_bone_weighting(Object *ob,
|
|||
sys->heat.tris_num = poly_to_tri_count(me->totpoly, me->totloop);
|
||||
mlooptri = MEM_mallocN(sizeof(*sys->heat.mlooptri) * sys->heat.tris_num, __func__);
|
||||
|
||||
BKE_mesh_recalc_looptri(loops, polys, mesh_positions, me->totloop, me->totpoly, mlooptri);
|
||||
BKE_mesh_recalc_looptri(loops, polys, vert_positions, me->totloop, me->totpoly, mlooptri);
|
||||
|
||||
sys->heat.mlooptri = mlooptri;
|
||||
sys->heat.mloop = loops;
|
||||
|
|
|
@ -1473,7 +1473,7 @@ static void project_line_gesture_apply_task_cb(void *__restrict userdata,
|
|||
continue;
|
||||
}
|
||||
add_v3_v3(vd.co, disp);
|
||||
if (vd.mesh_positions) {
|
||||
if (vd.vert_positions) {
|
||||
BKE_pbvh_vert_tag_update_normal(sgcontext->ss->pbvh, vd.vertex);
|
||||
}
|
||||
any_updated = true;
|
||||
|
|
|
@ -254,7 +254,7 @@ static void snap_object_data_mesh_get(SnapObjectContext *sctx,
|
|||
BKE_bvhtree_from_mesh_get(
|
||||
r_treedata, me_eval, use_hide ? BVHTREE_FROM_LOOPTRI_NO_HIDDEN : BVHTREE_FROM_LOOPTRI, 4);
|
||||
|
||||
BLI_assert(reinterpret_cast<const float3 *>(r_treedata->positions) == positions.data());
|
||||
BLI_assert(reinterpret_cast<const float3 *>(r_treedata->vert_positions) == positions.data());
|
||||
BLI_assert(r_treedata->loop == loops.data());
|
||||
BLI_assert(!polys.data() || r_treedata->looptri);
|
||||
BLI_assert(!r_treedata->tree || r_treedata->looptri);
|
||||
|
|
|
@ -402,7 +402,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
|
|||
{
|
||||
char *name = ob->id.name + 2;
|
||||
|
||||
const Span<float3> mesh_positions = me->vert_positions();
|
||||
const Span<float3> vert_positions = me->vert_positions();
|
||||
const Span<MPoly> mesh_polys = me->polys();
|
||||
const Span<MLoop> mesh_loops = me->loops();
|
||||
|
||||
|
@ -411,7 +411,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
|
|||
MLoopTri *mlooptri = (MLoopTri *)MEM_malloc_arrayN(tottri, sizeof(*mlooptri), __func__);
|
||||
BKE_mesh_recalc_looptri(mesh_loops.data(),
|
||||
mesh_polys.data(),
|
||||
reinterpret_cast<const float(*)[3]>(mesh_positions.data()),
|
||||
reinterpret_cast<const float(*)[3]>(vert_positions.data()),
|
||||
me->totloop,
|
||||
me->totpoly,
|
||||
mlooptri);
|
||||
|
@ -449,9 +449,9 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
|
|||
for (int a = 0; a < tottri; a++) {
|
||||
const MLoopTri *lt = &mlooptri[a];
|
||||
|
||||
copy_v3_v3(v1, mesh_positions[mesh_loops[lt->tri[0]].v]);
|
||||
copy_v3_v3(v2, mesh_positions[mesh_loops[lt->tri[1]].v]);
|
||||
copy_v3_v3(v3, mesh_positions[mesh_loops[lt->tri[2]].v]);
|
||||
copy_v3_v3(v1, vert_positions[mesh_loops[lt->tri[0]].v]);
|
||||
copy_v3_v3(v2, vert_positions[mesh_loops[lt->tri[1]].v]);
|
||||
copy_v3_v3(v3, vert_positions[mesh_loops[lt->tri[2]].v]);
|
||||
|
||||
mul_m4_v3(obmat, v1);
|
||||
mul_m4_v3(obmat, v2);
|
||||
|
@ -522,9 +522,9 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
|
|||
const MPoly *mp = &mesh_polys[lt->poly];
|
||||
Material *mat = BKE_object_material_get(ob, material_indices[lt->poly] + 1);
|
||||
|
||||
copy_v3_v3(v1, mesh_positions[mesh_loops[lt->tri[0]].v]);
|
||||
copy_v3_v3(v2, mesh_positions[mesh_loops[lt->tri[1]].v]);
|
||||
copy_v3_v3(v3, mesh_positions[mesh_loops[lt->tri[2]].v]);
|
||||
copy_v3_v3(v1, vert_positions[mesh_loops[lt->tri[0]].v]);
|
||||
copy_v3_v3(v2, vert_positions[mesh_loops[lt->tri[1]].v]);
|
||||
copy_v3_v3(v3, vert_positions[mesh_loops[lt->tri[2]].v]);
|
||||
|
||||
mul_m4_v3(obmat, v1);
|
||||
mul_m4_v3(obmat, v2);
|
||||
|
|
|
@ -580,7 +580,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
|
|||
mesh->totloop = group->totloop;
|
||||
mesh->totcol = group->materials.size();
|
||||
|
||||
float3 *mesh_positions = (float3 *)CustomData_add_layer_named(
|
||||
float3 *vert_positions = (float3 *)CustomData_add_layer_named(
|
||||
&mesh->vdata, CD_PROP_FLOAT3, CD_SET_DEFAULT, nullptr, mesh->totvert, "position");
|
||||
MEdge *edges = (MEdge *)CustomData_add_layer(
|
||||
&mesh->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, mesh->totedge);
|
||||
|
@ -668,16 +668,16 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
|
|||
else {
|
||||
if (!visible) {
|
||||
// first vertex
|
||||
mesh_positions[vertex_index][0] = svRep[0]->point2d()[0];
|
||||
mesh_positions[vertex_index][1] = svRep[0]->point2d()[1];
|
||||
mesh_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
vert_positions[vertex_index][0] = svRep[0]->point2d()[0];
|
||||
vert_positions[vertex_index][1] = svRep[0]->point2d()[1];
|
||||
vert_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
|
||||
++vertex_index;
|
||||
|
||||
// second vertex
|
||||
mesh_positions[vertex_index][0] = svRep[1]->point2d()[0];
|
||||
mesh_positions[vertex_index][1] = svRep[1]->point2d()[1];
|
||||
mesh_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
vert_positions[vertex_index][0] = svRep[1]->point2d()[0];
|
||||
vert_positions[vertex_index][1] = svRep[1]->point2d()[1];
|
||||
vert_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
|
||||
++vertex_index;
|
||||
|
||||
|
@ -690,9 +690,9 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
|
|||
visible = true;
|
||||
|
||||
// vertex
|
||||
mesh_positions[vertex_index][0] = svRep[2]->point2d()[0];
|
||||
mesh_positions[vertex_index][1] = svRep[2]->point2d()[1];
|
||||
mesh_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
vert_positions[vertex_index][0] = svRep[2]->point2d()[0];
|
||||
vert_positions[vertex_index][1] = svRep[2]->point2d()[1];
|
||||
vert_positions[vertex_index][2] = get_stroke_vertex_z();
|
||||
++vertex_index;
|
||||
|
||||
// edges
|
||||
|
|
|
@ -122,7 +122,7 @@ struct AbcMeshData {
|
|||
UInt32ArraySamplePtr uvs_indices;
|
||||
};
|
||||
|
||||
static void read_mverts_interp(float3 *mesh_positions,
|
||||
static void read_mverts_interp(float3 *vert_positions,
|
||||
const P3fArraySamplePtr &positions,
|
||||
const P3fArraySamplePtr &ceil_positions,
|
||||
const double weight)
|
||||
|
@ -133,19 +133,19 @@ static void read_mverts_interp(float3 *mesh_positions,
|
|||
const Imath::V3f &ceil_pos = (*ceil_positions)[i];
|
||||
|
||||
interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), float(weight));
|
||||
copy_zup_from_yup(mesh_positions[i], tmp);
|
||||
copy_zup_from_yup(vert_positions[i], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
|
||||
{
|
||||
float3 *mesh_positions = config.positions;
|
||||
float3 *vert_positions = config.positions;
|
||||
const P3fArraySamplePtr &positions = mesh_data.positions;
|
||||
|
||||
if (config.use_vertex_interpolation && config.weight != 0.0f &&
|
||||
mesh_data.ceil_positions != nullptr &&
|
||||
mesh_data.ceil_positions->size() == positions->size()) {
|
||||
read_mverts_interp(mesh_positions, positions, mesh_data.ceil_positions, config.weight);
|
||||
read_mverts_interp(vert_positions, positions, mesh_data.ceil_positions, config.weight);
|
||||
BKE_mesh_tag_coords_changed(config.mesh);
|
||||
return;
|
||||
}
|
||||
|
@ -155,11 +155,11 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
|
|||
|
||||
void read_mverts(Mesh &mesh, const P3fArraySamplePtr positions, const N3fArraySamplePtr normals)
|
||||
{
|
||||
MutableSpan<float3> mesh_positions = mesh.vert_positions_for_write();
|
||||
MutableSpan<float3> vert_positions = mesh.vert_positions_for_write();
|
||||
for (int i = 0; i < positions->size(); i++) {
|
||||
Imath::V3f pos_in = (*positions)[i];
|
||||
|
||||
copy_zup_from_yup(mesh_positions[i], pos_in.getValue());
|
||||
copy_zup_from_yup(vert_positions[i], pos_in.getValue());
|
||||
}
|
||||
BKE_mesh_tag_coords_changed(&mesh);
|
||||
|
||||
|
|
|
@ -695,9 +695,9 @@ void USDMeshReader::read_mesh_sample(ImportSettings *settings,
|
|||
* in code that expect this data to be there. */
|
||||
|
||||
if (new_mesh || (settings->read_flag & MOD_MESHSEQ_READ_VERT) != 0) {
|
||||
MutableSpan<float3> mesh_positions = mesh->vert_positions_for_write();
|
||||
MutableSpan<float3> vert_positions = mesh->vert_positions_for_write();
|
||||
for (int i = 0; i < positions_.size(); i++) {
|
||||
mesh_positions[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
|
||||
vert_positions[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
|
||||
}
|
||||
BKE_mesh_tag_coords_changed(mesh);
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
}
|
||||
|
||||
if (me != nullptr) {
|
||||
const Span<float3> mesh_positions = mesh->vert_positions();
|
||||
const Span<float3> vert_positions = mesh->vert_positions();
|
||||
const Span<MEdge> mesh_edges = mesh->edges();
|
||||
const Span<MPoly> mesh_polys = mesh->polys();
|
||||
const Span<float3> me_positions = me->vert_positions();
|
||||
|
@ -211,7 +211,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
/* TODO(sybren+bastien): possibly check relevant custom data layers (UV/color depending on
|
||||
* flags) and duplicate those too.
|
||||
* XXX(Hans): This probably isn't true anymore with various CoW improvements, etc. */
|
||||
if ((me_positions.data() == mesh_positions.data()) || (me_edges.data() == mesh_edges.data()) ||
|
||||
if ((me_positions.data() == vert_positions.data()) || (me_edges.data() == mesh_edges.data()) ||
|
||||
(me_polys.data() == mesh_polys.data())) {
|
||||
/* We need to duplicate data here, otherwise we'll modify org mesh, see T51701. */
|
||||
mesh = reinterpret_cast<Mesh *>(
|
||||
|
|
|
@ -163,7 +163,7 @@ static void get_closest_mesh_corners(const Mesh &mesh,
|
|||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
{
|
||||
const Span<float3> mesh_positions = mesh.vert_positions();
|
||||
const Span<float3> vert_positions = mesh.vert_positions();
|
||||
const Span<MPoly> polys = mesh.polys();
|
||||
const Span<MLoop> loops = mesh.loops();
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void get_closest_mesh_corners(const Mesh &mesh,
|
|||
for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
|
||||
const MLoop &loop = loops[loop_index];
|
||||
const int vertex_index = loop.v;
|
||||
const float distance_sq = math::distance_squared(position, mesh_positions[vertex_index]);
|
||||
const float distance_sq = math::distance_squared(position, vert_positions[vertex_index]);
|
||||
if (distance_sq < min_distance_sq) {
|
||||
min_distance_sq = distance_sq;
|
||||
closest_loop_index = loop_index;
|
||||
|
@ -194,7 +194,7 @@ static void get_closest_mesh_corners(const Mesh &mesh,
|
|||
r_corner_indices[i] = closest_loop_index;
|
||||
}
|
||||
if (!r_positions.is_empty()) {
|
||||
r_positions[i] = mesh_positions[closest_vert_index];
|
||||
r_positions[i] = vert_positions[closest_vert_index];
|
||||
}
|
||||
if (!r_distances_sq.is_empty()) {
|
||||
r_distances_sq[i] = min_distance_sq;
|
||||
|
|
Loading…
Reference in New Issue