Cleanup: consistent naming for normals
Use consistent naming for {vert/poly/loop/face}_normals.
This commit is contained in:
parent
6d3cc9c38a
commit
067fe443d8
|
@ -139,15 +139,15 @@ void BKE_keyblock_convert_to_mesh(const struct KeyBlock *kb, struct MVert *mvert
|
|||
*
|
||||
* \param kb: the KeyBlock to use to compute normals.
|
||||
* \param mesh: the Mesh to apply key-block to.
|
||||
* \param r_vertnors: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_polynors: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loopnors: if non-NULL, an array of vectors, same length as number of loops.
|
||||
* \param r_vert_normals: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_poly_normals: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loop_normals: if non-NULL, an array of vectors, same length as number of loops.
|
||||
*/
|
||||
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
|
||||
const struct Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3]);
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3]);
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
|
|
|
@ -481,7 +481,7 @@ void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
|
|||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
float split_angle);
|
||||
|
||||
|
@ -603,10 +603,10 @@ void BKE_mesh_normals_loop_split(const struct MVert *mverts,
|
|||
const struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
bool use_split_normals,
|
||||
float split_angle,
|
||||
|
@ -620,22 +620,22 @@ void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
|
|||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const struct MVert *mverts,
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
int numVerts,
|
||||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
|
||||
|
@ -672,18 +672,18 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
|
|||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_set().
|
||||
*
|
||||
* \param r_custom_loopnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_loop_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loop_normals)[3]);
|
||||
/**
|
||||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_from_verts_set().
|
||||
*
|
||||
* \param r_custom_vertnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]);
|
||||
|
||||
/* *** mesh_evaluate.cc *** */
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const struct MVert *mverts,
|
|||
int numVerts,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const struct MLoopUV *loopuv,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct ShrinkwrapTreeData {
|
|||
|
||||
const struct MPoly *polys;
|
||||
const float (*vert_normals)[3];
|
||||
const float (*pnors)[3];
|
||||
const float (*poly_normals)[3];
|
||||
const float (*clnors)[3];
|
||||
ShrinkwrapBoundaryData *boundary;
|
||||
} ShrinkwrapTreeData;
|
||||
|
|
|
@ -2240,11 +2240,11 @@ void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, MVert *mvert, const int to
|
|||
|
||||
void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
||||
const Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3])
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3])
|
||||
{
|
||||
if (r_vertnors == nullptr && r_polynors == nullptr && r_loopnors == nullptr) {
|
||||
if (r_vert_normals == nullptr && r_poly_normals == nullptr && r_loop_normals == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2254,21 +2254,21 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
const MPoly *polys = BKE_mesh_polys(mesh);
|
||||
const MLoop *loops = BKE_mesh_loops(mesh);
|
||||
|
||||
const bool loop_normals_needed = r_loopnors != nullptr;
|
||||
const bool vert_normals_needed = r_vertnors != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_polynors != nullptr || vert_normals_needed ||
|
||||
const bool loop_normals_needed = r_loop_normals != nullptr;
|
||||
const bool vert_normals_needed = r_vert_normals != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_poly_normals != nullptr || vert_normals_needed ||
|
||||
loop_normals_needed;
|
||||
|
||||
float(*vert_normals)[3] = r_vertnors;
|
||||
float(*poly_normals)[3] = r_polynors;
|
||||
float(*vert_normals)[3] = r_vert_normals;
|
||||
float(*poly_normals)[3] = r_poly_normals;
|
||||
bool free_vert_normals = false;
|
||||
bool free_poly_normals = false;
|
||||
if (vert_normals_needed && r_vertnors == nullptr) {
|
||||
if (vert_normals_needed && r_vert_normals == nullptr) {
|
||||
vert_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totvert, sizeof(float[3]), __func__));
|
||||
free_vert_normals = true;
|
||||
}
|
||||
if (poly_normals_needed && r_polynors == nullptr) {
|
||||
if (poly_normals_needed && r_poly_normals == nullptr) {
|
||||
poly_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totpoly, sizeof(float[3]), __func__));
|
||||
free_poly_normals = true;
|
||||
|
@ -2297,7 +2297,7 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
edges,
|
||||
mesh->totedge,
|
||||
loops,
|
||||
r_loopnors,
|
||||
r_loop_normals,
|
||||
mesh->totloop,
|
||||
polys,
|
||||
poly_normals,
|
||||
|
|
|
@ -1792,17 +1792,17 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
|
|||
|
||||
static float (*ensure_corner_normal_layer(Mesh &mesh))[3]
|
||||
{
|
||||
float(*r_loopnors)[3];
|
||||
float(*r_loop_normals)[3];
|
||||
if (CustomData_has_layer(&mesh.ldata, CD_NORMAL)) {
|
||||
r_loopnors = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loopnors, 0, sizeof(float[3]) * mesh.totloop);
|
||||
r_loop_normals = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loop_normals, 0, sizeof(float[3]) * mesh.totloop);
|
||||
}
|
||||
else {
|
||||
r_loopnors = (float(*)[3])CustomData_add_layer(
|
||||
r_loop_normals = (float(*)[3])CustomData_add_layer(
|
||||
&mesh.ldata, CD_NORMAL, CD_SET_DEFAULT, nullptr, mesh.totloop);
|
||||
CustomData_set_layer_flag(&mesh.ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
}
|
||||
return r_loopnors;
|
||||
return r_loop_normals;
|
||||
}
|
||||
|
||||
void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
|
||||
|
|
|
@ -163,10 +163,10 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
const float(*vertexCos)[3] = mesh->runtime->edit_data->vertexCos;
|
||||
|
||||
/* XXX: investigate using EditMesh data. */
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
int f_idx;
|
||||
|
||||
|
@ -179,16 +179,16 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
do {
|
||||
const BMVert *eve = l_iter->v;
|
||||
const int v_idx = BM_elem_index_get(eve);
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, vertexCos ? vertexCos[v_idx] : eve->co, no);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
const MVert *mv = BKE_mesh_verts(mesh);
|
||||
const MLoop *ml = BKE_mesh_loops(mesh);
|
||||
|
@ -204,7 +204,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = v_index ? v_index[ml->v] : ml->v;
|
||||
const int f_idx = f_index ? f_index[p_idx] : p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
if (ELEM(ORIGINDEX_NONE, v_idx, f_idx)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = ml->v;
|
||||
const int f_idx = p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, mv[ml->v].co, no);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,12 +326,13 @@ static void bm_corners_to_loops_ex(ID *id,
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(fdata, CD_TESSLOOPNORMAL)) {
|
||||
float(*lnors)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tlnors)[3] = (short(*)[3])CustomData_get(fdata, findex, CD_TESSLOOPNORMAL);
|
||||
float(*loop_normals)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tessloop_normals)[3] = (short(*)[3])CustomData_get(
|
||||
fdata, findex, CD_TESSLOOPNORMAL);
|
||||
const int max = mf->v4 ? 4 : 3;
|
||||
|
||||
for (int i = 0; i < max; i++, lnors++, tlnors++) {
|
||||
normal_short_to_float_v3(*lnors, *tlnors);
|
||||
for (int i = 0; i < max; i++, loop_normals++, tessloop_normals++) {
|
||||
normal_short_to_float_v3(*loop_normals, *tessloop_normals);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -842,12 +843,12 @@ static void mesh_loops_to_tessdata(CustomData *fdata,
|
|||
}
|
||||
|
||||
if (hasLoopNormal) {
|
||||
short(*fnors)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*lnors)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
short(*face_normals)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*loop_normals)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, fnors++) {
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, face_normals++) {
|
||||
for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
|
||||
normal_float_to_short_v3((*fnors)[j], lnors[(*lidx)[j]]);
|
||||
normal_float_to_short_v3((*face_normals)[j], loop_normals[(*lidx)[j]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -814,7 +814,7 @@ struct LoopSplitTaskDataCommon {
|
|||
* Note we do not need to protect it, though, since two different tasks will *always* affect
|
||||
* different elements in the arrays. */
|
||||
MLoopNorSpaceArray *lnors_spacearr;
|
||||
MutableSpan<float3> loopnors;
|
||||
MutableSpan<float3> loop_normals;
|
||||
MutableSpan<short2> clnors_data;
|
||||
|
||||
/* Read-only. */
|
||||
|
@ -824,7 +824,7 @@ struct LoopSplitTaskDataCommon {
|
|||
Span<MPoly> polys;
|
||||
Span<int2> edge_to_loops;
|
||||
Span<int> loop_to_poly;
|
||||
Span<float3> polynors;
|
||||
Span<float3> poly_normals;
|
||||
Span<float3> vert_normals;
|
||||
};
|
||||
|
||||
|
@ -906,7 +906,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const float split_angle)
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
{mpolys, numPolys},
|
||||
{mloops, numLoops},
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
true,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -996,8 +996,8 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
const Span<MVert> verts = common_data->verts;
|
||||
const Span<MEdge> edges = common_data->edges;
|
||||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
MutableSpan<float3> loop_normals = common_data->loopnors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
const int ml_curr_index = data->ml_curr_index;
|
||||
|
@ -1007,7 +1007,7 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
/* Simple case (both edges around that vertex are sharp in current polygon),
|
||||
* this loop just takes its poly normal.
|
||||
*/
|
||||
loop_normals[ml_curr_index] = polynors[mp_index];
|
||||
loop_normals[ml_curr_index] = poly_normals[mp_index];
|
||||
|
||||
#if 0
|
||||
printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n",
|
||||
|
@ -1051,7 +1051,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
BLI_Stack *edge_vectors)
|
||||
{
|
||||
MLoopNorSpaceArray *lnors_spacearr = common_data->lnors_spacearr;
|
||||
MutableSpan<float3> loopnors = common_data->loopnors;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
MutableSpan<short2> clnors_data = common_data->clnors_data;
|
||||
|
||||
const Span<MVert> verts = common_data->verts;
|
||||
|
@ -1060,7 +1060,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<int2> edge_to_loops = common_data->edge_to_loops;
|
||||
const Span<int> loop_to_poly = common_data->loop_to_poly;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
#if 0 /* Not needed for 'fan' loops. */
|
||||
|
@ -1143,7 +1143,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
/* Calculate angle between the two poly edges incident on this vertex. */
|
||||
const float fac = saacos(dot_v3v3(vec_curr, vec_prev));
|
||||
/* Accumulate */
|
||||
madd_v3_v3fl(lnor, polynors[mpfan_curr_index], fac);
|
||||
madd_v3_v3fl(lnor, poly_normals[mpfan_curr_index], fac);
|
||||
|
||||
if (!clnors_data.is_empty()) {
|
||||
/* Accumulate all clnors, if they are not all equal we have to fix that! */
|
||||
|
@ -1157,13 +1157,13 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
clnors_avg[0] += (*clnor)[0];
|
||||
clnors_avg[1] += (*clnor)[1];
|
||||
clnors_count++;
|
||||
/* We store here a pointer to all custom lnors processed. */
|
||||
/* We store here a pointer to all custom loop_normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(clnors, (short *)*clnor);
|
||||
}
|
||||
}
|
||||
|
||||
/* We store here a pointer to all loop-normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loopnors[mlfan_vert_index]));
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loop_normals[mlfan_vert_index]));
|
||||
|
||||
if (lnors_spacearr) {
|
||||
/* Assign current lnor space to current 'vertex' loop. */
|
||||
|
@ -1203,7 +1203,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
if (lnors_spacearr) {
|
||||
if (UNLIKELY(lnor_len == 0.0f)) {
|
||||
/* Use vertex normal as fallback! */
|
||||
copy_v3_v3(lnor, loopnors[mlfan_vert_index]);
|
||||
copy_v3_v3(lnor, loop_normals[mlfan_vert_index]);
|
||||
lnor_len = 1.0f;
|
||||
}
|
||||
|
||||
|
@ -1497,10 +1497,10 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
const MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const bool use_split_normals,
|
||||
const float split_angle,
|
||||
|
@ -1515,11 +1515,11 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
BLI_assert(use_split_normals || !(r_lnors_spacearr));
|
||||
|
||||
if (!use_split_normals) {
|
||||
/* In this case, we simply fill lnors with vnors (or fnors for flat faces), quite simple!
|
||||
/* In this case, simply fill `r_loop_normals` with `vert_normals`
|
||||
* (or `poly_normals` for flat faces), quite simple!
|
||||
* Note this is done here to keep some logic and consistency in this quite complex code,
|
||||
* since we may want to use lnors even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code).
|
||||
* As usual, we could handle that on case-by-case basis,
|
||||
* since we may want to use loop_normals even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code). As usual, we could handle that on case-by-case basis,
|
||||
* but simpler to keep it well confined here. */
|
||||
int mp_index;
|
||||
|
||||
|
@ -1531,10 +1531,10 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
|
||||
for (; ml_index < ml_index_end; ml_index++) {
|
||||
if (is_poly_flat) {
|
||||
copy_v3_v3(r_loopnors[ml_index], polynors[mp_index]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], poly_normals[mp_index]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(r_loopnors[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1591,7 +1591,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
/* Init data common to all tasks. */
|
||||
LoopSplitTaskDataCommon common_data;
|
||||
common_data.lnors_spacearr = r_lnors_spacearr;
|
||||
common_data.loopnors = {reinterpret_cast<float3 *>(r_loopnors), numLoops};
|
||||
common_data.loop_normals = {reinterpret_cast<float3 *>(r_loop_normals), numLoops};
|
||||
common_data.clnors_data = {reinterpret_cast<short2 *>(clnors_data), clnors_data ? numLoops : 0};
|
||||
common_data.verts = {mverts, numVerts};
|
||||
common_data.edges = {medges, numEdges};
|
||||
|
@ -1599,7 +1599,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
common_data.loops = loops;
|
||||
common_data.edge_to_loops = edge_to_loops;
|
||||
common_data.loop_to_poly = loop_to_poly;
|
||||
common_data.polynors = {reinterpret_cast<const float3 *>(polynors), numPolys};
|
||||
common_data.poly_normals = {reinterpret_cast<const float3 *>(poly_normals), numPolys};
|
||||
common_data.vert_normals = {reinterpret_cast<const float3 *>(vert_normals), numVerts};
|
||||
|
||||
/* Pre-populate all loop normals as if their verts were all smooth.
|
||||
|
@ -1608,7 +1608,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
for (const int poly_i : range) {
|
||||
const MPoly &poly = polys[poly_i];
|
||||
for (const int loop_i : IndexRange(poly.loopstart, poly.totloop)) {
|
||||
copy_v3_v3(r_loopnors[loop_i], vert_normals[loops[loop_i].v]);
|
||||
copy_v3_v3(r_loop_normals[loop_i], vert_normals[loops[loop_i].v]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1618,7 +1618,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
polys,
|
||||
loops,
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
check_angle,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -1653,9 +1653,9 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
|||
* Compute internal representation of given custom normals (as an array of float[2]).
|
||||
* It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed
|
||||
* to get a same custom lnor for all loops sharing a same smooth fan.
|
||||
* If use_vertices if true, r_custom_loopnors is assumed to be per-vertex, not per-loop
|
||||
* If use_vertices if true, r_custom_loop_normals is assumed to be per-vertex, not per-loop
|
||||
* (this allows to set whole vert's normals at once, useful in some cases).
|
||||
* r_custom_loopnors is expected to have normalized normals, or zero ones,
|
||||
* r_custom_loop_normals is expected to have normalized normals, or zero ones,
|
||||
* in which case they will be replaced by default loop/vertex normal.
|
||||
*/
|
||||
static void mesh_normals_loop_custom_set(const MVert *mverts,
|
||||
|
@ -1664,10 +1664,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2],
|
||||
const bool use_vertices)
|
||||
|
@ -1682,7 +1682,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
* So better to keep some simplicity here, and just call #BKE_mesh_normals_loop_split() twice! */
|
||||
MLoopNorSpaceArray lnors_spacearr = {nullptr};
|
||||
BitVector<> done_loops(numLoops, false);
|
||||
float(*lnors)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numLoops), sizeof(*lnors), __func__);
|
||||
float(*loop_normals)[3] = (float(*)[3])MEM_calloc_arrayN(
|
||||
size_t(numLoops), sizeof(*loop_normals), __func__);
|
||||
const Array<int> loop_to_poly = mesh_topology::build_loop_to_poly_map({mpolys, numPolys},
|
||||
numLoops);
|
||||
/* In this case we always consider split nors as ON,
|
||||
|
@ -1699,10 +1700,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1713,15 +1714,15 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
/* Set all given zero vectors to their default value. */
|
||||
if (use_vertices) {
|
||||
for (int i = 0; i < numVerts; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], vert_normals[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], vert_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < numLoops; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], lnors[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], loop_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1729,9 +1730,9 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
BLI_assert(lnors_spacearr.data_type == MLNOR_SPACEARR_LOOP_INDEX);
|
||||
|
||||
/* Now, check each current smooth fan (one lnor space per smooth fan!),
|
||||
* and if all its matching custom lnors are not (enough) equal, add sharp edges as needed.
|
||||
* and if all its matching custom loop_normals are not (enough) equal, add sharp edges as needed.
|
||||
* This way, next time we run BKE_mesh_normals_loop_split(), we'll get lnor spacearr/smooth fans
|
||||
* matching given custom lnors.
|
||||
* matching given custom loop_normals.
|
||||
* Note this code *will never* unsharp edges! And quite obviously,
|
||||
* when we set custom normals per vertices, running this is absolutely useless. */
|
||||
if (use_vertices) {
|
||||
|
@ -1775,7 +1776,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (!org_nor) {
|
||||
org_nor = nor;
|
||||
|
@ -1807,7 +1808,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (dot_v3v3(org_nor, nor) < LNOR_SPACE_TRIGO_THRESHOLD) {
|
||||
const MPoly *mp = &mpolys[loop_to_poly[lidx]];
|
||||
|
@ -1818,7 +1819,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
}
|
||||
}
|
||||
|
||||
/* And now, recompute our new auto lnors and lnor spacearr! */
|
||||
/* And now, recompute our new auto `loop_normals` and lnor spacearr! */
|
||||
BKE_lnor_spacearr_clear(&lnors_spacearr);
|
||||
BKE_mesh_normals_loop_split(mverts,
|
||||
vert_normals,
|
||||
|
@ -1826,10 +1827,10 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1858,7 +1859,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
|
||||
BLI_assert(POINTER_AS_INT(loops) == i);
|
||||
const int nidx = use_vertices ? int(mloops[i].v) : i;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], nor, r_clnors_data[i]);
|
||||
done_loops[i].reset();
|
||||
|
@ -1872,7 +1873,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
while (loops) {
|
||||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const int nidx = use_vertices ? int(mloops[lidx].v) : lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
avg_nor_count++;
|
||||
add_v3_v3(avg_nor, nor);
|
||||
|
@ -1893,7 +1894,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
}
|
||||
}
|
||||
|
||||
MEM_freeN(lnors);
|
||||
MEM_freeN(loop_normals);
|
||||
BKE_lnor_spacearr_free(&lnors_spacearr);
|
||||
}
|
||||
|
||||
|
@ -1903,10 +1904,10 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1916,10 +1917,10 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_loopnors,
|
||||
r_custom_loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
false);
|
||||
|
@ -1927,14 +1928,14 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const MVert *mverts,
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
const int numVerts,
|
||||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1944,10 +1945,10 @@ void BKE_mesh_normals_loop_custom_from_verts_set(const MVert *mverts,
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_vertnors,
|
||||
r_custom_vert_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
true);
|
||||
|
@ -1986,14 +1987,14 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
|
|||
use_vertices);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loop_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_loopnors, false);
|
||||
mesh_set_custom_normals(mesh, r_custom_loop_normals, false);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vertnors)[3])
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vert_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_vertnors, true);
|
||||
mesh_set_custom_normals(mesh, r_custom_vert_normals, true);
|
||||
}
|
||||
|
||||
void BKE_mesh_normals_loop_to_vertex(const int numVerts,
|
||||
|
|
|
@ -58,7 +58,7 @@ struct BKEMeshToTangent {
|
|||
|
||||
mikk::float3 GetNormal(const uint face_num, const uint vert_num)
|
||||
{
|
||||
return mikk::float3(lnors[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
return mikk::float3(loop_normals[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
}
|
||||
|
||||
void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
|
||||
|
@ -67,20 +67,20 @@ struct BKEMeshToTangent {
|
|||
copy_v4_fl4(p_res, T.x, T.y, T.z, orientation ? 1.0f : -1.0f);
|
||||
}
|
||||
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const MVert *mverts; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*lnors)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const MVert *mverts; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*loop_normals)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
};
|
||||
|
||||
void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
|
||||
const int /*numVerts*/,
|
||||
const MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const MLoopUV *loopuvs,
|
||||
const int /*numLoops*/,
|
||||
const MPoly *mpolys,
|
||||
|
@ -93,7 +93,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
|
|||
mesh_to_tangent.mloops = mloops;
|
||||
mesh_to_tangent.mverts = mverts;
|
||||
mesh_to_tangent.luvs = loopuvs;
|
||||
mesh_to_tangent.lnors = loopnors;
|
||||
mesh_to_tangent.loop_normals = loop_normals;
|
||||
mesh_to_tangent.tangents = r_looptangent;
|
||||
mesh_to_tangent.num_polys = numPolys;
|
||||
|
||||
|
@ -133,9 +133,9 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
return;
|
||||
}
|
||||
|
||||
const float(*loopnors)[3] = static_cast<const float(*)[3]>(
|
||||
const float(*loop_normals)[3] = static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
if (!loopnors) {
|
||||
if (!loop_normals) {
|
||||
BKE_report(
|
||||
reports, RPT_ERROR, "Tangent space computation needs loop normals, none found, aborting");
|
||||
return;
|
||||
|
@ -145,7 +145,7 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
mesh->totvert,
|
||||
BKE_mesh_loops(mesh),
|
||||
r_looptangents,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
loopuvs,
|
||||
mesh->totloop,
|
||||
BKE_mesh_polys(mesh),
|
||||
|
|
|
@ -1335,7 +1335,7 @@ typedef struct PBVHUpdateData {
|
|||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
float (*vnors)[3];
|
||||
float (*vert_normals)[3];
|
||||
int flag;
|
||||
bool show_sculpt_face_sets;
|
||||
PBVHAttrReq *attrs;
|
||||
|
@ -1349,7 +1349,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1357,7 +1357,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
for (int i = 0; i < totvert; i++) {
|
||||
const int v = verts[i];
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
zero_v3(vnors[v]);
|
||||
zero_v3(vert_normals[v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1371,7 +1371,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
uint mpoly_prev = UINT_MAX;
|
||||
|
@ -1405,7 +1405,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
* Not exact equivalent though, since atomicity is only ensured for one component
|
||||
* of the vector at a time, but here it shall not make any sensible difference. */
|
||||
for (int k = 3; k--;) {
|
||||
atomic_add_and_fetch_fl(&vnors[v][k], fn[k]);
|
||||
atomic_add_and_fetch_fl(&vert_normals[v][k], fn[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1420,7 +1420,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1432,7 +1432,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
/* No atomics necessary because we are iterating over uniq_verts only,
|
||||
* so we know only this thread will handle this vertex. */
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
normalize_v3(vnors[v]);
|
||||
normalize_v3(vert_normals[v]);
|
||||
pbvh->vert_bitmap[v] = false;
|
||||
}
|
||||
}
|
||||
|
@ -1456,7 +1456,7 @@ static void pbvh_faces_update_normals(PBVH *pbvh, PBVHNode **nodes, int totnode)
|
|||
PBVHUpdateData data = {
|
||||
.pbvh = pbvh,
|
||||
.nodes = nodes,
|
||||
.vnors = pbvh->vert_normals,
|
||||
.vert_normals = pbvh->vert_normals,
|
||||
};
|
||||
|
||||
TaskParallelSettings settings;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool BKE_shrinkwrap_init_tree(
|
|||
}
|
||||
|
||||
if (force_normals || BKE_shrinkwrap_needs_normals(shrinkType, shrinkMode)) {
|
||||
data->pnors = BKE_mesh_poly_normals_ensure(mesh);
|
||||
data->poly_normals = BKE_mesh_poly_normals_ensure(mesh);
|
||||
if ((mesh->flag & ME_AUTOSMOOTH) != 0) {
|
||||
data->clnors = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
}
|
||||
|
@ -1218,8 +1218,8 @@ void BKE_shrinkwrap_compute_smooth_normal(const ShrinkwrapTreeData *tree,
|
|||
}
|
||||
}
|
||||
/* Use the polygon normal if flat. */
|
||||
else if (tree->pnors != nullptr) {
|
||||
copy_v3_v3(r_no, tree->pnors[tri->poly]);
|
||||
else if (tree->poly_normals != nullptr) {
|
||||
copy_v3_v3(r_no, tree->poly_normals[tri->poly]);
|
||||
}
|
||||
/* Finally fallback to the looptri normal. */
|
||||
else {
|
||||
|
|
|
@ -285,11 +285,11 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
|||
struct GPUBatch *normal_geom = DRW_cache_normal_arrow_get();
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
if (vnormals_do) {
|
||||
geom = DRW_mesh_batch_cache_get_edit_vnors(me);
|
||||
geom = DRW_mesh_batch_cache_get_edit_vert_normals(me);
|
||||
DRW_shgroup_call_instances_with_attrs(pd->edit_mesh_normals_grp, ob, normal_geom, geom);
|
||||
}
|
||||
if (lnormals_do) {
|
||||
geom = DRW_mesh_batch_cache_get_edit_lnors(me);
|
||||
geom = DRW_mesh_batch_cache_get_edit_loop_normals(me);
|
||||
DRW_shgroup_call_instances_with_attrs(pd->edit_mesh_normals_grp, ob, normal_geom, geom);
|
||||
}
|
||||
if (fnormals_do) {
|
||||
|
|
|
@ -213,8 +213,8 @@ struct GPUBatch *DRW_mesh_batch_cache_get_surface_viewer_attribute(struct Mesh *
|
|||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_edges(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vnors(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_lnors(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vert_normals(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_loop_normals(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(struct Mesh *me);
|
||||
struct GPUBatch *DRW_mesh_batch_cache_get_edit_skin_roots(struct Mesh *me);
|
||||
|
||||
|
|
|
@ -1111,14 +1111,14 @@ GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(Mesh *me)
|
|||
return DRW_batch_request(&cache->batch.edit_vertices);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_mesh_batch_cache_get_edit_vnors(Mesh *me)
|
||||
GPUBatch *DRW_mesh_batch_cache_get_edit_vert_normals(Mesh *me)
|
||||
{
|
||||
MeshBatchCache *cache = mesh_batch_cache_get(me);
|
||||
mesh_batch_cache_add_request(cache, MBC_EDIT_VNOR);
|
||||
return DRW_batch_request(&cache->batch.edit_vnor);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_mesh_batch_cache_get_edit_lnors(Mesh *me)
|
||||
GPUBatch *DRW_mesh_batch_cache_get_edit_loop_normals(Mesh *me)
|
||||
{
|
||||
MeshBatchCache *cache = mesh_batch_cache_get(me);
|
||||
mesh_batch_cache_add_request(cache, MBC_EDIT_LNOR);
|
||||
|
|
|
@ -264,16 +264,17 @@ static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
|
|||
|
||||
if (subdiv_cache->use_custom_loop_normals) {
|
||||
Mesh *coarse_mesh = subdiv_cache->mesh;
|
||||
const float(*lnors)[3] = static_cast<const float(*)[3]>(
|
||||
const float(*loop_normals)[3] = static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&coarse_mesh->ldata, CD_NORMAL));
|
||||
BLI_assert(lnors != nullptr);
|
||||
BLI_assert(loop_normals != nullptr);
|
||||
|
||||
GPUVertBuf *src_custom_normals = GPU_vertbuf_calloc();
|
||||
GPU_vertbuf_init_with_format(src_custom_normals, get_custom_normals_format());
|
||||
GPU_vertbuf_data_alloc(src_custom_normals, coarse_mesh->totloop);
|
||||
|
||||
memcpy(
|
||||
GPU_vertbuf_get_data(src_custom_normals), lnors, sizeof(float[3]) * coarse_mesh->totloop);
|
||||
memcpy(GPU_vertbuf_get_data(src_custom_normals),
|
||||
loop_normals,
|
||||
sizeof(float[3]) * coarse_mesh->totloop);
|
||||
|
||||
GPUVertBuf *dst_custom_normals = GPU_vertbuf_calloc();
|
||||
GPU_vertbuf_init_build_on_device(
|
||||
|
|
|
@ -78,8 +78,8 @@ struct LaplacianSystem {
|
|||
const MLoop *mloop; /* needed to find vertices by index */
|
||||
int verts_num;
|
||||
int tris_num;
|
||||
float (*verts)[3]; /* vertex coordinates */
|
||||
float (*vnors)[3]; /* vertex normals */
|
||||
float (*verts)[3]; /* vertex coordinates */
|
||||
float (*vert_normals)[3]; /* vertex normals */
|
||||
|
||||
float (*root)[3]; /* bone root */
|
||||
float (*tip)[3]; /* bone tip */
|
||||
|
@ -489,7 +489,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
|
|||
dist = normalize_v3(d);
|
||||
|
||||
/* if the vertex normal does not point along the bone, increase distance */
|
||||
cosine = dot_v3v3(d, sys->heat.vnors[vertex]);
|
||||
cosine = dot_v3v3(d, sys->heat.vert_normals[vertex]);
|
||||
|
||||
return dist / (0.5f * (cosine + 1.001f));
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
|
|||
float fnor[3];
|
||||
int a, v1, v2, v3, (*face)[3];
|
||||
|
||||
sys->heat.vnors = MEM_callocN(sizeof(float[3]) * sys->verts_num, "HeatVNors");
|
||||
sys->heat.vert_normals = MEM_callocN(sizeof(float[3]) * sys->verts_num, "HeatVNors");
|
||||
|
||||
for (a = 0, face = sys->faces; a < sys->faces_num; a++, face++) {
|
||||
v1 = (*face)[0];
|
||||
|
@ -562,13 +562,13 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
|
|||
|
||||
normal_tri_v3(fnor, sys->verts[v1], sys->verts[v2], sys->verts[v3]);
|
||||
|
||||
add_v3_v3(sys->heat.vnors[v1], fnor);
|
||||
add_v3_v3(sys->heat.vnors[v2], fnor);
|
||||
add_v3_v3(sys->heat.vnors[v3], fnor);
|
||||
add_v3_v3(sys->heat.vert_normals[v1], fnor);
|
||||
add_v3_v3(sys->heat.vert_normals[v2], fnor);
|
||||
add_v3_v3(sys->heat.vert_normals[v3], fnor);
|
||||
}
|
||||
|
||||
for (a = 0; a < sys->verts_num; a++) {
|
||||
normalize_v3(sys->heat.vnors[a]);
|
||||
normalize_v3(sys->heat.vert_normals[a]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ static void heat_system_free(LaplacianSystem *sys)
|
|||
MEM_freeN(sys->heat.mindist);
|
||||
MEM_freeN(sys->heat.H);
|
||||
MEM_freeN(sys->heat.p);
|
||||
MEM_freeN(sys->heat.vnors);
|
||||
MEM_freeN(sys->heat.vert_normals);
|
||||
}
|
||||
|
||||
static float heat_limit_weight(float weight)
|
||||
|
|
|
@ -9627,11 +9627,11 @@ static int edbm_set_normals_from_faces_exec(bContext *C, wmOperator *op)
|
|||
BKE_editmesh_ensure_autosmooth(em, obedit->data);
|
||||
BKE_editmesh_lnorspace_update(em, obedit->data);
|
||||
|
||||
float(*vnors)[3] = MEM_mallocN(sizeof(*vnors) * bm->totvert, __func__);
|
||||
float(*vert_normals)[3] = MEM_mallocN(sizeof(*vert_normals) * bm->totvert, __func__);
|
||||
{
|
||||
int v_index;
|
||||
BM_ITER_MESH_INDEX (v, &viter, bm, BM_VERTS_OF_MESH, v_index) {
|
||||
BM_vert_calc_normal_ex(v, BM_ELEM_SELECT, vnors[v_index]);
|
||||
BM_vert_calc_normal_ex(v, BM_ELEM_SELECT, vert_normals[v_index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9647,10 +9647,10 @@ static int edbm_set_normals_from_faces_exec(bContext *C, wmOperator *op)
|
|||
const int l_index = BM_elem_index_get(l);
|
||||
const int v_index = BM_elem_index_get(l->v);
|
||||
|
||||
if (!is_zero_v3(vnors[v_index])) {
|
||||
if (!is_zero_v3(vert_normals[v_index])) {
|
||||
short *clnors = BM_ELEM_CD_GET_VOID_P(l, cd_clnors_offset);
|
||||
BKE_lnor_space_custom_normal_to_data(
|
||||
bm->lnor_spacearr->lspacearr[l_index], vnors[v_index], clnors);
|
||||
bm->lnor_spacearr->lspacearr[l_index], vert_normals[v_index], clnors);
|
||||
|
||||
if (bm->lnor_spacearr->lspacearr[l_index]->flags & MLNOR_SPACE_IS_SINGLE) {
|
||||
BLI_BITMAP_ENABLE(loop_set, l_index);
|
||||
|
@ -9674,13 +9674,13 @@ static int edbm_set_normals_from_faces_exec(bContext *C, wmOperator *op)
|
|||
const int loop_index = BM_elem_index_get(l);
|
||||
short *clnors = BM_ELEM_CD_GET_VOID_P(l, cd_clnors_offset);
|
||||
BKE_lnor_space_custom_normal_to_data(
|
||||
bm->lnor_spacearr->lspacearr[loop_index], vnors[v_index], clnors);
|
||||
bm->lnor_spacearr->lspacearr[loop_index], vert_normals[v_index], clnors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(loop_set);
|
||||
MEM_freeN(vnors);
|
||||
MEM_freeN(vert_normals);
|
||||
EDBM_update(obedit->data,
|
||||
&(const struct EDBMUpdate_Params){
|
||||
.calc_looptri = true,
|
||||
|
|
|
@ -299,17 +299,17 @@ static void process_vertex_normals(CDStreamConfig &config,
|
|||
return;
|
||||
}
|
||||
|
||||
float(*vnors)[3] = static_cast<float(*)[3]>(
|
||||
float(*vert_normals)[3] = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(normals_count, sizeof(float[3]), "ABC::VertexNormals"));
|
||||
|
||||
const N3fArraySample &vertex_normals = *vertex_normals_ptr;
|
||||
for (int index = 0; index < normals_count; index++) {
|
||||
copy_zup_from_yup(vnors[index], vertex_normals[index].getValue());
|
||||
copy_zup_from_yup(vert_normals[index], vertex_normals[index].getValue());
|
||||
}
|
||||
|
||||
config.mesh->flag |= ME_AUTOSMOOTH;
|
||||
BKE_mesh_set_custom_normals_from_verts(config.mesh, vnors);
|
||||
MEM_freeN(vnors);
|
||||
BKE_mesh_set_custom_normals_from_verts(config.mesh, vert_normals);
|
||||
MEM_freeN(vert_normals);
|
||||
}
|
||||
|
||||
static void process_normals(CDStreamConfig &config,
|
||||
|
|
|
@ -102,14 +102,14 @@ static void rna_Mesh_calc_smooth_groups(
|
|||
}
|
||||
|
||||
static void rna_Mesh_normals_split_custom_do(Mesh *mesh,
|
||||
float (*custom_loopnors)[3],
|
||||
float (*custom_loop_or_vert_normals)[3],
|
||||
const bool use_verts)
|
||||
{
|
||||
if (use_verts) {
|
||||
BKE_mesh_set_custom_normals_from_verts(mesh, custom_loopnors);
|
||||
BKE_mesh_set_custom_normals_from_verts(mesh, custom_loop_or_vert_normals);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_set_custom_normals(mesh, custom_loopnors);
|
||||
BKE_mesh_set_custom_normals(mesh, custom_loop_or_vert_normals);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ static void rna_Mesh_normals_split_custom_set(Mesh *mesh,
|
|||
int normals_len,
|
||||
float *normals)
|
||||
{
|
||||
float(*loopnors)[3] = (float(*)[3])normals;
|
||||
float(*loop_normals)[3] = (float(*)[3])normals;
|
||||
const int numloops = mesh->totloop;
|
||||
|
||||
if (normals_len != numloops * 3) {
|
||||
|
@ -130,7 +130,7 @@ static void rna_Mesh_normals_split_custom_set(Mesh *mesh,
|
|||
return;
|
||||
}
|
||||
|
||||
rna_Mesh_normals_split_custom_do(mesh, loopnors, false);
|
||||
rna_Mesh_normals_split_custom_do(mesh, loop_normals, false);
|
||||
|
||||
DEG_id_tag_update(&mesh->id, 0);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
|
|||
int normals_len,
|
||||
float *normals)
|
||||
{
|
||||
float(*vertnors)[3] = (float(*)[3])normals;
|
||||
float(*vert_normals)[3] = (float(*)[3])normals;
|
||||
const int numverts = mesh->totvert;
|
||||
|
||||
if (normals_len != numverts * 3) {
|
||||
|
@ -152,7 +152,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
|
|||
return;
|
||||
}
|
||||
|
||||
rna_Mesh_normals_split_custom_do(mesh, vertnors, true);
|
||||
rna_Mesh_normals_split_custom_do(mesh, vert_normals, true);
|
||||
|
||||
DEG_id_tag_update(&mesh->id, 0);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ static bool polygons_check_flip(MLoop *mloop,
|
|||
float (*nos)[3],
|
||||
CustomData *ldata,
|
||||
const MPoly *mpoly,
|
||||
float (*polynors)[3],
|
||||
float (*poly_normals)[3],
|
||||
const int polys_num)
|
||||
{
|
||||
const MPoly *mp;
|
||||
|
@ -198,9 +198,9 @@ static bool polygons_check_flip(MLoop *mloop,
|
|||
}
|
||||
|
||||
/* If average of new loop normals is opposed to polygon normal, flip polygon. */
|
||||
if (dot_v3v3(polynors[i], norsum) < 0.0f) {
|
||||
if (dot_v3v3(poly_normals[i], norsum) < 0.0f) {
|
||||
BKE_mesh_polygon_flip_ex(mp, mloop, ldata, nos, mdisp, true);
|
||||
negate_v3(polynors[i]);
|
||||
negate_v3(poly_normals[i]);
|
||||
flipped = true;
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd,
|
|||
Object *ob,
|
||||
Mesh *mesh,
|
||||
short (*clnors)[2],
|
||||
float (*loopnors)[3],
|
||||
const float (*polynors)[3],
|
||||
float (*loop_normals)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const short mix_mode,
|
||||
const float mix_factor,
|
||||
const float mix_limit,
|
||||
|
@ -308,7 +308,7 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd,
|
|||
}
|
||||
}
|
||||
|
||||
if (loopnors) {
|
||||
if (loop_normals) {
|
||||
mix_normals(mix_factor,
|
||||
dvert,
|
||||
defgrp_index,
|
||||
|
@ -317,7 +317,7 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd,
|
|||
mix_mode,
|
||||
verts_num,
|
||||
mloop,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
nos,
|
||||
loops_num);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ static void normalEditModifier_do_radial(NormalEditModifierData *enmd,
|
|||
nos,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
clnors);
|
||||
|
||||
|
@ -352,8 +352,8 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
|
|||
Object *ob,
|
||||
Mesh *mesh,
|
||||
short (*clnors)[2],
|
||||
float (*loopnors)[3],
|
||||
const float (*polynors)[3],
|
||||
float (*loop_normals)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const short mix_mode,
|
||||
const float mix_factor,
|
||||
const float mix_limit,
|
||||
|
@ -425,7 +425,7 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
|
|||
MEM_freeN(cos);
|
||||
}
|
||||
|
||||
if (loopnors) {
|
||||
if (loop_normals) {
|
||||
mix_normals(mix_factor,
|
||||
dvert,
|
||||
defgrp_index,
|
||||
|
@ -434,7 +434,7 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
|
|||
mix_mode,
|
||||
verts_num,
|
||||
mloop,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
nos,
|
||||
loops_num);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
|
|||
nos,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
clnors);
|
||||
|
||||
|
@ -535,7 +535,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
int defgrp_index;
|
||||
const MDeformVert *dvert;
|
||||
|
||||
float(*loopnors)[3] = nullptr;
|
||||
float(*loop_normals)[3] = nullptr;
|
||||
|
||||
CustomData *ldata = &result->ldata;
|
||||
|
||||
|
@ -546,8 +546,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
if (use_current_clnors) {
|
||||
clnors = static_cast<short(*)[2]>(
|
||||
CustomData_duplicate_referenced_layer(ldata, CD_CUSTOMLOOPNORMAL, loops_num));
|
||||
loopnors = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(size_t(loops_num), sizeof(*loopnors), __func__));
|
||||
loop_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(size_t(loops_num), sizeof(*loop_normals), __func__));
|
||||
|
||||
BKE_mesh_normals_loop_split(verts,
|
||||
vert_normals,
|
||||
|
@ -555,7 +555,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
edges,
|
||||
edges_num,
|
||||
loops,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
loops_num,
|
||||
polys,
|
||||
poly_normals,
|
||||
|
@ -580,7 +580,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
ob,
|
||||
result,
|
||||
clnors,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
poly_normals,
|
||||
enmd->mix_mode,
|
||||
enmd->mix_factor,
|
||||
|
@ -603,7 +603,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
ob,
|
||||
result,
|
||||
clnors,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
poly_normals,
|
||||
enmd->mix_mode,
|
||||
enmd->mix_factor,
|
||||
|
@ -621,7 +621,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
polys_num);
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(loopnors);
|
||||
MEM_SAFE_FREE(loop_normals);
|
||||
|
||||
result->runtime->is_original_bmesh = false;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ struct WeightedNormalData {
|
|||
float split_angle;
|
||||
|
||||
const MPoly *mpoly;
|
||||
const float (*polynors)[3];
|
||||
const float (*poly_normals)[3];
|
||||
const int *poly_strength;
|
||||
|
||||
const MDeformVert *dvert;
|
||||
|
@ -131,7 +131,7 @@ static void aggregate_item_normal(WeightedNormalModifierData *wnmd,
|
|||
const float curr_val,
|
||||
const bool use_face_influence)
|
||||
{
|
||||
const float(*polynors)[3] = wn_data->polynors;
|
||||
const float(*poly_normals)[3] = wn_data->poly_normals;
|
||||
|
||||
const MDeformVert *dvert = wn_data->dvert;
|
||||
const int defgrp_index = wn_data->defgrp_index;
|
||||
|
@ -175,7 +175,7 @@ static void aggregate_item_normal(WeightedNormalModifierData *wnmd,
|
|||
cached_inverse_powers_of_weight[loops_num] :
|
||||
1.0f / powf(weight, loops_num);
|
||||
|
||||
madd_v3_v3fl(item_data->normal, polynors[mp_index], curr_val * inverted_n_weight);
|
||||
madd_v3_v3fl(item_data->normal, poly_normals[mp_index], curr_val * inverted_n_weight);
|
||||
}
|
||||
|
||||
static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
||||
|
@ -195,7 +195,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
const Span<int> loop_to_poly = wn_data->loop_to_poly;
|
||||
|
||||
const MPoly *mpoly = wn_data->mpoly;
|
||||
const float(*polynors)[3] = wn_data->polynors;
|
||||
const float(*poly_normals)[3] = wn_data->poly_normals;
|
||||
const int *poly_strength = wn_data->poly_strength;
|
||||
|
||||
const MDeformVert *dvert = wn_data->dvert;
|
||||
|
@ -232,7 +232,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
loop_normals,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
true,
|
||||
split_angle,
|
||||
|
@ -364,7 +364,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
loop_normals,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
clnors);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
mloop,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
clnors);
|
||||
|
||||
|
@ -414,7 +414,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
loop_normals,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
true,
|
||||
split_angle,
|
||||
|
@ -438,7 +438,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
|
|||
loop_normals,
|
||||
loops_num,
|
||||
mpoly,
|
||||
polynors,
|
||||
poly_normals,
|
||||
polys_num,
|
||||
clnors);
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
wn_data.split_angle = split_angle;
|
||||
|
||||
wn_data.mpoly = mpoly;
|
||||
wn_data.polynors = BKE_mesh_poly_normals_ensure(mesh);
|
||||
wn_data.poly_normals = BKE_mesh_poly_normals_ensure(mesh);
|
||||
wn_data.poly_strength = static_cast<const int *>(CustomData_get_layer_named(
|
||||
&result->pdata, CD_PROP_INT32, MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID));
|
||||
|
||||
|
|
Loading…
Reference in New Issue