New: rendering in background mode (blender -b) now prints a percentage to
authorTon Roosendaal <ton@blender.org>
Sat, 24 Apr 2004 12:02:39 +0000 (12:02 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 24 Apr 2004 12:02:39 +0000 (12:02 +0000)
indicate scanlines being in progress. For motion blur frames it works too.

Bug fix: in background render it accidentally tried to free a sound pointer
that wasn't set. (caused by own commit of three days ago).

Fix: rendering motion blur in forground prints correct sample # in info-
header again.

source/blender/render/intern/source/RE_callbacks.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/ray.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/vanillaRenderPipe.c
source/blender/src/renderwin.c
source/blender/src/usiblender.c

index c0223cf4cece12a50bbd521f8906212a2e39e2f2..c6b74867c7346ad60cd359340f51284971a4b44c 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <stdlib.h> /* for NULL??? */
+#include <stdio.h>
 #include "render.h"
 #include "render_intern.h"
 #include "RE_callbacks.h"
@@ -104,6 +105,11 @@ void RE_local_timecursor(int i) {
 
 void RE_local_render_display(int i, int j, int k, int l, unsigned int* m) {
        if (RE_local_renderdisplay_function) RE_local_renderdisplay_function(i, j, k, l, m);
+       else {
+               if(j-i >= l-1) printf("\n");// full picture
+               else printf("\rRender %d%% ", (100*i)/l); 
+               fflush(stdout);
+       }
 }
 void RE_local_init_render_display(void) {
        if (RE_local_initrenderdisplay_function) RE_local_initrenderdisplay_function();
index e282cee18c2b8887d97a1192926e3c991427a16e..1b61a28af20a18b7468de39616d914ad274f0d39 100644 (file)
@@ -860,7 +860,10 @@ void oldRenderLoop(void)  /* here the PART and FIELD loops */
                                R.rectot= (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
                                R.rectz =  (unsigned int *)MEM_mallocN(sizeof(int)*R.rectx*R.recty, "rectz");
 
-                               if(R.r.mode & R_MBLUR) RE_local_printrenderinfo(0.0, R.osa - blur);
+                               if(R.r.mode & R_MBLUR) {
+                                       RE_local_printrenderinfo(0.0, R.osa - blur);
+                                       if(G.background && blur<R.osa) printf("\n"); // newline for percentage print
+                               }
                                else RE_local_printrenderinfo(0.0, -1);
 
                                /* choose render pipeline type, and whether or not to use the */
index 21e053532e26921a64f968fe2cdac3b15a59b6d9..495d8b52c1291c00cacf472b15485263c640ac1e 100644 (file)
@@ -441,12 +441,12 @@ void freeoctree(void)
                a++;
        }
        
-
-//     printf("branches %d nodes %d\n", branchcount, nodecount);
-       printf("raycount %d \n", raycount);     
-       printf("ray coherent %d \n", coherent_ray);
-//     printf("accepted %d rejected %d\n", accepted, rejected);
-
+       if(G.f & G_DEBUG) {
+               printf("branches %d nodes %d\n", branchcount, nodecount);
+               printf("raycount %d \n", raycount);     
+               printf("ray coherent %d \n", coherent_ray);
+       //      printf("accepted %d rejected %d\n", accepted, rejected);
+       }
        branchcount= 0;
        nodecount= 0;
 }
@@ -1447,6 +1447,7 @@ static void reflection(float *ref, float *n, float *view, float *orn)
        }
 }
 
