Revision: 17758
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17758
Author:   joeedh
Date:     2008-12-09 08:26:23 +0100 (Tue, 09 Dec 2008)

Log Message:
-----------
fixed compiler error, and some button issues.

Modified Paths:
--------------
    branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/rayshade.c
    branches/soc-2007-joeedh/source/blender/src/buttons_shading.c

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-12-09 07:19:55 UTC (rev 17757)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-12-09 07:26:23 UTC (rev 17758)
@@ -1484,7 +1484,7 @@
 }
 
 #ifndef INLINE
-#define INLINE inline
+#define INLINE //inline
 #endif
 
 INLINE static float dsm_bsearch(DSMFunction *func, int z, int bias) {

Modified: 
branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c     
2008-12-09 07:19:55 UTC (rev 17757)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c     
2008-12-09 07:26:23 UTC (rev 17758)
@@ -174,12 +174,9 @@
        siz= 0.5f*(float)shb->size;
 
        VECCOPY(co, rco);
-//     VECCOPY(co4, rco);
 
-//     co4[3] = 1.0f;
        co[3]= 1.0f;
        MTC_Mat4MulVec4fl(shb->persmat, co); /* rational hom co */
-//     MTC_Mat4MulVec4fl(shb->viewmat, co4); /* used for getting world-space 
depth */
        
        xs= siz*(1.0f+co[0]/co[3]);
        ys= siz*(1.0f+co[1]/co[3]);
@@ -235,9 +232,15 @@
 
        samp = func->samples;
        for (i=0; i<func->totsamples; i++, samp++) {
-               if (zs > samp->depth+bias) {
-                       startsamp = samp;
-                       break;
+               if (zs >= samp->depth+bias) {
+                       if (i != func->totsamples-1) {
+                               if (zs <= (samp+1)->depth+bias) {
+                                       startsamp = samp;
+                                       break;
+                               }
+                       } else {
+                               startsamp = samp;
+                       }
                }
        }
        
@@ -249,21 +252,22 @@
        
        /*find initial search size*/
        //compute the light-space depth
-       startz = dsm_homogz_to_dist(startsamp->depth, shb->winmat);
+       if (G.rt==31||DSM_LINEAR)
+               startz = dsm_linearz_to_dist(startsamp->depth, shb->clipsta, 
shb->clipend, shb->winmat);
+       else
+               startz = dsm_homogz_to_dist(startsamp->depth, shb->winmat);
+
        searchsize = shb->soft * (startz - shb->clipsta) / startz;
        searchsize /= 2;
        if (searchsize == 0) searchsize = 1;
+       searchsize = (float) floor(searchsize + 0.5f);
 
-       printf("u - %f %f %f %f\n", shb->clipsta, shb->soft, startz, 
searchsize);
-
        averz = 0.0f;
        totblockers = 0;
 
        for (a=xs-searchsize; a<xs+searchsize; a++) {
-               printf("0");
                if (a < 0 || a >= dbuf->sizex) continue;
                for (b=ys-searchsize; b<ys+searchsize; b++) {
-                       printf("1");
                        if (b < 0 || b >= dbuf->sizey) continue;
                        func = get_dsm_func(dbuf, a, b, 0);
                        if (!func) continue;
@@ -271,12 +275,17 @@
                        samp = func->samples;
                        for (i=0; i<func->totsamples; i++, samp++) {
                                if (samp->depth < startsamp->depth) {
-                                       fz = dsm_homogz_to_dist(samp->depth, 
shb->winmat);
-                                       averz += fz;
-                                       totblockers++;
-                                       break;
+                                       if (i==func->totsamples-1 || 
(samp+1)->depth
+                                       >= startsamp->depth) {
+                                               if (G.rt==31||DSM_LINEAR)
+                                                       fz = 
dsm_linearz_to_dist(samp->depth, shb->clipsta, shb->clipend, shb->winmat);
+                                               else
+                                                       fz = 
dsm_homogz_to_dist(samp->depth, shb->winmat);
+                                               averz += fz;
+                                               totblockers++;
+                                               break;
+                                       }
                                }
-                               printf("2");
                        }
                }
        }
@@ -284,26 +293,20 @@
        if (totblockers) averz /= totblockers;
        if (averz == 0.0f) averz = startz;
 
-       printf("d - %d %f %f %f\n", totblockers, averz, startz, searchsize);
-
        shadfac[0] = shadfac[1] = shadfac[2] = 0.0f;
        totblockers = 0;
 
        searchsize = (startz - averz) / averz;
-       printf("t - %d %f %f %f\n", totblockers, averz, startz, searchsize);
        searchsize = searchsize * shb->soft * shb->clipsta / startz;
        searchsize /= 2.0;
        if (searchsize == 0) searchsize = 1;
 
-       printf("u - %d %f %f %f\n", totblockers, averz, startz, searchsize);
-
        for (a=xs-searchsize; a < xs+searchsize; a++) {
                //printf("(3 %f %d %f %f %f) ", searchsize, a, xs, 
(xs-searchsize), (xs+searchsize));
                if (a < 0) continue;
                if (a >= dbuf->sizex) break;
 
                for (b=ys-searchsize; b < ys+searchsize; b++) {
-                       printf("4");
                        if (b < 0) continue;
                        if (b >= dbuf->sizey) break;
 
@@ -318,9 +321,12 @@
                                samp = func->samples;
                                for (c=0; c<func->totsamples; c++, samp++) {
                                        if (samp->depth < startsamp->depth) {
-                                               shadfac[i] += samp->value;
-                                               totblockers++;
-                                               break;
+                                               if (i==func->totsamples-1 || 
(samp+1)->depth
+                                          >= startsamp->depth) {
+                                                       shadfac[i] += 
samp->value;
+                                                       totblockers++;
+                                                       break;
+                                               }
                                        }
                                }
                        }

Modified: 
branches/soc-2007-joeedh/source/blender/render/intern/source/rayshade.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/rayshade.c     
2008-12-09 07:19:55 UTC (rev 17757)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/rayshade.c     
2008-12-09 07:26:23 UTC (rev 17758)
@@ -739,7 +739,7 @@
        }
 }
 
