diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-09-20 21:51:04 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-09-20 21:51:04 +0400 |
commit | 15cb47bf91820aac3a3881e94378067472c07e1b (patch) | |
tree | f8db8dd34c6a0b660ad1816e002c9ef3af939b00 /source/blender/render | |
parent | 9de082dbf4130b48d59e673ed276a046d97cc1e4 (diff) | |
parent | bc788a3607eda1889c7f0fe2201116826a9394ee (diff) |
Merge with trunk r40409
Diffstat (limited to 'source/blender/render')
30 files changed, 436 insertions, 446 deletions
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/render_types.h b/source/blender/render/intern/include/render_types.h index 13ca40bfd20..0b339d285ce 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -338,7 +338,7 @@ typedef struct ObjectInstanceRen { struct VolumePrecache *volume_precache; - float *vectors; + float *vectors; /* (RE_WINSPEED_ELEMS * VertRen.index) */ int totvector; /* used on makeraytree */ @@ -354,8 +354,8 @@ typedef struct VertRen float co[3]; float n[3]; float *orco; - short clip; - unsigned short flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c */ + unsigned int flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c + * only an 'int' because of alignment, could be a char too */ float accum; /* accum for radio weighting, and for strand texco static particles */ int index; /* index allows extending vertren with any property */ } VertRen; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 67c3cbcebe2..f9486b5d5c0 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -81,8 +81,8 @@ float mistfactor(float zcor, float *co); /* dist and height, return alpha */ void renderspothalo(struct ShadeInput *shi, float *col, float alpha); void add_halo_flare(Render *re); -void calc_renderco_zbuf(float *co, float *view, int z); -void calc_renderco_ortho(float *co, float x, float y, int z); +void calc_renderco_zbuf(float co[3], float *view, int z); +void calc_renderco_ortho(float co[3], float x, float y, int z); int count_mask(unsigned short mask); diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index e1fa208d0b6..06185d0ae74 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -91,7 +91,7 @@ void free_renderdata_vertnodes(struct VertTableNode *vertnodes); void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes); void set_normalflags(struct Render *re, struct ObjectRen *obr); -void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs, int do_buckets); +void project_renderdata(struct Render *re, void (*projectfunc)(const float *, float mat[][4], float *), int do_pano, float xoffs, int do_buckets); int clip_render_object(float boundbox[][3], float *bounds, float mat[][4]); /* functions are not exported... so wrong names */ 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 07d24ea6d66..91507ef3f98 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -63,7 +63,7 @@ void shade_volume_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, 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, float *co, float *dxco, float *dyco); 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); @@ -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 1da144a099f..294c7b53766 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, struct Render *re); +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, int mapto_flag, float *col, float *val, struct Render *re); 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 6d8d4cbe0f2..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 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/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h index 2353b24f310..68e924c1f2e 100644 --- a/source/blender/render/intern/include/voxeldata.h +++ b/source/blender/render/intern/include/voxeldata.h @@ -46,6 +46,6 @@ typedef struct VoxelDataHeader void cache_voxeldata(Tex *tex, int scene_frame); void make_voxeldata(struct Render *re); void free_voxeldata(struct Render *re); -int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres); +int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres); #endif /* VOXELDATA_H */ diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 4c87520d4d1..0d129081d62 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -51,9 +51,9 @@ void fillrect(int *rect, int x, int y, int val); * Converts a world coordinate into a homogenous coordinate in view * coordinates. */ -void projectvert(float *v1, float winmat[][4], float *adr); -void projectverto(float *v1, float winmat[][4], float *adr); -int testclip(float *v); +void projectvert(const float v1[3], float winmat[][4], float adr[4]); +void projectverto(const float v1[3], float winmat[][4], float adr[4]); +int testclip(const float v[3]); void zbuffer_shadow(struct Render *re, float winmat[][4], struct LampRen *lar, int *rectz, int size, float jitx, float jity); void zbuffer_abuf_shadow(struct Render *re, struct LampRen *lar, float winmat[][4], struct APixstr *APixbuf, struct APixstrand *apixbuf, struct ListBase *apsmbase, int size, int samples, float (*jit)[2]); diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index e35fcbc2df7..5fa0b836f4f 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -264,7 +264,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3] return 0; } -static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[][3]) +static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[4][3]) { Branch *br; Node *no; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 2f79560efd6..a15662f86f4 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -142,7 +142,7 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize) har= RE_findOrAddHalo(obr, obr->tothalo++); /* projectvert is done in function zbufvlaggen again, because of parts */ - VECCOPY(har->co, vec); + copy_v3_v3(har->co, vec); har->hasize= hasize; har->zd= 0.0; @@ -547,7 +547,7 @@ static void GetPosition(const SMikkTSpaceContext * pContext, float fPos[], const SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); const float *co= (&vlr->v1)[vert_index]->co; - VECCOPY(fPos, co); + copy_v3_v3(fPos, co); } static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[], const int face_num, const int vert_index) @@ -576,7 +576,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); const float *n= (&vlr->v1)[vert_index]->n; - VECCOPY(fNorm, n); + copy_v3_v3(fNorm, n); } static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) { @@ -585,7 +585,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1); if(ftang!=NULL) { - VECCOPY(&ftang[iVert*4+0], fvTangent); + copy_v3_v3(&ftang[iVert*4+0], fvTangent); ftang[iVert*4+3]=fSign; } } @@ -632,10 +632,10 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen VlakRen *vlr= RE_findOrAddVlak(obr, a); if((vlr->flag & ME_SMOOTH)==0) { - if(is_zero_v3(vlr->v1->n)) VECCOPY(vlr->v1->n, vlr->n); - if(is_zero_v3(vlr->v2->n)) VECCOPY(vlr->v2->n, vlr->n); - if(is_zero_v3(vlr->v3->n)) VECCOPY(vlr->v3->n, vlr->n); - if(vlr->v4 && is_zero_v3(vlr->v4->n)) VECCOPY(vlr->v4->n, vlr->n); + if(is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n); + if(is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n); + if(is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n); + if(vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n); } if(do_nmap_tangent) { @@ -647,17 +647,17 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1); vtang= find_vertex_tangent(vtangents[v1->index], tface->uv[0]); - VECCOPY(ftang, vtang); + copy_v3_v3(ftang, vtang); normalize_v3(ftang); vtang= find_vertex_tangent(vtangents[v2->index], tface->uv[1]); - VECCOPY(ftang+4, vtang); + copy_v3_v3(ftang+4, vtang); normalize_v3(ftang+4); vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]); - VECCOPY(ftang+8, vtang); + copy_v3_v3(ftang+8, vtang); normalize_v3(ftang+8); if(v4) { vtang= find_vertex_tangent(vtangents[v4->index], tface->uv[3]); - VECCOPY(ftang+12, vtang); + copy_v3_v3(ftang+12, vtang); normalize_v3(ftang+12); } for(k=0; k<4; k++) ftang[4*k+3]=1; @@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d if(obr->totvert==0) return; asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts"); - thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f ); + thresh= cosf(DEG2RADF((0.5f + (float)degr))); /* step zero: give faces normals of original mesh, if this is provided */ @@ -981,7 +981,7 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree) } } -static Material *give_render_material(Render *re, Object *ob, int nr) +static Material *give_render_material(Render *re, Object *ob, short nr) { extern Material defmaterial; /* material.c */ Material *ma; @@ -1023,7 +1023,7 @@ typedef struct ParticleStrandData } ParticleStrandData; /* future thread problem... */ -static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, ParticleStrandData *sd, float *vec, float *vec1) +static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, ParticleStrandData *sd, const float vec[3], const float vec1[3]) { static VertRen *v1= NULL, *v2= NULL; VlakRen *vlr= NULL; @@ -1090,27 +1090,27 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par vlr->v3= RE_findOrAddVert(obr, obr->totvert++); vlr->v4= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(vlr->v1->co, vec); + copy_v3_v3(vlr->v1->co, vec); add_v3_v3(vlr->v1->co, cross); - VECCOPY(vlr->v1->n, nor); + copy_v3_v3(vlr->v1->n, nor); vlr->v1->orco= sd->orco; vlr->v1->accum= -1.0f; // accum abuse for strand texco - VECCOPY(vlr->v2->co, vec); + copy_v3_v3(vlr->v2->co, vec); sub_v3_v3v3(vlr->v2->co, vlr->v2->co, cross); - VECCOPY(vlr->v2->n, nor); + copy_v3_v3(vlr->v2->n, nor); vlr->v2->orco= sd->orco; vlr->v2->accum= vlr->v1->accum; - VECCOPY(vlr->v4->co, vec1); + copy_v3_v3(vlr->v4->co, vec1); add_v3_v3(vlr->v4->co, cross); - VECCOPY(vlr->v4->n, nor); + copy_v3_v3(vlr->v4->n, nor); vlr->v4->orco= sd->orco; vlr->v4->accum= 1.0f; // accum abuse for strand texco - VECCOPY(vlr->v3->co, vec1); + copy_v3_v3(vlr->v3->co, vec1); sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross); - VECCOPY(vlr->v3->n, nor); + copy_v3_v3(vlr->v3->n, nor); vlr->v3->orco= sd->orco; vlr->v3->accum= vlr->v4->accum; @@ -1121,7 +1121,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->surfnor) { float *snor= RE_vlakren_get_surfnor(obr, vlr, 1); - VECCOPY(snor, sd->surfnor); + copy_v3_v3(snor, sd->surfnor); } if(sd->uvco){ @@ -1156,23 +1156,23 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par /* first two vertices of a strand */ else if(sd->first) { if(sd->adapt){ - VECCOPY(anor, nor); - VECCOPY(avec, vec); + copy_v3_v3(anor, nor); + copy_v3_v3(avec, vec); second=1; } v1= RE_findOrAddVert(obr, obr->totvert++); v2= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); add_v3_v3(v1->co, cross); - VECCOPY(v1->n, nor); + copy_v3_v3(v1->n, nor); v1->orco= sd->orco; v1->accum= -1.0f; // accum abuse for strand texco - VECCOPY(v2->co, vec); + copy_v3_v3(v2->co, vec); sub_v3_v3v3(v2->co, v2->co, cross); - VECCOPY(v2->n, nor); + copy_v3_v3(v2->n, nor); v2->orco= sd->orco; v2->accum= v1->accum; } @@ -1192,8 +1192,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->adapt){ second=0; - VECCOPY(anor,nor); - VECCOPY(avec,vec); + copy_v3_v3(anor,nor); + copy_v3_v3(avec,vec); } } @@ -1218,23 +1218,23 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par v1= vlr->v4; // cycle v2= vlr->v3; // cycle - VECCOPY(anor,nor); - VECCOPY(avec,vec); + copy_v3_v3(anor,nor); + copy_v3_v3(avec,vec); } else{ vlr= RE_findOrAddVlak(obr, obr->totvlak-1); } } - VECCOPY(vlr->v4->co, vec); + copy_v3_v3(vlr->v4->co, vec); add_v3_v3(vlr->v4->co, cross); - VECCOPY(vlr->v4->n, nor); + copy_v3_v3(vlr->v4->n, nor); vlr->v4->orco= sd->orco; vlr->v4->accum= -1.0f + 2.0f*sd->time; // accum abuse for strand texco - VECCOPY(vlr->v3->co, vec); + copy_v3_v3(vlr->v3->co, vec); sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross); - VECCOPY(vlr->v3->n, nor); + copy_v3_v3(vlr->v3->n, nor); vlr->v3->orco= sd->orco; vlr->v3->accum= vlr->v4->accum; @@ -1245,7 +1245,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->surfnor) { float *snor= RE_vlakren_get_surfnor(obr, vlr, 1); - VECCOPY(snor, sd->surfnor); + copy_v3_v3(snor, sd->surfnor); } if(sd->uvco){ @@ -1279,7 +1279,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par } } -static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float *vec1, int first, int line) +static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3], const float vec1[3], int first, int line) { VlakRen *vlr; static VertRen *v1; @@ -1291,13 +1291,13 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float vlr->v3= vlr->v2; vlr->v4= NULL; - VECCOPY(vlr->v1->co, vec); - VECCOPY(vlr->v2->co, vec1); + copy_v3_v3(vlr->v1->co, vec); + copy_v3_v3(vlr->v2->co, vec1); sub_v3_v3v3(vlr->n, vec, vec1); normalize_v3(vlr->n); - VECCOPY(vlr->v1->n, vlr->n); - VECCOPY(vlr->v2->n, vlr->n); + copy_v3_v3(vlr->v1->n, vlr->n); + copy_v3_v3(vlr->v2->n, vlr->n); vlr->mat= ma; vlr->ec= ME_V1V2; @@ -1305,7 +1305,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float } else if(first) { v1= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); } else { vlr= RE_findOrAddVlak(obr, obr->totvlak++); @@ -1315,11 +1315,11 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float vlr->v4= NULL; v1= vlr->v2; // cycle - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); sub_v3_v3v3(vlr->n, vec, vec1); normalize_v3(vlr->n); - VECCOPY(v1->n, vlr->n); + copy_v3_v3(v1->n, vlr->n); vlr->mat= ma; vlr->ec= ME_V1V2; @@ -1376,10 +1376,10 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl mul_m4_v3(re->viewmat, vlr->v4->co); normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co); - VECCOPY(vlr->v1->n,vlr->n); - VECCOPY(vlr->v2->n,vlr->n); - VECCOPY(vlr->v3->n,vlr->n); - VECCOPY(vlr->v4->n,vlr->n); + copy_v3_v3(vlr->v1->n,vlr->n); + copy_v3_v3(vlr->v2->n,vlr->n); + copy_v3_v3(vlr->v3->n,vlr->n); + copy_v3_v3(vlr->v4->n,vlr->n); vlr->mat= ma; vlr->ec= ME_V2V3; @@ -1470,7 +1470,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re { float loc[3], loc0[3], loc1[3], vel[3]; - VECCOPY(loc, state->co); + copy_v3_v3(loc, state->co); if(ren_as != PART_DRAW_BB) mul_m4_v3(re->viewmat, loc); @@ -1481,15 +1481,15 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re sd->time = 0.0f; sd->size = hasize; - VECCOPY(vel, state->vel); + copy_v3_v3(vel, state->vel); mul_mat3_m4_v3(re->viewmat, vel); normalize_v3(vel); if(part->draw & PART_DRAW_VEL_LENGTH) mul_v3_fl(vel, len_v3(state->vel)); - VECADDFAC(loc0, loc, vel, -part->draw_line[0]); - VECADDFAC(loc1, loc, vel, part->draw_line[1]); + madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]); + madd_v3_v3v3fl(loc1, loc, vel, part->draw_line[1]); particle_curve(re, obr, dm, ma, sd, loc0, loc1, seed, pa_co); @@ -1497,8 +1497,8 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re case PART_DRAW_BB: - VECCOPY(bb->vec, loc); - VECCOPY(bb->vel, state->vel); + copy_v3_v3(bb->vec, loc); + copy_v3_v3(bb->vel, state->vel); particle_billboard(re, obr, ma, bb); @@ -1717,7 +1717,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(part->draw & PART_DRAW_REN_ADAPT) { sd.adapt = 1; sd.adapt_pix = (float)part->adapt_pix; - sd.adapt_angle = cos((float)part->adapt_angle * (float)(M_PI / 180.0)); + sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle)); } if(re->r.renderer==R_INTERN && part->draw&PART_DRAW_REN_STRAND) { @@ -1728,7 +1728,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem strandbuf->winx= re->winx; strandbuf->winy= re->winy; strandbuf->maxdepth= 2; - strandbuf->adaptcos= cos((float)part->adapt_angle*(float)(M_PI/180.0)); + strandbuf->adaptcos= cosf(DEG2RADF((float)part->adapt_angle)); strandbuf->overrideuv= sd.override_uv; strandbuf->minwidth= ma->strand_min; @@ -1892,7 +1892,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem strand= RE_findOrAddStrand(obr, obr->totstrand++); strand->buffer= strandbuf; strand->vert= svert; - VECCOPY(strand->orco, sd.orco); + copy_v3_v3(strand->orco, sd.orco); if(dosimplify) { float *ssimplify= RE_strandren_get_simplify(obr, strand, 1); @@ -1902,7 +1902,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(sd.surfnor) { float *snor= RE_strandren_get_surfnor(obr, strand, 1); - VECCOPY(snor, sd.surfnor); + copy_v3_v3(snor, sd.surfnor); } if(dosurfacecache && num >= 0) { @@ -1945,8 +1945,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem float time; if(k<=max_k){ - VECCOPY(state.co,(cache+k)->co); - VECCOPY(state.vel,(cache+k)->vel); + copy_v3_v3(state.co,(cache+k)->co); + copy_v3_v3(state.vel,(cache+k)->vel); } else continue; @@ -1955,11 +1955,11 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem curlen += len_v3v3((cache+k-1)->co, (cache+k)->co); time= curlen/strandlen; - VECCOPY(loc,state.co); + copy_v3_v3(loc,state.co); mul_m4_v3(re->viewmat,loc); if(strandbuf) { - VECCOPY(svert->co, loc); + copy_v3_v3(svert->co, loc); svert->strandco= -1.0f + 2.0f*time; svert++; strand->totvert++; @@ -1982,7 +1982,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(k) particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co); - VECCOPY(loc1,loc); + copy_v3_v3(loc1,loc); } } @@ -2147,7 +2147,7 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int if(ok) { hasize= ma->hasize; - VECCOPY(vec, mvert->co); + copy_v3_v3(vec, mvert->co); mul_m4_v3(mat, vec); if(ma->mode & MA_HALOPUNO) { @@ -2161,7 +2161,7 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int nor[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn; normalize_v3(nor); - VECCOPY(view, vec); + copy_v3_v3(view, vec); normalize_v3(view); zn= nor[0]*view[0]+nor[1]*view[1]+nor[2]*view[2]; @@ -2238,9 +2238,9 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve int i; /* shi->co is current render coord, just make sure at least some vector is here */ - VECCOPY(shi->co, vr->co); + copy_v3_v3(shi->co, vr->co); /* vertex normal is used for textures type 'col' and 'var' */ - VECCOPY(shi->vn, vr->n); + copy_v3_v3(shi->vn, vr->n); if(mat) mul_m4_v3(mat, shi->co); @@ -2269,7 +2269,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve /* set all rendercoords, 'texco' is an ORed value for all textures needed */ if ((texco & TEXCO_ORCO) && (vr->orco)) { - VECCOPY(shi->lo, vr->orco); + copy_v3_v3(shi->lo, vr->orco); } if (texco & TEXCO_STICKY) { float *sticky= RE_vertren_get_sticky(obr, vr, 0); @@ -2280,11 +2280,11 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve } } if (texco & TEXCO_GLOB) { - VECCOPY(shi->gl, shi->co); + copy_v3_v3(shi->gl, shi->co); mul_m4_v3(re->viewinv, shi->gl); } if (texco & TEXCO_NORM) { - VECCOPY(shi->orn, shi->vn); + copy_v3_v3(shi->orn, shi->vn); } if(texco & TEXCO_REFL) { /* not (yet?) */ @@ -2461,7 +2461,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) for(a=0; a<dl->nr; a++, data+=3, nors+=3) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); + copy_v3_v3(ver->co, data); mul_m4_v3(mat, ver->co); /* render normals are inverted */ @@ -2540,7 +2540,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, data= dl->verts; for (u = 0; u < sizeu; u++) { v1 = RE_findOrAddVert(obr, obr->totvert++); /* save this for possible V wrapping */ - VECCOPY(v1->co, data); data += 3; + copy_v3_v3(v1->co, data); data += 3; if(orco) { v1->orco= orco; orco+= 3; orcoret++; } @@ -2548,7 +2548,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, for (v = 1; v < sizev; v++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); data += 3; + copy_v3_v3(ver->co, data); data += 3; if(orco) { ver->orco= orco; orco+= 3; orcoret++; } @@ -2557,7 +2557,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, /* if V-cyclic, add extra vertices at end of the row */ if (dl->flag & DL_CYCL_U) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, v1->co); + copy_v3_v3(ver->co, v1->co); if(orco) { ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0); } @@ -2573,7 +2573,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, for (v = 0; v < nsizev; v++) { v1= RE_findOrAddVert(obr, startvert + v); ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, v1->co); + copy_v3_v3(ver->co, v1->co); if(orco) { ver->orco= orco; orco+=3; orcoret++; //ver->orco= orcobase + 3*(0*sizev + v); } @@ -2602,7 +2602,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, normal_quad_v3( n1,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co); - VECCOPY(vlr->n, n1); + copy_v3_v3(vlr->n, n1); vlr->mat= matar[ dl->col]; vlr->ec= ME_V1V2+ME_V2V3; @@ -2670,10 +2670,10 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, add_v3_v3(n1, vlr2->n); vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m,0) */ add_v3_v3(n1, vlr3->n); - VECCOPY(vlr->v3->n, n1); - VECCOPY(vlr1->v1->n, n1); - VECCOPY(vlr2->v2->n, n1); - VECCOPY(vlr3->v4->n, n1); + copy_v3_v3(vlr->v3->n, n1); + copy_v3_v3(vlr1->v1->n, n1); + copy_v3_v3(vlr2->v2->n, n1); + copy_v3_v3(vlr3->v4->n, n1); } for(a = startvert; a < obr->totvert; a++) { ver= RE_findOrAddVert(obr, a); @@ -2688,7 +2688,8 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, int timeoffset, float *orco, float mat[4][4]) { Object *ob= obr->ob; - int a, a1, end, totvert, vertofs; + int a, end, totvert, vertofs; + short mat_iter; VertRen *ver; VlakRen *vlr; MVert *mvert = NULL; @@ -2701,7 +2702,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, for(a=0; a<totvert; a++, mvert++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, mvert->co); + copy_v3_v3(ver->co, mvert->co); mul_m4_v3(mat, ver->co); if(orco) { @@ -2718,16 +2719,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, /* faces in order of color blocks */ vertofs= obr->totvert - totvert; - for(a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) { + for(mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) { - ma= give_render_material(re, ob, a1+1); + ma= give_render_material(re, ob, mat_iter+1); end= dm->getNumFaces(dm); mface= dm->getFaceArray(dm); for(a=0; a<end; a++, mface++) { int v1, v2, v3, v4, flag; - if( mface->mat_nr==a1 ) { + if(mface->mat_nr == mat_iter) { float len; v1= mface->v1; @@ -2913,7 +2914,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) for(a=0; a<dl->nr; a++, data+=3) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); + copy_v3_v3(ver->co, data); mul_m4_v3(mat, ver->co); @@ -2979,7 +2980,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) while(nr--) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, fp); + copy_v3_v3(ver->co, fp); mul_m4_v3(mat, ver->co); fp+= 3; @@ -3340,7 +3341,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) for(a=0; a<totvert; a++, mvert++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, mvert->co); + copy_v3_v3(ver->co, mvert->co); if(do_autosmooth==0) { /* autosmooth on original unrotated data to prevent differences between frames */ normal_short_to_float_v3(ver->n, mvert->no); mul_m4_v3(mat, ver->co); @@ -3782,7 +3783,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren"); lar->sunsky->effect_type = la->sun_effect_type; - VECCOPY(vec,ob->obmat[2]); + copy_v3_v3(vec,ob->obmat[2]); normalize_v3(vec); InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness, @@ -4001,7 +4002,7 @@ void init_render_world(Render *re) cp[2]= 255.0f*re->wrld.horb; cp[3]= 1; - VECCOPY(re->grvec, re->viewmat[2]); + copy_v3_v3(re->grvec, re->viewmat[2]); normalize_v3(re->grvec); copy_m3_m4(re->imat, re->viewinv); @@ -4051,25 +4052,25 @@ static void set_phong_threshold(ObjectRen *obr) for(i=0; i<obr->totvlak; i++) { vlr= RE_findOrAddVlak(obr, i); if(vlr->flag & R_SMOOTH) { - dot= INPR(vlr->n, vlr->v1->n); + dot= dot_v3v3(vlr->n, vlr->v1->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } - dot= INPR(vlr->n, vlr->v2->n); + dot= dot_v3v3(vlr->n, vlr->v2->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } - dot= INPR(vlr->n, vlr->v3->n); + dot= dot_v3v3(vlr->n, vlr->v3->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } if(vlr->v4) { - dot= INPR(vlr->n, vlr->v4->n); + dot= dot_v3v3(vlr->n, vlr->v4->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; @@ -4340,16 +4341,16 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) strand_minmax(strand, smin, smax, width); } - VECCOPY(sbound->boundbox[0], smin); - VECCOPY(sbound->boundbox[1], smax); + copy_v3_v3(sbound->boundbox[0], smin); + copy_v3_v3(sbound->boundbox[1], smax); DO_MINMAX(smin, min, max); DO_MINMAX(smax, min, max); } } - VECCOPY(obr->boundbox[0], min); - VECCOPY(obr->boundbox[1], max); + copy_v3_v3(obr->boundbox[0], min); + copy_v3_v3(obr->boundbox[1], max); } } } @@ -4932,7 +4933,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* fill in instance variables for texturing */ set_dupli_tex_mat(re, obi, dob); if(dob->type != OB_DUPLIGROUP) { - VECCOPY(obi->dupliorco, dob->orco); + copy_v3_v3(obi->dupliorco, dob->orco); obi->dupliuv[0]= dob->uv[0]; obi->dupliuv[1]= dob->uv[1]; } @@ -4958,7 +4959,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp set_dupli_tex_mat(re, obi, dob); if(dob->type != OB_DUPLIGROUP) { - VECCOPY(obi->dupliorco, dob->orco); + copy_v3_v3(obi->dupliorco, dob->orco); obi->dupliuv[0]= dob->uv[0]; obi->dupliuv[1]= dob->uv[1]; } @@ -5064,7 +5065,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* still bad... doing all */ init_render_textures(re); - VECCOPY(amb, &re->wrld.ambr); + copy_v3_v3(amb, &re->wrld.ambr); init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); @@ -5216,7 +5217,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la } /* choose to use static, to prevent giving too many args to this call */ -static void speedvector_project(Render *re, float *zco, float *co, float *ho) +static void speedvector_project(Render *re, float zco[2], const float co[3], const float ho[4]) { static float pixelphix=0.0f, pixelphiy=0.0f, zmulx=0.0f, zmuly=0.0f; static int pano= 0; @@ -5251,7 +5252,7 @@ static void speedvector_project(Render *re, float *zco, float *co, float *ho) if(pano) { float vec[3], ang; /* angle between (0,0,-1) and (co) */ - VECCOPY(vec, co); + copy_v3_v3(vec, co); ang= saacos(-vec[2]/sqrt(vec[0]*vec[0] + vec[2]*vec[2])); if(vec[0]<0.0f) ang= -ang; @@ -5267,7 +5268,7 @@ static void speedvector_project(Render *re, float *zco, float *co, float *ho) } } -static void calculate_speedvector(float *vectors, int step, float winsq, float winroot, float *co, float *ho, float *speed) +static void calculate_speedvector(const float vectors[2], int step, float winsq, float winroot, const float co[3], const float ho[4], float speed[4]) { float zco[2], len; @@ -5764,7 +5765,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, /* still bad... doing all */ init_render_textures(re); - VECCOPY(amb, &re->wrld.ambr); + copy_v3_v3(amb, &re->wrld.ambr); init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); @@ -5860,7 +5861,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d) ms= me->msticky; for(a=0; a<me->totvert; a++, ms++, mvert++) { - VECCOPY(ho, mvert->co); + copy_v3_v3(ho, mvert->co); mul_m4_v3(mat, ho); projectverto(ho, re->winmat, ho); ms->co[0]= ho[0]/ho[3]; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 66a73b47790..e2b3b23b9c9 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -240,8 +240,8 @@ static void envmap_transmatrix(float mat[][4], int part) copy_m4_m4(tmat, mat); eul_to_mat4( rotmat,eul); mul_serie_m4(mat, tmat, rotmat, - 0, 0, 0, - 0, 0, 0); + NULL, NULL, NULL, + NULL, NULL, NULL); } /* ------------------------------------------------------------------------- */ 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/occlusion.c b/source/blender/render/intern/source/occlusion.c index 54137c62d22..36dd4eb9708 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1777,11 +1777,11 @@ void sample_occ(Render *re, ShadeInput *shi) if(cache->sample && cache->step) { sample= &cache->sample[(shi->ys-cache->y)*cache->w + (shi->xs-cache->x)]; - VECCOPY(sample->co, shi->co); - VECCOPY(sample->n, shi->vno); - VECCOPY(sample->ao, shi->ao); - VECCOPY(sample->env, shi->env); - VECCOPY(sample->indirect, shi->indirect); + copy_v3_v3(sample->co, shi->co); + copy_v3_v3(sample->n, shi->vno); + copy_v3_v3(sample->ao, shi->ao); + copy_v3_v3(sample->env, shi->env); + copy_v3_v3(sample->indirect, shi->indirect); sample->intensity= MAX3(sample->ao[0], sample->ao[1], sample->ao[2]); sample->intensity= MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2])); sample->intensity= MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2])); @@ -1872,11 +1872,11 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp) exclude.facenr= shi->vlr->index; sample_occ_tree(re, tree, &exclude, shi->co, shi->vno, shi->thread, onlyshadow, shi->ao, shi->env, shi->indirect); - VECCOPY(sample->co, shi->co); - VECCOPY(sample->n, shi->vno); - VECCOPY(sample->ao, shi->ao); - VECCOPY(sample->env, shi->env); - VECCOPY(sample->indirect, shi->indirect); + copy_v3_v3(sample->co, shi->co); + copy_v3_v3(sample->n, shi->vno); + copy_v3_v3(sample->ao, shi->ao); + copy_v3_v3(sample->env, shi->env); + copy_v3_v3(sample->indirect, shi->indirect); sample->intensity= MAX3(sample->ao[0], sample->ao[1], sample->ao[2]); sample->intensity= MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2])); sample->intensity= MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2])); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 49e5e7b989d..05bcc32a90a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1452,10 +1452,12 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle)) /* object is considered fully prepared on correct time etc */ /* includes lights */ +#if 0 void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob)) { } +#endif /* *************************************** */ diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index febfea89f04..5c5162d268b 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; } @@ -306,7 +306,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, /* soften the halo if it intersects geometry */ if(har->mat && har->mat->mode & MA_HALO_SOFT) { - float segment_length, halo_depth, distance_from_z, visible_depth, soften; + float segment_length, halo_depth, distance_from_z /* , visible_depth */ /* UNUSED */, soften; /* calculate halo depth */ segment_length= har->hasize*sasqrt(1.0f - dist/(har->rad*har->rad)); @@ -317,7 +317,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, /* calculate how much of this depth is visible */ distance_from_z = haloZtoDist(zz) - haloZtoDist(har->zs); - visible_depth = halo_depth; + /* visible_depth = halo_depth; */ /* UNUSED */ if(distance_from_z < segment_length) { soften= (segment_length + distance_from_z)/halo_depth; @@ -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/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 28406732b9d..5f5a4e9c638 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -107,7 +107,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa ParticleSimulationData sim= {NULL}; ParticleData *pa=NULL; float cfra = BKE_curframe(re->scene); - int i, childexists; + int i /*, childexists*/ /* UNUSED */; int total_particles, offset=0; int data_used = point_data_used(pd); float partco[3]; @@ -143,9 +143,11 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa pd->totpoints = total_particles; if (data_used & POINT_DATA_VEL) offset = pd->totpoints*3; +#if 0 /* UNUSED */ if (psys->totchild > 0 && !(psys->part->draw & PART_DRAW_PARENT)) childexists = 1; - +#endif + for (i=0, pa=psys->particles; i < total_particles; i++, pa++) { state.time = cfra; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 56b6dedd24c..2b04a3520e8 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -125,7 +125,7 @@ static void init_render_texture(Render *re, Tex *tex) } if(tex->nodetree && tex->use_nodes) { - ntreeBeginExecTree(tex->nodetree); /* has internal flag to detect it only does it once */ + ntreeTexBeginExecTree(tex->nodetree, 1); /* has internal flag to detect it only does it once */ } } @@ -144,8 +144,8 @@ void init_render_textures(Render *re) static void end_render_texture(Tex *tex) { - if(tex && tex->use_nodes && tex->nodetree) - ntreeEndExecTree(tex->nodetree); + if(tex && tex->use_nodes && tex->nodetree && tex->nodetree->execdata) + ntreeTexEndExecTree(tex->nodetree->execdata, 1); } void end_render_textures(Render *re) @@ -505,7 +505,7 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres) if(texres->nor) { - VECCOPY(texres->nor, nor); + copy_v3_v3(texres->nor, nor); tex_normal_derivate(tex, texres); if(tex->stype==TEX_WALLOUT) { @@ -755,9 +755,9 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex if(pit && pit->doit) { if(texres->nor) { if (pit->version < 6) { - VECCOPY(pit->result+5, texres->nor); + copy_v3_v3(pit->result+5, texres->nor); } else { - VECCOPY(result+5, texres->nor); + copy_v3_v3(result+5, texres->nor); } } if (pit->version < 6) { @@ -781,9 +781,9 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex if(rgbnor & TEX_NOR) { if(texres->nor) { if (pit->version < 6) { - VECCOPY(texres->nor, pit->result+5); + copy_v3_v3(texres->nor, pit->result+5); } else { - VECCOPY(texres->nor, result+5); + copy_v3_v3(texres->nor, result+5); } } } @@ -820,7 +820,7 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float nor[0]= x; nor[1]= y; nor[2]= z; // use local render coord } else { - VECCOPY(nor, n); + copy_v3_v3(nor, n); } mul_mat3_m4_v3(R.viewinv, nor); @@ -914,7 +914,7 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad if(n==NULL) return 0; - VECCOPY(nor, n); + copy_v3_v3(nor, n); if(ob) mul_mat3_m4_v3(ob->imat, nor); x1= fabs(nor[0]); @@ -1219,7 +1219,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, /* ton: added this, for Blender convention reason. * artificer: added the use of tmpvec to avoid scaling texvec */ - VECCOPY(tmpvec, texvec); + copy_v3_v3(tmpvec, texvec); mul_v3_fl(tmpvec, 1.0f/tex->noisesize); switch(tex->stype) { @@ -1241,7 +1241,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, /* ton: added this, for Blender convention reason. * artificer: added the use of tmpvec to avoid scaling texvec */ - VECCOPY(tmpvec, texvec); + copy_v3_v3(tmpvec, texvec); mul_v3_fl(tmpvec, 1.0f/tex->noisesize); retval= voronoiTex(tex, tmpvec, texres); @@ -1250,7 +1250,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, /* ton: added this, for Blender convention reason. * artificer: added the use of tmpvec to avoid scaling texvec */ - VECCOPY(tmpvec, texvec); + copy_v3_v3(tmpvec, texvec); mul_v3_fl(tmpvec, 1.0f/tex->noisesize); retval= mg_distNoiseTex(tex, tmpvec, texres); @@ -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; @@ -1477,32 +1477,32 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg case MTEX_BLEND_HUE: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_HUE, in, in+1, in+2, fact, tex); break; case MTEX_BLEND_SAT: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_SAT, in, in+1, in+2, fact, tex); break; case MTEX_BLEND_VAL: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_VAL, in, in+1, in+2, fact, tex); break; case MTEX_BLEND_COLOR: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_COLOR, in, in+1, in+2, fact, tex); break; case MTEX_SOFT_LIGHT: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_SOFT, in, in+1, in+2, fact, tex); break; case MTEX_LIN_LIGHT: fact*= facg; - VECCOPY(in, out); + copy_v3_v3(in, out); ramp_blend(MA_RAMP_LINEAR, in, in+1, in+2, fact, tex); break; } @@ -1924,8 +1924,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T Hscale *= 0.1f; // factor 0.1 proved to look like the previous bump code if( !ntap_bump->init_done ) { - VECCOPY(ntap_bump->vNacc, shi->vn); - VECCOPY(ntap_bump->vNorg, shi->vn); + copy_v3_v3(ntap_bump->vNacc, shi->vn); + copy_v3_v3(ntap_bump->vNorg, shi->vn); ntap_bump->fPrevMagnitude = 1.0f; ntap_bump->iPrevBumpSpace = 0; @@ -1994,7 +1994,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T else { /* same as above, but doing 5 taps, increasing quality at cost of speed */ float STc[3], STl[3], STr[3], STd[3], STu[3]; - float Hc, Hl, Hr, Hd, Hu; + float /* Hc, */ /* UNUSED */ Hl, Hr, Hd, Hu; texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt); @@ -2017,7 +2017,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T // use texres for the center sample, set rgbnor rgbnor = multitex_mtex(shi, mtex, STc, dxt, dyt, texres); - Hc = (fromrgb)? RGBTOBW(texres->tr, texres->tg, texres->tb) : texres->tin; + /* Hc = (fromrgb)? RGBTOBW(texres->tr, texres->tg, texres->tb) : texres->tin; */ /* UNUSED */ // use ttexr for the other taps multitex_mtex(shi, mtex, STl, dxt, dyt, &ttexr); @@ -2056,9 +2056,9 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T float obj2view[3][3], view2obj[3][3], tmp[4][4]; // local copies of derivatives and normal float dPdx[3], dPdy[3], vN[3]; - VECCOPY(dPdx, shi->dxco); - VECCOPY(dPdy, shi->dyco); - VECCOPY(vN, ntap_bump->vNorg); + copy_v3_v3(dPdx, shi->dxco); + copy_v3_v3(dPdy, shi->dyco); + copy_v3_v3(vN, ntap_bump->vNorg); if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) { // TODO: these calculations happen for every pixel! @@ -2200,14 +2200,14 @@ void do_material_tex(ShadeInput *shi) co= tempvec; dx= dxt; dy= dyt; - VECCOPY(tempvec, shi->co); + copy_v3_v3(tempvec, shi->co); if(mtex->texflag & MTEX_OB_DUPLI_ORIG) if(shi->obi && shi->obi->duplitexmat) mul_m4_v3(shi->obi->duplitexmat, tempvec); mul_m4_v3(ob->imat_ren, tempvec); if(shi->osatex) { - VECCOPY(dxt, shi->dxco); - VECCOPY(dyt, shi->dyco); + copy_v3_v3(dxt, shi->dxco); + copy_v3_v3(dyt, shi->dyco); mul_mat3_m4_v3(ob->imat_ren, dxt); mul_mat3_m4_v3(ob->imat_ren, dyt); } @@ -2369,7 +2369,7 @@ void do_material_tex(ShadeInput *shi) float *warpnor= texres.nor, warpnor_[3]; if(use_ntap_bump) { - VECCOPY(warpnor_, texres.nor); + copy_v3_v3(warpnor_, texres.nor); warpnor= warpnor_; normalize_v3(warpnor_); } @@ -2485,7 +2485,7 @@ void do_material_tex(ShadeInput *shi) else { float nor[3]; - VECCOPY(nor, texres.nor); + copy_v3_v3(nor, texres.nor); if(mtex->normapspace == MTEX_NSPACE_CAMERA); else if(mtex->normapspace == MTEX_NSPACE_WORLD) { @@ -2526,7 +2526,7 @@ void do_material_tex(ShadeInput *shi) nor[1]= Tnor*norfac*texres.nor[1]; nor[2]= Tnor*norfac*texres.nor[2]; - dot= 0.5f + 0.5f*INPR(nor, shi->vn); + dot= 0.5f + 0.5f * dot_v3v3(nor, shi->vn); shi->vn[0]+= dot*nor[0]; shi->vn[1]+= dot*nor[1]; @@ -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, Render *re) +void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col, float *val, Render *re) { MTex *mtex; Tex *tex; @@ -2687,7 +2687,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa if(mtex->texco==TEXCO_OBJECT) { Object *ob= mtex->object; if(ob) { - VECCOPY(co, xyz); + copy_v3_v3(co, xyz); if(mtex->texflag & MTEX_OB_DUPLI_ORIG) { if(shi->obi && shi->obi->duplitexmat) mul_m4_v3(shi->obi->duplitexmat, co); @@ -2699,16 +2699,16 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa else if(mtex->texco==TEXCO_ORCO) { if(mtex->texflag & MTEX_DUPLI_MAPTO) { - VECCOPY(co, shi->duplilo); + copy_v3_v3(co, shi->duplilo); } else { Object *ob= shi->obi->ob; - VECCOPY(co, xyz); + copy_v3_v3(co, xyz); mul_m4_v3(ob->imat_ren, co); } } else if(mtex->texco==TEXCO_GLOB) { - VECCOPY(co, xyz); + copy_v3_v3(co, xyz); mul_m4_v3(re->viewinv, co); } else continue; // can happen when texco defines disappear and it renders old files @@ -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; @@ -3054,7 +3054,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f break; case TEXCO_OBJECT: if(mtex->object) { - VECCOPY(tempvec, lo); + copy_v3_v3(tempvec, lo); mul_m4_v3(mtex->object->imat_ren, tempvec); co= tempvec; } @@ -3062,16 +3062,16 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f case TEXCO_GLOB: if(rco) { - VECCOPY(tempvec, rco); + copy_v3_v3(tempvec, rco); mul_m4_v3(R.viewinv, tempvec); co= tempvec; } else co= lo; -// VECCOPY(shi->dxgl, shi->dxco); +// copy_v3_v3(shi->dxgl, shi->dxco); // mul_m3_v3(R.imat, shi->dxco); -// VECCOPY(shi->dygl, shi->dyco); +// copy_v3_v3(shi->dygl, shi->dyco); // mul_m3_v3(R.imat, shi->dyco); break; } @@ -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; @@ -3203,11 +3203,11 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef co= tempvec; dx= dxt; dy= dyt; - VECCOPY(tempvec, shi->co); + copy_v3_v3(tempvec, shi->co); mul_m4_v3(ob->imat_ren, tempvec); if(shi->osatex) { - VECCOPY(dxt, shi->dxco); - VECCOPY(dyt, shi->dyco); + copy_v3_v3(dxt, shi->dxco); + copy_v3_v3(dyt, shi->dyco); mul_mat3_m4_v3(ob->imat_ren, dxt); mul_mat3_m4_v3(ob->imat_ren, dyt); } @@ -3219,12 +3219,12 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef } else if(mtex->texco==TEXCO_GLOB) { co= shi->gl; dx= shi->dxco; dy= shi->dyco; - VECCOPY(shi->gl, shi->co); + copy_v3_v3(shi->gl, shi->co); mul_m4_v3(R.viewinv, shi->gl); } else if(mtex->texco==TEXCO_VIEW) { - VECCOPY(tempvec, lavec); + copy_v3_v3(tempvec, lavec); mul_m3_v3(la->imat, tempvec); if(la->type==LA_SPOT) { @@ -3238,8 +3238,8 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef dx= dxt; dy= dyt; if(shi->osatex) { - VECCOPY(dxt, shi->dxlv); - VECCOPY(dyt, shi->dylv); + copy_v3_v3(dxt, shi->dxlv); + copy_v3_v3(dyt, shi->dylv); /* need some matrix conversion here? la->imat is a [3][3] matrix!!! **/ mul_m3_v3(la->imat, dxt); mul_m3_v3(la->imat, dyt); @@ -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/rendercore.c b/source/blender/render/intern/source/rendercore.c index b66740c87ba..bc5e7f23e21 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -128,7 +128,7 @@ void calc_view_vector(float *view, float x, float y) } } -void calc_renderco_ortho(float *co, float x, float y, int z) +void calc_renderco_ortho(float co[3], float x, float y, int z) { /* x and y 3d coordinate can be derived from pixel coord and winmat */ float fx= 2.0f/(R.winx*R.winmat[0][0]); @@ -142,7 +142,7 @@ void calc_renderco_ortho(float *co, float x, float y, int z) co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] ); } -void calc_renderco_zbuf(float *co, float *view, int z) +void calc_renderco_zbuf(float co[3], float *view, int z) { float fac, zco; @@ -992,7 +992,7 @@ static void convert_to_key_alpha(RenderPart *pa, RenderLayer *rl) } /* adds only alpha values */ -void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz) +static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz) { /* use zbuffer to define edges, add it to the image */ int y, x, col, *rz, *rz1, *rz2, *rz3; @@ -1133,7 +1133,7 @@ typedef struct ZbufSolidData { float *edgerect; } ZbufSolidData; -void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *data) +static void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *data) { ZbufSolidData *sdata= (ZbufSolidData*)data; ListBase *lb= sdata->psmlist; @@ -1515,7 +1515,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe { ShadeInput *shi= ssamp->shi; ShadeResult shr; - float texfac, orthoarea, nor[3], alpha, sx, sy; + float /* texfac,*/ /* UNUSED */ orthoarea, nor[3], alpha, sx, sy; /* cache for shadow */ shi->samplenr= R.shadowsamplenr[shi->thread]++; @@ -1578,7 +1578,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe VECCOPY(color, shr.combined); /* texture blending */ - texfac= shi->mat->sss_texfac; + /* texfac= shi->mat->sss_texfac; */ /* UNUSED */ alpha= shr.combined[3]; *area *= alpha; @@ -2234,21 +2234,17 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f maxdist= R.r.bake_maxdist; else maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist; - + /* 'dir' is always normalized */ - VECADDFAC(isect->start, start, dir, -R.r.bake_biasdist); + madd_v3_v3v3fl(isect->start, start, dir, -R.r.bake_biasdist); - isect->dir[0] = dir[0]*sign; - isect->dir[1] = dir[1]*sign; - isect->dir[2] = dir[2]*sign; + mul_v3_v3fl(isect->dir, dir, sign); isect->dist = maxdist; hit = RE_rayobject_raycast(raytree, isect); if(hit) { - hitco[0] = isect->start[0] + isect->dist*isect->dir[0]; - hitco[1] = isect->start[1] + isect->dist*isect->dir[1]; - hitco[2] = isect->start[2] + isect->dist*isect->dir[2]; + madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist); *dist= isect->dist; } diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 0c5ad0475ab..7a39342ac8d 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -428,7 +428,7 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr) surfnor= RE_vlakren_get_surfnor(obr, vlr, 0); if(surfnor) { surfnor1= RE_vlakren_get_surfnor(obr, vlr1, 1); - VECCOPY(surfnor1, surfnor); + copy_v3_v3(surfnor1, surfnor); } tangent= RE_vlakren_get_nmap_tangent(obr, vlr, 0); @@ -451,13 +451,12 @@ void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen * float (*nmat)[3]= obi->nmat; if(obi->flag & R_TRANSFORMED) { - VECCOPY(nor, vlr->n); - - mul_m3_v3(nmat, nor); + mul_v3_m3v3(nor, nmat, vlr->n); normalize_v3(nor); } - else - VECCOPY(nor, vlr->n); + else { + copy_v3_v3(nor, vlr->n); + } } void RE_set_customdata_names(ObjectRen *obr, CustomData *data) @@ -953,7 +952,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f } har= RE_findOrAddHalo(obr, obr->tothalo++); - VECCOPY(har->co, vec); + copy_v3_v3(har->co, vec); har->hasize= hasize; /* actual projectvert is done in function project_renderdata() because of parts/border/pano */ @@ -1009,7 +1008,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f else { mtex= ma->mtex[0]; - VECCOPY(texvec, vec); + copy_v3_v3(texvec, vec); if(mtex->texco & TEXCO_NORM) { ; @@ -1022,7 +1021,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f } else { if(orco) { - VECCOPY(texvec, orco); + copy_v3_v3(texvec, orco); } } @@ -1067,7 +1066,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater } har= RE_findOrAddHalo(obr, obr->tothalo++); - VECCOPY(har->co, vec); + copy_v3_v3(har->co, vec); har->hasize= hasize; /* actual projectvert is done in function project_renderdata() because of parts/border/pano */ @@ -1123,7 +1122,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater for(i=0; i<MAX_MTEX; i++) if(ma->mtex[i] && (ma->septex & (1<<i))==0) { mtex= ma->mtex[i]; - VECCOPY(texvec, vec); + copy_v3_v3(texvec, vec); if(mtex->texco & TEXCO_NORM) { ; @@ -1133,7 +1132,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater mul_m4_v3(mtex->object->imat_ren,texvec); } else if(mtex->texco & TEXCO_GLOB){ - VECCOPY(texvec,vec); + copy_v3_v3(texvec,vec); } else if(mtex->texco & TEXCO_UV && uvco){ int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname); @@ -1153,7 +1152,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater texvec[2] = pa_co[2]; } else if(orco) { - VECCOPY(texvec, orco); + copy_v3_v3(texvec, orco); } hasrgb = externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0); @@ -1238,7 +1237,7 @@ static int panotestclip(Render *re, int do_pano, float *v) - shadow buffering (shadbuf.c) */ -void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs, int UNUSED(do_buckets)) +void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat[][4], float *), int do_pano, float xoffs, int UNUSED(do_buckets)) { ObjectRen *obr; HaloRen *har = NULL; @@ -1264,7 +1263,7 @@ void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], vec[2]= -re->panosi*har->co[0] + re->panoco*har->co[2]; } else { - VECCOPY(vec, har->co); + copy_v3_v3(vec, har->co); } projectfunc(vec, re->winmat, hoco); diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 5860c395b07..a4bf6c6b5e1 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -61,16 +61,16 @@ /* XXX, could be better implemented... this is for endian issues */ -#if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__) -#define RCOMP 3 -#define GCOMP 2 -#define BCOMP 1 -#define ACOMP 0 +#ifdef __BIG_ENDIAN__ +# define RCOMP 3 +# define GCOMP 2 +# define BCOMP 1 +# define ACOMP 0 #else -#define RCOMP 0 -#define GCOMP 1 -#define BCOMP 2 -#define ACOMP 3 +# define RCOMP 0 +# define GCOMP 1 +# define BCOMP 2 +# define ACOMP 3 #endif /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -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/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 7dc5f0dfa4a..44aa227fe4c 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -114,10 +114,8 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) float fac= shi->translucency; shade_input_init_material(shi); - - VECCOPY(shi->vn, shi->vno); - VECMUL(shi->vn, -1.0f); - VECMUL(shi->facenor, -1.0f); + negate_v3_v3(shi->vn, shi->vno); + negate_v3(shi->facenor); shi->depth++; /* hack to get real shadow now */ shade_lamp_loop(shi, &shr_t); shi->depth--; @@ -184,8 +182,8 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr) /* copy additional passes */ if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) { - QUATCOPY(shr->winspeed, shi->winspeed); - VECCOPY(shr->nor, shi->vn); + copy_v4_v4(shr->winspeed, shi->winspeed); + copy_v3_v3(shr->nor, shi->vn); } /* MIST */ @@ -286,9 +284,9 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen /* calculate vertexnormals */ if(vlr->flag & R_SMOOTH) { - VECCOPY(shi->n1, shi->v1->n); - VECCOPY(shi->n2, shi->v2->n); - VECCOPY(shi->n3, shi->v3->n); + copy_v3_v3(shi->n1, shi->v1->n); + copy_v3_v3(shi->n2, shi->v2->n); + copy_v3_v3(shi->n3, shi->v3->n); if(obi->flag & R_TRANSFORMED) { mul_m3_v3(obi->nmat, shi->n1); normalize_v3(shi->n1); @@ -341,26 +339,26 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo shi->mode= shi->mat->mode_l; /* or-ed result for all nodes */ /* shade_input_set_viewco equivalent */ - VECCOPY(shi->co, spoint->co); - VECCOPY(shi->view, shi->co); + copy_v3_v3(shi->co, spoint->co); + copy_v3_v3(shi->view, shi->co); normalize_v3(shi->view); shi->xs= (int)spoint->x; shi->ys= (int)spoint->y; if(shi->osatex || (R.r.mode & R_SHADOW)) { - VECCOPY(shi->dxco, spoint->dtco); - VECCOPY(shi->dyco, spoint->dsco); + copy_v3_v3(shi->dxco, spoint->dtco); + copy_v3_v3(shi->dyco, spoint->dsco); } /* dxview, dyview, not supported */ /* facenormal, simply viewco flipped */ - VECCOPY(shi->facenor, spoint->nor); + copy_v3_v3(shi->facenor, spoint->nor); /* shade_input_set_normals equivalent */ if(shi->mat->mode & MA_TANGENT_STR) { - VECCOPY(shi->vn, spoint->tan) + copy_v3_v3(shi->vn, spoint->tan); } else { float cross[3]; @@ -369,11 +367,11 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo cross_v3_v3v3(shi->vn, cross, spoint->tan); normalize_v3(shi->vn); - if(INPR(shi->vn, shi->view) < 0.0f) + if(dot_v3v3(shi->vn, shi->view) < 0.0f) negate_v3(shi->vn); } - VECCOPY(shi->vno, shi->vn); + copy_v3_v3(shi->vno, shi->vn); } void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert *svert, StrandPoint *spoint) @@ -393,17 +391,17 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert } if(mode & (MA_TANGENT_V|MA_NORMAP_TANG)) { - VECCOPY(shi->tang, spoint->tan); - VECCOPY(shi->nmaptang, spoint->tan); + copy_v3_v3(shi->tang, spoint->tan); + copy_v3_v3(shi->nmaptang, spoint->tan); } if(mode & MA_STR_SURFDIFF) { float *surfnor= RE_strandren_get_surfnor(obr, strand, 0); if(surfnor) - VECCOPY(shi->surfnor, surfnor) + copy_v3_v3(shi->surfnor, surfnor); else - VECCOPY(shi->surfnor, shi->vn) + copy_v3_v3(shi->surfnor, shi->vn); if(shi->mat->strand_surfnor > 0.0f) { shi->surfdist= 0.0f; @@ -418,7 +416,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert speed= RE_strandren_get_winspeed(shi->obi, strand, 0); if(speed) - QUATCOPY(shi->winspeed, speed) + copy_v4_v4(shi->winspeed, speed); else shi->winspeed[0]= shi->winspeed[1]= shi->winspeed[2]= shi->winspeed[3]= 0.0f; } @@ -426,18 +424,18 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert /* shade_input_set_shade_texco equivalent */ if(texco & NEED_UV) { if(texco & TEXCO_ORCO) { - VECCOPY(shi->lo, strand->orco); + copy_v3_v3(shi->lo, strand->orco); /* no shi->osatex, orco derivatives are zero */ } if(texco & TEXCO_GLOB) { - VECCOPY(shi->gl, shi->co); + copy_v3_v3(shi->gl, shi->co); mul_m4_v3(R.viewinv, shi->gl); if(shi->osatex) { - VECCOPY(shi->dxgl, shi->dxco); + copy_v3_v3(shi->dxgl, shi->dxco); mul_mat3_m4_v3(R.viewinv, shi->dxgl); - VECCOPY(shi->dygl, shi->dyco); + copy_v3_v3(shi->dygl, shi->dyco); mul_mat3_m4_v3(R.viewinv, shi->dygl); } } @@ -591,7 +589,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert } /* from scanline pixel coordinates to 3d coordinates, requires set_triangle */ -void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float *view, float *dxyview, float *co, float *dxco, float *dyco) +void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float view[3], float dxyview[2], float co[3], float dxco[3], float dyco[3]) { /* returns not normalized, so is in viewplane coords */ calc_view_vector(view, x, y); @@ -608,7 +606,7 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float * /* for non-wire, intersect with the triangle to get the exact coord */ float fac, dface, v1[3]; - VECCOPY(v1, shi->v1->co); + copy_v3_v3(v1, shi->v1->co); if(shi->obi->flag & R_TRANSFORMED) mul_m4_v3(shi->obi->mat, v1); @@ -726,9 +724,9 @@ void shade_input_set_uv(ShadeInput *shi) if((vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) { float v1[3], v2[3], v3[3]; - VECCOPY(v1, shi->v1->co); - VECCOPY(v2, shi->v2->co); - VECCOPY(v3, shi->v3->co); + copy_v3_v3(v1, shi->v1->co); + copy_v3_v3(v2, shi->v2->co); + copy_v3_v3(v3, shi->v3->co); if(shi->obi->flag & R_TRANSFORMED) { mul_m4_v3(shi->obi->mat, v1); @@ -827,18 +825,18 @@ void shade_input_set_normals(ShadeInput *shi) shi->vn[2]= l*n3[2]-u*n1[2]-v*n2[2]; // use unnormalized normal (closer to games) - VECCOPY(shi->nmapnorm, shi->vn); + copy_v3_v3(shi->nmapnorm, shi->vn); normalize_v3(shi->vn); } else { - VECCOPY(shi->vn, shi->facenor); - VECCOPY(shi->nmapnorm, shi->vn); + copy_v3_v3(shi->vn, shi->facenor); + copy_v3_v3(shi->nmapnorm, shi->vn); } /* used in nodes */ - VECCOPY(shi->vno, shi->vn); + copy_v3_v3(shi->vno, shi->vn); /* flip normals to viewing direction */ if(!(shi->vlr->flag & R_TANGENT)) @@ -861,18 +859,18 @@ void shade_input_set_vertex_normals(ShadeInput *shi) shi->vn[2]= l*n3[2]-u*n1[2]-v*n2[2]; // use unnormalized normal (closer to games) - VECCOPY(shi->nmapnorm, shi->vn); + copy_v3_v3(shi->nmapnorm, shi->vn); normalize_v3(shi->vn); } else { - VECCOPY(shi->vn, shi->facenor); - VECCOPY(shi->nmapnorm, shi->vn); + copy_v3_v3(shi->vn, shi->facenor); + copy_v3_v3(shi->nmapnorm, shi->vn); } /* used in nodes */ - VECCOPY(shi->vno, shi->vn); + copy_v3_v3(shi->vno, shi->vn); } @@ -961,7 +959,7 @@ void shade_input_set_shade_texco(ShadeInput *shi) mul_m3_v3(obi->nmat, shi->tang); normalize_v3(shi->tang); - VECCOPY(shi->nmaptang, shi->tang); + copy_v3_v3(shi->nmaptang, shi->tang); } } @@ -974,9 +972,9 @@ void shade_input_set_shade_texco(ShadeInput *shi) vlr_set_uv_indices(shi->vlr, &j1, &j2, &j3); - VECCOPY(c0, &tangent[j1*4]); - VECCOPY(c1, &tangent[j2*4]); - VECCOPY(c2, &tangent[j3*4]); + copy_v3_v3(c0, &tangent[j1*4]); + copy_v3_v3(c1, &tangent[j2*4]); + copy_v3_v3(c2, &tangent[j3*4]); // keeping tangents normalized at vertex level // corresponds better to how it's done in game engines @@ -1004,12 +1002,12 @@ void shade_input_set_shade_texco(ShadeInput *shi) float *surfnor= RE_vlakren_get_surfnor(obr, shi->vlr, 0); if(surfnor) { - VECCOPY(shi->surfnor, surfnor) + copy_v3_v3(shi->surfnor, surfnor); if(obi->flag & R_TRANSFORMED) mul_m3_v3(obi->nmat, shi->surfnor); } else - VECCOPY(shi->surfnor, shi->vn) + copy_v3_v3(shi->surfnor, shi->vn); shi->surfdist= 0.0f; } @@ -1062,16 +1060,16 @@ void shade_input_set_shade_texco(ShadeInput *shi) } } - VECCOPY(shi->duplilo, obi->dupliorco); + copy_v3_v3(shi->duplilo, obi->dupliorco); } if(texco & TEXCO_GLOB) { - VECCOPY(shi->gl, shi->co); + copy_v3_v3(shi->gl, shi->co); mul_m4_v3(R.viewinv, shi->gl); if(shi->osatex) { - VECCOPY(shi->dxgl, shi->dxco); + copy_v3_v3(shi->dxgl, shi->dxco); mul_mat3_m4_v3(R.viewinv, shi->dxgl); - VECCOPY(shi->dygl, shi->dyco); + copy_v3_v3(shi->dygl, shi->dyco); mul_mat3_m4_v3(R.viewinv, shi->dygl); } } @@ -1181,8 +1179,9 @@ void shade_input_set_shade_texco(ShadeInput *shi) shi->vcol[2]= 1.0f; shi->vcol[3]= 1.0f; } - if(tface && tface->tpage) + if(tface->tpage) { render_realtime_texture(shi, tface->tpage); + } } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index af4236e6d84..274c9bdc424 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -85,7 +85,7 @@ static void fogcolor(float *colf, float *rco, float *view) hor[0]= R.wrld.horr; hor[1]= R.wrld.horg; hor[2]= R.wrld.horb; zen[0]= R.wrld.zenr; zen[1]= R.wrld.zeng; zen[2]= R.wrld.zenb; - VECCOPY(vec, rco); + copy_v3_v3(vec, rco); /* we loop from cur coord to mist start in steps */ stepsize= 1.0f; @@ -486,8 +486,8 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn) int a= lar->ray_totsamp; /* test if co is behind lamp */ - VECSUB(vec, co, lar->co); - if(INPR(vec, lar->vec) < 0.0f) + sub_v3_v3v3(vec, co, lar->co); + if(dot_v3v3(vec, lar->vec) < 0.0f) return 0.0f; while(a--) { @@ -1125,21 +1125,21 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) { if(lar->type==LA_SUN || lar->type==LA_HEMI) { *dist= 1.0f; - VECCOPY(lv, lar->vec); + copy_v3_v3(lv, lar->vec); return 1.0f; } else { float visifac= 1.0f, t; - VECSUB(lv, co, lar->co); - *dist= sqrt( INPR(lv, lv)); + sub_v3_v3v3(lv, co, lar->co); + *dist= sqrtf(dot_v3v3(lv, lv)); t= 1.0f/dist[0]; - VECMUL(lv, t); + mul_v3_fl(lv, t); /* area type has no quad or sphere option */ if(lar->type==LA_AREA) { /* area is single sided */ - //if(INPR(lv, lar->vec) > 0.0f) + //if(dot_v3v3(lv, lar->vec) > 0.0f) // visifac= 1.0f; //else // visifac= 0.0f; @@ -1185,11 +1185,11 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) float inpr; if(lar->mode & LA_SQUARE) { - if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) { + if(dot_v3v3(lv, lar->vec) > 0.0f) { float lvrot[3], x; /* rotate view to lampspace */ - VECCOPY(lvrot, lv); + copy_v3_v3(lvrot, lv); mul_m3_v3(lar->imat, lvrot); x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2])); @@ -1285,7 +1285,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int cross_v3_v3v3(cross, shi->surfnor, vn); cross_v3_v3v3(nstrand, vn, cross); - blend= INPR(nstrand, shi->surfnor); + blend= dot_v3v3(nstrand, shi->surfnor); blend= 1.0f - blend; CLAMP(blend, 0.0f, 1.0f); @@ -1320,8 +1320,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int /* dot product and reflectivity */ /* inp = dotproduct, is = shader result, i = lamp energy (with shadow), i_noshad = i without shadow */ - inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2]; - + inp= dot_v3v3(vn, lv); + /* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */ /* this complex construction screams for a nicer implementation! (ton) */ if(R.r.mode & R_SHADOW) { @@ -1389,7 +1389,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int if(lar->shb || (lar->mode & LA_SHAD_RAY)) { if(vn==vnor) /* tangent trigger */ - lamp_get_shadow(lar, shi, INPR(shi->vn, lv), shadfac, shi->depth); + lamp_get_shadow(lar, shi, dot_v3v3(shi->vn, lv), shadfac, shi->depth); else lamp_get_shadow(lar, shi, inp, shadfac, shi->depth); @@ -1431,7 +1431,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int add_to_diffuse(shr->diff, shi, is, i_noshad*lacol[0], i_noshad*lacol[1], i_noshad*lacol[2]); } else - VECCOPY(shr->diff, shr->shad); + copy_v3_v3(shr->diff, shr->shad); } } @@ -1508,12 +1508,12 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) LampRen *lar; GroupObject *go; float inpr, lv[3]; - float *view, shadfac[4]; + float /* *view, */ shadfac[4]; float ir, accum, visifac, lampdist; float shaded = 0.0f, lightness = 0.0f; - view= shi->view; + /* view= shi->view; */ /* UNUSED */ accum= ir= 0.0f; lights= get_lights(shi); @@ -1537,7 +1537,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) continue; } - inpr= INPR(shi->vn, lv); + inpr= dot_v3v3(shi->vn, lv); if(inpr <= 0.0f) { if (shi->mat->shadowonly_flag == MA_SO_OLD) accum+= 1.0f; @@ -1724,9 +1724,9 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) /* AO was calculated for scanline already */ if(shi->depth || shi->volume_depth) ambient_occlusion(shi); - VECCOPY(shr->ao, shi->ao); - VECCOPY(shr->env, shi->env); // XXX multiply - VECCOPY(shr->indirect, shi->indirect); // XXX multiply + copy_v3_v3(shr->ao, shi->ao); + copy_v3_v3(shr->env, shi->env); // XXX multiply + copy_v3_v3(shr->indirect, shi->indirect); // XXX multiply } } } @@ -1771,7 +1771,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) invalpha= (shr->col[3] > FLT_EPSILON)? 1.0f/shr->col[3]: 1.0f; if(texfac==0.0f) { - VECCOPY(col, shr->col); + copy_v3_v3(col, shr->col); mul_v3_fl(col, invalpha); } else if(texfac==1.0f) { @@ -1779,7 +1779,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) mul_v3_fl(col, invalpha); } else { - VECCOPY(col, shr->col); + copy_v3_v3(col, shr->col); mul_v3_fl(col, invalpha); col[0]= pow(col[0], 1.0f-texfac); col[1]= pow(col[1], 1.0f-texfac); @@ -1799,9 +1799,9 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) } if(shi->combinedflag & SCE_PASS_SHADOW) - VECCOPY(shr->combined, shr->shad) /* note, no ';' ! */ + copy_v3_v3(shr->combined, shr->shad); /* note, no ';' ! */ else - VECCOPY(shr->combined, shr->diff); + copy_v3_v3(shr->combined, shr->diff); /* calculate shadow pass, we use a multiplication mask */ /* if diff = 0,0,0 it doesn't matter what the shadow pass is, so leave it as is */ @@ -1876,10 +1876,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) result[2]= shi->mirb*shi->refcol[3] + (1.0f - shi->mirb*shi->refcol[0])*shr->combined[2]; if(passflag & SCE_PASS_REFLECT) - VECSUB(shr->refl, result, shr->combined); + sub_v3_v3v3(shr->refl, result, shr->combined); if(shi->combinedflag & SCE_PASS_REFLECT) - VECCOPY(shr->combined, result); + copy_v3_v3(shr->combined, result); } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 0ba13b31c4b..36b577ce9a4 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -394,8 +394,8 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int for(i=0; i<node->totpoint; i++) { ScatterPoint *p= &node->points[i]; - VECSUB(sub, co, p->co); - dist= INPR(sub, sub); + sub_v3_v3v3(sub, co, p->co); + dist= dot_v3v3(sub, sub); if(p->back) add_radiance(tree, NULL, p->rad, 0.0f, p->area, dist, result); @@ -418,8 +418,8 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int } else { /* decide subnode traversal based on maximum solid angle */ - VECSUB(sub, co, subnode->co); - dist= INPR(sub, sub); + sub_v3_v3v3(sub, co, subnode->co); + dist= dot_v3v3(sub, sub); /* actually area/dist > error, but this avoids division */ if(subnode->area+subnode->backarea>tree->error*dist) { diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 2037acc943f..18132c4a7f3 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -490,7 +490,7 @@ static void *vol_precache_part(void *data) RayObject *tree = pa->tree; ShadeInput *shi = pa->shi; float scatter_col[3] = {0.f, 0.f, 0.f}; - float co[3], cco[3]; + float co[3], cco[3], view[3]; int x, y, z, i; int res[3]; @@ -523,9 +523,9 @@ static void *vol_precache_part(void *data) continue; } - copy_v3_v3(shi->view, cco); - normalize_v3(shi->view); - vol_get_scattering(shi, scatter_col, cco); + copy_v3_v3(view, cco); + normalize_v3(view); + vol_get_scattering(shi, scatter_col, cco, view); obi->volume_precache->data_r[i] = scatter_col[0]; obi->volume_precache->data_g[i] = scatter_col[1]; diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index dcb3c9d5749..807531f2daf 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; @@ -95,7 +95,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co) is.dir[2] = -lar->vec[2]; is.dist = R.maxdist; } else { - VECSUB( is.dir, lar->co, is.start ); + sub_v3_v3v3(is.dir, lar->co, is.start); is.dist = normalize_v3( is.dir ); } @@ -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_r[4]) { 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; @@ -204,16 +204,16 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co /* check to see if there's anything behind the volume, otherwise shade the sky */ if(RE_rayobject_raycast(R.raytree, &isect)) { - shade_intersection(shi, col, &isect); + shade_intersection(shi, col_r, &isect); } else { - shadeSkyView(col, co, shi->view, NULL, shi->thread); - shadeSunView(col, shi->view); + shadeSkyView(col_r, co, shi->view, NULL, shi->thread); + shadeSunView(col_r, shi->view); } } /* 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, &R); @@ -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, &R); @@ -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, 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, LampRen *lar, 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) { @@ -535,7 +535,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, if (luminance(lacol) < 0.001f) return; normalize_v3(lv); - p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, shi->view, lv); + p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, view, lv); /* physically based scattering with non-physically based RGB gain */ vol_get_reflection_color(shi, ref_col, co); @@ -546,14 +546,14 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, } /* single scattering only for now */ -void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co) +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) { @@ -561,7 +561,7 @@ void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co) lar= go->lampren; if (lar) { - vol_shade_one_lamp(shi, co, lar, lacol); + vol_shade_one_lamp(shi, co, view, lar, lacol); add_v3_v3(scatter_col, lacol); } } @@ -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}; @@ -629,7 +629,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float vol_get_precached_scattering(&R, shi, scatter_col, p2); } else - vol_get_scattering(shi, scatter_col, p); + vol_get_scattering(shi, scatter_col, p, shi->view); radiance[0] += stepd * tr[0] * (emit_col[0] + scatter_col[0]); radiance[1] += stepd * tr[1] * (emit_col[1] + scatter_col[1]); @@ -699,7 +699,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } else { /* we're tracing through the volume between the camera * and a solid surface, so use that pre-shaded radiance */ - QUATCOPY(col, shr->combined); + copy_v4_v4(col, shr->combined); } /* shade volume from 'camera' to 1st hit point */ @@ -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, diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 3ef70d703a5..77219abee20 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -383,7 +383,7 @@ void make_voxeldata(struct Render *re) } -int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres) +int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres) { int retval = TEX_INT; VoxelData *vd = tex->vd; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 925f8529dfa..f36994e0969 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -239,7 +239,7 @@ static short cliptestf(float p, float q, float *u1, float *u2) return 1; } -int testclip(float *v) +int testclip(const float v[4]) { float abs4; /* WATCH IT: this function should do the same as cliptestf, otherwise troubles in zbufclip()*/ short c=0; @@ -843,7 +843,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo } -static int clipline(float *v1, float *v2) /* return 0: do not draw */ +static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */ { float dz,dw, u1=0.0, u2=1.0; float dx, dy, v13; @@ -893,7 +893,7 @@ static int clipline(float *v1, float *v2) /* return 0: do not draw */ return 0; } -void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco) +void hoco_to_zco(ZSpan *zspan, float zco[3], const float hoco[4]) { float div; @@ -998,7 +998,7 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } -void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2) +void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const float ho2[4]) { float f1[4], f2[4]; int c1, c2; @@ -1008,8 +1008,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2) if(c1 | c2) { /* not in the middle */ if(!(c1 & c2)) { /* not out completely */ - QUATCOPY(f1, ho1); - QUATCOPY(f2, ho2); + copy_v4_v4(f1, ho1); + copy_v4_v4(f2, ho2); if(clipline(f1, f2)) { hoco_to_zco(zspan, f1, f1); @@ -1692,7 +1692,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo /* ------------------------------------------------------------------------- */ -void projectverto(float *v1, float winmat[][4], float *adr) +void projectverto(const float v1[3], float winmat[][4], float adr[4]) { /* calcs homogenic coord of vertex v1 */ float x,y,z; @@ -1710,7 +1710,7 @@ void projectverto(float *v1, float winmat[][4], float *adr) /* ------------------------------------------------------------------------- */ -void projectvert(float *v1, float winmat[][4], float *adr) +void projectvert(const float v1[3], float winmat[][4], float adr[4]) { /* calcs homogenic coord of vertex v1 */ float x,y,z; @@ -2864,7 +2864,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * float v1[3], v2[3], v3[3], v4[3], fx, fy; float *rectvz, *dvz, *dimg, *dvec1, *dvec2, *dz, *dz1, *dz2, *rectz; float *minvecbufrect= NULL, *rectweight, *rw, *rectmax, *rm, *ro; - float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed, totfac; + float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed; int y, x, step, maxspeed=nbd->maxspeed, samples= nbd->samples; int tsktsk= 0; static int firsttime= 1; @@ -3038,7 +3038,6 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * } memset(newrect, 0, sizeof(float)*xsize*ysize*4); - totfac= 0.0f; /* accumulate */ samples/= 2; |