+#if 0
 static void color_combine(float *result, float fac1, float fac2, float *col1, float *col2)
 {
        float col1t[3], col2t[3];
@@ -1465,6 +1466,7 @@ static void color_combine(float *result, float fac1, float fac2, float *col1, fl
        result[2]= (fac1*col1t[2] + fac2*col2t[2]);
        result[2]*= result[2];
 }
+#endif
 
 /* the main recursive tracer itself */
 static void traceray(short depth, float *start, float *vec, float *col, VlakRen *vlr, int mask)
index 7b98328f99c1de26e7e664ddaa5539a03d990b70..2a202815bbe64352547d7c1ec6e19971f53c86bc 100644 (file)
@@ -2867,7 +2867,7 @@ void zbufshadeDA(void)    /* Delta Accum Pixel Struct */
                Zjitx= -xd;
                Zjity= -yd;
 
-               RE_local_printrenderinfo(0.0, v);
+               if((R.r.mode & R_MBLUR)==0) RE_local_printrenderinfo(0.0, v);
 
                /* RECTDELTA  */
                fillrect(R.rectot,R.rectx,R.recty,0);
@@ -2907,7 +2907,7 @@ void zbufshadeDA(void)    /* Delta Accum Pixel Struct */
                Zjitx= -xd;
                Zjity= -yd;
                RE_setwindowclip(0, 0);
-               RE_local_printrenderinfo(0.0, v);
+               if((R.r.mode & R_MBLUR)==0) RE_local_printrenderinfo(0.0, v);
                zbufferall();
        }
 
@@ -3018,7 +3018,7 @@ void zbufshadeDA(void)    /* Delta Accum Pixel Struct */
                        rowbuf2= rowbuf1;
                        rowbuf1= rb3;
 
-                       if( y>0 && G.background==0) {
+                       if( y>0) {
                                if((y & 1)==0) {
                                        RE_local_render_display(y-2, y-1,  R.rectx, R.recty, R.rectot);
                                }
@@ -3118,7 +3118,7 @@ void zbufshade(void)
                }
                scanlinesky( (char *)(rp-R.rectx), y);
                
-               if((y & 1) && G.background!=1) {
+               if(y & 1) {
                        RE_local_render_display(y-1, y, R.rectx, R.recty, R.rectot);
                }
                
index f585327bf600c7036e205d409a27a58dc867a7ff..d39f1fbac013f46d7f2c57cc0386cdeb49426bd2 100644 (file)
@@ -229,10 +229,7 @@ void zBufShadeAdvanced()
                renderZBufLine(y);
                transferColourBufferToOutput(y);
                
-               if((y & 1) && G.background!=1) RE_local_render_display(y-1, y,
-                                                                                                                          imageWidth, 
-                                                                                                                          imageHeight,
-                                                                                                                          R.rectot);           
+               if(y & 1) RE_local_render_display(y-1, y, imageWidth, imageHeight, R.rectot);           
 
                if(RE_local_test_break()) keepLooping = 0;
                y++; 
index 3ae049e0792359bf47c05aaf7cc502dc2a7114b4..1d2db07f05acf6533699b838683a5dfa2f12ea78 100644 (file)
@@ -666,7 +666,7 @@ static void renderview_progress_display_cb(int y1, int y2, int w, int h, unsigne
 
 
 /* callback for print info in top header in interface */
-static void printrenderinfo_cb(double time, int sample)
+static void printrenderinfo_cb(double time, int sample, int blur)
 {
        extern int mem_in_use;
        float megs_used_memory= mem_in_use/(1024.0*1024.0);
@@ -679,8 +679,11 @@ static void printrenderinfo_cb(double time, int sample)
        if (R.r.mode & R_FIELDS) {
                spos+= sprintf(spos, "Field %c ", (R.flag&R_SEC_FIELD)?'B':'A');
        }
+       if (blur!=-1) {
+               spos+= sprintf(spos, "Blur: %d ", blur);
+       }
        if (sample!=-1) {
-               spos+= sprintf(spos, "Sample: %d ", sample);
+               spos+= sprintf(spos, "Sample: %d    ", sample);
        }
        
        screen_draw_info_text(G.curscreen, str);
index 8a1d046ca3f888342c2080a1cc137cedfc8ab97d..a0609b9a03929ab8fe584fae05872c030eae7541 100644 (file)
@@ -549,7 +549,7 @@ void exit_usiblender(void)
        free_txt_data();
 
        sound_exit_audio();
-       MEM_freeN(G.listener);
+       if(G.listener) MEM_freeN(G.listener);
 
 #ifdef WITH_QUICKTIME
        quicktime_exit();