style cleanup: follow style guide for formatting of if/for/while loops, and else...
[blender.git] / source / blender / render / intern / source / volume_precache.c
index f99eb0298bf1d0ccda06bbbce0938144cbe56aa0..bd01c75ef3fbb96a8e2152b707ad0c1a311d586b 100644 (file)
@@ -89,7 +89,8 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
                isect->orig.ob= isect->hit.ob;
                
                return intersect_outside_volume(tree, isect, offset, limit-1, depth+1);
-       } else {
+       }
+       else {
                return depth;
        }
 }
@@ -140,14 +141,14 @@ void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *
        
        INIT_MINMAX(bbmin, bbmax);
        
-       for(a=0; a<obr->totvert; a++) {
-               if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+       for (a=0; a<obr->totvert; a++) {
+               if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
                else ver++;
                
                copy_v3_v3(co, ver->co);
                
                /* transformed object instance in camera space */
-               if(obi->flag & R_TRANSFORMED)
+               if (obi->flag & R_TRANSFORMED)
                        mul_m4_v3(obi->mat, co);
                
                /* convert to global space */
@@ -409,7 +410,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
                                                sb[j] += vp->data_b[i];
                                        
                                        /* Displays progress every second */
-                                       if(time-lasttime>1.0) {
+                                       if (time-lasttime>1.0) {
                                                char str[64];
                                                BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total)));
                                                re->i.infostr= str;
@@ -446,7 +447,8 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
                /* conserve energy - half single, half multiple */
                origf = 0.5f;
                fac *= 0.5f;
-       } else {
+       }
+       else {
                origf = 0.0f;
        }
 
@@ -735,25 +737,25 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
        queue.done = BLI_thread_queue_init();
        BLI_thread_queue_nowait(queue.work);
 
-       for(pa= re->volume_precache_parts.first; pa; pa= pa->next)
+       for (pa= re->volume_precache_parts.first; pa; pa= pa->next)
                BLI_thread_queue_push(queue.work, pa);
        
        /* launch threads */
        BLI_init_threads(&threads, vol_precache_part, totthread);
 
-       for(thread= 0; thread<totthread; thread++)
+       for (thread= 0; thread<totthread; thread++)
                BLI_insert_thread(&threads, &queue);
        
        /* loop waiting for work to be done */
-       while(counter < totparts) {
-               if(re->test_break && re->test_break(re->tbh))
+       while (counter < totparts) {
+               if (re->test_break && re->test_break(re->tbh))
                        break;
 
-               if(BLI_thread_queue_pop_timeout(queue.done, 50))
+               if (BLI_thread_queue_pop_timeout(queue.done, 50))
                        counter++;
 
                time= PIL_check_seconds_timer();
-               if(time-lasttime>1.0) {
+               if (time-lasttime>1.0) {
                        char str[64];
                        BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts)));
                        re->i.infostr= str;
@@ -769,7 +771,7 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
        BLI_thread_queue_free(queue.done);
        BLI_freelistN(&re->volume_precache_parts);
        
-       if(tree) {
+       if (tree) {
                //TODO: makeraytree_object creates a tree and saves it on OBI, if we free this tree we should also clear other pointers to it
                //RE_rayobject_free(tree);
                //tree= NULL;
@@ -799,18 +801,18 @@ void volume_precache(Render *re)
        re->i.infostr= "Volume preprocessing";
        re->stats_draw(re->sdh, &re->i);
 
-       for(vo= re->volumes.first; vo; vo= vo->next) {
+       for (vo= re->volumes.first; vo; vo= vo->next) {
                if (using_lightcache(vo->ma)) {
-                       for(obi= re->instancetable.first; obi; obi= obi->next) {
+                       for (obi= re->instancetable.first; obi; obi= obi->next) {
                                if (obi->obr == vo->obr) {
                                        vol_precache_objectinstance_threads(re, obi, vo->ma);
 
-                                       if(re->test_break && re->test_break(re->tbh))
+                                       if (re->test_break && re->test_break(re->tbh))
                                                break;
                                }
                        }
 
-                       if(re->test_break && re->test_break(re->tbh))
+                       if (re->test_break && re->test_break(re->tbh))
                                break;
                }
        }
@@ -823,7 +825,7 @@ void free_volume_precache(Render *re)
 {
        ObjectInstanceRen *obi;
        
-       for(obi= re->instancetable.first; obi; obi= obi->next) {
+       for (obi= re->instancetable.first; obi; obi= obi->next) {
                if (obi->volume_precache != NULL) {
                        MEM_freeN(obi->volume_precache->data_r);
                        MEM_freeN(obi->volume_precache->data_g);