diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 11:01:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 11:01:24 +0400 |
commit | 7508540c53222c289a665cb0528e2a5c984b9b99 (patch) | |
tree | 1fd3f92c4fd7ea74d23288468a1ce494350c33a7 /source/blender/render | |
parent | 261c1679b484884973d485c3f21bed9e87fa5260 (diff) | |
parent | 4b3cc63f73cfe519689bdbd8482e655b72423038 (diff) |
svn merge -r41575:41602 ^/trunk/blender
Diffstat (limited to 'source/blender/render')
19 files changed, 292 insertions, 297 deletions
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 5a544c46255..08f73ccbe0d 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -42,7 +42,6 @@ /* vector defines */ #define CROSS(dest, a, b) { dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0]; } -#define VECMUL(dest, f) { dest[0]*= f; dest[1]*= f; dest[2]*= f; } struct HaloRen; struct ShadeInput; diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 6567cdacf0e..c467c31b5a6 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -135,7 +135,7 @@ void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, f /* exported to shadeinput.c */ void zbuf_make_winmat(Render *re, float winmat[][4]); -void zbuf_render_project(float winmat[][4], float *co, float *ho); +void zbuf_render_project(float winmat[][4], const float co[3], float ho[4]); #endif diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 31d92d7f342..4fe34a29e55 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -478,11 +478,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr if(do_tangent) { tav= RE_vertren_get_tangent(obr, v1, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); tav= RE_vertren_get_tangent(obr, v2, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); tav= RE_vertren_get_tangent(obr, v3, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); } if(do_nmap_tangent) { @@ -496,11 +496,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr if(do_tangent) { tav= RE_vertren_get_tangent(obr, v1, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); tav= RE_vertren_get_tangent(obr, v3, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); tav= RE_vertren_get_tangent(obr, v4, 1); - VECADD(tav, tav, tang); + add_v3_v3(tav, tang); } if(do_nmap_tangent) { @@ -1357,20 +1357,20 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl psys_make_billboard(bb, xvec, yvec, zvec, bb_center); - VECADD(vlr->v1->co, bb_center, xvec); - VECADD(vlr->v1->co, vlr->v1->co, yvec); + add_v3_v3v3(vlr->v1->co, bb_center, xvec); + add_v3_v3(vlr->v1->co, yvec); mul_m4_v3(re->viewmat, vlr->v1->co); - VECSUB(vlr->v2->co, bb_center, xvec); - VECADD(vlr->v2->co, vlr->v2->co, yvec); + sub_v3_v3v3(vlr->v2->co, bb_center, xvec); + add_v3_v3(vlr->v2->co, yvec); mul_m4_v3(re->viewmat, vlr->v2->co); - VECSUB(vlr->v3->co, bb_center, xvec); - VECSUB(vlr->v3->co, vlr->v3->co, yvec); + sub_v3_v3v3(vlr->v3->co, bb_center, xvec); + sub_v3_v3v3(vlr->v3->co, vlr->v3->co, yvec); mul_m4_v3(re->viewmat, vlr->v3->co); - VECADD(vlr->v4->co, bb_center, xvec); - VECSUB(vlr->v4->co, vlr->v4->co, yvec); + add_v3_v3v3(vlr->v4->co, bb_center, xvec); + sub_v3_v3(vlr->v4->co, yvec); 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); @@ -1968,8 +1968,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(k==1){ sd.first = 1; sd.time = 0.0f; - VECSUB(loc0,loc1,loc); - VECADD(loc0,loc1,loc0); + sub_v3_v3v3(loc0,loc1,loc); + add_v3_v3v3(loc0,loc1,loc0); particle_curve(re, obr, psmd->dm, ma, &sd, loc1, loc0, seed, pa_co); } @@ -3475,7 +3475,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1); for(vindex=0; vindex<nr_verts; vindex++) { - QUATCOPY(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4); + copy_v4_v4(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4); mul_mat3_m4_v3(mat, ftang+vindex*4); normalize_v3(ftang+vindex*4); } @@ -3579,7 +3579,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4]) if(shb==NULL) return; - VECCOPY(shb->co, lar->co); + VECCOPY(shb->co, lar->co); /* int copy */ /* percentage render: keep track of min and max */ shb->size= (lar->bufsize*re->r.size)/100; @@ -4190,7 +4190,7 @@ static void check_non_flat_quads(ObjectRen *obr) v2= vlr->v2; v3= vlr->v3; v4= vlr->v4; - VECSUB(nor, v1->co, v2->co); + sub_v3_v3v3(nor, v1->co, v2->co); if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) { vlr->v1= v2; vlr->v2= v3; @@ -4198,19 +4198,19 @@ static void check_non_flat_quads(ObjectRen *obr) vlr->v4= NULL; } else { - VECSUB(nor, v2->co, v3->co); + sub_v3_v3v3(nor, v2->co, v3->co); if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) { vlr->v2= v3; vlr->v3= v4; vlr->v4= NULL; } else { - VECSUB(nor, v3->co, v4->co); + sub_v3_v3v3(nor, v3->co, v4->co); if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) { vlr->v4= NULL; } else { - VECSUB(nor, v4->co, v1->co); + sub_v3_v3v3(nor, v4->co, v1->co); if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) { vlr->v4= NULL; } @@ -5397,12 +5397,12 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve interp_weights_face_v3( w,co1, co2, co3, co4, strand->vert->co); - speed[0]= speed[1]= speed[2]= speed[3]= 0.0f; - QUATADDFAC(speed, speed, winspeed[face[0]], w[0]); - QUATADDFAC(speed, speed, winspeed[face[1]], w[1]); - QUATADDFAC(speed, speed, winspeed[face[2]], w[2]); + zero_v4(speed); + madd_v4_v4fl(speed, winspeed[face[0]], w[0]); + madd_v4_v4fl(speed, winspeed[face[1]], w[1]); + madd_v4_v4fl(speed, winspeed[face[2]], w[2]); if(face[3]) - QUATADDFAC(speed, speed, winspeed[face[3]], w[3]); + madd_v4_v4fl(speed, winspeed[face[3]], w[3]); } } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 2f20c328405..6ea62828601 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -704,7 +704,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe } /* rotate to envmap space, if object is set */ - VECCOPY(vec, texvec); + copy_v3_v3(vec, texvec); if(env->object) mul_m3_v3(env->obimat, vec); else mul_mat3_m4_v3(R.viewinv, vec); diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 719b9674b80..d1f7059416d 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -88,11 +88,11 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y) if(ibuf->rect_float) { if(ibuf->channels==4) { float *fp= ibuf->rect_float + 4*ofs; - QUATCOPY(col, fp); + copy_v4_v4(col, fp); } else if(ibuf->channels==3) { float *fp= ibuf->rect_float + 3*ofs; - VECCOPY(col, fp); + copy_v3_v3(col, fp); col[3]= 1.0f; } else { diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index a2363472694..7434425d24b 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -172,7 +172,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr, shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2); /* set up view vector */ - VECCOPY(shi->view, shi->co); + copy_v3_v3(shi->view, shi->co); normalize_v3(shi->view); /* cache for shadow */ @@ -205,7 +205,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr, shade_input_set_shade_texco(shi); shade_material_loop(shi, shr); /* todo: nodes */ - VECCOPY(rad, shr->combined); + copy_v3_v3(rad, shr->combined); } static void occ_build_shade(Render *re, OcclusionTree *tree) @@ -339,10 +339,10 @@ static void occ_face(const OccFace *face, float co[3], float normal[3], float *a } if(area) { - VECCOPY(v1, vlr->v1->co); - VECCOPY(v2, vlr->v2->co); - VECCOPY(v3, vlr->v3->co); - if(vlr->v4) VECCOPY(v4, vlr->v4->co); + copy_v3_v3(v1, vlr->v1->co); + copy_v3_v3(v2, vlr->v2->co); + copy_v3_v3(v3, vlr->v3->co); + if(vlr->v4) copy_v3_v3(v4, vlr->v4->co); if(obi->flag & R_TRANSFORMED) { mul_m4_v3(obi->mat, v1); @@ -439,14 +439,14 @@ static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3], else if(node->child[b].node) { OccNode *child= node->child[b].node; occ_build_dco(tree, child, co, dco); - VECCOPY(nco, child->co); + copy_v3_v3(nco, child->co); } else { continue; } - VECSUB(d, nco, co); - dist= INPR(d, d); + sub_v3_v3v3(d, nco, co); + dist= dot_v3v3(d, d); if(dist > *dco) *dco= dist; } @@ -604,7 +604,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i if(child) { node->area += child->area; sh_add(node->sh, node->sh, child->sh); - VECADDFAC(node->co, node->co, child->co, child->area); + madd_v3_v3fl(node->co, child->co, child->area); } } @@ -745,7 +745,7 @@ static void occ_free_tree(OcclusionTree *tree) /* ------------------------- Traversal --------------------------- */ -static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, float *receivenormal) +static float occ_solid_angle(OccNode *node, const float v[3], float d2, float invd2, const float receivenormal[3]) { float dotreceive, dotemit; float ev[3]; @@ -754,7 +754,7 @@ static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, flo ev[1]= -v[1]*invd2; ev[2]= -v[2]*invd2; dotemit= sh_eval(node->sh, ev); - dotreceive= INPR(receivenormal, v)*invd2; + dotreceive= dot_v3v3(receivenormal, v)*invd2; CLAMP(dotemit, 0.0f, 1.0f); CLAMP(dotreceive, 0.0f, 1.0f); @@ -762,24 +762,24 @@ static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, flo return ((node->area*dotemit*dotreceive)/(d2 + node->area*INVPI))*INVPI; } -static void VecAddDir(float *result, float *v1, float *v2, float fac) +static void VecAddDir(float result[3], const float v1[3], const float v2[3], const float fac) { result[0]= v1[0] + fac*(v2[0] - v1[0]); result[1]= v1[1] + fac*(v2[1] - v1[1]); result[2]= v1[2] + fac*(v2[2] - v1[2]); } -static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, float *q0, float *q1, float *q2, float *q3) +static int occ_visible_quad(float *p, const float n[3], const float v0[3], const float *v1, const float *v2, float q0[3], float q1[3], float q2[3], float q3[3]) { static const float epsilon = 1e-6f; float c, sd[3]; - c= INPR(n, p); + c= dot_v3v3(n, p); /* signed distances from the vertices to the plane. */ - sd[0]= INPR(n, v0) - c; - sd[1]= INPR(n, v1) - c; - sd[2]= INPR(n, v2) - c; + sd[0]= dot_v3v3(n, v0) - c; + sd[1]= dot_v3v3(n, v1) - c; + sd[2]= dot_v3v3(n, v2) - c; if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f; if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f; @@ -789,70 +789,70 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, if(sd[1] > 0) { if(sd[2] > 0) { // +++ - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // ++- - VECCOPY(q0, v0); - VECCOPY(q1, v1); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2]))); VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2]))); } else { // ++0 - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } } else if(sd[1] < 0) { if(sd[2] > 0) { // +-+ - VECCOPY(q0, v0); + copy_v3_v3(q0, v0); VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1]))); VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2]))); - VECCOPY(q3, v2); + copy_v3_v3(q3, v2); } else if(sd[2] < 0) { // +-- - VECCOPY(q0, v0); + copy_v3_v3(q0, v0); VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1]))); VecAddDir(q2, v0, v2, (sd[0]/(sd[0]-sd[2]))); - VECCOPY(q3, q2); + copy_v3_v3(q3, q2); } else { // +-0 - VECCOPY(q0, v0); + copy_v3_v3(q0, v0); VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1]))); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } } else { if(sd[2] > 0) { // +0+ - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // +0- - VECCOPY(q0, v0); - VECCOPY(q1, v1); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); VecAddDir(q2, v0, v2, (sd[0]/(sd[0]-sd[2]))); - VECCOPY(q3, q2); + copy_v3_v3(q3, q2); } else { // +00 - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } } } @@ -861,23 +861,23 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, if(sd[2] > 0) { // -++ VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1]))); - VECCOPY(q1, v1); - VECCOPY(q2, v2); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2]))); } else if(sd[2] < 0) { // -+- VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1]))); - VECCOPY(q1, v1); + copy_v3_v3(q1, v1); VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2]))); - VECCOPY(q3, q2); + copy_v3_v3(q3, q2); } else { // -+0 VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1]))); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } } else if(sd[1] < 0) { @@ -885,8 +885,8 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, // --+ VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2]))); VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2]))); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // --- @@ -901,9 +901,9 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, if(sd[2] > 0) { // -0+ VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2]))); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // -0- @@ -919,33 +919,33 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, if(sd[1] > 0) { if(sd[2] > 0) { // 0++ - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // 0+- - VECCOPY(q0, v0); - VECCOPY(q1, v1); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2]))); - VECCOPY(q3, q2); + copy_v3_v3(q3, q2); } else { // 0+0 - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } } else if(sd[1] < 0) { if(sd[2] > 0) { // 0-+ - VECCOPY(q0, v0); + copy_v3_v3(q0, v0); VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2]))); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // 0-- @@ -959,10 +959,10 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, else { if(sd[2] > 0) { // 00+ - VECCOPY(q0, v0); - VECCOPY(q1, v1); - VECCOPY(q2, v2); - VECCOPY(q3, q2); + copy_v3_v3(q0, v0); + copy_v3_v3(q1, v1); + copy_v3_v3(q2, v2); + copy_v3_v3(q3, q2); } else if(sd[2] < 0) { // 00- @@ -1117,7 +1117,7 @@ static void normalizef(float *n) { float d; - d= INPR(n, n); + d= dot_v3v3(n, n); if(d > 1.0e-35F) { d= 1.0f/sqrtf(d); @@ -1128,15 +1128,15 @@ static void normalizef(float *n) } } -static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3) +static float occ_quad_form_factor(const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3]) { float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3]; float a1, a2, a3, a4, dot1, dot2, dot3, dot4, result; - VECSUB(r0, q0, p); - VECSUB(r1, q1, p); - VECSUB(r2, q2, p); - VECSUB(r3, q3, p); + sub_v3_v3v3(r0, q0, p); + sub_v3_v3v3(r1, q1, p); + sub_v3_v3v3(r2, q2, p); + sub_v3_v3v3(r3, q3, p); normalizef(r0); normalizef(r1); @@ -1148,15 +1148,15 @@ static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, floa cross_v3_v3v3(g2, r3, r2); normalizef(g2); cross_v3_v3v3(g3, r0, r3); normalizef(g3); - a1= saacosf(INPR(r0, r1)); - a2= saacosf(INPR(r1, r2)); - a3= saacosf(INPR(r2, r3)); - a4= saacosf(INPR(r3, r0)); + a1= saacosf(dot_v3v3(r0, r1)); + a2= saacosf(dot_v3v3(r1, r2)); + a3= saacosf(dot_v3v3(r2, r3)); + a4= saacosf(dot_v3v3(r3, r0)); - dot1= INPR(n, g0); - dot2= INPR(n, g1); - dot3= INPR(n, g2); - dot4= INPR(n, g3); + dot1= dot_v3v3(n, g0); + dot2= dot_v3v3(n, g1); + dot3= dot_v3v3(n, g2); + dot4= dot_v3v3(n, g3); result= (a1*dot1 + a2*dot2 + a3*dot3 + a4*dot4)*0.5f/(float)M_PI; result= MAX2(result, 0.0f); @@ -1173,9 +1173,9 @@ static float occ_form_factor(OccFace *face, float *p, float *n) obi= &R.objectinstance[face->obi]; vlr= RE_findOrAddVlak(obi->obr, face->facenr); - VECCOPY(v1, vlr->v1->co); - VECCOPY(v2, vlr->v2->co); - VECCOPY(v3, vlr->v3->co); + copy_v3_v3(v1, vlr->v1->co); + copy_v3_v3(v2, vlr->v2->co); + copy_v3_v3(v3, vlr->v3->co); if(obi->flag & R_TRANSFORMED) { mul_m4_v3(obi->mat, v1); @@ -1187,7 +1187,7 @@ static float occ_form_factor(OccFace *face, float *p, float *n) contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3); if(vlr->v4) { - VECCOPY(v4, vlr->v4->co); + copy_v3_v3(v4, vlr->v4->co); if(obi->flag & R_TRANSFORMED) mul_m4_v3(obi->mat, v4); @@ -1207,9 +1207,9 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float int b, f, totstack; /* init variables */ - VECCOPY(p, pp); - VECCOPY(n, pn); - VECADDFAC(p, p, n, 1e-4f); + copy_v3_v3(p, pp); + copy_v3_v3(n, pn); + madd_v3_v3fl(p, n, 1e-4f); if(bentn) copy_v3_v3(bentn, n); @@ -1229,8 +1229,8 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float /* pop point off the stack */ node= stack[--totstack]; - VECSUB(v, node->co, p); - d2= INPR(v, v) + 1e-16f; + sub_v3_v3v3(v, node->co, p); + d2= dot_v3v3(v, v) + 1e-16f; emitarea= MAX2(node->area, node->dco); if(d2*error > emitarea) { @@ -1270,8 +1270,8 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float if(!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) { if(bentn || distfac != 0.0f) { occ_face(face, co, NULL, NULL); - VECSUB(v, co, p); - d2= INPR(v, v) + 1e-16f; + sub_v3_v3v3(v, co, p); + d2= dot_v3v3(v, v) + 1e-16f; fac= (distfac == 0.0f)? 1.0f: 1.0f/(1.0f + distfac*d2); if(fac < 0.01f) @@ -1368,7 +1368,7 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass) for(i=0; i<tree->totface; i++) { occ_face(&tree->face[i], co, n, NULL); negate_v3(n); - VECADDFAC(co, co, n, 1e-8f); + madd_v3_v3fl(co, n, 1e-8f); occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL, NULL); if(re->test_break(re->tbh)) @@ -1484,12 +1484,12 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int if(cache->sample && cache->step) { sample= &cache->sample[(y-cache->y)*cache->w + (x-cache->x)]; if(sample->filled) { - VECSUB(d, sample->co, co); - dist2= INPR(d, d); - if(dist2 < 0.5f*sample->dist2 && INPR(sample->n, n) > 0.98f) { - VECCOPY(ao, sample->ao); - VECCOPY(env, sample->env); - VECCOPY(indirect, sample->indirect); + sub_v3_v3v3(d, sample->co, co); + dist2= dot_v3v3(d, d); + if(dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) { + copy_v3_v3(ao, sample->ao); + copy_v3_v3(env, sample->env); + copy_v3_v3(indirect, sample->indirect); return 1; } } @@ -1534,11 +1534,11 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int wb[0]= tx*ty; for(i=0; i<4; i++) { - VECSUB(d, samples[i]->co, co); - //dist2= INPR(d, d); + sub_v3_v3v3(d, samples[i]->co, co); + //dist2= dot_v3v3(d, d); wz[i]= 1.0f; //(samples[i]->dist2/(1e-4f + dist2)); - wn[i]= pow(INPR(samples[i]->n, n), 32.0f); + wn[i]= pow(dot_v3v3(samples[i]->n, n), 32.0f); w= wb[i]*wn[i]*wz[i]; @@ -1633,9 +1633,9 @@ static void *exec_strandsurface_sample(void *data) negate_v3(n); sample_occ_tree(re, re->occlusiontree, NULL, co, n, othread->thread, 0, ao, env, indirect); - VECCOPY(othread->faceao[a], ao); - VECCOPY(othread->faceenv[a], env); - VECCOPY(othread->faceindirect[a], indirect); + copy_v3_v3(othread->faceao[a], ao); + copy_v3_v3(othread->faceenv[a], env); + copy_v3_v3(othread->faceindirect[a], indirect); } return 0; @@ -1701,27 +1701,27 @@ void make_occ_tree(Render *re) for(a=0; a<mesh->totface; a++) { face= mesh->face[a]; - VECCOPY(ao, faceao[a]); - VECCOPY(env, faceenv[a]); - VECCOPY(indirect, faceindirect[a]); + copy_v3_v3(ao, faceao[a]); + copy_v3_v3(env, faceenv[a]); + copy_v3_v3(indirect, faceindirect[a]); - VECADD(mesh->ao[face[0]], mesh->ao[face[0]], ao); - VECADD(mesh->env[face[0]], mesh->env[face[0]], env); - VECADD(mesh->indirect[face[0]], mesh->indirect[face[0]], indirect); + add_v3_v3(mesh->ao[face[0]], ao); + add_v3_v3(mesh->env[face[0]], env); + add_v3_v3(mesh->indirect[face[0]], indirect); count[face[0]]++; - VECADD(mesh->ao[face[1]], mesh->ao[face[1]], ao); - VECADD(mesh->env[face[1]], mesh->env[face[1]], env); - VECADD(mesh->indirect[face[1]], mesh->indirect[face[1]], indirect); + add_v3_v3(mesh->ao[face[1]], ao); + add_v3_v3(mesh->env[face[1]], env); + add_v3_v3(mesh->indirect[face[1]], indirect); count[face[1]]++; - VECADD(mesh->ao[face[2]], mesh->ao[face[2]], ao); - VECADD(mesh->env[face[2]], mesh->env[face[2]], env); - VECADD(mesh->indirect[face[2]], mesh->indirect[face[2]], indirect); + add_v3_v3(mesh->ao[face[2]], ao); + add_v3_v3(mesh->env[face[2]], env); + add_v3_v3(mesh->indirect[face[2]], indirect); count[face[2]]++; if(face[3]) { - VECADD(mesh->ao[face[3]], mesh->ao[face[3]], ao); - VECADD(mesh->env[face[3]], mesh->env[face[3]], env); - VECADD(mesh->indirect[face[3]], mesh->indirect[face[3]], indirect); + add_v3_v3(mesh->ao[face[3]], ao); + add_v3_v3(mesh->env[face[3]], env); + add_v3_v3(mesh->indirect[face[3]], indirect); count[face[3]]++; } } @@ -1784,7 +1784,7 @@ void sample_occ(Render *re, ShadeInput *shi) 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])); - sample->dist2= INPR(shi->dxco, shi->dxco) + INPR(shi->dyco, shi->dyco); + sample->dist2= dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco); sample->filled= 1; } } @@ -1879,7 +1879,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp) 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])); - sample->dist2= INPR(shi->dxco, shi->dxco) + INPR(shi->dyco, shi->dyco); + sample->dist2= dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco); sample->x= shi->xs; sample->y= shi->ys; sample->filled= 1; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index dfd10687a33..36709408496 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -84,7 +84,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) ir= ig= ib= 0.0; - VECCOPY(rco, har->co); + copy_v3_v3(rco, har->co); dco[0]=dco[1]=dco[2]= 1.0f/har->rad; vn= har->no; @@ -97,7 +97,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) /* lampdist cacluation */ if(lar->type==LA_SUN || lar->type==LA_HEMI) { - VECCOPY(lv, lar->vec); + copy_v3_v3(lv, lar->vec); lampdist= 1.0; } else { @@ -146,7 +146,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) memset(&shi, 0, sizeof(ShadeInput)); /* end warning! - Campbell */ - VECCOPY(shi.co, rco); + copy_v3_v3(shi.co, rco); shi.osatex= 0; do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE); } @@ -158,7 +158,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) float x, lvrot[3]; /* 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])); @@ -610,7 +610,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread) if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) { /* 1. solid color */ - VECCOPY(collector, &R.wrld.horr); + copy_v3_v3(collector, &R.wrld.horr); collector[3] = 0.0f; } diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 36ded5c10d2..c3a4ca9bf7d 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -153,7 +153,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa state.time = cfra; if(psys_get_particle_state(&sim, i, &state, 0)) { - VECCOPY(partco, state.co); + copy_v3_v3(partco, state.co); if (pd->psys_cache_space == TEX_PD_OBJECTSPACE) mul_m4_v3(ob->imat, partco); @@ -217,7 +217,7 @@ static void pointdensity_cache_object(Render *re, PointDensity *pd, Object *ob) for(i=0; i < pd->totpoints; i++, mvert++) { float co[3]; - VECCOPY(co, mvert->co); + copy_v3_v3(co, mvert->co); switch(pd->ob_cache_space) { case TEX_PD_OBJECTSPACE: @@ -423,7 +423,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) (pd->flag&TEX_PD_FALLOFF_CURVE ? pd->falloff_curve : NULL), pd->falloff_speed_scale*0.001f); noise_fac = pd->noise_fac * 0.5f; /* better default */ - VECCOPY(co, texvec); + copy_v3_v3(co, texvec); if (point_data_used(pd)) { /* does a BVH lookup to find accumulated density and additional point data * @@ -480,7 +480,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) if (pd->coba) { if (do_colorband(pd->coba, age, col)) { texres->talpha= 1; - VECCOPY(&texres->tr, col); + copy_v3_v3(&texres->tr, col); texres->tin *= col[3]; texres->ta = texres->tin; } @@ -493,7 +493,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) if (pd->coba) { if (do_colorband(pd->coba, speed, col)) { texres->talpha= 1; - VECCOPY(&texres->tr, col); + copy_v3_v3(&texres->tr, col); texres->tin *= col[3]; texres->ta = texres->tin; } @@ -503,7 +503,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) case TEX_PD_COLOR_PARTVEL: texres->talpha= 1; mul_v3_fl(vec, pd->speed_scale); - VECCOPY(&texres->tr, vec); + copy_v3_v3(&texres->tr, vec); texres->ta = texres->tin; break; case TEX_PD_COLOR_CONSTANT: diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index a02c5681e5e..1a58a665e0a 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1593,7 +1593,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) } /* put back together */ if(shi->combinedflag & SCE_PASS_SPEC) - VECADD(shr->combined, diff, shr->spec) /* no ; */ + add_v3_v3v3(shr->combined, diff, shr->spec); else copy_v3_v3(shr->combined, diff); } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 14b02920439..b5386dde623 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -2297,7 +2297,7 @@ void do_material_tex(ShadeInput *shi) else texres.nor= NULL; if(warpdone) { - VECADD(tempvec, co, warpvec); + add_v3_v3v3(tempvec, co, warpvec); co= tempvec; } diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index d2683f26c3a..456702e0827 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -562,7 +562,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult float *fp; fp= rl->rectf + 4*offset; - QUATCOPY(fp, shr->combined); + copy_v4_v4(fp, shr->combined); for(rpass= rl->passes.first; rpass; rpass= rpass->next) { float *col= NULL, uvcol[3]; @@ -695,7 +695,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl) } if(pass[3]==0.0f) { - QUATCOPY(pass, col); + copy_v4_v4(pass, col); } else { addAlphaUnderFloat(pass, col); @@ -768,18 +768,17 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) continue; } - VECCOPY(tmp_rgb, rgbrect); + copy_v3_v3(tmp_rgb, rgbrect); if(rgbrect[3]!=1.0f) { /* de-premul */ - float div= 1.0f/rgbrect[3]; - VECMUL(tmp_rgb, div); + mul_v3_fl(tmp_rgb, 1.0f/rgbrect[3]); } shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); if(rgbrect[3]!=1.0f) { /* premul */ - VECMUL(tmp_rgb, rgbrect[3]); + mul_v3_fl(tmp_rgb, rgbrect[3]); } if(done==0) { - VECCOPY(rgb, tmp_rgb); + copy_v3_v3(rgb, tmp_rgb); done = 1; } else{ @@ -793,7 +792,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) /* if at least for one sun lamp aerial perspective was applied*/ if(done) { - VECCOPY(rgbrect, rgb); + copy_v3_v3(rgbrect, rgb); } } } @@ -1533,13 +1532,13 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe then clamp to avoid a too large contribution from a single pixel */ shi->osatex= 1; - VECCOPY(nor, shi->facenor); + copy_v3_v3(nor, shi->facenor); calc_view_vector(shi->facenor, sx, sy); normalize_v3(shi->facenor); shade_input_set_viewco(shi, x, y, sx, sy, z); orthoarea= len_v3(shi->dxco)*len_v3(shi->dyco); - VECCOPY(shi->facenor, nor); + copy_v3_v3(shi->facenor, nor); shade_input_set_viewco(shi, x, y, sx, sy, z); *area= len_v3(shi->dxco)*len_v3(shi->dyco); *area= MIN2(*area, 2.0f*orthoarea); @@ -1572,8 +1571,8 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe shade_samples_do_AO(ssamp); shade_material_loop(shi, &shr); - VECCOPY(co, shi->co); - VECCOPY(color, shr.combined); + copy_v3_v3(co, shi->co); + copy_v3_v3(color, shr.combined); /* texture blending */ /* texfac= shi->mat->sss_texfac; */ /* UNUSED */ @@ -1711,7 +1710,7 @@ void zbufshade_sss_tile(RenderPart *pa) totpoint++; - VECADD(fcol, fcol, color); + add_v3_v3(fcol, color); fcol[3]= 1.0f; } @@ -1730,7 +1729,7 @@ void zbufshade_sss_tile(RenderPart *pa) shade_sample_sss(&ssamp, mat, obi, vlr, quad, x, y, *rz, co[totpoint], color[totpoint], &area[totpoint]); - VECADD(fcol, fcol, color[totpoint]); + add_v3_v3(fcol, color[totpoint]); fcol[3]= 1.0f; totpoint++; } @@ -1753,7 +1752,7 @@ void zbufshade_sss_tile(RenderPart *pa) /* to indicate this is a back sample */ area[totpoint]= -area[totpoint]; - VECADD(fcol, fcol, color[totpoint]); + add_v3_v3(fcol, color[totpoint]); fcol[3]= 1.0f; totpoint++; } @@ -2068,7 +2067,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua if(bs->type==RE_BAKE_NORMALS) { float nor[3]; - VECCOPY(nor, shi->vn); + copy_v3_v3(nor, shi->vn); if(R.r.bake_normal_space == R_BAKE_SPACE_CAMERA); else if(R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) { @@ -2076,16 +2075,16 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua /* bitangent */ if(tvn && ttang) { - VECCOPY(mat[0], ttang); + copy_v3_v3(mat[0], ttang); cross_v3_v3v3(mat[1], tvn, ttang); mul_v3_fl(mat[1], ttang[3]); - VECCOPY(mat[2], tvn); + copy_v3_v3(mat[2], tvn); } else { - VECCOPY(mat[0], shi->nmaptang); + copy_v3_v3(mat[0], shi->nmaptang); cross_v3_v3v3(mat[1], shi->nmapnorm, shi->nmaptang); mul_v3_fl(mat[1], shi->nmaptang[3]); - VECCOPY(mat[2], shi->nmapnorm); + copy_v3_v3(mat[2], shi->nmapnorm); } invert_m3_m3(imat, mat); @@ -2115,7 +2114,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua shr.alpha = shi->alpha; } else if(bs->type==RE_BAKE_SHADOW) { - VECCOPY(shr.combined, shr.shad); + copy_v3_v3(shr.combined, shr.shad); shr.alpha = shi->alpha; } else if(bs->type==RE_BAKE_SPEC_COLOR) { @@ -2158,7 +2157,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua if(bs->rect_float) { float *col= bs->rect_float + 4*(bs->rectx*y + x); - VECCOPY(col, shr.combined); + copy_v3_v3(col, shr.combined); if (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) { col[3]= shr.alpha; } else { @@ -2336,16 +2335,16 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v) if(obi->flag & R_TRANSFORMED) mul_m4_v3(obi->mat, shi->co); - VECCOPY(shi->dxco, bs->dxco); - VECCOPY(shi->dyco, bs->dyco); + copy_v3_v3(shi->dxco, bs->dxco); + copy_v3_v3(shi->dyco, bs->dyco); quad= bs->quad; bake_set_shade_input(obi, vlr, shi, quad, 0, x, y, u, v); if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) { shade_input_set_shade_texco(shi); - VECCOPY(tvn, shi->nmapnorm); - QUATCOPY(ttang, shi->nmaptang); + copy_v3_v3(tvn, shi->nmapnorm); + copy_v4_v4(ttang, shi->nmaptang); } /* if we are doing selected to active baking, find point on other face */ @@ -2359,7 +2358,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v) memset(&minisec, 0, sizeof(minisec)); minco[0]= minco[1]= minco[2]= 0.0f; - VECCOPY(bs->dir, shi->vn); + copy_v3_v3(bs->dir, shi->vn); for(sign=-1; sign<=1; sign+=2) { memset(&isec, 0, sizeof(isec)); @@ -2375,7 +2374,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v) if(!hit || len_v3v3(shi->co, co) < len_v3v3(shi->co, minco)) { minisec= isec; mindist= dist; - VECCOPY(minco, co); + copy_v3_v3(minco, co); hit= 1; dir = sign; } @@ -2395,7 +2394,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v) obi= (ObjectInstanceRen*)minisec.hit.ob; vlr= (VlakRen*)minisec.hit.face; quad= (minisec.isect == 2); - VECCOPY(shi->co, minco); + copy_v3_v3(shi->co, minco); u= -minisec.u; v= -minisec.v; diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 274fa4469e0..f3eb2234778 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -672,7 +672,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar) else ver++; if(clipflag[a]) { - VECCOPY(vec, ver->co); + copy_v3_v3(vec, ver->co); mul_m4_v3(obviewmat, vec); /* Z on visible side of lamp space */ if(vec[2] < 0.0f) { @@ -2063,7 +2063,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v float dface, fac, siz; RE_vlakren_get_normal(&R, obi, vlr, nor); - VECCOPY(v1, vlr->v1->co); + copy_v3_v3(v1, vlr->v1->co); if(obi->flag & R_TRANSFORMED) mul_m4_v3(obi->mat, v1); @@ -2463,7 +2463,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la samp->facenr= apn->p[a] & ~RE_QUAD_OFFS; samp->shadfac= &apn->shadfac[a]; - VECCOPY(samp->zco, zco); + copy_v3_v3(samp->zco, zco); bound_rectf((rctf *)&root.box, samp->zco); } } @@ -2479,7 +2479,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la samp->facenr= apn->p[a] & ~RE_QUAD_OFFS; samp->shadfac= &apn->shadfac[a]; - VECCOPY(samp->zco, zco); + copy_v3_v3(samp->zco, zco); bound_rectf((rctf *)&root.box, samp->zco); } } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 55d3703d351..1852dfaebab 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -127,8 +127,8 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) if(shi->passflag & SCE_PASS_SHADOW) VECADDISFAC(shr->shad, shr_t.shad, fac); - VECMUL(shi->vn, -1.0f); - VECMUL(shi->facenor, -1.0f); + negate_v3(shi->vn); + negate_v3(shi->facenor); } /* depth >= 1 when ray-shading */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index ddfe3199d30..0ed3a094cf8 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -495,10 +495,10 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn) vec[2]= 0.0f; mul_m3_v3(lar->mat, vec); - VECADD(area[0], lar->area[0], vec); - VECADD(area[1], lar->area[1], vec); - VECADD(area[2], lar->area[2], vec); - VECADD(area[3], lar->area[3], vec); + add_v3_v3v3(area[0], lar->area[0], vec); + add_v3_v3v3(area[1], lar->area[1], vec); + add_v3_v3v3(area[2], lar->area[2], vec); + add_v3_v3v3(area[3], lar->area[3], vec); intens+= area_lamp_energy(area, co, vn); @@ -1111,12 +1111,12 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], } if(shi->depth==0) { - QUATCOPY(lss->shadfac, shadfac); + copy_v4_v4(lss->shadfac, shadfac); lss->samplenr= shi->samplenr; } } else { - QUATCOPY(shadfac, lss->shadfac); + copy_v4_v4(shadfac, lss->shadfac); } } @@ -1879,16 +1879,16 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) /* and add emit and spec */ if(shi->combinedflag & SCE_PASS_EMIT) - VECADD(shr->combined, shr->combined, shr->emit); + add_v3_v3(shr->combined, shr->emit); if(shi->combinedflag & SCE_PASS_SPEC) - VECADD(shr->combined, shr->combined, shr->spec); + add_v3_v3(shr->combined, shr->spec); /* modulate by the object color */ if((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) { if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) { float obcol[4]; - QUATCOPY(obcol, shi->obr->ob->col); + copy_v4_v4(obcol, shi->obr->ob->col); CLAMP(obcol[3], 0.0f, 1.0f); shr->combined[0] *= obcol[0]; diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index cf97a63d8a0..4192aaf42aa 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -1,4 +1,4 @@ -/* +/* * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -452,11 +452,11 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad) mul_v3_fl(result.rad, tree->ss[0]->frontweight); mul_v3_fl(result.backrad, tree->ss[0]->backweight); - VECCOPY(rad, result.rad); - VECADD(backrad, result.rad, result.backrad); + copy_v3_v3(rad, result.rad); + add_v3_v3v3(backrad, result.rad, result.backrad); - VECCOPY(rdsum, result.rdsum); - VECADD(backrdsum, result.rdsum, result.backrdsum); + copy_v3_v3(rdsum, result.rdsum); + add_v3_v3v3(backrdsum, result.rdsum, result.backrdsum); if(rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0]; if(rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1]; @@ -761,8 +761,8 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error, INIT_MINMAX(tree->min, tree->max); for(i=0; i<totpoint; i++) { - VECCOPY(points[i].co, co[i]); - VECCOPY(points[i].rad, color[i]); + copy_v3_v3(points[i].co, co[i]); + copy_v3_v3(points[i].rad, color[i]); points[i].area= fabsf(area[i])/(tree->scale*tree->scale); points[i].back= (area[i] < 0.0f); @@ -818,7 +818,7 @@ void scatter_tree_sample(ScatterTree *tree, float *co, float *color) { float sco[3]; - VECCOPY(sco, co); + copy_v3_v3(sco, co); mul_v3_fl(sco, 1.0f/tree->scale); compute_radiance(tree, sco, color); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 644cb821e8c..913b4f45bcf 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -98,10 +98,10 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) t= spoint->t; type= (strandbuf->flag & R_STRAND_BSPLINE)? KEY_BSPLINE: KEY_CARDINAL; - VECCOPY(p[0], sseg->v[0]->co); - VECCOPY(p[1], sseg->v[1]->co); - VECCOPY(p[2], sseg->v[2]->co); - VECCOPY(p[3], sseg->v[3]->co); + copy_v3_v3(p[0], sseg->v[0]->co); + copy_v3_v3(p[1], sseg->v[1]->co); + copy_v3_v3(p[2], sseg->v[2]->co); + copy_v3_v3(p[3], sseg->v[3]->co); if(sseg->obi->flag & R_TRANSFORMED) { mul_m4_v3(sseg->obi->mat, p[0]); @@ -111,7 +111,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) } if(t == 0.0f) { - VECCOPY(spoint->co, p[1]); + copy_v3_v3(spoint->co, p[1]); spoint->strandco= sseg->v[1]->strandco; spoint->dtstrandco= (sseg->v[2]->strandco - sseg->v[0]->strandco); @@ -119,7 +119,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) spoint->dtstrandco *= 0.5f; } else if(t == 1.0f) { - VECCOPY(spoint->co, p[2]); + copy_v3_v3(spoint->co, p[2]); spoint->strandco= sseg->v[2]->strandco; spoint->dtstrandco= (sseg->v[3]->strandco - sseg->v[1]->strandco); @@ -139,12 +139,9 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) spoint->dtco[1]= data[0]*p[0][1] + data[1]*p[1][1] + data[2]*p[2][1] + data[3]*p[3][1]; spoint->dtco[2]= data[0]*p[0][2] + data[1]*p[1][2] + data[2]*p[2][2] + data[3]*p[3][2]; - VECCOPY(spoint->tan, spoint->dtco); - normalize_v3(spoint->tan); - - VECCOPY(spoint->nor, spoint->co); - VECMUL(spoint->nor, -1.0f); - normalize_v3(spoint->nor); + normalize_v3_v3(spoint->tan, spoint->dtco); + normalize_v3_v3(spoint->nor, spoint->co); + negate_v3(spoint->nor); spoint->width= strand_eval_width(ma, spoint->strandco); @@ -183,7 +180,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) sub_v3_v3v3(spoint->co1, spoint->co, cross); add_v3_v3v3(spoint->co2, spoint->co, cross); - VECCOPY(spoint->dsco, cross); + copy_v3_v3(spoint->dsco, cross); } /* *************** */ @@ -617,10 +614,10 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan * { float jco1[3], jco2[3], jco3[3], jco4[3], jx, jy; - VECCOPY(jco1, co1); - VECCOPY(jco2, co2); - VECCOPY(jco3, co3); - VECCOPY(jco4, co4); + copy_v3_v3(jco1, co1); + copy_v3_v3(jco2, co2); + copy_v3_v3(jco3, co3); + copy_v3_v3(jco4, co4); if(spart->jit) { jx= -spart->jit[sample][0]; @@ -1008,7 +1005,7 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm, mvert= dm->getVertArray(dm); for(a=0; a<mesh->totvert; a++, mvert++) { - VECCOPY(co[a], mvert->co); + copy_v3_v3(co[a], mvert->co); mul_m4_v3(mat, co[a]); } @@ -1047,7 +1044,7 @@ void strand_minmax(StrandRen *strand, float *min, float *max, float width) int a; for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) { - VECCOPY(vec, svert->co); + copy_v3_v3(vec, svert->co); DO_MINMAX(vec, min, max); if(width!=0.0f) { diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 850db5a55d4..29eea081672 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -102,8 +102,8 @@ static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), flo int final_depth=0, depth=0, limit=20; /* set up the isect */ - VECCOPY(isect.start, co); - VECCOPY(isect.dir, dir); + copy_v3_v3(isect.start, co); + copy_v3_v3(isect.dir, dir); isect.mode= RE_RAY_MIRROR; isect.last_hit= NULL; isect.lay= -1; @@ -623,7 +623,7 @@ static void precache_init_parts(Render *re, RayObject *tree, ShadeInput *shi, Ob copy_v3_v3(pa->bbmin, bbmin); copy_v3_v3(pa->voxel, voxel); - VECCOPY(pa->res, res); + copy_v3_v3_int(pa->res, res); pa->minx = minx; pa->maxx = maxx; pa->miny = miny; pa->maxy = maxy; diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index d624751f613..57ff5f4237a 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -241,7 +241,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra) size_t i; float *heat; - VECCOPY(vd->resol, smd->domain->res); + copy_v3_v3_int(vd->resol, smd->domain->res); totRes= vd_resol_size(vd); // scaling heat values from -2.0-2.0 to 0.0-1.0 @@ -262,7 +262,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra) size_t i; float *xvel, *yvel, *zvel; - VECCOPY(vd->resol, smd->domain->res); + copy_v3_v3_int(vd->resol, smd->domain->res); totRes= vd_resol_size(vd); // scaling heat values from -2.0-2.0 to 0.0-1.0 @@ -286,7 +286,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra) smoke_turbulence_get_res(smd->domain->wt, vd->resol); density = smoke_turbulence_get_density(smd->domain->wt); } else { - VECCOPY(vd->resol, smd->domain->res); + copy_v3_v3_int(vd->resol, smd->domain->res); density = smoke_get_density(smd->domain->fluid); } diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 7a8779ee969..8b383992e65 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -444,12 +444,12 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec /* all lines from left to right */ if(vec1[0]<vec2[0]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -512,12 +512,12 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec /* all lines from top to bottom */ if(vec1[1]<vec2[1]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -598,12 +598,12 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2) /* all lines from left to right */ if(vec1[0]<vec2[0]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -656,12 +656,12 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2) else { /* all lines from top to bottom */ if(vec1[1]<vec2[1]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -728,12 +728,12 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo /* all lines from left to right */ if(vec1[0]<vec2[0]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -784,12 +784,12 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo else { /* all lines from top to bottom */ if(vec1[1]<vec2[1]) { - VECCOPY(v1, vec1); - VECCOPY(v2, vec2); + copy_v3_v3(v1, vec1); + copy_v3_v3(v2, vec2); } else { - VECCOPY(v2, vec1); - VECCOPY(v1, vec2); + copy_v3_v3(v2, vec1); + copy_v3_v3(v1, vec2); dx= -dx; dy= -dy; } @@ -925,8 +925,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h else { /* clipping */ if(ec & ME_V1V2) { - QUATCOPY(vez, ho1); - QUATCOPY(vez+4, ho2); + copy_v4_v4(vez, ho1); + copy_v4_v4(vez+4, ho2); if( clipline(vez, vez+4)) { hoco_to_zco(zspan, vez, vez); hoco_to_zco(zspan, vez+4, vez+4); @@ -934,8 +934,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } } if(ec & ME_V2V3) { - QUATCOPY(vez, ho2); - QUATCOPY(vez+4, ho3); + copy_v4_v4(vez, ho2); + copy_v4_v4(vez+4, ho3); if( clipline(vez, vez+4)) { hoco_to_zco(zspan, vez, vez); hoco_to_zco(zspan, vez+4, vez+4); @@ -944,8 +944,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } if(ho4) { if(ec & ME_V3V4) { - QUATCOPY(vez, ho3); - QUATCOPY(vez+4, ho4); + copy_v4_v4(vez, ho3); + copy_v4_v4(vez+4, ho4); if( clipline(vez, vez+4)) { hoco_to_zco(zspan, vez, vez); hoco_to_zco(zspan, vez+4, vez+4); @@ -953,8 +953,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } } if(ec & ME_V4V1) { - QUATCOPY(vez, ho4); - QUATCOPY(vez+4, ho1); + copy_v4_v4(vez, ho4); + copy_v4_v4(vez+4, ho1); if( clipline(vez, vez+4)) { hoco_to_zco(zspan, vez, vez); hoco_to_zco(zspan, vez+4, vez+4); @@ -964,8 +964,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } else { if(ec & ME_V3V1) { - QUATCOPY(vez, ho3); - QUATCOPY(vez+4, ho1); + copy_v4_v4(vez, ho3); + copy_v4_v4(vez+4, ho1); if( clipline(vez, vez+4)) { hoco_to_zco(zspan, vez, vez); hoco_to_zco(zspan, vez+4, vez+4); @@ -1748,7 +1748,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[ int cindex= index & 255; if(cache[cindex].index == index) { - QUATCOPY(ho, cache[cindex].ho); + copy_v4_v4(ho, cache[cindex].ho); return cache[cindex].clip; } else { @@ -1756,7 +1756,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[ projectvert(co, winmat, ho); clipflag= testclip(ho); - QUATCOPY(cache[cindex].ho, ho); + copy_v4_v4(cache[cindex].ho, ho); cache[cindex].clip= clipflag; cache[cindex].index= index; @@ -1778,13 +1778,13 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][ int cindex= index & 255; if(cache[cindex].index == index) { - QUATCOPY(ho, cache[cindex].ho); + copy_v4_v4(ho, cache[cindex].ho); return cache[cindex].clip; } else { float wco; int clipflag= 0; - VECCOPY(vec, co) + copy_v3_v3(vec, co); projectvert(co, winmat, ho); wco= ho[3]; @@ -1793,7 +1793,7 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][ if(ho[1] > bounds[3]*wco) clipflag |= 4; else if(ho[1] < bounds[2]*wco) clipflag |= 8; - QUATCOPY(cache[cindex].ho, ho); + copy_v4_v4(cache[cindex].ho, ho); cache[cindex].clip= clipflag; cache[cindex].index= index; @@ -1801,11 +1801,11 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][ } } -void zbuf_render_project(float winmat[][4], float *co, float *ho) +void zbuf_render_project(float winmat[][4], const float co[3], float ho[4]) { float vec[3]; - VECCOPY(vec, co) + copy_v3_v3(vec, co); projectvert(vec, winmat, ho); } @@ -3348,7 +3348,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * mul= 0x7FFFFFFF; zval= mul*(1.0f+ho1[2]/ho1[3]); - VECCOPY(vec, v1->co); + copy_v3_v3(vec, v1->co); /* z is negative, otherwise its being clipped */ vec[2]-= ma->zoffs; projectverto(vec, obwinmat, hoco); @@ -3474,7 +3474,7 @@ void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, in if(fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f; } else if(rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) { - QUATCOPY(fp, speed); + copy_v4_v4(fp, speed); } else { /* add minimum speed in pixel */ @@ -3866,7 +3866,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf samp_shr->z= MIN2(samp_shr->z, shr->z); if(addpassflag & SCE_PASS_VECTOR) { - QUATCOPY(samp_shr->winspeed, shr->winspeed); + copy_v4_v4(samp_shr->winspeed, shr->winspeed); } /* optim... */ if(addpassflag & ~(SCE_PASS_VECTOR)) { |