svn merge -r 21508:22111 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / blender / render / intern / source / shadeinput.c
index c860e9ac5d10fc919aef2e35c410cb8d53b07b24..030091b80f6f0462e2aa7d154c6cb0eb1169f9f0 100644 (file)
@@ -175,6 +175,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        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);
@@ -219,6 +220,16 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        
        /* 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);
+       }
 }
 
 /* **************************************************************************** */