static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col_r[4]) { Isect isect; copy_v3_v3(isect.start, co); copy_v3_v3(isect.dir, shi->view); isect.dist = FLT_MAX; isect.mode = RE_RAY_MIRROR; isect.check = RE_CHECK_VLR_NONE; isect.skip = RE_SKIP_VLR_NEIGHBOUR; isect.orig.ob = (void *) shi->obi; isect.orig.face = (void *)vlr; isect.last_hit = NULL; isect.lay = -1; /* 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_r, &isect); } else { shadeSkyView(col_r, co, shi->view, NULL, shi->thread); shadeSunView(col_r, shi->view); } }
/* * Stuff the sky color into the collector. */ void shadeSkyPixel(float collector[4], float fx, float fy, short thread) { float view[3], dxyview[2]; /* * The rules for sky: * 1. Draw an image, if a background image was provided. Stop * 2. get texture and color blend, and combine these. */ float fac; if ((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) { /* 1. solid color */ copy_v3_v3(collector, &R.wrld.horr); collector[3] = 0.0f; } else { /* 2. */ /* This one true because of the context of this routine */ if (R.wrld.skytype & WO_SKYPAPER) { view[0]= -1.0f + 2.0f*(fx/(float)R.winx); view[1]= -1.0f + 2.0f*(fy/(float)R.winy); view[2]= 0.0; dxyview[0]= 1.0f/(float)R.winx; dxyview[1]= 1.0f/(float)R.winy; } else { calc_view_vector(view, fx, fy); fac= normalize_v3(view); if (R.wrld.skytype & WO_SKYTEX) { dxyview[0]= -R.viewdx/fac; dxyview[1]= -R.viewdy/fac; } } /* get sky color in the collector */ shadeSkyView(collector, NULL, view, dxyview, thread); collector[3] = 0.0f; } calc_view_vector(view, fx, fy); shadeSunView(collector, view); }
static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *col) { Isect isect; VECCOPY(isect.start, co); VECCOPY(isect.vec, shi->view); isect.labda = FLT_MAX; isect.mode= RE_RAY_MIRROR; isect.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK; isect.orig.ob = (void*) shi->obi; isect.orig.face = (void*)vlr; isect.last_hit = NULL; isect.lay= -1; /* 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); } else { shadeSkyView(col, co, shi->view, NULL, shi->thread); shadeSunView(col, shi->view); } }