Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-03-22 01:11:39 +0300
committerHans Goudey <h.goudey@me.com>2022-03-22 01:11:39 +0300
commitdef1c0c5385b7845c1a1bbbb55cd5275587a6338 (patch)
tree5b736587a4a1a16209114c4d29d0144d20e001c9 /source
parent3a8a7d93f9271935ac28d19b26aff0a671b65551 (diff)
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
Diffstat (limited to 'source')
-rw-r--r--source/blender/render/intern/multires_bake.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c
index a3fc22f5dbc..c573d4feed1 100644
--- a/source/blender/render/intern/multires_bake.c
+++ b/source/blender/render/intern/multires_bake.c
@@ -106,26 +106,26 @@ 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 (smoothnormal) {
+ const int vi = data->mloop[data->mlooptri[tri_num].tri[vert_index]].v;
+ copy_v3_v3(r_normal, data->vert_normals[vi]);
+ }
+ else {
if (data->precomputed_normals) {
- copy_v3_v3(norm, data->precomputed_normals[poly_index]);
+ copy_v3_v3(r_normal, data->precomputed_normals[poly_index]);
}
else {
- BKE_mesh_calc_poly_normal(mp, &data->mloop[mp->loopstart], data->mvert, norm);
+ BKE_mesh_calc_poly_normal(mp, &data->mloop[mp->loopstart], data->mvert, r_normal);
}
}
- else {
- const int vi = data->mloop[data->mlooptri[tri_num].tri[vert_index]].v;
- copy_v3_v3(norm, data->vert_normals[vi]);
- }
}
static void init_bake_rast(MBakeRast *bake_rast,
@@ -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);