remove redundant code & use GL_LINE_STRIP for object spiral drawing.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 22 Sep 2011 18:42:16 +0000 (18:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 22 Sep 2011 18:42:16 +0000 (18:42 +0000)
doc/manpage/blender.1
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/render/intern/source/shadeinput.c
source/blender/windowmanager/intern/wm_window.c

index ddf3a79..20cd40e 100644 (file)
@@ -1,4 +1,4 @@
-.TH "BLENDER" "1" "June 03, 2011" "Blender Blender 2\&.57 (sub 1)"
+.TH "BLENDER" "1" "September 22, 2011" "Blender Blender 2\&.59 (sub 3)"
 
 .SH NAME
 blender \- a 3D modelling and rendering package
@@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
 http://www.blender.org
 .SH OPTIONS
 
-Blender 2.57 (sub 1)
+Blender 2.59 (sub 3)
 Usage: blender [args ...] [file] [args ...]
 .br
 .SS "Render Options:"
index 44d68de..65267bb 100644 (file)
@@ -5112,6 +5112,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
        const float tot_inv= (1.0f / (float)CIRCLE_RESOL);
        int a;
        char inverse= FALSE;
+       float x, y, fac;
 
        if (start < 0) {
                inverse = TRUE;
@@ -5121,38 +5122,56 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
        mul_v3_v3fl(vx, tmat[0], rad);
        mul_v3_v3fl(vy, tmat[1], rad);
 
-       copy_v3_v3(vec, cent);
+       glBegin(GL_LINE_STRIP);
 
        if (inverse==0) {
+               copy_v3_v3(vec, cent);
+               glVertex3fv(vec);
+
                for(a=0; a<CIRCLE_RESOL; a++) {
-                       if (a+start>31)
+                       if (a+start>=CIRCLE_RESOL)
                                start=-a + 1;
-                       glBegin(GL_LINES);                                                      
-                       glVertex3fv(vec);
-                       vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv);
-                       vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv);
-                       vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv);
+
+                       fac= (float)a * tot_inv;
+                       x= sinval[a+start] * fac;
+                       y= cosval[a+start] * fac;
+
+                       vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
+                       vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
+                       vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
+
                        glVertex3fv(vec);
-                       glEnd();
                }
        }
        else {
-               a=0;
-               vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv);
-               vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv);
-               vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv);
+               a= 0;
+
+               fac= (float)(CIRCLE_RESOL-1) * tot_inv;
+               x= sinval[start] * fac;
+               y= cosval[start] * fac;
+
+               vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
+               vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
+               vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
+
+               glVertex3fv(vec);
+
                for(a=0; a<CIRCLE_RESOL; a++) {
-                       if (a+start>31)
+                       if (a+start>=CIRCLE_RESOL)
                                start=-a + 1;
-                       glBegin(GL_LINES);                                                      
-                       glVertex3fv(vec);
-                       vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv);
-                       vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv);
-                       vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv);
+
+                       fac= (float)(-a+(CIRCLE_RESOL-1)) * tot_inv;
+                       x= sinval[a+start] * fac;
+                       y= cosval[a+start] * fac;
+
+                       vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
+                       vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
+                       vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
                        glVertex3fv(vec);
-                       glEnd();
                }
        }
+
+       glEnd();
 }
 
 /* draws a circle on x-z plane given the scaling of the circle, assuming that 
index 0776ca7..44d85af 100644 (file)
@@ -285,14 +285,14 @@ static char *view3d_modeselect_pup(Scene *scene)
 {
        Object *ob= OBACT;
        static char string[256];
-       const char *title= N_("Mode: %%t");
+       const char *title= N_("Mode: %t");
        char *str = string;
 
        if(U.transopts&USER_TR_IFACE)
                title= BLF_gettext(title);
 
-       sprintf(str, title);
-       
+       BLI_strncpy(str, title, sizeof(string));
+
        str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
        
        if(ob==NULL || ob->data==NULL) return string;
index d8231c7..956a3d4 100644 (file)
@@ -1368,7 +1368,7 @@ void shade_samples_do_AO(ShadeSample *ssamp)
 
                if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
                        || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
-                       for(sample=0, shi= ssamp->shi; sample<ssamp->tot; shi++, sample++)
+                       for(sample=0; sample<ssamp->tot; shi++, sample++)
                                if(!(shi->mode & MA_SHLESS))
                                        ambient_occlusion(shi);         /* stores in shi->ao[] */
        }
index d9ca275..405960d 100644 (file)
@@ -111,14 +111,12 @@ static void wm_window_check_position(rcti *rect)
 #endif
        
        if(rect->xmin < 0) {
-               d= rect->xmin;
-               rect->xmax -= d;
-               rect->xmin -= d;
+               rect->xmax -= rect->xmin;
+               rect->xmin  = 0;
        }
        if(rect->ymin < 0) {
-               d= rect->ymin;
-               rect->ymax -= d;
-               rect->ymin -= d;
+               rect->ymax -= rect->ymin;
+               rect->ymin  = 0;
        }
        if(rect->xmax > width) {
                d= rect->xmax - width;