diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-08-29 18:31:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-08-29 18:31:20 +0300 |
commit | 39eb05161690510ecec4c30129a9f8d5532d39c9 (patch) | |
tree | db0773b3d0728237e267845a91a97724d3b05934 /source/blender/render/intern | |
parent | 76a9752be21a593387900e3885472de988a5a5c0 (diff) |
Cleanup: indentation
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/source/bake_api.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 36 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 492 | ||||
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 27 |
5 files changed, 282 insertions, 279 deletions
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c index 8b25c1fe962..4d5a8458897 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/source/bake_api.c @@ -568,7 +568,8 @@ bool RE_bake_pixels_populate_from_objects( /* cast ray */ if (!cast_ray_highpoly(treeData, tri_low, tris_high, pixel_array_from, pixel_array_to, mat_low, - highpoly, co, dir, i, tot_highpoly)) { + highpoly, co, dir, i, tot_highpoly)) + { /* if it fails mask out the original pixel array */ pixel_array_from[i].primitive_id = -1; } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index ba4bca35a34..15432af4915 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3757,24 +3757,24 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) } else if (lar->type==LA_AREA) { switch (lar->area_shape) { - case LA_AREA_SQUARE: - lar->ray_totsamp= lar->ray_samp*lar->ray_samp; - lar->ray_sampy= lar->ray_samp; - lar->area_sizey= lar->area_size; - break; - case LA_AREA_RECT: - lar->ray_totsamp= lar->ray_samp*lar->ray_sampy; - break; - case LA_AREA_CUBE: - lar->ray_totsamp= lar->ray_samp*lar->ray_samp*lar->ray_samp; - lar->ray_sampy= lar->ray_samp; - lar->ray_sampz= lar->ray_samp; - lar->area_sizey= lar->area_size; - lar->area_sizez= lar->area_size; - break; - case LA_AREA_BOX: - lar->ray_totsamp= lar->ray_samp*lar->ray_sampy*lar->ray_sampz; - break; + case LA_AREA_SQUARE: + lar->ray_totsamp= lar->ray_samp*lar->ray_samp; + lar->ray_sampy= lar->ray_samp; + lar->area_sizey= lar->area_size; + break; + case LA_AREA_RECT: + lar->ray_totsamp= lar->ray_samp*lar->ray_sampy; + break; + case LA_AREA_CUBE: + lar->ray_totsamp= lar->ray_samp*lar->ray_samp*lar->ray_samp; + lar->ray_sampy= lar->ray_samp; + lar->ray_sampz= lar->ray_samp; + lar->area_sizey= lar->area_size; + lar->area_sizez= lar->area_size; + break; + case LA_AREA_BOX: + lar->ray_totsamp= lar->ray_samp*lar->ray_sampy*lar->ray_sampz; + break; } area_lamp_vectors(lar); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index a79d0c3098f..4f2b0980762 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -912,7 +912,8 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil /* Skip non-RGBA and Z passes if not using multi layer. */ if (!multi_layer && !(STREQ(rp->name, RE_PASSNAME_COMBINED) || STREQ(rp->name, "") || - (STREQ(rp->name, RE_PASSNAME_Z) && write_z))) { + (STREQ(rp->name, RE_PASSNAME_Z) && write_z))) + { continue; } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 8450098d733..7426e953632 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1453,127 +1453,127 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa float facm; switch (blendtype) { - case MTEX_BLEND: - fact*= facg; - facm= 1.0f-fact; - - in[0]= (fact*tex[0] + facm*out[0]); - in[1]= (fact*tex[1] + facm*out[1]); - in[2]= (fact*tex[2] + facm*out[2]); - break; - - case MTEX_MUL: - fact*= facg; - facm= 1.0f-fact; - in[0]= (facm+fact*tex[0])*out[0]; - in[1]= (facm+fact*tex[1])*out[1]; - in[2]= (facm+fact*tex[2])*out[2]; - break; - - case MTEX_SCREEN: - fact*= facg; - facm= 1.0f-fact; - in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]); - in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]); - in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]); - break; - - case MTEX_OVERLAY: - fact*= facg; - facm= 1.0f-fact; - - if (out[0] < 0.5f) - in[0] = out[0] * (facm + 2.0f*fact*tex[0]); - else - in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]); - if (out[1] < 0.5f) - in[1] = out[1] * (facm + 2.0f*fact*tex[1]); - else - in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]); - if (out[2] < 0.5f) - in[2] = out[2] * (facm + 2.0f*fact*tex[2]); - else - in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]); - break; - - case MTEX_SUB: - fact= -fact; - ATTR_FALLTHROUGH; - case MTEX_ADD: - fact*= facg; - in[0]= (fact*tex[0] + out[0]); - in[1]= (fact*tex[1] + out[1]); - in[2]= (fact*tex[2] + out[2]); - break; - - case MTEX_DIV: - fact*= facg; - facm= 1.0f-fact; - - if (tex[0]!=0.0f) - in[0]= facm*out[0] + fact*out[0]/tex[0]; - if (tex[1]!=0.0f) - in[1]= facm*out[1] + fact*out[1]/tex[1]; - if (tex[2]!=0.0f) - in[2]= facm*out[2] + fact*out[2]/tex[2]; - - break; - - case MTEX_DIFF: - fact*= facg; - facm= 1.0f-fact; - in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]); - in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]); - in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]); - break; - - case MTEX_DARK: - fact*= facg; - facm= 1.0f-fact; - - in[0] = min_ff(out[0], tex[0])*fact + out[0]*facm; - in[1] = min_ff(out[1], tex[1])*fact + out[1]*facm; - in[2] = min_ff(out[2], tex[2])*fact + out[2]*facm; - break; - - case MTEX_LIGHT: - fact*= facg; - - in[0] = max_ff(fact * tex[0], out[0]); - in[1] = max_ff(fact * tex[1], out[1]); - in[2] = max_ff(fact * tex[2], out[2]); - break; - - case MTEX_BLEND_HUE: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_HUE, in, fact, tex); - break; - case MTEX_BLEND_SAT: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_SAT, in, fact, tex); - break; - case MTEX_BLEND_VAL: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_VAL, in, fact, tex); - break; - case MTEX_BLEND_COLOR: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_COLOR, in, fact, tex); - break; - case MTEX_SOFT_LIGHT: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_SOFT, in, fact, tex); - break; - case MTEX_LIN_LIGHT: - fact*= facg; - copy_v3_v3(in, out); - ramp_blend(MA_RAMP_LINEAR, in, fact, tex); - break; + case MTEX_BLEND: + fact*= facg; + facm= 1.0f-fact; + + in[0]= (fact*tex[0] + facm*out[0]); + in[1]= (fact*tex[1] + facm*out[1]); + in[2]= (fact*tex[2] + facm*out[2]); + break; + + case MTEX_MUL: + fact*= facg; + facm= 1.0f-fact; + in[0]= (facm+fact*tex[0])*out[0]; + in[1]= (facm+fact*tex[1])*out[1]; + in[2]= (facm+fact*tex[2])*out[2]; + break; + + case MTEX_SCREEN: + fact*= facg; + facm= 1.0f-fact; + in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]); + in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]); + in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]); + break; + + case MTEX_OVERLAY: + fact*= facg; + facm= 1.0f-fact; + + if (out[0] < 0.5f) + in[0] = out[0] * (facm + 2.0f*fact*tex[0]); + else + in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]); + if (out[1] < 0.5f) + in[1] = out[1] * (facm + 2.0f*fact*tex[1]); + else + in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]); + if (out[2] < 0.5f) + in[2] = out[2] * (facm + 2.0f*fact*tex[2]); + else + in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]); + break; + + case MTEX_SUB: + fact= -fact; + ATTR_FALLTHROUGH; + case MTEX_ADD: + fact*= facg; + in[0]= (fact*tex[0] + out[0]); + in[1]= (fact*tex[1] + out[1]); + in[2]= (fact*tex[2] + out[2]); + break; + + case MTEX_DIV: + fact*= facg; + facm= 1.0f-fact; + + if (tex[0]!=0.0f) + in[0]= facm*out[0] + fact*out[0]/tex[0]; + if (tex[1]!=0.0f) + in[1]= facm*out[1] + fact*out[1]/tex[1]; + if (tex[2]!=0.0f) + in[2]= facm*out[2] + fact*out[2]/tex[2]; + + break; + + case MTEX_DIFF: + fact*= facg; + facm= 1.0f-fact; + in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]); + in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]); + in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]); + break; + + case MTEX_DARK: + fact*= facg; + facm= 1.0f-fact; + + in[0] = min_ff(out[0], tex[0])*fact + out[0]*facm; + in[1] = min_ff(out[1], tex[1])*fact + out[1]*facm; + in[2] = min_ff(out[2], tex[2])*fact + out[2]*facm; + break; + + case MTEX_LIGHT: + fact*= facg; + + in[0] = max_ff(fact * tex[0], out[0]); + in[1] = max_ff(fact * tex[1], out[1]); + in[2] = max_ff(fact * tex[2], out[2]); + break; + + case MTEX_BLEND_HUE: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_HUE, in, fact, tex); + break; + case MTEX_BLEND_SAT: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_SAT, in, fact, tex); + break; + case MTEX_BLEND_VAL: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_VAL, in, fact, tex); + break; + case MTEX_BLEND_COLOR: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_COLOR, in, fact, tex); + break; + case MTEX_SOFT_LIGHT: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_SOFT, in, fact, tex); + break; + case MTEX_LIN_LIGHT: + fact*= facg; + copy_v3_v3(in, out); + ramp_blend(MA_RAMP_LINEAR, in, fact, tex); + break; } } @@ -1589,64 +1589,64 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen if (flip) SWAP(float, fact, facm); switch (blendtype) { - case MTEX_BLEND: - in= fact*tex + facm*out; - break; - - case MTEX_MUL: - facm= 1.0f-facg; - in= (facm+fact*tex)*out; - break; - - case MTEX_SCREEN: - facm= 1.0f-facg; - in= 1.0f-(facm+fact*(1.0f-tex))*(1.0f-out); - break; - - case MTEX_OVERLAY: - facm= 1.0f-facg; - if (out < 0.5f) - in = out * (facm + 2.0f*fact*tex); - else - in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out); - break; - - case MTEX_SUB: - fact= -fact; - ATTR_FALLTHROUGH; - case MTEX_ADD: - in= fact*tex + out; - break; - - case MTEX_DIV: - if (tex!=0.0f) - in= facm*out + fact*out/tex; - break; - - case MTEX_DIFF: - in= facm*out + fact*fabsf(tex-out); - break; - - case MTEX_DARK: - in = min_ff(out, tex)*fact + out*facm; - break; - - case MTEX_LIGHT: - col= fact*tex; - if (col > out) in= col; else in= out; - break; - - case MTEX_SOFT_LIGHT: - scf=1.0f - (1.0f - tex) * (1.0f - out); - in= facm*out + fact * ((1.0f - out) * tex * out) + (out * scf); - break; - - case MTEX_LIN_LIGHT: - if (tex > 0.5f) - in = out + fact*(2.0f*(tex - 0.5f)); - else - in = out + fact*(2.0f*tex - 1.0f); - break; + case MTEX_BLEND: + in= fact*tex + facm*out; + break; + + case MTEX_MUL: + facm= 1.0f-facg; + in= (facm+fact*tex)*out; + break; + + case MTEX_SCREEN: + facm= 1.0f-facg; + in= 1.0f-(facm+fact*(1.0f-tex))*(1.0f-out); + break; + + case MTEX_OVERLAY: + facm= 1.0f-facg; + if (out < 0.5f) + in = out * (facm + 2.0f*fact*tex); + else + in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out); + break; + + case MTEX_SUB: + fact= -fact; + ATTR_FALLTHROUGH; + case MTEX_ADD: + in= fact*tex + out; + break; + + case MTEX_DIV: + if (tex!=0.0f) + in= facm*out + fact*out/tex; + break; + + case MTEX_DIFF: + in= facm*out + fact*fabsf(tex-out); + break; + + case MTEX_DARK: + in = min_ff(out, tex)*fact + out*facm; + break; + + case MTEX_LIGHT: + col= fact*tex; + if (col > out) in= col; else in= out; + break; + + case MTEX_SOFT_LIGHT: + scf=1.0f - (1.0f - tex) * (1.0f - out); + in= facm*out + fact * ((1.0f - out) * tex * out) + (out * scf); + break; + + case MTEX_LIN_LIGHT: + if (tex > 0.5f) + in = out + fact*(2.0f*(tex - 0.5f)); + else + in = out + fact*(2.0f*tex - 1.0f); + break; } return in; @@ -3201,76 +3201,76 @@ void do_sky_tex( /* Grab the mapping settings for this texture */ switch (mtex->texco) { - case TEXCO_ANGMAP: - /* only works with texture being "real" */ - /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less than -1.0 */ - if (lo[0] || lo[1]) { /* check for zero case [#24807] */ - fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); - tempvec[0]= lo[0]*fact; - tempvec[1]= lo[1]*fact; - tempvec[2]= 0.0; - } - else { - /* this value has no angle, the vector is directly along the view. - * avoid divide by zero and use a dummy value. */ - tempvec[0]= 1.0f; - tempvec[1]= 0.0; - tempvec[2]= 0.0; - } - co= tempvec; - break; - - case TEXCO_H_SPHEREMAP: - case TEXCO_H_TUBEMAP: - if (skyflag & WO_ZENUP) { - if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]); - else map_to_sphere(tempvec, tempvec+1, lo[0], lo[2], lo[1]); - /* tube/spheremap maps for outside view, not inside */ - tempvec[0]= 1.0f-tempvec[0]; - /* only top half */ - tempvec[1]= 2.0f*tempvec[1]-1.0f; - tempvec[2]= 0.0; - /* and correction for do_2d_mapping */ - tempvec[0]= 2.0f*tempvec[0]-1.0f; - tempvec[1]= 2.0f*tempvec[1]-1.0f; - co= tempvec; - } - else { - /* potentially dangerous... check with multitex! */ - continue; - } - break; - case TEXCO_EQUIRECTMAP: - tempvec[0]= -atan2f(lo[2], lo[0]) / (float)M_PI; - tempvec[1]= atan2f(lo[1], hypot(lo[0], lo[2])) / (float)M_PI_2; - tempvec[2]= 0.0f; - co= tempvec; - break; - case TEXCO_OBJECT: - if (mtex->object) { - copy_v3_v3(tempvec, lo); - mul_m4_v3(mtex->object->imat_ren, tempvec); + case TEXCO_ANGMAP: + /* only works with texture being "real" */ + /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less than -1.0 */ + if (lo[0] || lo[1]) { /* check for zero case [#24807] */ + fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); + tempvec[0]= lo[0]*fact; + tempvec[1]= lo[1]*fact; + tempvec[2]= 0.0; + } + else { + /* this value has no angle, the vector is directly along the view. + * avoid divide by zero and use a dummy value. */ + tempvec[0]= 1.0f; + tempvec[1]= 0.0; + tempvec[2]= 0.0; + } co= tempvec; - } - break; - - case TEXCO_GLOB: - if (rco) { - copy_v3_v3(tempvec, rco); - mul_m4_v3(R.viewinv, tempvec); + break; + + case TEXCO_H_SPHEREMAP: + case TEXCO_H_TUBEMAP: + if (skyflag & WO_ZENUP) { + if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]); + else map_to_sphere(tempvec, tempvec+1, lo[0], lo[2], lo[1]); + /* tube/spheremap maps for outside view, not inside */ + tempvec[0]= 1.0f-tempvec[0]; + /* only top half */ + tempvec[1]= 2.0f*tempvec[1]-1.0f; + tempvec[2]= 0.0; + /* and correction for do_2d_mapping */ + tempvec[0]= 2.0f*tempvec[0]-1.0f; + tempvec[1]= 2.0f*tempvec[1]-1.0f; + co= tempvec; + } + else { + /* potentially dangerous... check with multitex! */ + continue; + } + break; + case TEXCO_EQUIRECTMAP: + tempvec[0]= -atan2f(lo[2], lo[0]) / (float)M_PI; + tempvec[1]= atan2f(lo[1], hypot(lo[0], lo[2])) / (float)M_PI_2; + tempvec[2]= 0.0f; co= tempvec; - } - else - co= lo; + break; + case TEXCO_OBJECT: + if (mtex->object) { + copy_v3_v3(tempvec, lo); + mul_m4_v3(mtex->object->imat_ren, tempvec); + co= tempvec; + } + break; -// copy_v3_v3(shi->dxgl, shi->dxco); -// mul_m3_v3(R.imat, shi->dxco); -// copy_v3_v3(shi->dygl, shi->dyco); -// mul_m3_v3(R.imat, shi->dyco); - break; - case TEXCO_VIEW: - co = view; - break; + case TEXCO_GLOB: + if (rco) { + copy_v3_v3(tempvec, rco); + mul_m4_v3(R.viewinv, tempvec); + co= tempvec; + } + else + co= lo; + +// copy_v3_v3(shi->dxgl, shi->dxco); +// mul_m3_v3(R.imat, shi->dxco); +// copy_v3_v3(shi->dygl, shi->dyco); +// mul_m3_v3(R.imat, shi->dyco); + break; + case TEXCO_VIEW: + co = view; + break; } /* placement */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 090c249defb..b9c703a0528 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1048,18 +1048,18 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3]) /* input */ switch (ma->rampin_spec) { - case MA_RAMP_IN_ENERGY: - fac= t; - break; - case MA_RAMP_IN_SHADER: - fac= is; - break; - case MA_RAMP_IN_NOR: - fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; - break; - default: - fac= 0.0f; - break; + case MA_RAMP_IN_ENERGY: + fac= t; + break; + case MA_RAMP_IN_SHADER: + fac= is; + break; + case MA_RAMP_IN_NOR: + fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; + break; + default: + fac= 0.0f; + break; } BKE_colorband_evaluate(ma->ramp_spec, fac, col); @@ -1833,7 +1833,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) /* AO pass */ if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || - (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) { + (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) + { if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (R.r.mode & R_SHADOW)) { /* AO was calculated for scanline already */ if (shi->depth || shi->volume_depth) |