-static struct QMCSampler *QMC_initSampler(int type, int tot)
+struct QMCSampler *QMC_initSampler(int type, int tot)
 {      
        QMCSampler *qsa = MEM_callocN(sizeof(QMCSampler), "qmc sampler");
        qsa->samp2d = MEM_callocN(2*sizeof(double)*tot, "qmc sample table");

Modified: branches/soc-2007-joeedh/source/blender/src/buttons_shading.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/src/buttons_shading.c       
2008-12-09 07:19:55 UTC (rev 17757)
+++ branches/soc-2007-joeedh/source/blender/src/buttons_shading.c       
2008-12-09 07:26:23 UTC (rev 17758)
@@ -2725,10 +2725,12 @@
                                
                                if (la->buftype==LA_SHADBUF_DEEP) {             
                
                                        uiDefButS(block, NUM,B_NOP,"Halo 
step:",                200,60,100,19,  &la->shadhalostep, 0.0, 12.0, 0, 0, 
"Sets the volumetric halo sampling frequency");
-                                       uiDefButF(block, 
NUM,B_LAMPREDRAW,"Bias:",              100,40,40,19,   &la->bias, 0.001, 200.0, 
1, 0, "Sets the shadow map sampling bias");
-                                       uiDefButF(block, NUM,B_LAMPREDRAW,"Soft 
Bias:",         140,40,60,19,   &la->zthresh, 0.001, 200.0, 1, 0, "Second bias 
for soft shadows, to reduce light leaks");
+                                       uiDefButF(block, 
NUM,B_LAMPREDRAW,"Bias:",              100,40,100,19,  &la->bias, 0.001, 200.0, 
1, 0, "Sets the shadow map sampling bias");
+                                       uiDefButF(block, 
NUM,B_LAMPREDRAW,"Soft:",              200,40,100,19,  &la->soft, 1.0, 100.0, 
100, 0, "Sets the size of the shadow sample area");
+                                       //uiDefButF(block, 
NUM,B_LAMPREDRAW,"Bias:",            100,40,40,19,   &la->bias, 0.001, 200.0, 
1, 0, "Sets the shadow map sampling bias");
+                                       //uiDefButF(block, 
NUM,B_LAMPREDRAW,"Soft Bias:",               140,40,60,19,   &la->zthresh, 
0.001, 200.0, 1, 0, "Second bias for soft shadows, to reduce light leaks");
                                        //uiDefButF(block, 
NUM,B_LAMPREDRAW,la->buftype==LA_SHADBUF_DEEP ? "Filter": "Soft:",           
200,40,100,19,  &la->soft, 1.0, la->buftype==LA_SHADBUF_DEEP ? 3 : 100.0, 100, 
0, la->buftype==LA_SHADBUF_DEEP ? "Anti-alias filter width": "Sets the size of 
the shadow sample area");
-                                       uiDefButF(block, NUM,B_LAMPREDRAW, 
"Soft:",             200,40,100,19,  &la->soft, 1.0, 100.0, 100, 0, "Sets the 
size of the shadow sample area");
+                                       //uiDefButF(block, NUM,B_LAMPREDRAW, 
"Soft:",           200,40,100,19,  &la->soft, 1.0, 100.0, 100, 0, "Sets the 
size of the shadow sample area");
                                } else {
                                        uiDefButS(block, NUM,B_NOP,"Halo 
step:",                200,60,100,19,  &la->shadhalostep, 0.0, 12.0, 0, 0, 
"Sets the volumetric halo sampling frequency");
                                        uiDefButF(block, 
NUM,B_LAMPREDRAW,"Bias:",              100,40,100,19,  &la->bias, 0.001, 200.0, 
1, 0, "Sets the shadow map sampling bias");


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

Reply via email to