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:
authorCampbell Barton <ideasman42@gmail.com>2011-09-12 17:00:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-12 17:00:24 +0400
commite16ba13251701a9845adf702e60be3f2fad724bd (patch)
tree8ab57f007a995b4928410cfacda18a5c4538fc9d /source/blender
parent4a9a0ec3e45c3870771e8dd44c62a05cf0d4d2d1 (diff)
use vector size and const args where possible (no functional change)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_material.h2
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c14
-rw-r--r--source/blender/render/extern/include/RE_render_ext.h4
-rw-r--r--source/blender/render/intern/include/pixelshading.h6
-rw-r--r--source/blender/render/intern/include/shadbuf.h4
-rw-r--r--source/blender/render/intern/include/shading.h2
-rw-r--r--source/blender/render/intern/include/texture.h12
-rw-r--r--source/blender/render/intern/include/volumetric.h4
-rw-r--r--source/blender/render/intern/source/imagetexture.c10
-rw-r--r--source/blender/render/intern/source/pixelshading.c45
-rw-r--r--source/blender/render/intern/source/render_texture.c42
-rw-r--r--source/blender/render/intern/source/shadbuf.c41
-rw-r--r--source/blender/render/intern/source/volumetric.c62
15 files changed, 122 insertions, 130 deletions
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 88965d12e4a..85b6f8f78fb 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -89,7 +89,7 @@ void end_render_materials(struct Main *);
int material_in_material(struct Material *parmat, struct Material *mat);
-void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col);
+void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3]);
/* copy/paste */
void clear_matcopybuf(void);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index aab8e1abbea..2a9e786d139 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1122,7 +1122,7 @@ int object_remove_material_slot(Object *ob)
/* r g b = current value, col = new value, fac==0 is no change */
/* if g==NULL, it only does r channel */
-void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
+void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3])
{
float tmp, facm= 1.0f-fac;
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 18955c158c6..d6a8f0fb925 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -83,7 +83,7 @@ void mul_serie_m4(float R[4][4],
float M5[4][4], float M6[4][4], float M7[4][4], float M8[4][4]);
void mul_m4_v3(float M[4][4], float r[3]);
-void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
+void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index e2f594376cb..20c503de2c3 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -306,7 +306,7 @@ void mul_serie_m4(float answ[][4], float m1[][4],
}
}
-void mul_m4_v3(float mat[][4], float *vec)
+void mul_m4_v3(float mat[][4], float vec[3])
{
float x,y;
@@ -317,7 +317,7 @@ void mul_m4_v3(float mat[][4], float *vec)
vec[2]=x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
}
-void mul_v3_m4v3(float *in, float mat[][4], float *vec)
+void mul_v3_m4v3(float in[3], float mat[][4], const float vec[3])
{
float x,y;
@@ -329,7 +329,7 @@ void mul_v3_m4v3(float *in, float mat[][4], float *vec)
}
/* same as mul_m4_v3() but doesnt apply translation component */
-void mul_mat3_m4_v3(float mat[][4], float *vec)
+void mul_mat3_m4_v3(float mat[][4], float vec[3])
{
float x,y;
@@ -384,7 +384,7 @@ void mul_m3_v3(float M[3][3], float r[3])
copy_v3_v3(r, tmp);
}
-void mul_transposed_m3_v3(float mat[][3], float *vec)
+void mul_transposed_m3_v3(float mat[][3], float vec[3])
{
float x,y;
@@ -422,7 +422,7 @@ void mul_mat3_m4_fl(float m[4][4], float f)
m[i][j] *= f;
}
-void mul_m3_v3_double(float mat[][3], double *vec)
+void mul_m3_v3_double(float mat[][3], double vec[3])
{
double x,y;
@@ -979,14 +979,14 @@ void size_to_mat4(float mat[][4], const float size[3])
copy_m4_m3(mat, tmat);
}
-void mat3_to_size(float *size, float mat[][3])
+void mat3_to_size(float size[3], float mat[][3])
{
size[0]= len_v3(mat[0]);
size[1]= len_v3(mat[1]);
size[2]= len_v3(mat[2]);
}
-void mat4_to_size(float *size, float mat[][4])
+void mat4_to_size(float size[3], float mat[][4])
{
size[0]= len_v3(mat[0]);
size[1]= len_v3(mat[1]);
diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h
index 849640a5c16..e98f481b162 100644
--- a/source/blender/render/extern/include/RE_render_ext.h
+++ b/source/blender/render/extern/include/RE_render_ext.h
@@ -55,10 +55,10 @@ struct ImBuf;
//void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
-int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
+int externtex(struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
/* particle.c */
-void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype);
+void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype);
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype);
/* node_composite.c */
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index 0298f90c0d0..feabfea9319 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -58,10 +58,10 @@ int shadeHaloFloat(HaloRen *har,
/**
* Render the sky at pixel (x, y).
*/
-void shadeSkyPixel(float *collector, float fx, float fy, short thread);
-void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread);
+void shadeSkyPixel(float collector[4], float fx, float fy, short thread);
+void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const float dxyview[2], short thread);
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
-void shadeSunView(float *colf, float *view);
+void shadeSunView(float col_r[3], const float view[3]);
/* ------------------------------------------------------------------------- */
#endif
diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h
index 2dca9963e4f..5bed39db3e9 100644
--- a/source/blender/render/intern/include/shadbuf.h
+++ b/source/blender/render/intern/include/shadbuf.h
@@ -59,13 +59,13 @@ void threaded_makeshadowbufs(struct Render *re);
* @param inp The inproduct between viewvector and ?
*
*/
-float testshadowbuf(struct Render *re, struct ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp, float mat_bias);
+float testshadowbuf(struct Render *re, struct ShadBuf *shb, const float rco[3], const float dxco[3], const float dyco[3], float inp, float mat_bias);
/**
* Determines the shadow factor for lamp <lar>, between <p1>
* and <p2>. (Which CS?)
*/
-float shadow_halo(LampRen *lar, float *p1, float *p2);
+float shadow_halo(LampRen *lar, const float p1[3], const float p2[3]);
/**
* Irregular shadowbuffer
diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h
index 75d76c8ae23..91507ef3f98 100644
--- a/source/blender/render/intern/include/shading.h
+++ b/source/blender/render/intern/include/shading.h
@@ -96,7 +96,7 @@ void ambient_occlusion(struct ShadeInput *shi);
void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr);
ListBase *get_lights(struct ShadeInput *shi);
-float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);
+float lamp_get_visibility(struct LampRen *lar, const float co[3], float *lv, float *dist);
void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real);
float fresnel_fac(float *view, float *vn, float fresnel, float fac);
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index a63c4f7f253..73f9d7a1627 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -64,11 +64,11 @@ struct ImBuf;
/* texture.h */
-void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
-void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread);
+void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
+void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread);
void do_material_tex(struct ShadeInput *shi);
-void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
-void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val);
+void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
+void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val);
void init_render_textures(Render *re);
void end_render_textures(Render *re);
@@ -77,8 +77,8 @@ void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
/* imagetexture.h */
-int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, float *texvec, float *dxt, float *dyt, struct TexResult *texres);
-int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, float *texvec, struct TexResult *texres);
+int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[3], const float dyt[3], struct TexResult *texres);
+int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float *result);
#endif /* TEXTURE_EXT_H */
diff --git a/source/blender/render/intern/include/volumetric.h b/source/blender/render/intern/include/volumetric.h
index a2d1821a62b..87d74de9134 100644
--- a/source/blender/render/intern/include/volumetric.h
+++ b/source/blender/render/intern/include/volumetric.h
@@ -35,8 +35,8 @@ struct Isect;
struct ShadeInput;
struct ShadeResult;
-float vol_get_density(struct ShadeInput *shi, float *co);
-void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co_, float *view);
+float vol_get_density(struct ShadeInput *shi, const float co[3]);
+void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3], const float view[3]);
void shade_volume_outside(ShadeInput *shi, ShadeResult *shr);
void shade_volume_inside(ShadeInput *shi, ShadeResult *shr);
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 6d264951204..b290459a7c9 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -111,7 +111,7 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
}
}
-int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texres)
+int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres)
{
float fx, fy, val1, val2, val3;
int x, y, retval;
@@ -1019,7 +1019,7 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
}
-static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *dxt, float *dyt, TexResult *texres)
+static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[3], float dyt[3], TexResult *texres)
{
TexResult texr;
float fx, fy, minx, maxx, miny, maxy;
@@ -1409,7 +1409,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
}
-int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, float *DYT, TexResult *texres)
+int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[3], const float DYT[3], TexResult *texres)
{
TexResult texr;
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3];
@@ -1418,8 +1418,8 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
// TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
// make a local copy here so that original vecs remain untouched
- VECCOPY(dxt, DXT);
- VECCOPY(dyt, DYT);
+ copy_v3_v3(dxt, DXT);
+ copy_v3_v3(dyt, DYT);
// anisotropic filtering
if (tex->texfilter != TXF_BOX)
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index febfea89f04..dd5deddece9 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -76,7 +76,7 @@ extern struct Render R;
extern float hashvectf[];
-static void render_lighting_halo(HaloRen *har, float *colf)
+static void render_lighting_halo(HaloRen *har, float col_r[3])
{
GroupObject *go;
LampRen *lar;
@@ -246,9 +246,9 @@ static void render_lighting_halo(HaloRen *har, float *colf)
if(ig<0.0f) ig= 0.0f;
if(ib<0.0f) ib= 0.0f;
- colf[0]*= ir;
- colf[1]*= ig;
- colf[2]*= ib;
+ col_r[0]*= ir;
+ col_r[1]*= ig;
+ col_r[2]*= ib;
}
@@ -502,8 +502,8 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
/* ------------------------------------------------------------------------- */
-/* Only view vector is important here. Result goes to colf[3] */
-void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread)
+/* Only view vector is important here. Result goes to col_r[3] */
+void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const float dxyview[2], short thread)
{
float lo[3], zen[3], hor[3], blend, blendm;
int skyflag;
@@ -528,13 +528,13 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th
blend= fabs(0.5f + view[1]);
}
- VECCOPY(hor, &R.wrld.horr);
- VECCOPY(zen, &R.wrld.zenr);
+ copy_v3_v3(hor, &R.wrld.horr);
+ copy_v3_v3(zen, &R.wrld.zenr);
/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If */
/* SKYBLEND is active, the texture and color blend are added. */
if(R.wrld.skytype & WO_SKYTEX) {
- VECCOPY(lo, view);
+ copy_v3_v3(lo, view);
if(R.wrld.skytype & WO_SKYREAL) {
mul_m3_v3(R.imat, lo);
@@ -550,19 +550,19 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th
/* No clipping, no conversion! */
if(R.wrld.skytype & WO_SKYBLEND) {
- colf[0] = (blendm*hor[0] + blend*zen[0]);
- colf[1] = (blendm*hor[1] + blend*zen[1]);
- colf[2] = (blendm*hor[2] + blend*zen[2]);
+ col_r[0] = (blendm*hor[0] + blend*zen[0]);
+ col_r[1] = (blendm*hor[1] + blend*zen[1]);
+ col_r[2] = (blendm*hor[2] + blend*zen[2]);
} else {
/* Done when a texture was grabbed. */
- colf[0]= hor[0];
- colf[1]= hor[1];
- colf[2]= hor[2];
+ col_r[0]= hor[0];
+ col_r[1]= hor[1];
+ col_r[2]= hor[2];
}
}
/* shade sky according to sun lamps, all parameters are like shadeSkyView except sunsky*/
-void shadeSunView(float *colf, float *view)
+void shadeSunView(float col_r[3], const float view[3])
{
GroupObject *go;
LampRen *lar;
@@ -576,9 +576,8 @@ void shadeSunView(float *colf, float *view)
float colorxyz[3];
if(do_init) {
-
- VECCOPY(sview, view);
- normalize_v3(sview);
+
+ normalize_v3_v3(sview, view);
mul_m3_v3(R.imat, sview);
if (sview[2] < 0.0f)
sview[2] = 0.0f;
@@ -590,7 +589,7 @@ void shadeSunView(float *colf, float *view)
xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sun_collector[0], &sun_collector[1], &sun_collector[2],
lar->sunsky->sky_colorspace);
- ramp_blend(lar->sunsky->skyblendtype, colf, colf+1, colf+2, lar->sunsky->skyblendfac, sun_collector);
+ ramp_blend(lar->sunsky->skyblendtype, col_r, col_r+1, col_r+2, lar->sunsky->skyblendfac, sun_collector);
}
}
}
@@ -599,7 +598,7 @@ void shadeSunView(float *colf, float *view)
/*
Stuff the sky color into the collector.
*/
-void shadeSkyPixel(float *collector, float fx, float fy, short thread)
+void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
{
float view[3], dxyview[2];
@@ -649,10 +648,10 @@ void shadeSkyPixel(float *collector, float fx, float fy, short thread)
}
/* aerial perspective */
-void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance)
+void shadeAtmPixel(struct SunSky *sunsky, float collector[3], float fx, float fy, float distance)
{
float view[3];
-
+
calc_view_vector(view, fx, fy);
normalize_v3(view);
/*mul_m3_v3(R.imat, view);*/
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index d94074725a0..ad592609ce6 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1374,7 +1374,7 @@ int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres)
/* in = destination, tex = texture, out = previous color */
/* fact = texture strength, facg = button strength value */
-void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype)
+void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype)
{
float facm, col;
@@ -2658,7 +2658,7 @@ void do_material_tex(ShadeInput *shi)
}
-void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val)
+void do_volume_tex(ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val)
{
MTex *mtex;
Tex *tex;
@@ -2838,7 +2838,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa
/* ------------------------------------------------------------------------- */
-void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
+void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
{
MTex *mtex;
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
@@ -2945,23 +2945,23 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
if(mtex->blendtype==MTEX_SUB) fact= -fact;
if(mtex->blendtype==MTEX_BLEND) {
- colf[0]= (fact*texres.tr + facm*har->r);
- colf[1]= (fact*texres.tg + facm*har->g);
- colf[2]= (fact*texres.tb + facm*har->b);
+ col_r[0]= (fact*texres.tr + facm*har->r);
+ col_r[1]= (fact*texres.tg + facm*har->g);
+ col_r[2]= (fact*texres.tb + facm*har->b);
}
else if(mtex->blendtype==MTEX_MUL) {
- colf[0]= (facm+fact*texres.tr)*har->r;
- colf[1]= (facm+fact*texres.tg)*har->g;
- colf[2]= (facm+fact*texres.tb)*har->b;
+ col_r[0]= (facm+fact*texres.tr)*har->r;
+ col_r[1]= (facm+fact*texres.tg)*har->g;
+ col_r[2]= (facm+fact*texres.tb)*har->b;
}
else {
- colf[0]= (fact*texres.tr + har->r);
- colf[1]= (fact*texres.tg + har->g);
- colf[2]= (fact*texres.tb + har->b);
+ col_r[0]= (fact*texres.tr + har->r);
+ col_r[1]= (fact*texres.tg + har->g);
+ col_r[2]= (fact*texres.tb + har->b);
- CLAMP(colf[0], 0.0f, 1.0f);
- CLAMP(colf[1], 0.0f, 1.0f);
- CLAMP(colf[2], 0.0f, 1.0f);
+ CLAMP(col_r[0], 0.0f, 1.0f);
+ CLAMP(col_r[1], 0.0f, 1.0f);
+ CLAMP(col_r[2], 0.0f, 1.0f);
}
}
if(mtex->mapto & MAP_ALPHA) {
@@ -2970,14 +2970,14 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
}
- colf[3]*= texres.tin;
+ col_r[3]*= texres.tin;
}
}
/* ------------------------------------------------------------------------- */
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
-void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread)
+void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread)
{
MTex *mtex;
Tex *tex;
@@ -3172,9 +3172,9 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f
}
/* ------------------------------------------------------------------------- */
-/* colf supposed to be initialized with la->r,g,b */
+/* col_r supposed to be initialized with la->r,g,b */
-void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int effect)
+void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r[3], int effect)
{
Object *ob;
MTex *mtex;
@@ -3356,7 +3356,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
col[1]= texres.tg*la->energy;
col[2]= texres.tb*la->energy;
- texture_rgb_blend(colf, col, colf, texres.tin, mtex->colfac, mtex->blendtype);
+ texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype);
}
}
}
@@ -3364,7 +3364,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
/* ------------------------------------------------------------------------- */
-int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
+int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
{
Tex *tex;
TexResult texr;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 5860c395b07..e4b2a0cf1d1 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1099,7 +1099,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
}
}
-static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, float co[3])
+static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, const float co[3])
{
float hco[4], size= 0.5f*(float)shb->size;
@@ -1115,7 +1115,7 @@ static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, flo
/* the externally called shadow testing (reading) function */
/* return 1.0: no shadow at all */
-float testshadowbuf(Render *re, ShadBuf *shb, float *co, float *dxco, float *dyco, float inp, float mat_bias)
+float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxco[3], const float dyco[3], float inp, float mat_bias)
{
ShadSampleBuf *shsample;
float fac, dco[3], dx[3], dy[3], shadfac=0.0f;
@@ -1291,7 +1291,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
}
-float shadow_halo(LampRen *lar, float *p1, float *p2)
+float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
{
/* p1 p2 already are rotated in spot-space */
ShadBuf *shb= lar->shb;
@@ -1469,7 +1469,7 @@ static void init_box(Boxf *box)
}
/* use v1 to calculate boundbox */
-static void bound_boxf(Boxf *box, float *v1)
+static void bound_boxf(Boxf *box, const float v1[3])
{
if(v1[0] < box->xmin) box->xmin= v1[0];
if(v1[0] > box->xmax) box->xmax= v1[0];
@@ -1480,7 +1480,7 @@ static void bound_boxf(Boxf *box, float *v1)
}
/* use v1 to calculate boundbox */
-static void bound_rectf(rctf *box, float *v1)
+static void bound_rectf(rctf *box, const float v1[2])
{
if(v1[0] < box->xmin) box->xmin= v1[0];
if(v1[0] > box->xmax) box->xmax= v1[0];
@@ -1639,24 +1639,17 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
return 0;
}
-static float VecLen2f( float *v1, float *v2)
-{
- float x= v1[0]-v2[0];
- float y= v1[1]-v2[1];
- return (float)sqrt(x*x+y*y);
-}
-
/* initialize vars in face, for optimal point-in-face test */
static void bspface_init_strand(BSPFace *face)
{
- face->radline= 0.5f*VecLen2f(face->v1, face->v2);
+ face->radline= 0.5f* len_v2v2(face->v1, face->v2);
mid_v3_v3v3(face->vec1, face->v1, face->v2);
if(face->v4)
mid_v3_v3v3(face->vec2, face->v3, face->v4);
else
- VECCOPY(face->vec2, face->v3);
+ copy_v3_v3(face->vec2, face->v3);
face->rc[0]= face->vec2[0]-face->vec1[0];
face->rc[1]= face->vec2[1]-face->vec1[1];
@@ -1671,7 +1664,7 @@ static void bspface_init_strand(BSPFace *face)
}
/* brought back to a simple 2d case */
-static int point_behind_strand(float *p, BSPFace *face)
+static int point_behind_strand(const float p[3], BSPFace *face)
{
/* v1 - v2 is radius, v1 - v3 length */
float dist, rc[2], pt[2];
@@ -1712,7 +1705,7 @@ static int point_behind_strand(float *p, BSPFace *face)
/* return 1 if inside. code derived from src/parametrizer.c */
-static int point_behind_tria2d(float *p, float *v1, float *v2, float *v3)
+static int point_behind_tria2d(const float p[3], const float v1[3], const float v2[3], const float v3[3])
{
float a[2], c[2], h[2], div;
float u, v;
@@ -1751,7 +1744,7 @@ static int point_behind_tria2d(float *p, float *v1, float *v2, float *v3)
/* tested these calls, but it gives inaccuracy, 'side' cannot be found reliably using v3 */
/* check if line v1-v2 has all rect points on other side of point v3 */
-static int rect_outside_line(rctf *rect, float *v1, float *v2, float *v3)
+static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
{
float a, b, c;
int side;
@@ -1772,7 +1765,7 @@ static int rect_outside_line(rctf *rect, float *v1, float *v2, float *v3)
}
/* check if one of the triangle edges separates all rect points on 1 side */
-static int rect_isect_tria(rctf *rect, float *v1, float *v2, float *v3)
+static int rect_isect_tria(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
{
if(rect_outside_line(rect, v1, v2, v3))
return 0;
@@ -1935,7 +1928,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
isb_bsp_face_inside((ISBBranch *)zspan->rectz, &face);
}
-static int testclip_minmax(float *ho, float *minmax)
+static int testclip_minmax(const float ho[4], const float minmax[4])
{
float wco= ho[3];
int flag= 0;
@@ -2064,7 +2057,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
}
/* returns 1 when the viewpixel is visible in lampbuffer */
-static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *vlr, float x, float y, float *co)
+static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *vlr, float x, float y, float co_r[3])
{
float hoco[4], v1[3], nor[3];
float dface, fac, siz;
@@ -2123,12 +2116,12 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
return 0;
siz= 0.5f*(float)shb->size;
- co[0]= siz*(1.0f+hoco[0]/hoco[3]) -0.5f;
- co[1]= siz*(1.0f+hoco[1]/hoco[3]) -0.5f;
- co[2]= ((float)0x7FFFFFFF)*(hoco[2]/hoco[3]);
+ co_r[0]= siz*(1.0f+hoco[0]/hoco[3]) -0.5f;
+ co_r[1]= siz*(1.0f+hoco[1]/hoco[3]) -0.5f;
+ co_r[2]= ((float)0x7FFFFFFF)*(hoco[2]/hoco[3]);
/* XXXX bias, much less than normal shadbuf, or do we need a constant? */
- co[2] -= 0.05f*shb->bias;
+ co_r[2] -= 0.05f*shb->bias;
return 1;
}
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index fdc9bbe4b33..ad6a951adff 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -70,13 +70,13 @@ extern struct Render R;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* luminance rec. 709 */
-BM_INLINE float luminance(float* col)
+BM_INLINE float luminance(const float col[3])
{
return (0.212671f*col[0] + 0.71516f*col[1] + 0.072169f*col[2]);
}
/* tracing */
-static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co)
+static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
{
float visibility = 1.f;
@@ -121,11 +121,11 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co)
return visibility;
}
-static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco, Isect *isect, int intersect_type)
+static int vol_get_bounds(ShadeInput *shi, const float co[3], const float vec[3], float hitco[3], Isect *isect, int intersect_type)
{
- VECCOPY(isect->start, co);
- VECCOPY(isect->dir, vec );
+ copy_v3_v3(isect->start, co);
+ copy_v3_v3(isect->dir, vec);
isect->dist = FLT_MAX;
isect->mode= RE_RAY_MIRROR;
isect->last_hit = NULL;
@@ -153,7 +153,7 @@ static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco,
}
}
-static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
+static void shade_intersection(ShadeInput *shi, float col_r[4], Isect *is)
{
ShadeInput shi_new;
ShadeResult shr_new;
@@ -173,7 +173,7 @@ static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
shi_new.light_override= shi->light_override;
shi_new.mat_override= shi->mat_override;
- VECCOPY(shi_new.camera_co, is->start);
+ copy_v3_v3(shi_new.camera_co, is->start);
memset(&shr_new, 0, sizeof(ShadeResult));
@@ -182,16 +182,16 @@ static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
shade_ray(is, &shi_new, &shr_new);
}
- copy_v3_v3(col, shr_new.combined);
- col[3] = shr_new.alpha;
+ copy_v3_v3(col_r, shr_new.combined);
+ col_r[3] = shr_new.alpha;
}
-static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *col)
+static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col[3])
{
Isect isect;
- VECCOPY(isect.start, co);
- VECCOPY(isect.dir, shi->view);
+ copy_v3_v3(isect.start, co);
+ copy_v3_v3(isect.dir, shi->view);
isect.dist = FLT_MAX;
isect.mode= RE_RAY_MIRROR;
@@ -213,7 +213,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co
/* trilinear interpolation */
-static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float *scatter_col, float *co)
+static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float scatter_col[3], const float co[3])
{
VolumePrecache *vp = shi->obi->volume_precache;
float bbmin[3], bbmax[3], dim[3];
@@ -238,7 +238,7 @@ static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float *sca
/* Meta object density, brute force for now
* (might be good enough anyway, don't need huge number of metaobs to model volumetric objects */
-static float metadensity(Object* ob, float* co)
+static float metadensity(Object* ob, const float co[3])
{
float mat[4][4], imat[4][4], dens = 0.f;
MetaBall* mb = (MetaBall*)ob->data;
@@ -284,7 +284,7 @@ static float metadensity(Object* ob, float* co)
return (dens < 0.f) ? 0.f : dens;
}
-float vol_get_density(struct ShadeInput *shi, float *co)
+float vol_get_density(struct ShadeInput *shi, const float co[3])
{
float density = shi->mat->vol.density;
float density_scale = shi->mat->vol.density_scale;
@@ -305,11 +305,11 @@ float vol_get_density(struct ShadeInput *shi, float *co)
/* Color of light that gets scattered out by the volume */
/* Uses same physically based scattering parameter as in transmission calculations,
* along with artificial reflection scale/reflection color tint */
-static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
+static void vol_get_reflection_color(ShadeInput *shi, float ref_col[3], const float co[3])
{
float scatter = shi->mat->vol.scattering;
float reflection= shi->mat->vol.reflection;
- VECCOPY(ref_col, shi->mat->vol.reflection_col);
+ copy_v3_v3(ref_col, shi->mat->vol.reflection_col);
if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_REFLECTION_COL))
do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter);
@@ -325,10 +325,10 @@ static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
/* compute emission component, amount of radiance to add per segment
* can be textured with 'emit' */
-static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co)
+static void vol_get_emission(ShadeInput *shi, float emission_col[3], const float co[3])
{
float emission = shi->mat->vol.emission;
- VECCOPY(emission_col, shi->mat->vol.emission_col);
+ copy_v3_v3(emission_col, shi->mat->vol.emission_col);
if (shi->mat->mapto_textured & (MAP_EMISSION+MAP_EMISSION_COL))
do_volume_tex(shi, co, MAP_EMISSION+MAP_EMISSION_COL, emission_col, &emission);
@@ -343,7 +343,7 @@ static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co)
* This can possibly use a specific scattering color,
* and absorption multiplier factor too, but these parameters are left out for simplicity.
* It's easy enough to get a good wide range of results with just these two parameters. */
-static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
+static void vol_get_sigma_t(ShadeInput *shi, float sigma_t[3], const float co[3])
{
/* technically absorption, but named transmission color
* since it describes the effect of the coloring *after* absorption */
@@ -361,7 +361,7 @@ static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
/* phase function - determines in which directions the light
* is scattered in the volume relative to incoming direction
* and view direction */
-static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp)
+static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3], const float wp[3])
{
const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI)
@@ -408,7 +408,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float
}
/* Compute transmittance = e^(-attenuation) */
-static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density)
+static void vol_get_transmittance_seg(ShadeInput *shi, float tr[3], float stepsize, const float co[3], float density)
{
/* input density = density at co */
float tau[3] = {0.f, 0.f, 0.f};
@@ -428,7 +428,7 @@ static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize
}
/* Compute transmittance = e^(-attenuation) */
-static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float *endco)
+static void vol_get_transmittance(ShadeInput *shi, float tr[3], const float co[3], const float endco[3])
{
float p[3] = {co[0], co[1], co[2]};
float step_vec[3] = {endco[0] - co[0], endco[1] - co[1], endco[2] - co[2]};
@@ -464,7 +464,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float *
tr[2] = expf(-tau[2]);
}
-static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, float *view, LampRen *lar, float *lacol)
+static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const float view[3], LampRen *lar, float lacol[3])
{
float visifac, lv[3], lampdist;
float tr[3]={1.0,1.0,1.0};
@@ -487,7 +487,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, float *view, L
mul_v3_fl(lacol, visifac);
if (ELEM(lar->type, LA_SUN, LA_HEMI))
- VECCOPY(lv, lar->vec);
+ copy_v3_v3(lv, lar->vec);
negate_v3(lv);
if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) {
@@ -546,14 +546,14 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, float *view, L
}
/* single scattering only for now */
-void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co, float *view)
+void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3], const float view[3])
{
ListBase *lights;
GroupObject *go;
LampRen *lar;
-
- scatter_col[0] = scatter_col[1] = scatter_col[2] = 0.f;
-
+
+ zero_v3(scatter_col);
+
lights= get_lights(shi);
for(go=lights->first; go; go= go->next)
{
@@ -585,7 +585,7 @@ outgoing radiance from behind surface * beam transmittance/attenuation
* it also makes it harder to control the overall look of the volume since coloring the outscattered light results
* in the inverse color being transmitted through the rest of the volume.
*/
-static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float *endco)
+static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co[3], const float endco[3])
{
float radiance[3] = {0.f, 0.f, 0.f};
float tr[3] = {1.f, 1.f, 1.f};
@@ -736,7 +736,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
copy_v3_v3(shr->combined, col);
shr->alpha = col[3];
- VECCOPY(shr->diff, shr->combined);
+ copy_v3_v3(shr->diff, shr->combined);
}
/* Traces a shadow through the object,