svn merge -r 22371:22571 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender-staging.git] / source / blender / render / intern / source / shadeinput.c
index 857b401e29885a8ec0659a757d4a2f7988c151da..0da2f0b1c9dcff6f6bac4cbd3e1e3e376fdc3f3b 100644 (file)
@@ -175,6 +175,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        float alpha;
        
        /* ------  main shading loop -------- */
        float alpha;
        
        /* ------  main shading loop -------- */
+       memset(&shi->raycounter, 0, sizeof(shi->raycounter));
        
        if(shi->mat->nodetree && shi->mat->use_nodes) {
                ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
        
        if(shi->mat->nodetree && shi->mat->use_nodes) {
                ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
@@ -218,6 +219,16 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        
        /* add z */
        shr->z= -shi->co[2];
        
        /* add z */
        shr->z= -shi->co[2];
+       
+       /* RAYHITS */
+       if(1 || shi->passflag & SCE_PASS_RAYHITS)
+       {
+               shr->rayhits[0] = (float)shi->raycounter.faces.test;
+               shr->rayhits[1] = (float)shi->raycounter.bb.hit;
+               shr->rayhits[2] = 0.0;
+               shr->rayhits[3] = 1.0;
+               RE_RC_MERGE(&re_rc_counter[shi->thread], &shi->raycounter);
+       }
 }
 
 /* **************************************************************************** */
 }
 
 /* **************************************************************************** */