[Bf-blender-cvs] [07f6be87a97] master: Cleanup: style (render module)

Campbell Barton noreply at git.blender.org
Mon Mar 25 01:58:30 CET 2019


Commit: 07f6be87a97ed952c82804abc7f647c488c8ed3a
Author: Campbell Barton
Date:   Mon Mar 25 11:55:36 2019 +1100
Branches: master
https://developer.blender.org/rB07f6be87a97ed952c82804abc7f647c488c8ed3a

Cleanup: style (render module)

===================================================================

M	source/blender/render/intern/source/bake_api.c
M	source/blender/render/intern/source/external_engine.c
M	source/blender/render/intern/source/imagetexture.c
M	source/blender/render/intern/source/initrender.c
M	source/blender/render/intern/source/multires_bake.c
M	source/blender/render/intern/source/pipeline.c
M	source/blender/render/intern/source/pointdensity.c
M	source/blender/render/intern/source/render_result.c
M	source/blender/render/intern/source/render_texture.c
M	source/blender/render/intern/source/zbuf.c

===================================================================

diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index a658a0e1138..5e63f76ca80 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -362,7 +362,7 @@ static bool cast_ray_highpoly(
 
 		/* transfer position differentials */
 		float tmp[3];
-		mul_v3_v3fl(tmp, dir_high, 1.0f/dot_v3v3(dir_high, triangle_high->normal));
+		mul_v3_v3fl(tmp, dir_high, 1.0f / dot_v3v3(dir_high, triangle_high->normal));
 		madd_v3_v3fl(dxco, tmp, -dot_v3v3(dxco, triangle_high->normal));
 		madd_v3_v3fl(dyco, tmp, -dot_v3v3(dyco, triangle_high->normal));
 
@@ -421,10 +421,10 @@ static TriTessFace *mesh_calc_tri_tessface(
 	}
 
 	BKE_mesh_recalc_looptri(
-	            me->mloop, me->mpoly,
-	            me->mvert,
-	            me->totloop, me->totpoly,
-	            looptri);
+	        me->mloop, me->mpoly,
+	        me->mvert,
+	        me->totloop, me->totpoly,
+	        looptri);
 
 	const float *precomputed_normals = CustomData_get_layer(&me->pdata, CD_NORMAL);
 	const bool calculate_normal = precomputed_normals ? false : true;
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index b29d504c21f..a9bf80a6aa0 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -273,7 +273,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, bool cance
 		RenderPart *pa = get_part_from_result(re, result);
 
 		if (pa) {
-			pa->status = (!cancel && merge_results)? PART_STATUS_MERGED: PART_STATUS_RENDERED;
+			pa->status = (!cancel && merge_results) ? PART_STATUS_MERGED : PART_STATUS_RENDERED;
 		}
 		else if (re->result->do_exr_tile) {
 			/* if written result does not match any tile and we are using save
@@ -505,7 +505,7 @@ static void engine_depsgraph_free(RenderEngine *engine)
 
 void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
 {
-	if(!engine->depsgraph) {
+	if (!engine->depsgraph) {
 		return;
 	}
 
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index e246592f24e..e67a07e791e 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -63,27 +63,27 @@ static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
 	int ofs = y * ibuf->x + x;
 
 	if (ibuf->rect_float) {
-		if (ibuf->channels==4) {
-			const float *fp= ibuf->rect_float + 4*ofs;
+		if (ibuf->channels == 4) {
+			const float *fp = ibuf->rect_float + 4 * ofs;
 			copy_v4_v4(col, fp);
 		}
-		else if (ibuf->channels==3) {
-			const float *fp= ibuf->rect_float + 3*ofs;
+		else if (ibuf->channels == 3) {
+			const float *fp = ibuf->rect_float + 3 * ofs;
 			copy_v3_v3(col, fp);
-			col[3]= 1.0f;
+			col[3] = 1.0f;
 		}
 		else {
-			const float *fp= ibuf->rect_float + ofs;
-			col[0]= col[1]= col[2]= col[3]= *fp;
+			const float *fp = ibuf->rect_float + ofs;
+			col[0] = col[1] = col[2] = col[3] = *fp;
 		}
 	}
 	else {
-		const char *rect = (char *)( ibuf->rect+ ofs);
+		const char *rect = (char *)(ibuf->rect + ofs);
 
-		col[0] = ((float)rect[0])*(1.0f/255.0f);
-		col[1] = ((float)rect[1])*(1.0f/255.0f);
-		col[2] = ((float)rect[2])*(1.0f/255.0f);
-		col[3] = ((float)rect[3])*(1.0f/255.0f);
+		col[0] = ((float)rect[0]) * (1.0f / 255.0f);
+		col[1] = ((float)rect[1]) * (1.0f / 255.0f);
+		col[2] = ((float)rect[2]) * (1.0f / 255.0f);
+		col[3] = ((float)rect[3]) * (1.0f / 255.0f);
 
 		/* bytes are internally straight, however render pipeline seems to expect premul */
 		col[0] *= col[3];
@@ -98,13 +98,13 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 	int x, y, retval;
 	int xi, yi; /* original values */
 
-	texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f;
+	texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
 
 	/* we need to set retval OK, otherwise texture code generates normals itself... */
-	retval= texres->nor ? 3 : 1;
+	retval = texres->nor ? 3 : 1;
 
 	/* quick tests */
-	if (ibuf==NULL && ima==NULL)
+	if (ibuf == NULL && ima == NULL)
 		return retval;
 	if (ima) {
 
@@ -114,9 +114,9 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 
 		ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
 
-		ima->flag|= IMA_USED_FOR_RENDER;
+		ima->flag |= IMA_USED_FOR_RENDER;
 	}
-	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
+	if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
 		if (ima)
 			BKE_image_pool_release_ibuf(ima, ibuf, pool);
 		return retval;
@@ -124,21 +124,21 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 
 	/* setup mapping */
 	if (tex->imaflag & TEX_IMAROT) {
-		fy= texvec[0];
-		fx= texvec[1];
+		fy = texvec[0];
+		fx = texvec[1];
 	}
 	else {
-		fx= texvec[0];
-		fy= texvec[1];
+		fx = texvec[0];
+		fy = texvec[1];
 	}
 
 	if (tex->extend == TEX_CHECKER) {
 		int xs, ys;
 
-		xs= (int)floor(fx);
-		ys= (int)floor(fy);
-		fx-= xs;
-		fy-= ys;
+		xs = (int)floor(fx);
+		ys = (int)floor(fy);
+		fx -= xs;
+		fy -= ys;
 
 		if ( (tex->flag & TEX_CHECKER_ODD) == 0) {
 			if ((xs + ys) & 1) {
@@ -150,53 +150,53 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 				return retval;
 			}
 		}
-		if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
-			if ((xs+ys) & 1) {
+		if ( (tex->flag & TEX_CHECKER_EVEN) == 0) {
+			if ((xs + ys) & 1) {
 				if (ima)
 					BKE_image_pool_release_ibuf(ima, ibuf, pool);
 				return retval;
 			}
 		}
 		/* scale around center, (0.5, 0.5) */
-		if (tex->checkerdist<1.0f) {
-			fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
-			fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
+		if (tex->checkerdist < 1.0f) {
+			fx = (fx - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
+			fy = (fy - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
 		}
 	}
 
-	x= xi= (int)floorf(fx*ibuf->x);
-	y= yi= (int)floorf(fy*ibuf->y);
+	x = xi = (int)floorf(fx * ibuf->x);
+	y = yi = (int)floorf(fy * ibuf->y);
 
 	if (tex->extend == TEX_CLIPCUBE) {
-		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
+		if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y || texvec[2] < -1.0f || texvec[2] > 1.0f) {
 			if (ima)
 				BKE_image_pool_release_ibuf(ima, ibuf, pool);
 			return retval;
 		}
 	}
-	else if ( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
-		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
+	else if (tex->extend == TEX_CLIP || tex->extend == TEX_CHECKER) {
+		if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y) {
 			if (ima)
 				BKE_image_pool_release_ibuf(ima, ibuf, pool);
 			return retval;
 		}
 	}
 	else {
-		if (tex->extend==TEX_EXTEND) {
-			if (x>=ibuf->x) x = ibuf->x-1;
-			else if (x<0) x= 0;
+		if (tex->extend == TEX_EXTEND) {
+			if (x >= ibuf->x) x = ibuf->x - 1;
+			else if (x < 0) x = 0;
 		}
 		else {
-			x= x % ibuf->x;
-			if (x<0) x+= ibuf->x;
+			x = x % ibuf->x;
+			if (x < 0) x += ibuf->x;
 		}
-		if (tex->extend==TEX_EXTEND) {
-			if (y>=ibuf->y) y = ibuf->y-1;
-			else if (y<0) y= 0;
+		if (tex->extend == TEX_EXTEND) {
+			if (y >= ibuf->y) y = ibuf->y - 1;
+			else if (y < 0) y = 0;
 		}
 		else {
-			y= y % ibuf->y;
-			if (y<0) y+= ibuf->y;
+			y = y % ibuf->y;
+			if (y < 0) y += ibuf->y;
 		}
 	}
 
@@ -221,7 +221,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		fx -= (float)(xi - x) / (float)ibuf->x;
 		fy -= (float)(yi - y) / (float)ibuf->y;
 
-		boxsample(ibuf, fx-filterx, fy-filtery, fx+filterx, fy+filtery, texres, (tex->extend==TEX_REPEAT), (tex->extend==TEX_EXTEND));
+		boxsample(ibuf, fx - filterx, fy - filtery, fx + filterx, fy + filtery, texres, (tex->extend == TEX_REPEAT), (tex->extend == TEX_EXTEND));
 	}
 	else { /* no filtering */
 		ibuf_get_color(&texres->tr, ibuf, x, y);
@@ -236,35 +236,35 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 			 * the normal used in the renderer points inward. It is generated
 			 * this way in calc_vertexnormals(). Should this ever change
 			 * this negate must be removed. */
-			texres->nor[0] = -2.f*(texres->tr - 0.5f);
-			texres->nor[1] = 2.f*(texres->tg - 0.5f);
-			texres->nor[2] = 2.f*(texres->tb - 0.5f);
+			texres->nor[0] = -2.f * (texres->tr - 0.5f);
+			texres->nor[1] = 2.f * (texres->tg - 0.5f);
+			texres->nor[2] = 2.f * (texres->tb - 0.5f);
 		}
 		else {
 			/* bump: take three samples */
-			val1= texres->tr+texres->tg+texres->tb;
+			val1 = texres->tr + texres->tg + texres->tb;
 
-			if (x<ibuf->x-1) {
+			if (x < ibuf->x - 1) {
 				float col[4];
-				ibuf_get_color(col, ibuf, x+1, y);
-				val2= (col[0]+col[1]+col[2]);
+				ibuf_get_color(col, ibuf, x + 1, y);
+				val2 = (col[0] + col[1] + col[2]);
 			}
 			else {
-				val2= val1;
+				val2 = val1;
 			}
 
-			if (y<ibuf->y-1) {
+			if (y < ibuf->y - 1) {
 				float col[4];
-				ibuf_get_color(col, ibuf, x, y+1);
-				val3 = (col[0]+col[1]+col[2]);
+				ibuf_get_color(col, ibuf, x, y + 1);
+				val3 = (col[0] + col[1] + col[2]);
 			}
 			else {
 				val3 = val1;
 			}
 
 			/* do not mix up x and y here! */
-			texres->nor[0]= (val1-val2);
-			texres->nor[1]= (val1-val3);
+			texres->nor[0] = (val1 - val2);
+			texres->nor[1] = (val1 - val3);
 		}
 	}
 
@@ -284,11 +284,11 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 
 	/* de-premul, this is being premulled in shade_input_do_shade()
 	 * do not de-premul for generated alpha, it is already in straight */
-	if (texres->ta!=1.0f && texres->ta>1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
-		fx= 1.0f/texres->ta;
-		texres->tr*= fx;
-		texres->tg*= fx;
-		texres->tb*= fx;
+	if (texres->ta != 1.0f && texres->ta > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
+		fx = 1.0f / texres->ta;
+		texres->tr *= fx;
+		texres->tg *= fx;
+		texres->tb *= fx;
 	}
 
 	if (ima)
@@ -304,45 +304,45 @@ static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
 	rctf *rf, *newrct;
 	short a;
 
-	a= *count;
-	r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list