diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-16 03:11:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-16 03:11:59 +0400 |
commit | 92862f96dc537242f66a6b5ebe0fc3f835acada0 (patch) | |
tree | fea4747aa87c396769ddbfa8d43a906ed8dec327 /source/blender/render/intern | |
parent | 59ea74fd6f5ac027d9b9e94132e2dd0a2bef7504 (diff) |
code cleanup: use float sizes for function args.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/include/envmap.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/include/pointdensity.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/include/shading.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 28 | ||||
-rw-r--r-- | source/blender/render/intern/source/pointdensity.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 288 |
6 files changed, 164 insertions, 160 deletions
diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h index 24138884cd2..d0f346f7402 100644 --- a/source/blender/render/intern/include/envmap.h +++ b/source/blender/render/intern/include/envmap.h @@ -46,7 +46,7 @@ struct Render; struct TexResult; void make_envmaps(struct Render *re); -int envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres); +int envmaptex(struct Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres); #endif /* __ENVMAP_H__ */ diff --git a/source/blender/render/intern/include/pointdensity.h b/source/blender/render/intern/include/pointdensity.h index cc8fabda49c..e0c293e2473 100644 --- a/source/blender/render/intern/include/pointdensity.h +++ b/source/blender/render/intern/include/pointdensity.h @@ -43,7 +43,7 @@ struct TexResult; void cache_pointdensity(struct Render *re, struct Tex *tex); void make_pointdensities(struct Render *re); void free_pointdensities(struct Render *re); -int pointdensitytex(struct Tex *tex, float *texvec, struct TexResult *texres); +int pointdensitytex(struct Tex *tex, const float texvec[3], struct TexResult *texres); #endif /* __POINTDENSITY_H__ */ diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index a8519d8a7fb..4f6e005d742 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -60,7 +60,7 @@ void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr); void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3); void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip); void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from); -void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float *dxyview, float *co, float *dxco, float *dyco); +void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float dxyview[2], float co[3], float dxco[3], float dyco[3]); void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z); void shade_input_set_uv(struct ShadeInput *shi); void shade_input_set_normals(struct ShadeInput *shi); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 96b33a0bf1a..910307f370b 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -643,31 +643,31 @@ static int envcube_isect(EnvMap *env, const float vec[3], float answ[2]) /* ------------------------------------------------------------------------- */ -static void set_dxtdyt(float *dxts, float *dyts, float *dxt, float *dyt, int face) +static void set_dxtdyt(float r_dxt[3], float r_dyt[3], const float dxt[3], const float dyt[3], int face) { if (face == 2 || face == 4) { - dxts[0] = dxt[0]; - dyts[0] = dyt[0]; - dxts[1] = dxt[2]; - dyts[1] = dyt[2]; + r_dxt[0] = dxt[0]; + r_dyt[0] = dyt[0]; + r_dxt[1] = dxt[2]; + r_dyt[1] = dyt[2]; } else if (face == 3 || face == 5) { - dxts[0] = dxt[1]; - dxts[1] = dxt[2]; - dyts[0] = dyt[1]; - dyts[1] = dyt[2]; + r_dxt[0] = dxt[1]; + r_dxt[1] = dxt[2]; + r_dyt[0] = dyt[1]; + r_dyt[1] = dyt[2]; } else { - dxts[0] = dxt[0]; - dyts[0] = dyt[0]; - dxts[1] = dxt[1]; - dyts[1] = dyt[1]; + r_dxt[0] = dxt[0]; + r_dyt[0] = dyt[0]; + r_dxt[1] = dxt[1]; + r_dyt[1] = dyt[1]; } } /* ------------------------------------------------------------------------- */ -int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres) +int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres) { extern Render R; /* only in this call */ /* texvec should be the already reflected normal */ diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index ea92be6153c..f8462dcd888 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -406,7 +406,7 @@ static void init_pointdensityrangedata(PointDensity *pd, PointDensityRangeData * } -int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) +int pointdensitytex(Tex *tex, const float texvec[3], TexResult *texres) { int retval = TEX_INT; PointDensity *pd = tex->pd; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 030b7d68163..91da5c50d01 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -185,7 +185,7 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres) -static int blend(Tex *tex, float *texvec, TexResult *texres) +static int blend(Tex *tex, const float texvec[3], TexResult *texres) { float x, y, t; @@ -237,7 +237,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres) /* newnoise: all noisebased types now have different noisebases to choose from */ -static int clouds(Tex *tex, float *texvec, TexResult *texres) +static int clouds(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; @@ -332,7 +332,7 @@ static float wood_int(Tex *tex, float x, float y, float z) return wi; } -static int wood(Tex *tex, float *texvec, TexResult *texres) +static int wood(Tex *tex, const float texvec[3], TexResult *texres) { int rv=TEX_INT; @@ -383,7 +383,7 @@ static float marble_int(Tex *tex, float x, float y, float z) return mi; } -static int marble(Tex *tex, float *texvec, TexResult *texres) +static int marble(Tex *tex, const float texvec[3], TexResult *texres) { int rv=TEX_INT; @@ -407,7 +407,7 @@ static int marble(Tex *tex, float *texvec, TexResult *texres) /* ------------------------------------------------------------------------- */ -static int magic(Tex *tex, float *texvec, TexResult *texres) +static int magic(Tex *tex, const float texvec[3], TexResult *texres) { float x, y, z, turb=1.0; int n; @@ -483,7 +483,7 @@ static int magic(Tex *tex, float *texvec, TexResult *texres) /* ------------------------------------------------------------------------- */ /* newnoise: stucci also modified to use different noisebasis */ -static int stucci(Tex *tex, float *texvec, TexResult *texres) +static int stucci(Tex *tex, const float texvec[3], TexResult *texres) { float nor[3], b2, ofs; int retval= TEX_INT; @@ -525,7 +525,7 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres) /* ------------------------------------------------------------------------- */ /* newnoise: musgrave terrain noise types */ -static float mg_mFractalOrfBmTex(Tex *tex, float *texvec, TexResult *texres) +static float mg_mFractalOrfBmTex(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; float (*mgravefunc)(float, float, float, float, float, float, int); @@ -555,7 +555,7 @@ static float mg_mFractalOrfBmTex(Tex *tex, float *texvec, TexResult *texres) } -static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec, TexResult *texres) +static float mg_ridgedOrHybridMFTex(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; float (*mgravefunc)(float, float, float, float, float, float, float, float, int); @@ -586,7 +586,7 @@ static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec, TexResult *texres) } -static float mg_HTerrainTex(Tex *tex, float *texvec, TexResult *texres) +static float mg_HTerrainTex(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; @@ -611,7 +611,7 @@ static float mg_HTerrainTex(Tex *tex, float *texvec, TexResult *texres) } -static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres) +static float mg_distNoiseTex(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; @@ -640,7 +640,7 @@ static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres) /* ------------------------------------------------------------------------- */ /* newnoise: Voronoi texture type, probably the slowest, especially with minkovsky, bumpmapping, could be done another way */ -static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) +static float voronoiTex(Tex *tex, const float texvec[3], TexResult *texres) { int rv = TEX_INT; float da[4], pa[12]; /* distance and point coordinate arrays of 4 nearest neighbors */ @@ -869,7 +869,7 @@ static int cubemap_ob(Object *ob, const float n[3], float x, float y, float z, f /* ------------------------------------------------------------------------- */ -static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], float *dxt, float *dyt) +static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float n[3], float dxt[3], float dyt[3]) { Tex *tex; Object *ob= NULL; @@ -885,15 +885,15 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], if (R.osa==0) { if (wrap==MTEX_FLAT) { - fx = (t[0] + 1.0f) / 2.0f; - fy = (t[1] + 1.0f) / 2.0f; + fx = (texvec[0] + 1.0f) / 2.0f; + fy = (texvec[1] + 1.0f) / 2.0f; } - else if (wrap == MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]); - else if (wrap == MTEX_SPHERE) map_to_sphere(&fx, &fy, t[0], t[1], t[2]); + else if (wrap == MTEX_TUBE) map_to_tube( &fx, &fy, texvec[0], texvec[1], texvec[2]); + else if (wrap == MTEX_SPHERE) map_to_sphere(&fx, &fy, texvec[0], texvec[1], texvec[2]); else { - if (texco == TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy); - else if (texco == TEXCO_GLOB) cubemap_glob(n, t[0], t[1], t[2], &fx, &fy); - else cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy); + if (texco == TEXCO_OBJECT) cubemap_ob(ob, n, texvec[0], texvec[1], texvec[2], &fx, &fy); + else if (texco == TEXCO_GLOB) cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy); + else cubemap(mtex, vlr, n, texvec[0], texvec[1], texvec[2], &fx, &fy); } /* repeat */ @@ -933,14 +933,14 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], fy= tex->cropymin+ fy*fac1; } - t[0]= fx; - t[1]= fy; + texvec[0]= fx; + texvec[1]= fy; } else { if (wrap==MTEX_FLAT) { - fx= (t[0] + 1.0f) / 2.0f; - fy= (t[1] + 1.0f) / 2.0f; + fx= (texvec[0] + 1.0f) / 2.0f; + fy= (texvec[1] + 1.0f) / 2.0f; dxt[0]/= 2.0f; dxt[1]/= 2.0f; dxt[2]/= 2.0f; @@ -951,13 +951,13 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], else if (ELEM(wrap, MTEX_TUBE, MTEX_SPHERE)) { /* exception: the seam behind (y<0.0) */ ok= 1; - if (t[1]<=0.0f) { - fx= t[0]+dxt[0]; - fy= t[0]+dyt[0]; - if (fx>=0.0f && fy>=0.0f && t[0]>=0.0f) { + if (texvec[1]<=0.0f) { + fx= texvec[0]+dxt[0]; + fy= texvec[0]+dyt[0]; + if (fx>=0.0f && fy>=0.0f && texvec[0]>=0.0f) { /* pass */ } - else if (fx<=0.0f && fy<=0.0f && t[0]<=0.0f) { + else if (fx<=0.0f && fy<=0.0f && texvec[0]<=0.0f) { /* pass */ } else { @@ -967,20 +967,20 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], if (ok) { if (wrap==MTEX_TUBE) { - map_to_tube(area, area+1, t[0], t[1], t[2]); - map_to_tube(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]); - map_to_tube(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]); + map_to_tube(area, area+1, texvec[0], texvec[1], texvec[2]); + map_to_tube(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]); + map_to_tube(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]); } else { - map_to_sphere(area, area+1, t[0], t[1], t[2]); - map_to_sphere(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]); - map_to_sphere(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]); + map_to_sphere(area, area+1, texvec[0], texvec[1], texvec[2]); + map_to_sphere(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]); + map_to_sphere(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]); } areaflag= 1; } else { - if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]); - else map_to_sphere(&fx, &fy, t[0], t[1], t[2]); + if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, texvec[0], texvec[1], texvec[2]); + else map_to_sphere(&fx, &fy, texvec[0], texvec[1], texvec[2]); dxt[0]/= 2.0f; dxt[1]/= 2.0f; dyt[0]/= 2.0f; @@ -989,9 +989,9 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], } else { - if (texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy); - else if (texco==TEXCO_GLOB) proj = cubemap_glob(n, t[0], t[1], t[2], &fx, &fy); - else proj = cubemap(mtex, vlr, n, t[0], t[1], t[2], &fx, &fy); + if (texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, texvec[0], texvec[1], texvec[2], &fx, &fy); + else if (texco==TEXCO_GLOB) proj = cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy); + else proj = cubemap(mtex, vlr, n, texvec[0], texvec[1], texvec[2], &fx, &fy); if (proj==1) { SWAP(float, dxt[1], dxt[2]); @@ -1091,111 +1091,111 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, const float n[3], dyt[1]*= fac1; } - t[0]= fx; - t[1]= fy; + texvec[0]= fx; + texvec[1]= fy; } } /* ************************************** */ -static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output) +static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output) { float tmpvec[3]; - int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */ + int retval = 0; /* return value, int:0, col:1, nor:2, everything:3 */ texres->talpha = FALSE; /* is set when image texture returns alpha (considered premul) */ if (tex->use_nodes && tex->nodetree) { retval = ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, osatex, thread, - tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL); + tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL); } - else - switch (tex->type) { - - case 0: - texres->tin= 0.0f; - return 0; - case TEX_CLOUDS: - retval= clouds(tex, texvec, texres); - break; - case TEX_WOOD: - retval= wood(tex, texvec, texres); - break; - case TEX_MARBLE: - retval= marble(tex, texvec, texres); - break; - case TEX_MAGIC: - retval= magic(tex, texvec, texres); - break; - case TEX_BLEND: - retval= blend(tex, texvec, texres); - break; - case TEX_STUCCI: - retval= stucci(tex, texvec, texres); - break; - case TEX_NOISE: - retval= texnoise(tex, texres); - break; - case TEX_IMAGE: - if (osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres); - else retval= imagewrap(tex, tex->ima, NULL, texvec, texres); - BKE_image_tag_time(tex->ima); /* tag image as having being used */ - break; - case TEX_ENVMAP: - retval= envmaptex(tex, texvec, dxt, dyt, osatex, texres); - break; - case TEX_MUSGRAVE: - /* newnoise: musgrave types */ - - /* ton: added this, for Blender convention reason. - * artificer: added the use of tmpvec to avoid scaling texvec - */ - copy_v3_v3(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0f/tex->noisesize); - - switch (tex->stype) { - case TEX_MFRACTAL: - case TEX_FBM: - retval= mg_mFractalOrfBmTex(tex, tmpvec, texres); - break; - case TEX_RIDGEDMF: - case TEX_HYBRIDMF: - retval= mg_ridgedOrHybridMFTex(tex, tmpvec, texres); - break; - case TEX_HTERRAIN: - retval= mg_HTerrainTex(tex, tmpvec, texres); - break; + else { + switch (tex->type) { + case 0: + texres->tin= 0.0f; + return 0; + case TEX_CLOUDS: + retval = clouds(tex, texvec, texres); + break; + case TEX_WOOD: + retval = wood(tex, texvec, texres); + break; + case TEX_MARBLE: + retval = marble(tex, texvec, texres); + break; + case TEX_MAGIC: + retval = magic(tex, texvec, texres); + break; + case TEX_BLEND: + retval = blend(tex, texvec, texres); + break; + case TEX_STUCCI: + retval = stucci(tex, texvec, texres); + break; + case TEX_NOISE: + retval = texnoise(tex, texres); + break; + case TEX_IMAGE: + if (osatex) retval = imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres); + else retval = imagewrap(tex, tex->ima, NULL, texvec, texres); + BKE_image_tag_time(tex->ima); /* tag image as having being used */ + break; + case TEX_ENVMAP: + retval = envmaptex(tex, texvec, dxt, dyt, osatex, texres); + break; + case TEX_MUSGRAVE: + /* newnoise: musgrave types */ + + /* ton: added this, for Blender convention reason. + * artificer: added the use of tmpvec to avoid scaling texvec + */ + copy_v3_v3(tmpvec, texvec); + mul_v3_fl(tmpvec, 1.0f / tex->noisesize); + + switch (tex->stype) { + case TEX_MFRACTAL: + case TEX_FBM: + retval = mg_mFractalOrfBmTex(tex, tmpvec, texres); + break; + case TEX_RIDGEDMF: + case TEX_HYBRIDMF: + retval = mg_ridgedOrHybridMFTex(tex, tmpvec, texres); + break; + case TEX_HTERRAIN: + retval = mg_HTerrainTex(tex, tmpvec, texres); + break; + } + break; + /* newnoise: voronoi type */ + case TEX_VORONOI: + /* ton: added this, for Blender convention reason. + * artificer: added the use of tmpvec to avoid scaling texvec + */ + copy_v3_v3(tmpvec, texvec); + mul_v3_fl(tmpvec, 1.0f / tex->noisesize); + + retval = voronoiTex(tex, tmpvec, texres); + break; + case TEX_DISTNOISE: + /* ton: added this, for Blender convention reason. + * artificer: added the use of tmpvec to avoid scaling texvec + */ + copy_v3_v3(tmpvec, texvec); + mul_v3_fl(tmpvec, 1.0f / tex->noisesize); + + retval = mg_distNoiseTex(tex, tmpvec, texres); + break; + case TEX_POINTDENSITY: + retval = pointdensitytex(tex, texvec, texres); + break; + case TEX_VOXELDATA: + retval = voxeldatatex(tex, texvec, texres); + break; + case TEX_OCEAN: + retval = ocean_texture(tex, texvec, texres); + break; } - break; - /* newnoise: voronoi type */ - case TEX_VORONOI: - /* ton: added this, for Blender convention reason. - * artificer: added the use of tmpvec to avoid scaling texvec - */ - copy_v3_v3(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0f/tex->noisesize); - - retval= voronoiTex(tex, tmpvec, texres); - break; - case TEX_DISTNOISE: - /* ton: added this, for Blender convention reason. - * artificer: added the use of tmpvec to avoid scaling texvec - */ - copy_v3_v3(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0f/tex->noisesize); - - retval= mg_distNoiseTex(tex, tmpvec, texres); - break; - case TEX_POINTDENSITY: - retval= pointdensitytex(tex, texvec, texres); - break; - case TEX_VOXELDATA: - retval= voxeldatatex(tex, texvec, texres); - break; - case TEX_OCEAN: - retval= ocean_texture(tex, texvec, texres); - break; } if (tex->flag & TEX_COLORBAND) { @@ -1213,7 +1213,8 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, } /* this is called from the shader and texture nodes */ -int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output, ShadeInput *shi, MTex *mtex) +int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, + const short thread, short which_output, ShadeInput *shi, MTex *mtex) { if (tex==NULL) { memset(texres, 0, sizeof(TexResult)); @@ -1229,7 +1230,7 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, if (mtex) { /* we have mtex, use it for 2d mapping images only */ do_2d_mapping(mtex, texvec, shi->vlr, shi->facenor, dxt, dyt); - rgbnor= multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output); + rgbnor = multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output); if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) { ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); @@ -1265,12 +1266,13 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, return rgbnor; } - else + else { return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output); + } } /* this is called for surface shading */ -static int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float *dyt, TexResult *texres) +static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres) { Tex *tex = mtex->tex; @@ -1287,13 +1289,13 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, /* Warning, if the texres's values are not declared zero, check the return value to be sure * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */ -int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres) +int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres) { return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL); } /* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */ -int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres) +int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres) { int use_nodes= tex->use_nodes, retval; @@ -1518,7 +1520,8 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen return in; } -static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, float* dx, float* dy, float* texvec, float* dxt, float* dyt) +static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, + const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3]) { /* new: first swap coords, then map, then trans/scale */ if (tex->type == TEX_IMAGE) { @@ -1550,10 +1553,10 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa texvec[0] = mtex->size[0]*(texvec[0] - 0.5f) + mtex->ofs[0] + 0.5f; texvec[1] = mtex->size[1]*(texvec[1] - 0.5f) + mtex->ofs[1] + 0.5f; if (shi->osatex) { - dxt[0] = mtex->size[0]*dxt[0]; - dxt[1] = mtex->size[1]*dxt[1]; - dyt[0] = mtex->size[0]*dyt[0]; - dyt[1] = mtex->size[1]*dyt[1]; + dxt[0] = mtex->size[0] * dxt[0]; + dxt[1] = mtex->size[1] * dxt[1]; + dyt[0] = mtex->size[0] * dyt[0]; + dyt[1] = mtex->size[1] * dyt[1]; } /* problem: repeat-mirror is not a 'repeat' but 'extend' in imagetexture.c */ @@ -1683,7 +1686,8 @@ static void compatible_bump_uv_derivs(CompatibleBump *compat_bump, ShadeInput *s } } -static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt) +static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, + float Tnor, const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3]) { TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; /* temp TexResult */ float tco[3], texv[3], cd, ud, vd, du, dv, idu, idv; @@ -1839,7 +1843,7 @@ static void ntap_bump_init(NTapBump *ntap_bump) memset(ntap_bump, 0, sizeof(*ntap_bump)); } -static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt) +static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float texvec[3], float dxt[3], float dyt[3]) { TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; /* temp TexResult */ |