Cleanup: shadowing (render)

This commit is contained in:
Campbell Barton 2015-11-23 12:28:01 +11:00
parent 2e348fd43e
commit e2a79e8b6c
10 changed files with 46 additions and 45 deletions

@ -444,7 +444,6 @@ static TriTessFace *mesh_calc_tri_tessface(
if (calculate_normal) {
if (lt->poly != mpoly_prev) {
const MPoly *mp = &me->mpoly[lt->poly];
BKE_mesh_calc_poly_normal(mp, &me->mloop[mp->loopstart], me->mvert, no);
mpoly_prev = lt->poly;
}

@ -140,26 +140,27 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startv
for (v=0; v<vLen; v++) {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v);
VlakRen *vlr_other;
VertRen *vert = RE_vertren_copy(obr, vlr->v2);
if (cyclv) {
vlr->v2 = vert;
if (v == vLen - 1) {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + 0);
vlr->v1 = vert;
vlr_other = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + 0);
vlr_other->v1 = vert;
}
else {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
vlr->v1 = vert;
vlr_other = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
vlr_other->v1 = vert;
}
}
else {
vlr->v2 = vert;
if (v < vLen - 1) {
VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
vlr->v1 = vert;
vlr_other = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
vlr_other->v1 = vert;
}
if (v == 0) {

@ -2384,7 +2384,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
/* garbage collection */
while (rectfs->first) {
RenderView *rv = rectfs->first;
rv = rectfs->first;
BLI_remlink(rectfs, rv);
MEM_freeN(rv);
}

@ -750,7 +750,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
d= shade_by_transmission(&isec, &shi, &shr);
if (depth>0) {
float fr, fg, fb, f, f1;
float fr, fg, fb, f1;
if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
float nf, f, refract[3], tracol[4];
@ -810,9 +810,11 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
col[3]= f1*tracol[3] + f;
}
else
else {
col[3]= 1.0f;
}
float f;
if (shi.mat->mode_l & MA_RAYMIRROR) {
f= shi.ray_mirror;
if (f!=0.0f) f*= fresnel_fac(shi.view, shi.vn, shi.mat->fresnel_mir_i, shi.mat->fresnel_mir);

@ -3684,7 +3684,7 @@ void RE_sample_material_color(
MVert *mvert;
MLoop *mloop;
const MLoopTri *mlooptri;
float uv[3], normal[3];
float normal[3];
ShadeInput shi = {NULL};
Render re = {NULL};
@ -3712,6 +3712,7 @@ void RE_sample_material_color(
mul_m4_v3(ob->imat, shi.co);
/* orco coordinates */
{
float uv[2];
float l;
/* Get generated UV */
textured_face_generate_uv(normal, shi.co, mvert[v1].co, mvert[v2].co, mvert[v3].co, uv);

@ -1382,20 +1382,20 @@ ObjectInstanceRen *RE_addRenderInstance(
if (par && dob) {
const ParticleSystem *psys = dob->particle_system;
if (psys) {
int index;
int part_index;
if (obi->index < psys->totpart) {
index = obi->index;
part_index = obi->index;
}
else if (psys->child) {
index = psys->child[obi->index - psys->totpart].parent;
part_index = psys->child[obi->index - psys->totpart].parent;
}
else {
index = -1;
part_index = -1;
}
if (index >= 0) {
const ParticleData *p = &psys->particles[index];
obi->part_index = index;
if (part_index >= 0) {
const ParticleData *p = &psys->particles[part_index];
obi->part_index = part_index;
obi->part_size = p->size;
obi->part_age = RE_GetStats(re)->cfra - p->time;
obi->part_lifetime = p->lifetime;

@ -287,12 +287,12 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
return newtot;
}
static float deep_alpha(Render *re, int obinr, int facenr, int strand)
static float deep_alpha(Render *re, int obinr, int facenr, bool use_strand)
{
ObjectInstanceRen *obi= &re->objectinstance[obinr];
Material *ma;
if (strand) {
if (use_strand) {
StrandRen *strand= RE_findOrAddStrand(obi->obr, facenr-1);
ma= strand->buffer->ma;
}

@ -1131,7 +1131,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
float obwinmat[4][4], winmat[4][4], ho1[4], ho2[4], ho3[4];
float Zmulx, Zmuly;
float hox, hoy, l, dl, u, v;
float hox, hoy, l_proj, dl_proj, u_proj, v_proj;
float s00, s01, s10, s11, detsh;
/* old globals, localized now */
@ -1161,12 +1161,12 @@ void shade_input_set_shade_texco(ShadeInput *shi)
/* recalc u and v again */
hox = x / Zmulx - 1.0f;
hoy = y / Zmuly - 1.0f;
u = (hox - ho3[0] / ho3[3]) * s11 - (hoy - ho3[1] / ho3[3]) * s10;
v = (hoy - ho3[1] / ho3[3]) * s00 - (hox - ho3[0] / ho3[3]) * s01;
l = 1.0f + u + v;
u_proj = (hox - ho3[0] / ho3[3]) * s11 - (hoy - ho3[1] / ho3[3]) * s10;
v_proj = (hoy - ho3[1] / ho3[3]) * s00 - (hox - ho3[0] / ho3[3]) * s01;
l_proj = 1.0f + u_proj + v_proj;
suv->uv[0] = l * s3[0] - u * s1[0] - v * s2[0];
suv->uv[1] = l * s3[1] - u * s1[1] - v * s2[1];
suv->uv[0] = l_proj * s3[0] - u_proj * s1[0] - v_proj * s2[0];
suv->uv[1] = l_proj * s3[1] - u_proj * s1[1] - v_proj * s2[1];
suv->uv[2] = 0.0f;
if (shi->osatex) {
@ -1176,12 +1176,12 @@ void shade_input_set_shade_texco(ShadeInput *shi)
dyuv[0] = -s10 / Zmuly;
dyuv[1] = s00 / Zmuly;
dl = dxuv[0] + dxuv[1];
suv->dxuv[0] = dl * s3[0] - dxuv[0] * s1[0] - dxuv[1] * s2[0];
suv->dxuv[1] = dl * s3[1] - dxuv[0] * s1[1] - dxuv[1] * s2[1];
dl = dyuv[0] + dyuv[1];
suv->dyuv[0] = dl * s3[0] - dyuv[0] * s1[0] - dyuv[1] * s2[0];
suv->dyuv[1] = dl * s3[1] - dyuv[0] * s1[1] - dyuv[1] * s2[1];
dl_proj = dxuv[0] + dxuv[1];
suv->dxuv[0] = dl_proj * s3[0] - dxuv[0] * s1[0] - dxuv[1] * s2[0];
suv->dxuv[1] = dl_proj * s3[1] - dxuv[0] * s1[1] - dxuv[1] * s2[1];
dl_proj = dyuv[0] + dyuv[1];
suv->dyuv[0] = dl_proj * s3[0] - dyuv[0] * s1[0] - dyuv[1] * s2[0];
suv->dyuv[1] = dl_proj * s3[1] - dyuv[0] * s1[1] - dyuv[1] * s2[1];
}
}
else {

@ -1188,12 +1188,10 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
return 1.0f;
}
else {
float visifac= 1.0f, t;
float visifac= 1.0f;
sub_v3_v3v3(lv, co, lar->co);
*dist = len_v3(lv);
t = 1.0f / (*dist);
mul_v3_fl(lv, t);
mul_v3_fl(lv, 1.0f / (*dist = len_v3(lv)));
/* area type has no quad or sphere option */
if (lar->type==LA_AREA) {
@ -1241,7 +1239,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
if (visifac > 0.0f) {
if (lar->type==LA_SPOT) {
float inpr;
float inpr, t;
if (lar->mode & LA_SQUARE) {
if (dot_v3v3(lv, lar->vec) > 0.0f) {

@ -4239,14 +4239,14 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
for (a=0; a<R.osa; a++) {
alpha= samp_shr[a].combined[3];
if (alpha != 0.0f) {
RenderLayer *rl= ssamp.rlpp[a];
RenderLayer *rl_other = ssamp.rlpp[a];
float *rect = RE_RenderLayerGetPass(rl, SCE_PASS_COMBINED, R.viewname);
float *rect = RE_RenderLayerGetPass(rl_other , SCE_PASS_COMBINED, R.viewname);
addAlphaOverFloat(rect + 4 * od, samp_shr[a].combined);
add_transp_passes(rl, od, &samp_shr[a], alpha);
add_transp_passes(rl_other , od, &samp_shr[a], alpha);
if (addpassflag & SCE_PASS_VECTOR)
add_transp_speed(rl, od, samp_shr[a].winspeed, alpha, rdrect);
add_transp_speed(rl_other , od, samp_shr[a].winspeed, alpha, rdrect);
}
}
}