From a1bc7729f20b8a8250f938d768ab2d104c41af54 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 8 Mar 2021 14:48:45 +1100 Subject: Cleanup: use ofs instead of offs as an abbreviation for offset Used for local structs/variables, since `ofs` is by far the most widely used abbreviation. --- source/blender/render/intern/multires_bake.c | 16 ++++----- source/blender/render/intern/texture_procedural.c | 40 +++++++++++------------ 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'source/blender/render') diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c index 1859886f563..cba4628b63a 100644 --- a/source/blender/render/intern/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c @@ -658,10 +658,10 @@ static void get_ccgdm_data(DerivedMesh *lodm, /* get the original cage face index */ int cage_face_index = index_mp_to_orig ? index_mp_to_orig[poly_index] : poly_index; /* local offset in total cage face grids - * (1 << (2 * lvl)) is number of all polys for one cage face */ - int loc_cage_poly_offs = poly_index % (1 << (2 * lvl)); + * `(1 << (2 * lvl))` is number of all polys for one cage face */ + int loc_cage_poly_ofs = poly_index % (1 << (2 * lvl)); /* local offset in the vertex grid itself */ - int cell_index = loc_cage_poly_offs % (polys_per_grid_side * polys_per_grid_side); + int cell_index = loc_cage_poly_ofs % (polys_per_grid_side * polys_per_grid_side); int cell_side = (grid_size - 1) / polys_per_grid_side; /* row and column based on grid side */ int row = cell_index / polys_per_grid_side; @@ -1193,7 +1193,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, MLoopUV *mloopuv = lores_dm->getLoopDataArray(lores_dm, CD_MLOOPUV); MAOBakeData *ao_data = (MAOBakeData *)bake_data; - int i, k, perm_offs; + int i, k, perm_ofs; float pos[3], nrm[3]; float cen[3]; float axisX[3], axisY[3], axisZ[3]; @@ -1236,7 +1236,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, build_coordinate_frame(axisX, axisY, axisZ); /* static noise */ - perm_offs = (get_ao_random2(get_ao_random1(x) + y)) & (MAX_NUMBER_OF_AO_RAYS - 1); + perm_ofs = (get_ao_random2(get_ao_random1(x) + y)) & (MAX_NUMBER_OF_AO_RAYS - 1); /* importance sample shadow rays (cosine weighted) */ for (i = 0; i < ao_data->number_of_rays; i++) { @@ -1246,12 +1246,12 @@ static void apply_ao_callback(DerivedMesh *lores_dm, * a multi-dimensional domain (2D) */ const unsigned short I = - ao_data->permutation_table_1[(i + perm_offs) % ao_data->number_of_rays]; + ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays]; const unsigned short J = ao_data->permutation_table_2[i]; - const float JitPh = (get_ao_random2(I + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / + const float JitPh = (get_ao_random2(I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / ((float)MAX_NUMBER_OF_AO_RAYS); - const float JitTh = (get_ao_random1(J + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / + const float JitTh = (get_ao_random1(J + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / ((float)MAX_NUMBER_OF_AO_RAYS); const float SiSqPhi = (I + JitPh) / ao_data->number_of_rays; const float Theta = (float)(2 * M_PI) * ((J + JitTh) / ao_data->number_of_rays); diff --git a/source/blender/render/intern/texture_procedural.c b/source/blender/render/intern/texture_procedural.c index b0ab20de10d..bea9dfbb0ed 100644 --- a/source/blender/render/intern/texture_procedural.c +++ b/source/blender/render/intern/texture_procedural.c @@ -555,10 +555,10 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult tex->noisebasis); if (texres->nor != NULL) { - float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ + float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + offs, + texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + ofs, texvec[1], texvec[2], tex->mg_H, @@ -566,7 +566,7 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult tex->mg_octaves, tex->noisebasis); texres->nor[1] = tex->ns_outscale * mgravefunc(texvec[0], - texvec[1] + offs, + texvec[1] + ofs, texvec[2], tex->mg_H, tex->mg_lacunarity, @@ -574,7 +574,7 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult tex->noisebasis); texres->nor[2] = tex->ns_outscale * mgravefunc(texvec[0], texvec[1], - texvec[2] + offs, + texvec[2] + ofs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, @@ -612,10 +612,10 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu tex->noisebasis); if (texres->nor != NULL) { - float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ + float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + offs, + texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + ofs, texvec[1], texvec[2], tex->mg_H, @@ -625,7 +625,7 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu tex->mg_gain, tex->noisebasis); texres->nor[1] = tex->ns_outscale * mgravefunc(texvec[0], - texvec[1] + offs, + texvec[1] + ofs, texvec[2], tex->mg_H, tex->mg_lacunarity, @@ -635,7 +635,7 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu tex->noisebasis); texres->nor[2] = tex->ns_outscale * mgravefunc(texvec[0], texvec[1], - texvec[2] + offs, + texvec[2] + ofs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, @@ -666,10 +666,10 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr tex->noisebasis); if (texres->nor != NULL) { - float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ + float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + offs, + texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + ofs, texvec[1], texvec[2], tex->mg_H, @@ -678,7 +678,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr tex->mg_offset, tex->noisebasis); texres->nor[1] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0], - texvec[1] + offs, + texvec[1] + ofs, texvec[2], tex->mg_H, tex->mg_lacunarity, @@ -687,7 +687,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr tex->noisebasis); texres->nor[2] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0], texvec[1], - texvec[2] + offs, + texvec[2] + ofs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, @@ -711,24 +711,24 @@ static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *tex texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); if (texres->nor != NULL) { - float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ + float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + offs, + texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + ofs, texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); texres->nor[1] = BLI_noise_mg_variable_lacunarity(texvec[0], - texvec[1] + offs, + texvec[1] + ofs, texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); texres->nor[2] = BLI_noise_mg_variable_lacunarity(texvec[0], texvec[1], - texvec[2] + offs, + texvec[2] + ofs, tex->dist_amount, tex->noisebasis, tex->noisebasis2); @@ -805,14 +805,14 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres) } if (texres->nor != NULL) { - float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ + float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - BLI_noise_voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + BLI_noise_voronoi(texvec[0] + ofs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[0] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); - BLI_noise_voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + BLI_noise_voronoi(texvec[0], texvec[1] + ofs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[1] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); - BLI_noise_voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); + BLI_noise_voronoi(texvec[0], texvec[1], texvec[2] + ofs, da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[2] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); tex_normal_derivate(tex, texres); -- cgit v1.2.3