Revision: 16234
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16234
Author:   unclezeiv
Date:     2008-08-22 22:03:33 +0200 (Fri, 22 Aug 2008)

Log Message:
-----------
Added indirect lighting generation for omnidirectional lights (this completes 
support for the various light types but, again, several issues are still there)

Modified Paths:
--------------
    branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c

Modified: 
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-08-22 18:28:34 UTC (rev 16233)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-08-22 20:03:33 UTC (rev 16234)
@@ -1071,6 +1071,19 @@
        dir[1]= sinf(phi) * sin_th;
 }
 
+static void get_random_direction(float *dir)
+{
+       float theta, phi, s;
+       
+       theta= 2.0f * M_PI * BLI_frand();
+       phi= acosf(2.0f * BLI_frand() - 1.0f);
+       s= sinf(phi);
+       
+       dir[0]= cosf(theta) * s;
+       dir[1]= sinf(theta) * s;
+       dir[2]= cosf(phi);
+}
+
 /* XXX: terrible hack currently needed by get_bounce_color */
 extern struct Render R;
 
@@ -1246,8 +1259,10 @@
                }
                break;
        case LA_LOCAL:
-               /* TODO: indirect lighting for omnidirectional lamps */
-               return;
+               VECCOPY(isec.start, orig->co);
+               get_random_direction(isec.vec);
+               VECADDFAC(isec.end, isec.start, isec.vec, lcd->scene_diag);
+               break;
        }
        
        if (!RE_ray_tree_intersect(re->raytree, &isec)) {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to