Cleanup: Small changes to multires bake normals access
- Order return arguments last, add `r_` prefix - Use explicit size on array argument - Avoid double negative in if statement
This commit is contained in:
parent
3a8a7d93f9
commit
def1c0c538
|
@ -106,25 +106,25 @@ typedef struct BakeImBufuserData {
|
|||
} BakeImBufuserData;
|
||||
|
||||
static void multiresbake_get_normal(const MResolvePixelData *data,
|
||||
float norm[],
|
||||
const int tri_num,
|
||||
const int vert_index)
|
||||
const int vert_index,
|
||||
float r_normal[3])
|
||||
{
|
||||
const int poly_index = data->mlooptri[tri_num].poly;
|
||||
const MPoly *mp = &data->mpoly[poly_index];
|
||||
const bool smoothnormal = (mp->flag & ME_SMOOTH) != 0;
|
||||
|
||||
if (!smoothnormal) { /* flat */
|
||||
if (data->precomputed_normals) {
|
||||
copy_v3_v3(norm, data->precomputed_normals[poly_index]);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_calc_poly_normal(mp, &data->mloop[mp->loopstart], data->mvert, norm);
|
||||
}
|
||||
if (smoothnormal) {
|
||||
const int vi = data->mloop[data->mlooptri[tri_num].tri[vert_index]].v;
|
||||
copy_v3_v3(r_normal, data->vert_normals[vi]);
|
||||
}
|
||||
else {
|
||||
const int vi = data->mloop[data->mlooptri[tri_num].tri[vert_index]].v;
|
||||
copy_v3_v3(norm, data->vert_normals[vi]);
|
||||
if (data->precomputed_normals) {
|
||||
copy_v3_v3(r_normal, data->precomputed_normals[poly_index]);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_calc_poly_normal(mp, &data->mloop[mp->loopstart], data->mvert, r_normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,9 +160,9 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
|
|||
st1 = data->mloopuv[data->mlooptri[data->tri_index].tri[1]].uv;
|
||||
st2 = data->mloopuv[data->mlooptri[data->tri_index].tri[2]].uv;
|
||||
|
||||
multiresbake_get_normal(data, no0, data->tri_index, 0); /* can optimize these 3 into one call */
|
||||
multiresbake_get_normal(data, no1, data->tri_index, 1);
|
||||
multiresbake_get_normal(data, no2, data->tri_index, 2);
|
||||
multiresbake_get_normal(data, data->tri_index, 0, no0); /* can optimize these 3 into one call */
|
||||
multiresbake_get_normal(data, data->tri_index, 1, no1);
|
||||
multiresbake_get_normal(data, data->tri_index, 2, no2);
|
||||
|
||||
resolve_tri_uv_v2(fUV, st, st0, st1, st2);
|
||||
|
||||
|
|
Loading…
Reference in New Issue