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
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-28 07:04:21 +0300
committerHans Goudey <h.goudey@me.com>2022-09-28 07:04:21 +0300
commitc4b7ffa6f50c9680059fd221b5d7391fae6e6f29 (patch)
tree431834a347a5cab1347ff92eb7290a8cebe04079 /source/blender/render/intern
parent0f36ad24b5031f78664a935a3c483751e173e308 (diff)
parent788f3d72cf89c0301721a5eb2a72da07058dfa24 (diff)
Merge branch 'master' into refactor-mesh-position-generic
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/bake.c2
-rw-r--r--source/blender/render/intern/engine.cc2
-rw-r--r--source/blender/render/intern/initrender.cc2
-rw-r--r--source/blender/render/intern/multires_bake.c32
-rw-r--r--source/blender/render/intern/pipeline.cc15
-rw-r--r--source/blender/render/intern/render_result.cc22
-rw-r--r--source/blender/render/intern/texture_margin.cc8
7 files changed, 37 insertions, 46 deletions
diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c
index c49481495a8..fef8c9b530b 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -456,7 +456,7 @@ static TriTessFace *mesh_calc_tri_tessface(Mesh *me, bool tangent, Mesh *me_eval
TriTessFace *triangles;
/* calculate normal for each polygon only once */
- unsigned int mpoly_prev = UINT_MAX;
+ uint mpoly_prev = UINT_MAX;
float no[3];
const float(*positions)[3] = BKE_mesh_positions(me);
diff --git a/source/blender/render/intern/engine.cc b/source/blender/render/intern/engine.cc
index 87152822fab..9b5a5fff6b0 100644
--- a/source/blender/render/intern/engine.cc
+++ b/source/blender/render/intern/engine.cc
@@ -802,7 +802,7 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
DEG_ids_clear_recalc(engine->depsgraph, false);
Render *re = engine->re;
- double cfra = (double)frame + (double)subframe;
+ double cfra = double(frame) + double(subframe);
CLAMP(cfra, MINAFRAME, MAXFRAME);
BKE_scene_frame_set(re->scene, cfra);
diff --git a/source/blender/render/intern/initrender.cc b/source/blender/render/intern/initrender.cc
index 1ea93cbf6c8..591791587fe 100644
--- a/source/blender/render/intern/initrender.cc
+++ b/source/blender/render/intern/initrender.cc
@@ -128,7 +128,7 @@ float RE_filter_value(int type, float x)
case R_FILTER_FAST_GAUSS: {
const float two_gaussfac2 = 2.0f * gaussfac * gaussfac;
x *= 3.0f * gaussfac;
- return 1.0f / sqrtf((float)M_PI * two_gaussfac2) * expf(-x * x / two_gaussfac2);
+ return 1.0f / sqrtf(float(M_PI) * two_gaussfac2) * expf(-x * x / two_gaussfac2);
}
case R_FILTER_MITCH:
diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c
index e1d6b3dfd50..3f37b80f320 100644
--- a/source/blender/render/intern/multires_bake.c
+++ b/source/blender/render/intern/multires_bake.c
@@ -994,7 +994,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm,
rrgbf[3] = 1.0f;
}
else {
- unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
+ uchar *rrgb = (uchar *)ibuf->rect + pixel * 4;
rgb_float_to_uchar(rrgb, vec);
rrgb[3] = 255;
}
@@ -1007,8 +1007,8 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm,
/* Must be a power of two. */
# define MAX_NUMBER_OF_AO_RAYS 1024
-static unsigned short ao_random_table_1[MAX_NUMBER_OF_AO_RAYS];
-static unsigned short ao_random_table_2[MAX_NUMBER_OF_AO_RAYS];
+static ushort ao_random_table_1[MAX_NUMBER_OF_AO_RAYS];
+static ushort ao_random_table_2[MAX_NUMBER_OF_AO_RAYS];
static void init_ao_random(void)
{
@@ -1020,18 +1020,18 @@ static void init_ao_random(void)
}
}
-static unsigned short get_ao_random1(const int i)
+static ushort get_ao_random1(const int i)
{
return ao_random_table_1[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
}
-static unsigned short get_ao_random2(const int i)
+static ushort get_ao_random2(const int i)
{
return ao_random_table_2[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
}
-static void build_permutation_table(unsigned short permutation[],
- unsigned short temp_permutation[],
+static void build_permutation_table(ushort permutation[],
+ ushort temp_permutation[],
const int number_of_rays,
const int is_first_perm_table)
{
@@ -1042,9 +1042,9 @@ static void build_permutation_table(unsigned short permutation[],
}
for (i = 0; i < number_of_rays; i++) {
- const unsigned int nr_entries_left = number_of_rays - i;
- unsigned short rnd = is_first_perm_table != false ? get_ao_random1(i) : get_ao_random2(i);
- const unsigned short entry = rnd % nr_entries_left;
+ const uint nr_entries_left = number_of_rays - i;
+ ushort rnd = is_first_perm_table != false ? get_ao_random1(i) : get_ao_random2(i);
+ const ushort entry = rnd % nr_entries_left;
/* pull entry */
permutation[i] = temp_permutation[entry];
@@ -1114,7 +1114,7 @@ static void *init_ao_data(MultiresBakeRender *bkr, ImBuf *UNUSED(ibuf))
{
MAOBakeData *ao_data;
DerivedMesh *lodm = bkr->lores_dm;
- unsigned short *temp_permutation_table;
+ ushort *temp_permutation_table;
size_t permutation_size;
init_ao_random();
@@ -1129,7 +1129,7 @@ static void *init_ao_data(MultiresBakeRender *bkr, ImBuf *UNUSED(ibuf))
create_ao_raytree(bkr, ao_data);
/* initialize permutation tables */
- permutation_size = sizeof(unsigned short) * bkr->number_of_rays;
+ permutation_size = sizeof(ushort) * bkr->number_of_rays;
ao_data->permutation_table_1 = MEM_callocN(permutation_size, "multires AO baker perm1");
ao_data->permutation_table_2 = MEM_callocN(permutation_size, "multires AO baker perm2");
temp_permutation_table = MEM_callocN(permutation_size, "multires AO baker temp perm");
@@ -1271,9 +1271,9 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
/* use N-Rooks to distribute our N ray samples across
* a multi-dimensional domain (2D)
*/
- const unsigned short I =
+ const ushort I =
ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays];
- const unsigned short J = ao_data->permutation_table_2[i];
+ const ushort J = ao_data->permutation_table_2[i];
const float JitPh = (get_ao_random2(I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
((float)MAX_NUMBER_OF_AO_RAYS);
@@ -1315,7 +1315,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
rrgbf[3] = 1.0f;
}
else {
- unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
+ uchar *rrgb = (uchar *)ibuf->rect + pixel * 4;
rrgb[0] = rrgb[1] = rrgb[2] = unit_float_to_uchar_clamp(value);
rrgb[3] = 255;
}
@@ -1391,7 +1391,7 @@ static void bake_ibuf_normalize_displacement(ImBuf *ibuf,
}
if (ibuf->rect) {
- unsigned char *cp = (unsigned char *)(ibuf->rect + i);
+ uchar *cp = (uchar *)(ibuf->rect + i);
cp[0] = cp[1] = cp[2] = unit_float_to_uchar_clamp(normalized_displacement);
cp[3] = 255;
}
diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc
index 3c9849591f4..3dca26356df 100644
--- a/source/blender/render/intern/pipeline.cc
+++ b/source/blender/render/intern/pipeline.cc
@@ -475,7 +475,7 @@ void RE_ReleaseResultImage(Render *re)
}
}
-void RE_ResultGet32(Render *re, unsigned int *rect)
+void RE_ResultGet32(Render *re, uint *rect)
{
RenderResult rres;
const int view_id = BKE_scene_multiview_view_id_get(&re->r, re->viewname);
@@ -491,10 +491,7 @@ void RE_ResultGet32(Render *re, unsigned int *rect)
RE_ReleaseResultImageViews(re, &rres);
}
-void RE_AcquiredResultGet32(Render *re,
- RenderResult *result,
- unsigned int *rect,
- const int view_id)
+void RE_AcquiredResultGet32(Render *re, RenderResult *result, uint *rect, const int view_id)
{
render_result_rect_get_pixels(result,
rect,
@@ -1241,7 +1238,7 @@ static void renderresult_stampinfo(Render *re)
BKE_image_stamp_buf(re->scene,
ob_camera_eval,
(re->r.stamp & R_STAMP_STRIPMETA) ? rres.stamp_data : nullptr,
- (unsigned char *)rres.rect32,
+ (uchar *)rres.rect32,
rres.rectf,
rres.rectx,
rres.recty,
@@ -1371,7 +1368,7 @@ static void do_render_sequencer(Render *re)
/* set overall progress of sequence rendering */
if (re->r.efra != re->r.sfra) {
- re->progress(re->prh, (float)(cfra - re->r.sfra) / (re->r.efra - re->r.sfra));
+ re->progress(re->prh, float(cfra - re->r.sfra) / (re->r.efra - re->r.sfra));
}
else {
re->progress(re->prh, 1.0f);
@@ -2328,7 +2325,7 @@ void RE_RenderAnim(Render *re,
if (is_movie == false && do_write_file) {
if (rd.mode & R_TOUCH) {
if (!is_multiview_name) {
- if ((BLI_file_size(name) == 0)) {
+ if (BLI_file_size(name) == 0) {
/* BLI_exists(name) is implicit */
BLI_delete(name, false, false);
}
@@ -2343,7 +2340,7 @@ void RE_RenderAnim(Render *re,
BKE_scene_multiview_filepath_get(srv, name, filepath);
- if ((BLI_file_size(filepath) == 0)) {
+ if (BLI_file_size(filepath) == 0) {
/* BLI_exists(filepath) is implicit */
BLI_delete(filepath, false, false);
}
diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc
index 8b7a07e2b3f..7c4b0713d7c 100644
--- a/source/blender/render/intern/render_result.cc
+++ b/source/blender/render/intern/render_result.cc
@@ -169,7 +169,7 @@ static void render_layer_allocate_pass(RenderResult *rr, RenderPass *rp)
return;
}
- const size_t rectsize = ((size_t)rr->rectx) * rr->recty * rp->channels;
+ const size_t rectsize = size_t(rr->rectx) * rr->recty * rp->channels;
rp->rect = MEM_cnew_array<float>(rectsize, rp->name);
if (STREQ(rp->name, RE_PASSNAME_VECTOR)) {
@@ -654,8 +654,8 @@ static int order_render_passes(const void *a, const void *b)
/* 1 if `a` is after `b`. */
RenderPass *rpa = (RenderPass *)a;
RenderPass *rpb = (RenderPass *)b;
- unsigned int passtype_a = passtype_from_name(rpa->name);
- unsigned int passtype_b = passtype_from_name(rpb->name);
+ uint passtype_a = passtype_from_name(rpa->name);
+ uint passtype_b = passtype_from_name(rpb->name);
/* Render passes with default type always go first. */
if (passtype_b && !passtype_a) {
@@ -780,7 +780,7 @@ static void do_merge_tile(
copylen = tilex = rrpart->rectx;
tiley = rrpart->recty;
- ofs = (((size_t)rrpart->tilerect.ymin) * rr->rectx + rrpart->tilerect.xmin);
+ ofs = (size_t(rrpart->tilerect.ymin) * rr->rectx + rrpart->tilerect.xmin);
target += pixsize * ofs;
copylen *= sizeof(float) * pixsize;
@@ -1026,7 +1026,7 @@ ImBuf *RE_render_result_rect_to_ibuf(RenderResult *rr,
RenderView *rv = RE_RenderViewGetById(rr, view_id);
/* if not exists, BKE_imbuf_write makes one */
- ibuf->rect = (unsigned int *)rv->rect32;
+ ibuf->rect = (uint *)rv->rect32;
ibuf->rect_float = rv->rectf;
ibuf->zbuf_float = rv->rectz;
@@ -1112,7 +1112,7 @@ void render_result_rect_fill_zero(RenderResult *rr, const int view_id)
}
void render_result_rect_get_pixels(RenderResult *rr,
- unsigned int *rect,
+ uint *rect,
int rectx,
int recty,
const ColorManagedViewSettings *view_settings,
@@ -1125,14 +1125,8 @@ void render_result_rect_get_pixels(RenderResult *rr,
memcpy(rect, rv->rect32, sizeof(int) * rr->rectx * rr->recty);
}
else if (rv && rv->rectf) {
- IMB_display_buffer_transform_apply((unsigned char *)rect,
- rv->rectf,
- rr->rectx,
- rr->recty,
- 4,
- view_settings,
- display_settings,
- true);
+ IMB_display_buffer_transform_apply(
+ (uchar *)rect, rv->rectf, rr->rectx, rr->recty, 4, view_settings, display_settings, true);
}
else {
/* else fill with black */
diff --git a/source/blender/render/intern/texture_margin.cc b/source/blender/render/intern/texture_margin.cc
index e1eb01575b6..e17fa8faad6 100644
--- a/source/blender/render/intern/texture_margin.cc
+++ b/source/blender/render/intern/texture_margin.cc
@@ -245,8 +245,8 @@ class TextureMarginMap {
for (int i = 0; i < maxPolygonSteps; i++) {
/* Force to pixel grid. */
- int nx = (int)round(destX);
- int ny = (int)round(destY);
+ int nx = int(round(destX));
+ int ny = int(round(destY));
uint32_t polygon_from_map = get_pixel(nx, ny);
if (other_poly == polygon_from_map) {
found_pixel_in_polygon = true;
@@ -566,8 +566,8 @@ static void generate_margin(ImBuf *ibuf,
* our intersection tests where a pixel gets in between 2 faces or the middle of a quad,
* camera aligned quads also have this problem but they are less common.
* Add a small offset to the UVs, fixes bug T18685. */
- vec[a][0] = (uv[0] - uv_offset[0]) * (float)ibuf->x - (0.5f + 0.001f);
- vec[a][1] = (uv[1] - uv_offset[1]) * (float)ibuf->y - (0.5f + 0.002f);
+ vec[a][0] = (uv[0] - uv_offset[0]) * float(ibuf->x) - (0.5f + 0.001f);
+ vec[a][1] = (uv[1] - uv_offset[1]) * float(ibuf->y) - (0.5f + 0.002f);
}
/* NOTE: we need the top bit for the dijkstra distance map. */